Skip to content

fix(test): pin managed-claim conformance lease duration - #9496

Merged
huangruiteng merged 1 commit into
mainfrom
codex/pin-managed-claim-fixture-ttl-20261126
Nov 26, 2026
Merged

huangruiteng merged 1 commit into
mainfrom
codex/pin-managed-claim-fixture-ttl-20261126

Conversation

@loopx-agent

@loopx-agent loopx-agent commented Nov 26, 2026 •

Copy link
Copy Markdown
Collaborator

Goal and delivered outcome

Managed-claim conformance advances a fixture clock to 10:45 UTC to exercise expiry. The fixture inherited the three-hour default introduced in #9487, leaving the lease active at that timestamp. The PostgreSQL conformance failure reproduced on both the #9436 CI candidate source and the observed main revision. Each isolated run reported 395 passes and the same six failures out of 401 tests. PR qualification run · Main qualification run

Pin the fixture's managed lease to 45 minutes so its timestamps exercise the intended renewal, expiry, and stale-writer fences. Use plain claim inputs for the unmanaged and historical replay cases so those assertions reach the intended ownership and replay checks.

Author declaration

Written by an OpenAI Codex model agent. The change follows the default lease policy shipped in #9487 and the exact transition assertions in the conformance suite. Tested revision 9509c2afe507c639ad9f7c58c80992d0820eb40b uses main base 5947dc87ec1395b8aee3e73db649841e6d5391f7.

Validation

Check Result
Full authority-store conformance on PostgreSQL 16.15 with Node 22.22.3 on macOS 401 passed, zero failures and zero skips.
Same #9436 CI source with only the fixture patch applied 401 passed, zero failures and zero skips.
File and SQLite managed-claim conformance 40 passed.
Task-lease policy tests 4 passed, including the default TTL.
npm run typecheck:control-plane Passed.
Bilingual RFC diff check and whitespace check Passed.

Hosted Linux CI remains the qualification step for the PR.

Scope and boundaries

  • One shared test fixture. UI impact none.
  • Signed-off commit and public-safe aggregate evidence.

Independent exact-head validation

The independent review of 9509c2afe507c639ad9f7c58c80992d0820eb40b reproduced the same six managed-claim failures on the baseline across PostgreSQL, File, and SQLite. On the patched head, all 20 focused PostgreSQL tests and all 40 File and SQLite tests passed. The omitted-TTL test returned the three-hour default on both revisions. The reviewer used macOS, Node 24.21.0, and isolated PostgreSQL 16.15.

Hosted Linux qualification remains pending. PostgreSQL job

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

@loopx-agent loopx-agent 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.

Reviewer: model_agent · Gemini · Google DeepMind · self_reported

Approval conclusion (author-owned PR; GitHub blocks formal self-approval)

未发现阻塞性问题(no blocking findings)。剩余边界风险:本地无原生 PostgreSQL 服务且未启动 Colima,因此未在本机实连 PostgreSQL 跑通一致性集成测试(不过被测助手为存储无关共享夹具,已在 File、SQLite、NoKV 单包与 NoKV JSON-lines 四种真实存储上完成全量核验);另全量 npm run test:control-plane 中 canonical_task_lease_renew.test.ts:106 的 2 项失败在基准提交 5947dc87ec 已存在且与本 PR 无因果关系,远端 CI 未被咨询或等待。

动机 / Motivation

修改 tests/control_plane_ts/managed_claim_execution_conformance.ts 中共享的 registerManagedClaimExecutionConformance 测试夹具;直接影响 File、SQLite、NoKV(单包及 JSON-lines 进程)及 PostgreSQL 一致性测试运行者,以及所有在合并前执行 npm run test:control-plane 的维护者与协作者。

改动前在基线 5947dc87ec 运行 node --test 四套存储一致性测试时,因为 #9487(提交 6268621e5e)已将未传 --ttl-seconds 的默认任务租约从 45 分钟(2700 秒)提高到 3 小时(10800 秒),而该夹具硬编码于 10:00:00Z 发起声明并在 10:31:00Z / 10:45:00Z 断言续租、过期与接管,导致四类本地存储共 1,598 项中固定失败 24 项(租约过期时间变为 13:00:00Z)。改动后显式固定 ttl_seconds: 45 * 60 并仅在禁用受管执行的旧路径用例中清除 ttl_seconds: undefined,四类本地存储 1,598 项全数通过。

