Skip to content

test(control-plane): align timeout-aware runtime doubles - #5104

Merged
huangruiteng merged 2 commits into
loopx-project:mainfrom
Duang777:codex/fix-authority-timeout-test-contract
Sep 26, 2026
Merged

huangruiteng merged 2 commits into
loopx-project:mainfrom
Duang777:codex/fix-authority-timeout-test-contract

Conversation

@Duang777

@Duang777 Duang777 commented Sep 26, 2026 •

Copy link
Copy Markdown
Collaborator

Goal And Delivered Outcome

Scope And Continuation

  • Completed scope and remaining work: Updates only test doubles, the checkpoint test helper, and the generated registry I/O manifest. Production behavior is unchanged.
  • Slice boundary / successor: Complete within this scope. After merge, dependent PRs can merge current main and rerun their exact-head checks.

Validation

  • Tested revision: 88553e88ab0ee21cdd65b991e4c593d4e1a681b6
  • Run state: finished
  • Input classes: synthetic, public_fixture
Check kind Result Public-safe evidence / limitation
regression_parity passed Current main reproduced the timeout-signature failures; the same affected tests pass on this branch.
unit passed Eight affected test files plus the newly merged public-safety test: 141 passed.
static passed Ruff passed for all changed Python files; scripts/generate_project_registry_io_manifest.py --check reports 242 current sites.
integration passed Standard loopx canary premerge --from-git-diff: 10/10 selected checks passed.
  • Coverage and gaps: The full files containing every CI failure were run. No production path changed; repository CI remains the final cross-shard check.

Frontend / Visual Evidence

  • UI impact: none
  • Before: N/A
  • After: N/A
  • States and viewports shown: N/A
  • Source data: none
  • Attention review: N/A; no UI files changed.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Refactoring (no functional changes)
  • Documentation update
  • Test update

LoopX Area

  • Control plane (goals, todos, quota, scheduler, registry, runtime)
  • Benchmark boundary (adapters, runners, verifiers, scoring, evidence)
  • Capability or extension (providers, adapters, skills)
  • Public docs or presentation surface (README, protocols, dashboard)
  • Build, packaging, installer, or CI
  • Host or runtime integration

Technical Direction

  • Direction / acceptance reference, when applicable: Shared Goal Authority test compatibility after the canonical write-timeout change.

Shared-authority RFC fixture impact

  • Production-scale fixture schema: unchanged
  • Semantic dimensions changed, or reviewed no-impact rationale: no semantic change; test transport doubles now preserve the production call signature.
  • Provider conformance arms run: File and SQLite parameterizations in the affected suites.
  • Read-only legacy/file/PostgreSQL three-arm rehearsal: not applicable; this PR changes no runtime routing or provider behavior.

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 (including .loopx/, .codex/goals/, and live ACTIVE_GOAL_STATE.md).
  • 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.
  • I completed the visual evidence section for UI changes, or marked UI impact none.
  • Every commit includes a DCO Signed-off-by trailer.

Maintainer Repair At The Merged Head

Merged head 147dc992794c1290d720458969d07022bfe4aee4 on base 5c40583d85e038dc078d563f3d883e061fb747f9, merged as b15413ffcb9d362e6b30c960a6be49359dab1471 with an identical tree. The maintainer repair only removed work and refreshed generated output:

  • Rebased onto current main, dropping the branch's merge commits. tests/control_plane/test_local_coordination_authority.py now keeps main's stronger doubles (*, timeout: float with assert timeout > 0) instead of the branch's looser **_kwargs variant, so the same fix no longer exists at two different strengths.
  • Regenerated loopx/semantics/project_registry_io_manifest_v1.json with its generator: 243 sites, 0 unclassified direct sites. The copy on main was stale (five relocated sites plus one added load_registry site), so generate_project_registry_io_manifest.py --check was red before this head.

The authored fix is otherwise unchanged and still needed: restoring main's two-argument doubles to test_checkpoint_provider_fence.py and test_validated_create_recovery.py fails 6 assertions with TypeError: unexpected keyword argument 'timeout', while the same selection passes here. Validation at the merged head: 111 tests across the six changed files plus test_local_coordination_authority.py in the file and sqlite arms; manifest check current; loopx canary premerge --from-git-diff with 0 direct and 0 run failures; exact-diff change-quality receipt valid. Remote CI was not consulted (wait_for_ci=false for this goal). The author's separately triaged main-side findings (UTF-8 subprocess guard, Windows installer environment) stay in their own repair.

