Skip to content

chore(canary): ratchet Any ceilings to retired module debt - #9581

Open
Duang777 wants to merge 2 commits into
loopx-project:mainfrom
Duang777:codex/tighten-module-metric-baseline-20261129
Open

Duang777 wants to merge 2 commits into
loopx-project:mainfrom
Duang777:codex/tighten-module-metric-baseline-20261129

Conversation

@Duang777

Copy link
Copy Markdown
Collaborator

Goal And Delivered Outcome

  • Outcome basis / optional anchor: maintenance of the module metric ratchet (loopx/canary/maintainability_ratchet.py); no issue.
  • Goal/source and gap: the zero-Any refactors that landed on main left their module_metric_baseline.json ceilings at the pre-refactor any_count, so the ratchet would accept Any being reintroduced into modules that are already clean. goal_frontier/terminal.py was also the last goal_frontier module still carrying Any.
  • Observable before → after: adding one Any to loopx/extensions/lark/presentation/kanban.py produced no module_metric_budget finding before; it now produces regressions={'any_count': 1}. terminal.py goes from 15 AST Any to 0.
  • Issue/task and intended base: none; base main at 811c1a1f6.

Author Declaration

  • Written by: model_agent (Claude Opus, Anthropic), operated by @Duang777

Implemented against

  • Specification and revision: no written specification; the ratchet's own baseline semantics at 811c1a1f6 are the basis.
  • Criteria:
Criterion (spec clause) Disposition Symbol / path Test or command
Ceilings never rise; only any_count lowered to measured AST counts implemented loopx/canary/module_metric_baseline.json module_metrics() on each entry
Line ceilings untouched (policy does not freeze exact line counts) implemented same tests/canary/test_maintainability_ratchet.py
terminal.py behavior unchanged implemented loopx/control_plane/goals/goal_frontier/terminal.py AST comparison with annotations removed: identical

Scope And Continuation

  • Completed scope and remaining work: any_count lowered for goal_frontier/__init__.py 115→0, lark/presentation/kanban.py 62→0, state_refresh.py 30→0, goal_frontier/terminal.py 15→0, slash_command_install.py 11→0, capabilities/issue_fix/cli.py 5→0, worker_bridge.py 28→15.
  • Slice boundary / successor: complete within this scope. Remaining Any debt (pr_review.py, lark/presentation/explore_results.py, chat_runtime.py, bootstrap_command_pack.py, chat_server.py, worker_bridge.py, agent_scope.py, capabilities/catalog.py) is untouched.

Validation

  • Tested revision: 81637fc7f
  • Run state: finished
  • Input classes: none
Check kind Result Public-safe evidence / limitation
static passed mypy --strict --follow-imports=silent on terminal.py (also clean before).
unit passed tests/canary/test_maintainability_ratchet.py (14 passed).
unit passed goal terminal / periodic report / todo closure / goal frontier / replan semantic action suites: 345 passed.
regression_parity passed Mutation check: one added Any in kanban.py is reported by collect_module_metric_findings; terminal.py AST identical to base once annotations are stripped.
static passed loopx canary premerge --from-git-diff --git-diff-base origin/main: 18 selected, 0 failures.

Frontend / Visual Evidence

  • UI impact: none

Type of Change

  • Refactoring (no functional changes)

LoopX Area

  • Build, packaging, installer, or CI

Shared-authority RFC fixture impact

N/A

Boundary Checklist

  • Neither the diff nor this PR body/comments/attachments disclose private state, credentials, raw traces or verifier output, internal links, or local machine paths.
  • I did not duplicate maintainer-owned benchmark work unless a maintainer split out a public issue for it.
  • I kept the change scoped to the linked issue/task.
  • No paired RFC changed.
  • I completed the visual evidence section for UI changes, or marked UI impact none.
  • Every commit includes a DCO Signed-off-by trailer (git commit -s).

🤖 Generated with Claude Code

