Skip to content

style: enforce the 100-column baseline repo-wide (E501) - #249

Merged
3aKHP merged 6 commits into
devfrom
style/e501-baseline
Sep 14, 2026
Merged

3aKHP merged 6 commits into
devfrom
style/e501-baseline

Conversation

@3aKHP

@3aKHP 3aKHP commented Sep 14, 2026 •

Copy link
Copy Markdown
Owner

概要

执行长文件审计 §六.4 的仓库级决策(方案 A):移除 pyproject.toml 的 ignore = ["E501"],并把全仓存量超长行折叠到 style.md 早已声明的 100 列基线。纯机械变更,无任何语义/文案/行为改动。

变更内容

  • 217 个文件、约 1020 行超长行折叠,分域提交:style(llm) → style(src,scripts) → style(tests) → style(prod.example) → 末位删除 lint ignore。
  • 折叠纪律:仅重排空白/括号;长字符串与正则用相邻字面量隐式拼接;三引号 SQL/模板转为相邻字面量(SQL 列单内部空白重排,token 序不变)。

等价性验证

  • 全仓 AST 对比(独立 CR 复核):203 个改动文件语法树与基线完全一致;其余 14 个差异全部归类——
    • 3 条 docstring rewrap(文档性文本):scheduled_messages.py、scheduled_cron.py fixture、daily_summary_plugin.py:382(仅空白/换行重排);
    • 9 处仅空白差异的 SQL/内嵌脚本字符串(token 序不变,逐文件归一比对通过);
    • 2 处局部变量提升(行为等价,PR 披露):service_parts/health.py(f-string 插值内 94 字符调用,3.11 无法折行,先赋局部变量再拼接,运行时输出逐字节相同);prod.example/deploy-state.py(payload 提升局部变量)。
  • 高风险点字节复证:defectify 系统 prompt、awakening 指令常量、identity 占位模板、niuniu 文案模板。
  • .venv/bin/ruff check .(含 E501)全绿;全量 pytest 2090 全绿;TOML 样例校验通过。

独立 CR 处置(ee7acad)

  • [BLOCKING] schedule_messages_tool 四处 description 拼接尾逗号:字符串变单元素元组、经 json 序列化为数组发往 provider(opt-in 工具启用即触发)——已修(删除尾逗号,该文件 AST 与基线完全一致),并新增全工具 schema 类型守卫测试(负例自检通过)。
  • 其余发现为上表披露项;CR 结论「修复后可合并」已满足。

Whitespace/paren reflow and implicit string-literal concatenation only; SQL triple-quotes converted to adjacent literals with whitespace-only diffs; prompt/template strings byte-verified identical
Same mechanical discipline: whitespace/paren reflow, implicit concatenation for long CJK literals; instruction strings in the awakening triggers and defectify prompt byte-verified identical
Assertion/call reflow and implicit string concatenation; identity placeholder template byte-verified identical
Whitespace/paren reflow plus one hoisted payload local; covered by tests/unit/scripts/test_deploy_v4.py
style.md already declares the line-length 100 baseline; pyproject was the lagging side. Repo-wide zero E501 verified by the preceding fold commits
…iptions

Independent CR caught four implicit-concat folds leaving a trailing comma, turning description strings into 1-element tuples and emitting JSON arrays to providers when the opt-in tool is enabled. File is now AST-identical to origin/dev. Adds a schema-type guard test over all registered tools
@3aKHP

3aKHP commented Sep 14, 2026

Copy link
Copy Markdown
Owner Author

Bot Review 处置记录(降智处置预案)

PR 开出时(02:36Z)Bot 的 review job 已入队,但该 job 于 02:59Z 以 ManagementError 失败(attempt 启动 0.75 秒即终止,服务器侧 bot 服务本身健康,随后正常处理了其他仓库的任务)。按既有降智处置预案,本 PR 以独立 CR + CI 为质量门合并:

  • 独立 CR(未参与实现的 reviewer)已完成全量验证:203 个改动文件 AST 与基线完全一致、字符串等价性归类、f-string 逐段比对、高风险折叠点人工抽查、全量测试;
  • CR 唯一 blocking(schedule tool schema description 元组化)已修复于 ee7acad 并复证 AST 一致,附防回归守卫测试;
  • CI 三项绿(ee7acad),本地 ruff(含 E501)+ pytest 2090 + TOML 校验全绿。

留痕:失败 job 6ef7556f(errorClass=ManagementError),如需事后补跑 Bot Review 可人工触发。

@3aKHP
3aKHP merged commit a8f6a1b into dev Sep 14, 2026
3 checks passed
@3aKHP
3aKHP deleted the style/e501-baseline branch September 14, 2026 03:39
3aKHP added a commit that referenced this pull request Sep 14, 2026
Marks the structural-governance batch set (PR #247/#248/#249) as one integrated phase on the 1.16.0 target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant