From 19a76e25d64ca684877de844b7050562cc6115f4 Mon Sep 17 00:00:00 2001 From: claude_dev Date: Fri, 11 Sep 2026 05:19:29 +0800 Subject: [PATCH 1/2] =?UTF-8?q?[moz]=20ci(lint):=20=E9=94=81=E5=AE=9A=20fl?= =?UTF-8?q?ake8=3D=3D7.3.0=EF=BC=8C=E4=BF=AE=E5=A4=8D=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E6=BC=82=E7=A7=BB=E8=87=B4=20E122=20=E5=85=A8=E7=BA=BF?= =?UTF-8?q?=E8=AF=AF=E6=8A=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 根因:ci.yml lint 步骤 pip install flake8 未锁版本,runner 每次装最新版。 2026-09-11 新版 pycodestyle 对 main 现存代码(toolchain_routes.py:1217)报 E122,而该代码 2026-06-23 后未改动、06-25 CI 绿——纯工具版本漂移,main 全量 lint 现已必红,阻塞所有 PR(含挂起 9 天的 #131)。 证据:本地 flake8 7.3.0 (pycodestyle 2.14.0) 对 origin/main 全量 src/ 零报错(exit=0);CI 同款命令最新版报 1217:21 E122。 处置:锁定 7.3.0(实证绿版本),版本策略写入 ci.yml 行内注释。 纯 CI 配置变更,不碰业务代码。 交付检查: - docs/design:无需更新(设计文档未规定 flake8 版本策略,ci.yml 注释即现行说明) - tests:无需更新(纯 CI 配置,本 PR 自身 CI 即验证) --- .gitea/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index d55f2dd..36e8a46 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -34,7 +34,7 @@ jobs: rm -rf /tmp/ci-venv-lint python3 -m venv /tmp/ci-venv-lint /tmp/ci-venv-lint/bin/pip install --quiet --upgrade pip - /tmp/ci-venv-lint/bin/pip install --quiet flake8 + /tmp/ci-venv-lint/bin/pip install --quiet 'flake8==7.3.0' # 锁版本:防漂移。2026-09-11 新版 pycodestyle 对现存代码报 E122 致 lint 全线误报,7.3.0 经全量 src/ 实证零报错 - name: Lint with flake8 run: | -- 2.45.4 From 96d6926272d68b986cd84736bcd42886f1d30ced Mon Sep 17 00:00:00 2001 From: claude_dev Date: Fri, 11 Sep 2026 05:32:14 +0800 Subject: [PATCH 2/2] =?UTF-8?q?[moz]=20ci:=20venv=20=E8=A7=A3=E9=87=8A?= =?UTF-8?q?=E5=99=A8=E9=92=89=20/usr/bin/python3(3.9.6)=E2=80=94=E2=80=94?= =?UTF-8?q?=E7=9C=9F=E5=9B=A0=E6=98=AF=203.14=20tokenize=20=E8=A1=8C?= =?UTF-8?q?=E4=B8=BA=E5=8F=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修正 19a76e2 的错误归因:flake8/pycodestyle 版本无漂移(CI venv 与 本地用户站完全同版 7.3.0/2.14.0,已对拍排除)。真正差异是解释器: - runner PATH 首位 /opt/homebrew/bin(7-5 起 python3→3.14.6) - Python 3.12+ 重写 tokenize,pycodestyle E122 判定翻转 - 同一 toolchain_routes.py:1217:3.9 零报错 / 3.14 报 E122(实证) - 6-25 绿色基线的 CI venv 是 python3.9(6月任务日志实证) - 另:pydantic<2 无 3.14 wheel,test job 在 3.14 下必挂 本地预验证(/usr/bin/python3 3.9.6,CI 同款命令): - lint: flake8 7.3.0 全量 src/ exit=0 零报错(两轮) - test: 同款依赖 503 passed / 9 skipped / 0 failed 交付检查:docs/design 无需更新(环境策略写入 ci.yml 注释);tests 无需更新(本提交含全量预验证)。 --- .gitea/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 36e8a46..4b01b5d 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -32,9 +32,9 @@ jobs: no_proxy: "*" run: | rm -rf /tmp/ci-venv-lint - python3 -m venv /tmp/ci-venv-lint + /usr/bin/python3 -m venv /tmp/ci-venv-lint # 钉解释器:runner PATH 首位 homebrew python3=3.14(tokenize 行为变化致 E122 误报);3.9.6=6月绿基线 /tmp/ci-venv-lint/bin/pip install --quiet --upgrade pip - /tmp/ci-venv-lint/bin/pip install --quiet 'flake8==7.3.0' # 锁版本:防漂移。2026-09-11 新版 pycodestyle 对现存代码报 E122 致 lint 全线误报,7.3.0 经全量 src/ 实证零报错 + /tmp/ci-venv-lint/bin/pip install --quiet 'flake8==7.3.0' # 锁版本(防漂移)。注:首版归因 pycodestyle 有误,真因是解释器 3.14 tokenize 变化,见本 PR 后续 commit - name: Lint with flake8 run: | @@ -52,7 +52,7 @@ jobs: no_proxy: "*" run: | rm -rf /tmp/ci-venv-test - python3 -m venv /tmp/ci-venv-test + /usr/bin/python3 -m venv /tmp/ci-venv-test # 同钉 3.9.6:pydantic<2 无 3.14 wheel;全量 503 用例本地实证绿 /tmp/ci-venv-test/bin/pip install --quiet --upgrade pip /tmp/ci-venv-test/bin/pip install --quiet 'fastapi' 'pydantic<2' pyyaml uvicorn requests pytest pytest-asyncio httpx -- 2.45.4