共享一致性套件在 File、SQLite、NoKV 单包与 NoKV JSON-lines 上从 1,574 通过 / 24 失败恢复至 1,598 全部通过(零跳过);同时策略层“省略 TTL 时默认为 3 小时”契约测试与类型检查继续通过。

本 PR 不修改任何生产控制面租约默认值或策略代码,也不修复 canonical_task_lease_renew.test.ts 中在基线 5947dc87ec 已存在的独立失败项。

改动思路 / Approach

保持 loopx/control_plane/work_items/task_lease_record.ts 中既有的 3 小时默认租约(DEFAULT_TASK_LEASE_TTL_SECONDS = 3 * 60 * 60)以及 loopx/control_plane/coordination/todo_claim.ts 对 manage_execution: false 时禁止携带托管 TTL 的校验边界,仅把依赖 10:31:00Z / 10:45:00Z 固定时间推进的测试夹具显式锚定为 45 分钟,避免通过改动数十处测试时间戳引入噪音或削弱真实策略断言。

全仓库检索 registerManagedClaimExecutionConformance 确认仅存在一份共享一致性实现,由 authority_store_conformance.ts 统一分发给 File、SQLite、NoKV 单包、NoKV JSON-lines 和 PostgreSQL 五大存储套件。正向路径在 setup()(ttl_seconds: 45 * 60)下按原设定的末段三分之一节点(10:31:00Z)续租并在 10:45:00Z 进入过期接管;反向/禁用路径在展开 request 并将 manage_execution: false 时显式置 ttl_seconds: undefined,满足 todo_claim.ts#L401-L403 校验使断言落到 claim_owner_mismatch 与非升级回放检测。

具体改动 / Changes

对照基准 5947dc87ec1395b8aee3e73db649841e6d5391f7 与审查提交 9509c2afe507c639ad9f7c58c80992d0820eb40b:共修改 1 个测试夹具文件(+5 / -3 行),零生产源码改动,合并树 git merge-tree 无冲突,签名(DCO -s)完整。

  • 规格依据: docs/reference/canonical-lease-renew.md(修订 6268621e5e26851fed3810e208fabb92c1ef7879,规则 C1-managed-claim-ttl-fixture:默认租约改为 3 小时,历史或固定时长场景需显式传入 ttl_seconds)。
  • 固定夹具租约: setup() 补充注释并设置 ttl_seconds: 45 * 60,而测试文件内原有显式 ttl_seconds: 7200 用例保持覆盖行为不受影响。
  • 清理禁用托管字段: 接管互斥校验 与 预升级普通认领回放 在覆盖 manage_execution: false 时同时显式传入 ttl_seconds: undefined,准确触发原有 claim_owner_mismatch 与 replayed 状态校验。

对主干的风险 / Risks

验证维度 / Check 结果 / Status 说明 / Notes
基线对比四存储一致性套件 (5947dc87ec vs 9509c2afe5) PASS 基线 1,574 passed, 24 failed(4 类存储各固定失败 6 项);当前头 1,598 passed, 0 failed, 0 skipped(142.27s)
npm run typecheck:control-plane PASS tsc --noEmit 零错误
TS 租约策略套件 (tests/control_plane_ts/task_lease*.test.ts) PASS 107 passed, 4 PG skipped(含默认 3 小时 TTL 校验)
全量 TS 控制面 (npm run test:control-plane) PASS (with pre-existing attribution) 6,849 passed, 97 skipped, 2 failed;2 项 canonical_task_lease_renew.test.ts:106 失败在基线 5947dc87ec(75 pass, 2 fail)完全同签复现(pre_existing_unrelated)
Python 租约与架构/棘轮测试 + smokes PASS Python 租约 98 passed;架构/棘轮 22 passed;semantic-vocabulary-drift-smoke.py、control-plane-maintainability-ratchet-smoke.py (unreviewed_count=0)、canary premerge (4/4 direct)、check (0 errors) 均通过
PostgreSQL 一致性 (postgresql_authority_store.integration.test.ts) UNVERIFIED 本地无可用 PostgreSQL 实例;仅通过共享夹具在其他四套真实存储验证等价性

