Repository navigation
fix(digest): restore the single owner for the whole-value SHA-256 shape - #6845
huangruiteng merged 3 commits into
Conversation
The required Python Tests check is red on main dc9fdbb: the digest-owner guard reports second owners of the whole-value bare SHA-256 shape in loopx/control_plane/status/goal_source.py (three re.fullmatch sites added by 6e8b4b1) and loopx/hosts/checkpoint_retention.py (the compiled _SHA added by c56a3b1). This is the same class as loopx-project#6117 on the TypeScript twin; every PR based on current main inherits the failing required check. Validate all four sites through BARE_SHA256_PATTERN from the canonical owner and pin both modules in the guard's CONSUMER_MODULES, which is the guard's designed review event for a new reader of the owner. The guard's layer-4 parity corpus already proves that the retired spellings split exactly the same strings as the owner pattern, including the trailing-newline probe, so this is behaviour-preserving. Closes loopx-project#6841. Signed-off-by: JasonBuildAI <jasonbuildai@gmail.com>
Independent review record —
|
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · gpt-6.1-sol · OpenAI · runtime_reported · reasoning_effort=max · observation=bc811dddc598476f28a07c6665e70eee96fe6fc5e62a624f0e5d31c4946ae644
结论:APPROVE,绑定 0866d6f3b6a33927f412e9c687fe0c987c6b900c(base dc9fdbb5186618ec2e797a9d7545e2fe524fee56)。本地实际执行的检查通过;精确范围质量凭证缺失仍为独立合并门槛。
动机
维护者运行主干的格式所有权检查时,会被两个已发布读取器重复声明 SHA-256 规则阻断。例如来源标识和检查点恢复都需要校验完整的 64 位小写十六进制值:旧代码各写一套模式,违反单一 owner 契约;本次改为引用已有规则,并保留原来接受和拒绝的输入。独立重跑确认,基线报告的四处重复声明在候选版本消失,21 类输入经过四个真实读取入口的结果与错误信息逐项相同。本 PR 不扩大可访问来源、不改变检查点删除权限或持久化格式,也不宣称其余主干失败均已修复。
改动思路
沿用既有共享格式规则并移除四处重复声明,两个读取器继续负责自己的来源范围和文件恢复条件;无需新增兼容分支、provider 或判断 owner。当前边界是四个完整值校验点与两个消费者清单项;来源读取、检查点恢复、原有错误信息和副作用条件保持不变。入口按 GoalSource constructor/manifest parser and loopback read_endpoint -> canonical bare pattern; retention original receipt recovery -> _SHA alias -> same canonical pattern. 追踪。没有另建权威状态、手工同步字段或用户配置。无改动会保留已复现的验证问题;仅改数字/豁免扫描会缺失必要证明,因此本提案连同对应契约、消费者和反例一起审查。
具体改动
规范依据:先读取 immutable base 的既有契约,再将本轮局部审查标准映射如下;这些标准不新增产品词表或执行权限。D1 已实现:来源构造、manifest 解析和 loopback 描述返回值三个完整值判断改用 canonical export,retention 的 _SHA 保留名称但成为同一个对象;不再重编译相等模式。D2 已实现:消费者清单新增这两个真实模块,原四层 guard、扫描范围和行为断言没有删除、豁免或放宽。D3 已实现:所有相关实际调用仍使用 fullmatch,调用方的类型、来源范围、回执文件名、状态和恢复前置条件保持原样。TypeScript 是值的 owner,生成的 Python 常量没有改,纯 Python 调用未增加桥接 IO。
关键代码讲解
GoalSource.__post_init__:Pinned container identity and source scope before IO。Existing canonical pattern replaces local literal; parse follows same rule。read_endpoint:Validates actual loopback description before later source reads。Namespace regex delegates to same owner。_recover_trash:Checks original receipt identity/name/status before quarantine recovery。_SHA is actual canonical object; fullmatch and all recovery guards retained。
对主干的风险
同三个模块在 immutable base 为 1 失败、246 通过,失败明确列出三处 goal_source literal 和一处 retention 模式;head 为 247 通过,无跳过。除了 guard,还执行真实 POSIX 检查点 preview、execute、失败恢复、并发读锁和惯常 CLI 路径,补上作者 Windows 环境未能执行的 POSIX 部分。另用相同 21 类输入分别进入 dataclass 构造、manifest 解析、真实 loopback HTTP 描述读取和原始 retention 回执恢复,共 84 个观察/版本:接受/拒绝、异常类型与错误信息逐项一致,拒绝后原回执字节不变。容器真正执行和远端 SSH/Docker 环境没有新增实测。
主要反例是摘要格式被意外放宽后导致错绑来源或恢复错误文件。本轮覆盖大写、长短值、非十六进制、envelope、空白、换行/CRLF、后缀、全角字符和非字符串,仍由原读取器拒绝。实际 POSIX 恢复测试通过;没有把这些结果称为 Windows 或全仓库健康。作者记录的其他历史失败及 hosted 状态没有被本轮测试数替代。Ruff、diff 检查通过;标准原生 premerge 的 6 个 direct 与 13 个 selected 检查实际执行并通过。托管精确范围质量凭证返回 receipt_missing,所以premerge 外层 exit=1 / ok=false,没有记为全绿,也没有生成或伪造凭证。该合并门槛与源码评审结论分别保留。没有查询、等待或派发 CI。
语义与 CI 对齐
本 PR 恢复已存在的“一个 owner 声明完整摘要形状”契约,属于 reuse_existing。清单 pin 是已有所有权检查要求,不是新增业务状态;没有增加授权、值域或持久化版本。实际 whole-value 语言保持等价,当前所有路径都用 fullmatch,因此 $ 与旧 \Z 的换行差异没有扩大接受范围。未来改成 match/search 需重新验证,当前无需为假设中的调用方式增加兼容层。静态词表 smoke 和当前选择的语义检查通过,检查通过不代替上述实际反例与合同判断。
我的整体评价
四处重复声明的修复和行为不变性已独立验证,建议 APPROVE。长期工作与用户体验均评为 preserved:格式 owner 归一,原生读取、拒绝、恢复和完整错误信息保持既有行为;测试恢复不能直接证明长期效果提升。这次移除重复规则就是有边界的简化,不需要新增抽象或迁移。两项维度的结论只覆盖上述真实路径和完整提案。沿用既有共享格式规则并移除四处重复声明,两个读取器继续负责自己的来源范围和文件恢复条件;无需新增兼容分支、provider 或判断 owner。当前边界是四个完整值校验点与两个消费者清单项;来源读取、检查点恢复、原有错误信息和副作用条件保持不变。未发现本 head 的阻断性源码问题;批准不代表质量凭证已齐备、其他 review hold 已清除或获得合并权限。发布前再次核对当前 head 和原生 action,后续版本变化需要重新判断。
English verdict: APPROVE — Restores the canonical bare-SHA256 owner without widening actual reader acceptance. Base failure, real reader parity and POSIX recovery paths were independently verified. The separate exact-scope quality-receipt hold remains.
Goal And Delivered Outcome
Impact first: the required
Python Testscheck fails on currentmain(dc9fdbb51), so every pull request open againstmaininherits a failing required check it did not cause. The decisive shard assertion is the digest-owner guard reporting second owners of the whole-value bare SHA-256 shape, and this change restores that single owner.Outcome basis / optional anchor: [Bug]: main's Python digest-owner guard fails - goal_source.py and checkpoint_retention.py restate the bare SHA-256 shape #6841 — required CI red on
main: run 39172287050, jobtest-shard (1)(117808033842) failstests/architecture/test_content_digest_single_owner.py::test_only_the_owner_module_states_a_whole_value_digest_shape.Goal/source and gap:
loopx/control_plane/status/goal_source.py(threere.fullmatch(r"[0-9a-f]{64}", …)sites for a pinned container id and the source namespace, added by6e8b4b1a0, PR feat(workspace): share scoped Goal source reads #6827) andloopx/hosts/checkpoint_retention.py(_SHA = re.compile(r"[0-9a-f]{64}\Z"), added byc56a3b14ea, PR feat(checkpoint): rotate managed checkpoint banks by default #6785) state the digest shape themselves instead of reading it from the single ownerloopx/control_plane/content_digest.py. This repeats the class reported in [Bug]: main's TypeScript digest-owner guard fails — progress_review_evidence.ts restates the bare SHA-256 shape #6117 on the TypeScript twin.Observable before → after, with the validation row that proves it: the focused guard test fails at
dc9fdbb51listing exactly those four sites and passes at this head (227 passed); the whole guard file is the validation row below.Issue/task and intended base: Closes [Bug]: main's Python digest-owner guard fails - goal_source.py and checkpoint_retention.py restate the bare SHA-256 shape #6841; base
main.Author Declaration
model_agent(OpenAI Codex).Implemented against
tests/architecture/test_content_digest_single_owner.py(module docstring: "One owner decides what a stored SHA-256 looks like"; layer 2 requires every consumer to name a canonical export and to be pinned in the manifest) plus issue [Bug]: main's Python digest-owner guard fails - goal_source.py and checkpoint_retention.py restate the bare SHA-256 shape #6841.loopx/control_plane/status/goal_source.py,loopx/hosts/checkpoint_retention.pytests/architecture/test_content_digest_single_owner.py::test_only_the_owner_module_states_a_whole_value_digest_shapeBARE_SHA256_PATTERN; both added toCONSUMER_MODULES::test_the_consumer_manifest_is_exactly_the_pinned_set,::test_consumers_name_the_canonical_exports_and_use_them,::test_every_consumer_holds_the_owner_object_not_an_equal_copyBARE_SHA256_PATTERN.fullmatchreplaces the local patterns::test_each_retired_spelling_and_the_owner_split_the_same_strings(21 probes, including the trailing newline)dc9fdbb51; then removed both modules from the tree (they did not exist before their introducing merges) and the focused test passed (1 passed), proving these sites are the only cause; restored the tree, applied the fix, and the whole guard file passes. Also ran ruff, the semantic coinage advisory, the architecture suite and canary premerge, with every remaining failure base-verified (details below).APPROVE WITH NOTES, no blocking findings. Its two notes are recorded under Coverage and gaps.Scope And Continuation
windows-powershellbudget failure that also feedsmerge-gateis a different pre-existing defect and is not part of this diff.Validation
0866d6f3b6a33927f412e9c687fe0c987c6b900cregression_paritypassedtests/architecture/test_content_digest_single_owner.pyat this head: 227 passed. The same file atdc9fdbb51fails with the four listed sites. With both modules removed the focused test passes (1 passed), and with them restored plus the fix it passes again — failing-before / passing-after in one worktree.staticpasseduv run --extra test python -m ruff check tests/architecture/test_content_digest_single_owner.py loopx/control_plane/status/goal_source.py loopx/hosts/checkpoint_retention.py→ "All checks passed!";scripts/generate_semantic_inventory.py --changed-from HEAD→ no supported new vocabulary carriers.unitpassedtests/architecture(excluding the two cp936-limited files listed below): 1500 passed, 1 skipped.unitnot_applicabletests/control_plane/test_checkpoint_retention.py: 12 skipped — the module refuses non-POSIX hosts by design, so the retired\Zspelling is covered by the guard's parity corpus instead; hosted Linux shards exercise the POSIX path.unitfailedtests/presentation/test_goal_source.py: 3 failures at this head and identical at a baselinedc9fdbb51worktree (POSIX-absolute source paths on a Windows host:ValueError: Source paths must be absolute); the 5 host-independent cases pass. Pre-existing, not caused by this diff.unitfailedtests/architecture/test_semantic_quota_run_witness.pyandtests/architecture/test_settlement_receipt_source_boundaries.py::test_failure_input_witnesses_cover_the_registered_wire_domainfail withUnicodeDecodeError: 'gbk' codec ...on this cp936 host, reproduced at the baselinedc9fdbb51worktree; excluded from the suite row above.manualfailedloopx canary premerge --from-git-diff: public-boundary check passed (0 errors / 0 warnings); the direct and risk-profile failures (pr-review-command-smoke,install-local-smokeWinError 1314 symlink privilege,codex-cli-packaged-install-smokerequiring bash,loopx-update-smoke, and the dsh plugin phases requiring a pnpm workspace) reproduce identically in the baseline worktree.integrationfailedtest-shard (1)runstests/architecture/test_content_digest_single_owner.py::test_only_the_owner_module_states_a_whole_value_digest_shapeasPASSED(job 117864821025, 05:19:40Z) and ends1 failed, 4137 passed, 107 skipped- the single failure is the pre-existingtests/test_chat_manager_inspection.pyCodex app-server timeout, which fails identically on the baseline run. Per-lane comparison against run 39172287050 atdc9fdbb51: shard 11 failed / 4137 passedhere vs2 failed / 4136 passedbaseline (the baseline extra failure is exactly the digest second-owner assertion this PR removes); shard 32 failed / 4138 passedon both (monitorDID NOT RAISE+ chat[todos]); shard 41 failed / 4144 passedon both (chat[todos_exact]); shards 5 and 2 endcancelledon both runs (the 60-minute job ceiling); shard 6successon both.windows-powershellfails on both runs on the pre-existing budget defect (heartbeat_prompt_brief/json emitted 10522 chars; variant ceiling is 10500; baseline job 117808033252).pytestandmerge-gatetherefore stay red for causes identical todc9fdbb51and outside this diff; no new failing test id appears at this head.windows-powershellbudget failure keepsmerge-gatered independently of this diff; (2) because the owner pattern ends in$, a future switch of any site from.fullmatchto.match/.searchwould accept a trailing newline where the retired\Zspelling rejected it — no current call site does this, and the guard's layer-4 corpus documents that$-vs-\Zboundary.Frontend / Visual Evidence
none— no user-visible surface changed.noneType of Change
LoopX Area
Technical Direction
Shared-authority RFC fixture impact
Boundary Checklist
.loopx/,.codex/goals/, and liveACTIVE_GOAL_STATE.md).python3 scripts/check_rfc_bilingual.py --base origin/main --head HEADpasses, or no paired RFC changed.none.Signed-off-bytrailer (git commit -s).