Skip to content

v0.5.1 — Maintainability pass / 可维护性整理

Latest

Choose a tag to compare

@Schlaflied Schlaflied released this 27 Sep 03:38
· 4 commits to main since this release
954fdda

Highlights

Excel-Ops v0.5.1 is a maintainability release on top of v0.5.0. It does not change delivery behavior. Since v0.5.0, 12 PRs broke every oversized module and function into named steps and added a CI guard so the code cannot grow back into large files. The refactors that changed control flow were each checked with old-vs-new differential runs, not only the test suite.

  • delivery.py split into focused modules (PR #74, #87, #88): the 1,828-line delivery.py is now delivery_models, delivery_ambiguity, delivery_planning, delivery_write, delivery_config, and delivery_guard, and delivery_manifest gained delivery_manifest_format. from excel_ops.delivery import ... and from excel_ops.delivery_manifest import ... keep working through explicit re-exports.
  • Long delivery functions broken into named steps (PR #75, #89): run_delivery (≈280 → 94 lines), _write_and_verify, _finish_run, and _write_target became named phases: idempotency guard, prepare, stopped run, result, Manifest recovery, and target failure. The complete run_delivery result for 101 test runs was identical to main apart from content hashes and timestamps, which also differ between two runs of the same code.
  • Working-directory scan split (PR #76, #77): scan_workdir and workdir.py (940 → 432 lines) are now workdir_models, workdir_classify, and workdir. The access-audit tests still intercept every content read.
  • CLI split by subcommand (PR #86): cli.py:main (246 → 8 lines) dispatches to one function per subcommand. A side-by-side run of 17 invocations produced identical arguments, output, and exit codes. The MCP bridge depends on these.
  • PDF layout verification and template writer split (PR #90, #91): verify_pdf_layout and write_template moved their loops out verbatim. PDF verification matched on 400 randomized cases covering all ten finding codes. The template writer matched on 146 recorded test calls, byte for byte including every written cell's value, format, and style, and on 800 randomized templates.
  • CI size ratchet (PR #76): tests/test_code_size.py fails CI for any function over 100 lines or module over 800 lines, scanning subpackages and keying functions by qualified name. Both exception lists are now empty.
  • Agent guidance (PR #76, #85): AGENTS.md adds "Split before you append" and lists the repository's type labels (enhancement, bug, documentation, refactor) and area: labels.
  • Housekeeping (PR #74, #75): package and refresh-manifest versions now match the release; the stray issue-refresh-mjs.md draft is no longer shipped by refresh.mjs; README and AGENTS.md now credit Career-Ops (https://github.com/career-ops-hq/career-ops) and PPT-Ops as other people's projects that the maintainer contributes to.
  • Verification baseline: every PR passed the full GitHub Actions workflow (Python, Node on Ubuntu/Windows/macOS, MCP integration) and a CodeRabbit review with no open findings. Local validation recorded 341 Python tests passed and 4 skipped, 34 Node tests passed, and 4 MCP integration tests passed. The single local failure is the LibreOffice recalculation test, which cannot run headless in the build sandbox and passes on CI.

Safety and compatibility notes

  • There are no functional changes: ingestion, matching, write-back, verification, Manifests, idempotency, exports, and MCP behave as in v0.5.0.
  • Public import paths are unchanged. Code that imports or monkeypatches private helpers may need a new module path, for example delivery_guard._mapping_payload, delivery_write.apply_formula_delivery, or workdir_classify._read_bytes.
  • refresh.mjs updates ship the new modules and delete issue-refresh-mjs.md. The old name stays recognized so a rollback of an earlier update still validates.

Known gaps carried forward

  • The v0.5.0 known gaps still apply: working-directory scan results are not yet wired into run_delivery; cloud connectors and revision-aware writes are not implemented; cross-source contradiction detection, Evidence Diff, and natural-language join/grouping, summaries, and pivots remain future work.
  • A Feishu (Lark) connector is now the first cloud connector on the roadmap (#5), based on real user demand.

Full changelog: v0.5.0...v0.5.1


更新亮点

Excel-Ops v0.5.1 是在 v0.5.0 之上的可维护性版本,不改变任何交付行为。自 v0.5.0 以来共合并 12 个 PR:所有过长的模块和函数都被拆成了有名字的步骤,并新增 CI 检查,防止代码重新长成巨型文件。凡是改动了执行顺序的重构,除了跑测试之外,都额外做了新旧版本的逐项对比。

  • delivery.py 拆成职责单一的模块(PR #74、#87、#88):原来 1,828 行的 delivery.py 拆成 delivery_models、delivery_ambiguity、delivery_planning、delivery_write、delivery_config、delivery_guard,delivery_manifest 另拆出 delivery_manifest_format。from excel_ops.delivery import ... 和 from excel_ops.delivery_manifest import ... 的原有写法通过显式重新导出继续可用。
  • 交付流程中的超长函数拆成有名字的步骤(PR #75、#89):run_delivery(约 280 行降到 94 行)、_write_and_verify、_finish_run、_write_target 拆成防重复执行判断、准备、提前返回、组装结果、找回交付凭证、目标失败等步骤。101 次测试运行的完整 run_delivery 结果与 main 一致;唯一的差异是文件哈希和时间戳,而同一份代码自己跑两次也会有这些差异。
  • 工作目录扫描拆分(PR #76、#77):scan_workdir 和 workdir.py(940 行降到 432 行)拆成 workdir_models、workdir_classify、workdir;监控"读取了哪些文件"的安全测试依然能拦截到每一次读取。
  • 命令行按子命令拆分(PR #86):cli.py:main 从 246 行降到 8 行,只负责把命令分发给各子命令函数。新旧版本并排跑了 17 种调用,参数、输出和退出码全部一致;MCP 就是通过这些命令调用的。
  • PDF 版式校验与模板写入拆分(PR #90、#91):verify_pdf_layout 和 write_template 的循环原样搬出。PDF 校验在 400 个覆盖全部 10 种问题的随机场景中结果一致;模板写入在测试中的 146 次真实调用上逐字节一致(包括写出的每个单元格的值、格式和样式),800 个随机模板也全部一致。
  • CI 代码长度检查(PR #76):tests/test_code_size.py 会让任何超过 100 行的函数或超过 800 行的模块直接导致 CI 失败,子目录也会扫描,函数按"所在类 + 函数名"区分。两份例外清单现在都是空的。
  • 给 AI Agent 的规则(PR #76、#85):AGENTS.md 新增"先拆再加"规则,并写明仓库的类型标签(enhancement、bug、documentation、refactor)和各个 area: 标签。
  • 其他整理(PR #74、#75):包版本和更新清单版本已与 Release 对齐;多余的 issue-refresh-mjs.md 草稿不再随 refresh.mjs 分发;README 和 AGENTS.md 更正了署名,注明 Career-Ops(https://github.com/career-ops-hq/career-ops)和 PPT-Ops 是他人维护的项目,维护者是这两个项目的贡献者。
  • 验证基线:每个 PR 都通过了完整的 GitHub Actions(Python,Ubuntu/Windows/macOS 三平台 Node,MCP 集成测试),CodeRabbit 审查也没有遗留问题。本地验证结果:Python 341 passed、4 skipped,Node 34 passed,MCP integration 4 passed。唯一的本地失败是 LibreOffice 重算测试,它在构建沙箱里无法无界面运行,在 CI 上是通过的。

安全与兼容性说明

  • 没有功能变化:导入、匹配、写回、验证、交付凭证、防重复执行、导出和 MCP 的行为都与 v0.5.0 相同。
  • 公开导入路径不变。如果有代码导入或替换了私有辅助函数,可能需要改用新的模块路径,例如 delivery_guard._mapping_payload、delivery_write.apply_formula_delivery、workdir_classify._read_bytes。
  • 通过 refresh.mjs 更新时会带上新模块,并删除 issue-refresh-mjs.md;这个旧文件名仍会被识别,所以回滚更早的更新时校验依然能通过。

继续保留的已知缺口

  • v0.5.0 的已知缺口依然存在:工作目录扫描结果尚未自动接入 run_delivery;云端连接器和按版本安全写入尚未实现;跨来源矛盾检测、Evidence Diff、自然语言合并/分组、汇总和透视表仍是后续工作。
  • 根据真实用户的需求,飞书(Lark)连接器已被列为路线图(#5)上的第一个云端连接器。

完整变更记录:v0.5.0...v0.5.1