@Duang777 Duang777 left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Exact-head self-review for 2575f60bc7b8fe23337f8564ffc5b7debe230768: ready for maintainer review. The PR changes only timeout-aware test doubles, the checkpoint test helper, and the generated project-registry I/O manifest. The exact head merges main@16e6fac57b815b6fc40a0d738483ee22e6e229df without conflicts; the intervening main change is unrelated install-smoke work. Validation of the unchanged PR diff passed: 141 affected tests, Ruff, the 242-site manifest check, git diff --check, and the standard premerge gate with 10/10 selected checks.

@Duang777

Copy link
Copy Markdown
Collaborator Author

Additional baseline triage for exact head 2575f60bc7b8fe23337f8564ffc5b7debe230768: the completed Python shard 2 fails only the repository-wide UTF-8 subprocess guard, which reports the authority-upgrade calls added on main in loopx/self_update.py and loopx/windows_install.py. The Windows job separately fails because the installer does not pass LOOPX_RELEASE_ROOT to the copied candidate entrypoint. The isolated main repair is #5107. I will merge updated main into this branch and rerun exact-head CI after that repair lands.

huangruiteng
huangruiteng previously approved these changes Sep 26, 2026

@huangruiteng huangruiteng 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.

动机

#5063 已让 canonical authority 的写入调用显式携带 timeout,但若测试替身仍只收两个位置参数,测试会在到达真正的故障注入或事务之前报 TypeError。本 PR 要恢复这些测试的验证能力,而不是放宽运行时错误处理。我亲自对比了 immutable base 和本 head:同一组测试从 28 failed / 83 passed 变为 111 passed,实际失败恢复路径重新可达。

改动思路

沿用现有 effect-runtime 边界,不给生产调用增加回退,也不把测试成功当作 provider 成功。透传型替身接收并转交关键字参数;明确只用于返回合成结果的替身接受但不使用这些参数;故障注入仍只在原来的目标方法生效。生成的 registry I/O 清单同步已有源码事实,而不是引入另一个注册规则。File/SQLite 的真实事务、投影与 CLI 重放仍由原来的 owner 执行。

具体改动

整个 diff 是七个测试/fixture 文件及一个生成清单,共 58 additions / 28 deletions;没有生产执行逻辑变更。清单的增量是三个已有 authority upgrade 的 registry 读取点及四处源码位置同步,我重新运行生成器检查得到 242 sites current。

关键代码讲解

  1. unavailable_ack,L304:非 ACK 调用把关键字参数原样交给真实传输,目标 ACK 仍抛出注入的 OSError。断言没有被删掉:archive 已提交、delivery 待 ACK;经公开 CLI 重试后重用原 receipt,ACK 完成,provider revision 不额外前进。

  2. lose_response,L55:先执行真实 create,再模拟响应丢失。因此后面的独立 readback、投影、再次编辑与相同 operation 重放,确实在证明“已经写入后怎样恢复”,不是让 mock 直接给出成功。进程退出后的公开 CLI 恢复在 File 与 SQLite 两种 fixture 都通过。

  3. checkpoint_process.native,L75:非目标方法委托原始传输;目标方法仍交给真实 Node probe,在 provider CAS 和 checkpoint final read 间设置 barrier。这里没有把竞态替换为固定返回值;测试仍检查 writer 被排除、save 失败后的释放与 fresh comparison、重复 checkpoint 不多写 run index。

对主干的风险

最应担心的是“加了宽松 kwargs,错误却被吞掉”。我核对了所有改动:需要真正传输的路径继续转交参数,原 OSError、ambiguous response、source churn 及事务锁断言仍在。公开 CLI 和真实隔离 File/SQLite 已运行,不涉及活动 Goal。生产 runtime 的超时常量、决策或授权完全未改,也没有新配置、自动加载指令或 UI 入口;因此本 PR 不需要新增设置界面。

语义与 CI 对齐

采用现有 RPC timeout 与 registry codec 分类,没有新 vocabulary/state owner。现有生成器、semantic vocabulary、maintainability 和全范围 Ruff 均通过。标准 canary 最终为 4 direct + 10 selected 全通过;首次缺少 npm dev dependency 的失败在安装依赖后已消除。另运行三个 public-safety 测试文件,52 passed。