durable_smoke_value 核验确认:本次修复的正是覆盖五大权威存储契约的唯一共享测试夹具(无重复套件、无刷分脚手架),保留价值高,未降低任何产品默认值或生产校验强度。

我的整体评价 / Verdict

在持续演化维度(long_horizon)上,本 PR 为纯粹测试夹具修正,完全保留了生产代码中的 3 小时默认租约、到期恢复、旧写入者隔离与幂等性语义;在用户体验维度(user_experience)上不涉及界面或 CLI 交付面,属 not_applicable。仅修改 1 个测试文件(+5/-3 行),复用单一共享夹具并在本地四类真实存储引擎上完整消除了 #9487 遗留的 24 项夹具超时失败,同时不遮蔽也不污染任何生产默认行为,因此准予合入路径推进。

English verdict: APPROVE at 9509c2a. The shared conformance fixture cleanly pins its synthetic 45-minute lease scenarios without altering the shipped 3-hour default TTL or unmanaged-claim validation, fixing all 24 local conformance failures across File, SQLite, and NoKV while pre-existing failures in canonical_task_lease_renew.test.ts are proven unrelated on base 5947dc8.

@loopx-agent loopx-agent 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.

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

Approval conclusion (author-owned PR; GitHub blocks formal self-approval)

动机 / Motivation

控制面维护者用同一套租约测试验证正常续租、到期接管与旧持有者拒绝。

默认租约改为三小时后,测试时钟仍只前进到 10:45。原夹具的租约当时仍有效,原本用于覆盖到期的测试在三个存储后端各失败六项。 在同一 Node 24.21.0 和本地隔离 PostgreSQL 16.15 上,旧提交 395/401,通过修正后的提交 401/401。File 与 SQLite 合计从 28/40 恢复到 40/40。两版的四项默认 TTL 测试均通过。

这份提交只改共享测试夹具,生产的三小时默认值、既有租约和收据行为继续由原所有者负责。

按 6268621e5e26851fed3810e208fabb92c1ef7879 中的租约规范核验 Default TTL、Expiry and takeover 与 Original claim replay。前两项分别要求保留默认时长、按有效租约判断过早接管,最后一项要求重放保留原领取意图。现有租约契约

改动思路 / Approach

在共用夹具里明确指定用于这组时间点的 45 分钟。普通领取和升级前的重放样例清除从夹具继承的 TTL,让测试进入本来要覆盖的所有权检查。各 provider 继续用同一个测试入口和各自真实存储,独立的默认值用例仍覆盖三小时。改动范围限于这一个共用文件。

具体改动 / Changes

  • 建立测试任务时仍用 10:00 起始时钟和真实的领取逻辑。添加 ttl_seconds: 45 * 60 后,10:44:59 仍在原租约内,10:45 才进入到期判断。共享夹具
  • 两处普通领取显式清除夹具的 TTL。已有断言继续覆盖过早接管、过期后再次核验来源、续租和旧持有者不能写入。升级前未纳管的历史请求继续原样重放。到期和重放测试
  • 在同一台机器使用 Mac 上的 PostgreSQL 16.15 和 Node 24.21.0,以隔离的 Unix socket 比较基线和现提交。六个失败用例在 PostgreSQL、File 和 SQLite 的名字与失败路径相符。

对主干的风险 / Risks

原基线的 PostgreSQL 六项、File 与 SQLite 合计十二项时间相关失败均在当前提交通过。默认 TTL 检查一共四项,两版均通过。TypeScript 类型检查及标准预检所选四项直接检查通过。这组测试只修改自己创建的状态和时钟,当前实际产品租约由原逻辑写入。托管 Linux 测试未查询。

我的整体评价 / Verdict

APPROVE。 未见阻塞问题。固定场景时长后,实际三种存储再次运行到预期的到期与恢复分支。改动只在测试夹具,没有可见界面变更。托管 Linux 分支未由本轮验证。

English verdict: APPROVE at 9509c2a. The explicit fixture TTL restores the expected expiry and original claim replay scenarios on PostgreSQL, File and SQLite. Both revisions pass the tests for the unchanged three-hour production default.

@huangruiteng
huangruiteng merged commit 9467da4 into main Nov 26, 2026
22 of 36 checks passed
@huangruiteng
huangruiteng deleted the codex/pin-managed-claim-fixture-ttl-20261126 branch November 26, 2026 18:39
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