Skip to content

test(quota): seed fixture authority before bound-wait recovery reads - #7503

Closed
Aboysky wants to merge 1 commit into
loopx-project:mainfrom
Aboysky:codex/fix-quota-bound-wait-recovery
Closed

Aboysky wants to merge 1 commit into
loopx-project:mainfrom
Aboysky:codex/fix-quota-bound-wait-recovery

Conversation

@Aboysky

@Aboysky Aboysky commented Oct 27, 2026

Copy link
Copy Markdown

Fixes #7435

Since 155dee1 ("refactor(authority): retire unmigrated operational read fallbacks"),
todo list on a Goal without initialized canonical authority fails closed with
canonical_authority_required. This test still read the source Markdown first and
initialized the authority only afterwards, so all four parameterizations
(monitor_changed/todo_done × file/sqlite) failed at the first read with
ok: false.

Seed the fixture's canonical authority before the first read via the existing
_initialize_fixture_authority helper (the same pattern the sibling tests in
tests/control_plane/test_quota_settlement_cli.py already use), and drop the
now-redundant post-read initialize_canonical_authority call — the helper builds
the same soft_claim shadow projection from the same source state. Product
behavior is unchanged: the four parameterizations go from failing at the first
todo list to passing, and the rest of the test body (quota guard, resume-when +
successor update, unsettled_host_turn_recovery replay, refresh-state recovery,
idempotent replay) passes unchanged.