UTF-8 census 是独立的旧失败:同一命令 uv run --extra test python -m pytest -q tests/test_runtime_subprocess_utf8.py 在 base/head 都是同一个断言失败,offenders 完整列表均为 loopx/self_update.py:1232 和 loopx/windows_install.py:331,这三个因果文件在 diff 中均未变。它归类为 pre_existing_unrelated,不是本 PR 的 Request Changes 理由;#5107 是相邻修复候选,不在此继承其验证结论。没有查询或等待远端 CI。评审期间 #5104 读回过 mergeable=false,主干又有推进,最新读回为未判定;当前评审不是合并资格证明,维护者仍需单独处理冲突/合并门禁。

我的整体评价

APPROVE 当前完整 head,未发现 actionable blocker。long_horizon 改善了重复运行、响应丢失和并发恢复的验证可信度;user_experience 保持生产行为,减少维护者被测试替身误导的成本。做了相关的 future-facing pass:现有传输接口足够,继续显式区分“透传”与“合成结果”比引入一个带很多模式的通用 mock framework 更清楚;没有必要增加兼容分支。此结论不等于已可合并,尤其不是绕过冲突或无关红检查的授权;head/base/caller 变化后需核对失效证据。

English verdict: APPROVE - reviewed exact head 2575f60; unrelated UTF-8 failures and merge conflict remain separate merge-readiness concerns.

Duang777 and others added 2 commits September 27, 2026 00:19
Signed-off-by: duanjialing.777 <duanjialing.777@bytedance.com>
The checked-in manifest lagged main: `thread_agent_binding.py` gained the
shared binding-route resolver, which moved five classified sites, and
`cli_commands/capability.py` gained a second `load_registry` site. Running the
generator reports the drift, so the manifest check is red on main today.

Regenerated content only: 243 sites, 0 unclassified direct sites, no
hand-edited rows. Nothing but line/column metadata and the one added site
changes.

Signed-off-by: huangruiteng <14976749+huangruiteng@users.noreply.github.com>
@huangruiteng
huangruiteng force-pushed the codex/fix-authority-timeout-test-contract branch from 2575f60 to 147dc99 Compare September 26, 2026 16:36

@huangruiteng huangruiteng 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.

详细中文评审

结论:APPROVE。Exact head:147dc992794c1290d720458969d07022bfe4aee4;base:5c40583d85e038dc078d563f3d883e061fb747f9。作者已经把 #5063 引入 timeout 关键字后遗留的测试替身修好,本轮维护者只做减法和再生成:丢掉被 main 取代的那一处 loosening,并让生成的 manifest 重新对齐 main。

动机

#5063 给 canonical authority 调用加上了显式 write timeout,但仓库内的测试替身仍是 def native(method, params) 这类固定两参声明,生产代码带 timeout= 调用时直接抛 TypeError: unexpected keyword argument 'timeout',四个 Python shard 因此全红。更糟的是,红灯会让下一个 PR 无法判断失败是不是自己造成的。同一时间 loopx/semantics/project_registry_io_manifest_v1.json 也落后于 main:扫描器报出五个站点行号漂移与一个新增站点(242 → 243)。

改动思路

修复方向是最小且贴合既有 seam 的:让替身接受并转发关键字,而不是放宽断言。维护者 rebase 到当前 main 时发现 tests/control_plane/test_local_coordination_authority.py 已被 main 用更强的形式修过——def _claim(method, params, *, timeout: float) 并 assert timeout > 0——于是这一文件采用 main 的版本,丢弃分支里较弱的 **_kwargs 写法;其余六个文件 main 仍保留两参签名,作者的改动正是所需。manifest 不改手写,直接由生成器重跑。

具体改动

关键代码讲解

  1. tests/control_plane/checkpoint_process.py:75、test_checkpoint_provider_fence.py:118/209、test_validated_create_recovery.py:55/111/177:替身签名扩为 (..., **kwargs) 并把 **kwargs 转交给真实适配器,因此只有目标方法被拦截,其它调用仍原样落到生产代码。
  2. test_archive_retry_delivery.py:304、test_canonical_lease_inspection.py:134/158、test_canonical_handoff_mode.py:92:同一模式;lambda *_args 补成 lambda *_args, **_kwargs。
  3. test_local_coordination_authority.py:不再改,保留 main 的强断言版本(assert timeout > 0),这是比“能接收关键字”更强的契约。
  4. loopx/semantics/project_registry_io_manifest_v1.json:由 scripts/generate_project_registry_io_manifest.py 重跑生成,243 个站点、0 个未分类直接站点;除行号/列号元数据外只多出一个站点。

