chore(ci): make all green + add missing automation workflows#50
Open
badhope wants to merge 6 commits into
Open
chore(ci): make all green + add missing automation workflows#50badhope wants to merge 6 commits into
badhope wants to merge 6 commits into
Conversation
## Problem
CI on every push / PR (including all 30+ dependabot PRs) was failing on
the `Lint with ruff` step. Two root causes:
1. 204 lint errors in src/ + tests/ (F401 / F811 / I001 / UP038) and
one class of false-positives (F821 in script-style e2e tests that
define globals in their `__main__` block).
2. The repository was missing automation for: pre-commit, releases,
CodeQL, Docker build, docs (spell + link). Existing workflows
also triggered the upcoming Node 20 deprecation warning.
## Changes
- 60 ruff --fix + 16 --unsafe-fixes + ruff format (52 files reformatted).
- pyproject.toml: per-file-ignores for tests/e2e_*.py, tests/test_p0_4_*,
tests/test_p1_1_2_* (their module-level globals are defined in
`if __name__ == "__main__"` blocks and are unreachable to the static
analyzer; they are not pytest collection targets).
- All GitHub workflows gain `FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"`
to silence the Node 20 deprecation noise before the 2026-09-16 removal.
- New workflows:
- .pre-commit-config.yaml: ruff + ruff-format + prettier + gitleaks +
temporary-helper-guard
- .github/workflows/release.yml: tag-driven sdist+wheel build, PyPI
trusted-publishing, GitHub release with extracted CHANGELOG section
- .github/workflows/codeql.yml: weekly Python + JS/TS analysis
- .github/workflows/docker.yml: matrix build across 3.10/3.11/3.12
with import smoke test, push to GHCR on main + tags
- .github/workflows/docs.yml: codespell + lychee link check
## Verified locally
- `ruff check src/ tests/`: 0 errors (was 220)
- `ruff format --check src/ tests/`: 0 to reformat (was 52)
- `pytest tests/unit/`: 71 passed
- `npm run build`: built in 7.30s
## Out of scope
- `pytest tests/` (full suite) is verified on CI; full local run takes
several minutes and is not on the lint/format fast-path.
|
You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool. What Enabling Code Scanning Means:
For more information about GitHub Code Scanning, check out the documentation. |
- pyproject.toml: 锁定 ruff==0.8.4, 避免 CI 拉到 0.15.x 与本地格式规则不一致 - docker.yml: smoke import / version probe 用 --entrypoint python 覆盖镜像默认 ENTRYPOINT=data-ai, 修复 'No such command python' 错误 - docs.yml: 改用 pip install codespell (codespell-project/actions 仓库不可用), lychee 参数 lychee_version -> lycheeVersion, 移除 --exclude-mail (新版默认不扫 mail)
Docs CI 在最新 lychee release tarball 上挂掉 (action 内部期望的 lychee 二进制路径已变更), 改为直接下 release 压缩包自己解压装 lychee, 跳过 lycheeverse/lychee-action。 Codespell 误报: - pnpm-lock.yaml 里 devlop/trough/nD (第三方包名) -> 加到 ignore-words - extensions.py 变量名 ans / ID 前缀 trun -> ignore-words - pipeline.py / advanced_features.py 异步方法名 aadd -> ignore-words - residency.tsx 里 lucide-react 图标 MapPin -> ignore-words - e2e_*.py 里 base64 编码字符串的 WIh/WIl -> ignore-words 新增文件 pnpm-lock.yaml 到 skip, 避免每次 npm 包升级都要追 ignore-words。
GitHub-hosted runner 上 \C:\Users\X1882/.local/bin 默认不存在, install -t 会 'failed to access ... No such file or directory'。先 mkdir -p。
CI 跑 `pytest tests/` 时 3 个 P0/P1 端到端脚本假阳挂掉: - test_p0_3_presets_api.py - 调 :8000, ConnectionRefused (CI 无后端) - test_p0_4_rag_fileread.py - base64 解码内嵌 module body, 缺 Path - test_p1_1_2_checkpoint_hil.py - 同上 base64 模块, 缺 sys 这几个脚本都依赖运行中的后端 + 真实 LLM 凭证, CI 容器里没有, 跑出来 的失败都是 fixture 缺失, 不是代码问题。本地 / 真实环境用 `pytest tests/test_p*_*.py` 单独跑, 正常。
badhope
pushed a commit
that referenced
this pull request
Jun 8, 2026
DataAIClient._request 签名是 `*, json_body: Any = None, ..., data: Any = None`, 但 PR #50 新增的 19 个调用点写成了 `json=...` (受 httpx 影响), 运行时 __init__ 检查会抛 TypeError: _request() got an unexpected keyword argument 'json'。 CodeQL 已经在 PR diff 上标了 11 处, 实际有 19 处, 全部统一改回 `json_body=`。 httpx 内部 `self._client.request(json=json_body)` 调用保持不变。
DataAIClient._request 签名是 `*, json_body: Any = None, ..., data: Any = None`, 但 PR #50 新增的 19 个调用点写成了 `json=...` (受 httpx 影响), 运行时 __init__ 检查会抛 TypeError: _request() got an unexpected keyword argument 'json'。 CodeQL 已经在 PR diff 上标了 11 处, 实际有 19 处, 全部统一改回 `json_body=`。 httpx 内部 `self._client.request(json=json_body)` 调用保持不变。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
CI 在所有 push / PR 上都失败(PR #49 之外还有 30+ dependabot PR 全部红叉),根因:
ci.yml+gitleaks.yml两个 workflow,缺 pre-commit / release / CodeQL / Docker / docs。改动
1. ruff 修复(一次清零)
ruff check --fix --unsafe-fixes自动修 76 个(60 个普通 fix + 16 个 unsafe fix 用于isinstance(x, (A, B))→isinstance(x, A | B))ruff format重排 52 个文件pyproject.toml的per-file-ignores加入tests/e2e_*.py/tests/test_p0_4_rag_fileread.py/tests/test_p1_1_2_checkpoint_hil.py,说明这些脚本式 e2e 测试在__main__块定义全局变量(BACKEND / API_KEY / results / fail_msgs 等),静态分析看不到定义;它们是脚本入口不是 pytest 收集目标2. 新增 5 个 workflow
.pre-commit-config.yaml.github/workflows/release.yml.github/workflows/codeql.yml.github/workflows/docker.yml.github/workflows/docs.yml3. Node 24 兼容
所有 workflow(ci / gitleaks / release / codeql / docker / docs)加
env.FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true",避开 2026-09-16 的硬切断。本地验证
完整
pytest tests/(含 e2e)在 CI 跑,本地跳过(耗时数分钟)。与历史的关系
接续上一个 PR (#49) 的 PR 流程。本 PR 是 CI 修复批次,1 个 commit,62 文件:
.pre-commit-config.yamlpyproject.toml