Other tests that still read before initializing authority (the failures tracked in
#7433/#7434/#7436) likely need the same pattern; keeping that out of this PR.

Verification (on main f7a1ad7, Node 24.19.0):

Check Result
uv run --extra test pytest tests/test_quota_bound_wait_recovery.py -q 4 passed
uv run --extra test ruff check tests/test_quota_bound_wait_recovery.py pass
uv run --extra test mypy (repo config; files covers loopx/** only) pass, no issues in 17 source files
uv run --extra test loopx canary premerge --from-git-diff --git-diff-base upstream/main pass (diff checks, RFC bilingual gate, py_compile, 3 canaries)
git diff --check clean

Not run: the full pytest suite beyond this file. Running mypy directly on the test
file reports a pre-existing duplicate-module error that also occurs on unmodified
main (tests/ has no __init__.py), hence the config-implied run above.

AI-drafted under my direction, reviewed and validated by me.

155dee1 retired unmigrated operational read fallbacks, so todo list on a Goal without canonical authority now fails closed. Seed the fixture's authority before the first read via _initialize_fixture_authority (the same pattern as the sibling settlement CLI tests) and drop the redundant post-read initialize_canonical_authority call.

Fixes loopx-project#7435

Signed-off-by: Boyce <aboyskyi@gmail.com>
@mergify

mergify Bot commented Oct 27, 2026

Copy link
Copy Markdown

This pull request has merge conflicts with main and cannot be merged
until they are resolved. Please rebase or merge the base branch, @Aboysky.

Choose the remote for the base repository, not an out-of-date fork.
For a fork clone, first inspect git remote -v; upstream must point
to https://github.com/loopx-project/loopx.git. If it is absent, add it
with git remote add upstream https://github.com/loopx-project/loopx.git.
Then run:

git fetch upstream
git rebase upstream/main
# Resolve each conflict, git add the resolved files, then git rebase --continue.
git push --force-with-lease origin HEAD

For a same-repository clone whose origin points to
https://github.com/loopx-project/loopx.git, use origin instead of
upstream for fetch/rebase. If you prefer merging the base, use
git merge <base-remote>/main and push normally.

Keep the DCO Signed-off-by trailer on every commit when you rebase.
https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify Bot added the needs-rebase Mergify: the pull request has merge conflicts with its base branch label Oct 27, 2026

@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: actor_kind=model_agent; model=gpt-6.1-sol; provider=OpenAI; declaration_source=runtime_reported; reasoning_effort=max

动机 / Motivation

维护者在检查等待恢复回归时,会运行四个“等待解除方式 × 本地存储”组合。旧基线在尚未建立规范任务存储时先读任务,四个场景都在准备阶段失败,因而测不到原回合恢复;提案先完成夹具初始化,再运行原来的恢复断言。四个场景在旧基线全部失败,在该 head 全部通过;当前 main 也全部通过,因为同一初始化修复已经合入。本次只审查测试夹具,不修改产品恢复、调度或扣额语义,也不以用例通过证明长期收益。

这里的“规范任务存储”指测试真正调用的 File/SQLite authority,不能靠先读 Markdown 回填来绕过已结束的读取兼容。历史修复有意义;当前需要先核对主干已交付的结果。

改动思路 / Approach

提案把初始化放在全部任务写完之后、第一次 todo list 之前,直接复用已有 _initialize_fixture_authority。旧流程先调用被禁止的未迁移读取,后面的初始化根本到不了;新流程先建规范存储,原恢复断言得以执行。这是合理的测试维护方式,没有恢复旧 fallback、引入第二 authority 或改产品选择规则。

但“不再修改”这一更小方案已经能达到相同结果:当前 target 的 既有修复 使用相同 canonical fixture owner,在读取前初始化,而且去掉了多余的首个 todo list。该提交的时间为 2026-10-27 15:06:24Z,早于本 PR 创建时间 16:15:36Z。当前 main 的四个组合独立运行全部通过;因此应先对齐已有交付,而不能把旧基线红、提案绿直接解释成当前必要增量。

具体改动 / Changes

精确 head 485326ebf65890d533ae9b1dcdf58d7a88c37613,相对不可变 base f7a1ad73fec0c9058fe9feecfdff66438be37476 只有 tests/test_quota_bound_wait_recovery.py 一条路径,+5/-19;五条新增包括 helper import、说明注释及初始化调用,删除旧手工投影初始化和不用的 imports。完整下游断言未改变。

规范依据为 Issue #7435 及 不可变旧测试。spec_revision=f7a1ad73fec0c9058fe9feecfdff66438be37476 指被报告失败的固定测试来源;以下 criterion_id 是按原问题和仓库当前交付规则映射,并非新编运行时协议。

criterion_id 处置
four recovery parameterizations implemented:head 的 monitor_changed/todo_done × File/SQLite 四例全部通过。
retain original recovery obligations implemented:原 task/Turn、validator、claim、一次结算与新回合选择断言完整保留。
repair a current target gap not_met:当前 main 已在 00f6be3e4f86294608e857acc994a1b54195ec98 完成相同修复,独立四例全部通过。

关键内容讲解

head 初始化位置 在最后一段 fixture authoring 后立即建立 canonical authority;共享 helper 从完整 source Todos 初始化相应后端。后面的测试仍验证:等待解除时先恢复原回合与原任务,合法收尾之后重放不重复扣额,下一新回合才选择替代任务。附近 settlement 测试没有替代这四种等待组合的全部断言,因此应保留它们;本评审并不建议删除或弱化覆盖。

对主干的风险 / Risks

[P2] 先与主干已合入的同一修复核对增量。 这不是产品运行时 bug,也不是仅凭 merge conflict 提出的 blocker。当前 main 文件 已在第一次 canonical read 前初始化。实际相同命令 uv run --extra test python -m pytest -q tests/test_quota_bound_wait_recovery.py 的结果为:旧 base 四败、head 四过、当前 main 四过。完整比较仅剩 setup/import 写法差异,原恢复断言一致。请 rebase 后保留主干有效 setup;若仍有不同且可复现的维护问题,说明该增量,否则关闭为已被取代即可,不必另造后继任务。

PASS:干净 exact-head 工作树的标准 premerge 为 5 direct + 3 selected 全过、零 manual hold,Ruff 通过。预检与质量回执均仅覆盖上述一条已审查路径。CQR 物理规范回执在首次公开结论前完整读取,质量检查 PASS。没有查询或等待远端 CI;全仓、Windows 和安装态未新验。没有发现断言削弱或产品正确性回归。

我的整体评价 / Verdict

当前判断为 off_goal:历史问题和历史修法都成立,但全 head 尚未证明相对实际 target 的新增成果。long_horizon 为 preserved,已有恢复和一次结算覆盖保留;user_experience 为 not_applicable,只有测试准备变化,不涉及实际 UI/CLI 展示,visual_review 亦 not_applicable、相关 rendered 未验范围为 none。唯一必要处置是与已合入版本核对并保留有用覆盖;不要求修复无关 runtime、改预算或补长期模型试验。仓库经验在此用于核对“可通过”与“当前需要”的差别,不作为自动否定小 PR 的规则。

English verdict: REQUEST_CHANGES at 485326e: the fixture repair is valid against its old base, but current main already contains the equivalent fix and passes all four cases. Reconcile the current-target delta or close the superseded proposal; no product correctness regression was found.

@Aboysky

Aboysky commented Oct 28, 2026

Copy link
Copy Markdown
Author

Closing — this was fixed on main in the meantime by #7502 (00f6be3), which seeds the canonical fixture authority before the first read the same way. Verified on current main (787f15e): all four parameterizations of test_bound_wait_recovers_original_turn_before_selecting_successor pass (4 passed in 10.87s, Node 24).

@Aboysky Aboysky closed this Oct 28, 2026
@Aboysky
Aboysky deleted the codex/fix-quota-bound-wait-recovery branch October 28, 2026 00:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-rebase Mergify: the pull request has merge conflicts with its base branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Quota-bound wait recovery test fails on main

2 participants