Duang777 and others added 2 commits November 29, 2026 15:34
Recent zero-Any refactors left their baseline ceilings at the pre-refactor
counts, so the ratchet would silently accept Any being reintroduced. Lower
the any_count ceilings to the measured AST counts on main:

- goal_frontier/__init__.py 115 -> 0
- lark/presentation/kanban.py 62 -> 0
- state_refresh.py 30 -> 0
- slash_command_install.py 11 -> 0
- capabilities/issue_fix/cli.py 5 -> 0
- worker_bridge.py 28 -> 15

Line ceilings are left alone: the policy does not freeze exact line counts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: duang777 <duangjl007@gmail.com>
terminal.py was the last goal_frontier module carrying Any (15 AST
occurrences). Use the package's existing Payload / PayloadView aliases:
read-only inputs take Mapping[str, object], derived payloads return
dict[str, object]. Runtime checks still require dict, so behavior is
unchanged (the module's AST is identical once annotations are removed).

Ratchet its baseline any_count ceiling from 15 to 0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: duang777 <duangjl007@gmail.com>

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh

动机 / Motivation

维护 Goal 终态推导与 Canary 模块度量的工程人员。 六个既有模块的静态计数已经降低,terminal.py 仍有 15 处 Any,旧基线允许重新引入已清走的债务。 独立重测 7 个上限,6 个为 0,worker_bridge 为 15。去掉注解、新类型别名及其导入后,terminal.py 的 AST 相同。真 CLI File/SQLite 的终态及原轮重放用例两头通过。 两文件 +27/-23,其他度量和主链协议保持原路径。 使用隔离 File/SQLite 和局部合成 AST 对照,未跑完整全仓或远端 CI。 首次两头各有 258 项通过后触发本机临时空间下限。空间恢复后使用原默认阈值完整重跑,两头均通过。

改动思路 / Approach

把 terminal.py 的字典注解收紧为 object,保留原类型检查与取值。降低七个文件的 Any 上限以匹配实测。 Goal frontier 继续根据 Todo 和 projection 决策,Canary 只检测代码度量。 两文件 +27/-23,其他度量和主链协议保持原路径。

具体改动 / Changes

精确提交 81637fc7fc4c52e4c8ef9f0f6e0b1d8a709f71ef,基线 811c1a1f66652d3fc3b9830d467e14b45b7423c1。两文件 +27/-23,其他度量和主链协议保持原路径。

  • TERMINAL-PARITY。独立重测 7 个上限,6 个为 0,worker_bridge 为 15。去掉注解、新类型别名及其导入后,terminal.py 的 AST 相同。真 CLI File/SQLite 的终态及原轮重放用例两头通过。 验收契约
  • RATCHET-LOWER-ONLY。对同一个合成 kanban 模块加 1 个 Any,旧上限放行,新上限报告 any_count=1。无效计数和不全来源两头都无法制造终态。 验收契约

关键代码讲解

对主干的风险 / Risks

基线及候选各 273 项通过。Ruff、严格 mypy、Git diff 和候选标准预合并 18 项通过。 首次两头各有 258 项通过后触发本机临时空间下限。空间恢复后使用原默认阈值完整重跑,两头均通过。 使用隔离 File/SQLite 和局部合成 AST 对照,未跑完整全仓或远端 CI。
对同一个合成 kanban 模块加 1 个 Any,旧上限放行,新上限报告 any_count=1。无效计数和不全来源两头都无法制造终态。

我的整体评价 / Verdict

APPROVE。 通过。终态语义保持,七项上限都能阻止已清理的 Any 债务回流。 允许当前窄改动进入维护者终审。 使用隔离 File/SQLite 和局部合成 AST 对照,未跑完整全仓或远端 CI。

English verdict: APPROVE at 81637fc. The terminal runtime AST is unchanged after removing annotations and their type declarations. All seven lowered ceilings match measured Any counts. The same one-Any mutation is caught on head only, and all 273 focused tests passed on each revision.

This branch has not been deployed

No deployments
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.

2 participants