对主干的风险

范围只在测试 seam 与生成元数据:没有任何生产模块、超时值、重试策略或 provider 路由改动,因此没有用户可见或持久化行为变化。唯一值得记录的残余风险是这六个文件只转发关键字、不断言取值,所以“某天不再传 timeout”不会在这里被抓到——这层保护留在 main 已经收紧的 test_local_coordination_authority.py 中。行为证据取自真实反例:把 test_checkpoint_provider_fence.py 与 test_validated_create_recovery.py 还原成 main 的两参替身后,6 个断言以 TypeError: unexpected keyword argument 'timeout' 失败;换回本 head 后同一选择全绿,所以这不是“描述里有 bug”。完整受影响文件(含 test_local_coordination_authority.py)在本 head 上 file/sqlite 两臂 111 项通过;manifest --check 为 current;canary --from-git-diff 的直接检查与选中检查 0 失败,仅缺 exact-diff quality receipt,已补齐。作者另行归因的 UTF-8 subprocess guard 与 Windows 安装器问题属 main 侧、单独修复,不在本 diff;远端 CI 按 goal 策略未查询。

我的整体评价

APPROVE。problem_context 的 long_horizon 与 user_experience 均为 improved:测试替身不再随生产 seam 新增关键字而整体腐烂,控制平面基线恢复为可信的红/绿信号。repository_reuse 为 reused:同一 seam、同一文件内就地加宽,没有引入共享替身工厂(六个文件断言的失败形态不同,统一会掩盖差异);同时接受 main 已有更强实现,避免同一修复出现两套强度不同的版本。scope_fit、code_volume 与 change_proportionality 通过:19/19 的测试行数改动加一份生成文件,属最小可逆切片;authority_semantics 为 no_authority_change,default_off_isolation 不适用(未新增可选能力)。合并授权来自维护者,本评审只说明该 exact head 的批准条件已经满足。

English verdict: APPROVE - exact head 147dc99 on base 5c40583. The authored fix is correct and still needed: main's doubles keep the two-argument signature, and the value check reproduces 6 failures with TypeError: unexpected keyword argument 'timeout' when they are restored, while this head passes 111 tests across the file and sqlite arms. The maintainer repair only shrank the diff: the rebase keeps main's stricter assert timeout > 0 doubles in test_local_coordination_authority.py instead of the branch's weaker **_kwargs variant, and the generated registry I/O manifest was rerun to the scanner's current 243 sites, which main's checked-in copy failed. No production module changes, no signature loosening, no assertion removed. Unrelated main-side work the author triaged (UTF-8 subprocess guard, Windows installer environment) stays in its own repair. Merge authority comes from the maintainer, not from this review.

@huangruiteng
huangruiteng merged commit b15413f into loopx-project:main Sep 26, 2026
5 checks passed
@huangruiteng

Copy link
Copy Markdown
Collaborator

Merge decision (maintainer)

Reviewed exact head 147dc992794c1290d720458969d07022bfe4aee4 on base 5c40583d85e038dc078d563f3d883e061fb747f9; published review #pullrequestreview-5326600099 carries the five-block Chinese review and English verdict: APPROVE. Merged as b15413ffcb9d362e6b30c960a6be49359dab1471; the merged tree is identical to the reviewed head tree.

Changed surfaces: six control-plane test files (timeout-aware doubles) and the generated project-registry I/O manifest. No production module changed.

Checks: 111 tests across the six changed files plus test_local_coordination_authority.py in the file and sqlite arms; the main-doubles counterfactual failing 6 assertions with TypeError: unexpected keyword argument 'timeout'; generate_project_registry_io_manifest.py --check current at 243 sites; loopx canary premerge --from-git-diff with 0 direct and 0 run failures; exact-diff change-quality receipt. Remote CI was not consulted (wait_for_ci=false). No manual holds.

Gate note: merge readiness reported the single blocker github_review_decision_not_approved because the repository ruleset requires an approval after the last push and the last push came from this maintainer account. Admin bypass was applied deliberately under the owner's standing instruction to self-repair and self-merge; no other gate was overridden.

Authority note: merge authority came from the maintainer, not from the review.

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