Skip to content

test: align CI guards with current runtime behavior - #5344

Open
Duang777 wants to merge 3 commits into
loopx-project:mainfrom
Duang777:codex/fix-ci-generated-hook-guards
Open

Duang777 wants to merge 3 commits into
loopx-project:mainfrom
Duang777:codex/fix-ci-generated-hook-guards

Conversation

@Duang777

@Duang777 Duang777 commented Sep 30, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • account for both verified generated Turn modules in the independent twin guard
  • validate the turn-start capability dispatch while preserving checks for unchanged fields
  • publish the Host descendant marker through an atomic rename so process termination cannot expose a partial write
  • extract the signed test-only baseline repairs from perf(authority): copy journal JSON without repeated primitive allocation #5251 without copying its performance changes

These changes repair the current main failures blocking #5340. They do not change production runtime behavior. The original author is preserved on both commits.

Validation

  • python -m pytest -q tests/architecture/test_turn_contract_generation.py tests/control_plane/test_prompt_upgrade_hook.py (38 passed)
  • Node 22: tests/control_plane_ts/host_process.test.ts (9 passed)
  • Node 22: repeated the Host process test 10 times without failure
  • ruff check tests/architecture/test_turn_contract_generation.py tests/control_plane/test_prompt_upgrade_hook.py
  • git diff --check origin/main...HEAD

Signed-off-by: Lihua <1017343802@qq.com>
Signed-off-by: duanjialing.777 <duanjialing.777@bytedance.com>
Signed-off-by: Lihua <1017343802@qq.com>
Signed-off-by: duanjialing.777 <duanjialing.777@bytedance.com>
@Duang777 Duang777 changed the title test: align CI guards with generated digest and hook dispatch test: align CI guards with current runtime behavior Sep 30, 2026
Signed-off-by: duanjialing.777 <duanjialing.777@bytedance.com>
@Duang777

Copy link
Copy Markdown
Collaborator Author

This baseline repair also unblocks #5338. On #5338 exact head 73f937907, both prompt-hook parameters and the generated-pair assertion reproduced unchanged on immutable base 996bcc027; the separate leader_exit failure passed on rerun. The fixes remain isolated here rather than being copied into either feature PR.

@Duang777

Copy link
Copy Markdown
Collaborator Author

CI dependency update: dashboard-acceptance failed outside this PR's diff with the current main execution-chip baseline:

Error: Execution chip is not a compact hairline row: 28px tall

Exact job: https://github.com/loopx-project/loopx/actions/runs/36692413558/job/109813982376

The independent one-line fix is #5345. It restores the desktop button to the existing 26px contract, leaves the mobile 44px touch target unchanged, and passes the packaged execution-chip browser scenario on main@7e60e6999. #5344 does not modify the dashboard files involved in that failure.

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

动机

这个 PR 修复的是当前主干的测试基线,而不是通过改生产逻辑来追求绿灯。主干已经有两个经过源码重建验证的 Python/TypeScript generated twin,也已经会在待升级提示存在时投影 turn_start_capability_hook_dispatch;旧测试仍分别假定数量为 1、该字段不存在。另一个真实 CI 失败来自 Host 子进程在被终止时恰好进行原地写入,读取方先看到 27、随后看到空串,从而把半写文件误判成子进程仍在运行。

改动思路

改动保留现有生产 owner,只修正三个测试观察点:generated-twin 用当前两个 source-verified pair 作为显式 ratchet,并继续用 mutation 证明新增 authored twin 会消耗独立模块预算;prompt-upgrade 在比较其余决策字段不变之前,先验证 typed dispatch 的 hook/capability 身份和投影内容;Host fixture 先写同目录 staged 文件,再用原子 rename 发布完整计数,使“返回后 marker 是否继续变化”仍是有效的存活判据。

具体改动

  • test_turn_contract_generation.py 将已验证 generated twin 数从 1 更新为 2,原有超预算负例保持不变。
  • test_prompt_upgrade_hook.py 对 baseline 无 dispatch、pending 恰有一条 read、heartbeat.prompt_upgrade / automation-prompt-upgrade 身份以及与公开 hint 的字段一致性作显式断言;只有这个已验证字段被排除在其余决策字段的等值比较之外。
  • host_process.test.ts 把 counter 从原地覆盖改为 marker.next 写完后 renameSync,不修改被测 Host 实现、超时或清理语义。

关键代码讲解

test_new_independent_twin_cannot_hide_behind_generated_pair 仍会注入足量的 authored twin 并要求预算检查失败,因此不是简单放宽计数;prompt-upgrade 用 dispatch 内的 hook_id、capability_id 和完整 hint 字段锁住 typed route;Host 的 publish 只有在 staged 内容完整时才替换可观察 marker,存活子进程仍会在下一次完整 tick 改变它。

对主干的风险

whole-diff 没有生产代码、公共 API、持久状态或权限变化。主要风险是测试修复掩盖真实回归:这里 generated-twin 的 mutation 负例仍在,prompt 测试先校验新增字段再做窄范围排除,Host oracle 只屏蔽终止瞬间的半写状态,并未屏蔽返回后的完整写入。更新后的 immutable base 上同一 Python 命令稳定失败 3 项,新 exact head 38/38 通过;Host 新 exact head 完整复跑 10 次共 90 项通过,来源 CI 的 leader_exit 失败明确记录为空串与 27 的差异。Ruff、diff hygiene、DCO、4 个 Python shard、3 个 TypeScript shard、mutation、平台与集成检查均通过。

当前 merge readiness 仍有独立 hold:chat-bundle-browser 与 dashboard-acceptance 都在 execution-chip 的 28px hairline 断言失败;immutable base ba1e92d860027d2cf209d869249dcf61e6a11651 的对应两项以相同签名失败,且本 PR 不改 Dashboard/UI。checks、pytest、merge-gate 只是传播这两个结果。因此按 policy-12 不要求本 PR 修复无关主干问题,但合并前仍需由维护者处理或解除这些红项。

#5339 含有重叠的 Python 基线修复,但它是更大的 installer PR;本 PR 独立落地后应由 #5339 在 rebase 时消解重复。最新提交只是签署合并当前 main,贡献 diff 与前一 head 完全一致;审批仅绑定 fbd56efe262e75d6dc0ac3f00224addf58ea6d7f,不替代合并前的 freshness/merge-readiness 检查。

我的整体评价

这是一个有明确 before/after 收益的窄测试修复:它解除会持续阻塞其他 PR 的三项确定性基线假红,并修复一个有历史 CI 反例的观察竞态,同时把三个观察点保留为可失败的具体契约,没有新增一次性 smoke、框架或生产兼容层。对长周期交付是正向的,对终端用户行为保持不变;相关 future-facing pass 不需要额外抽象。未发现由本 PR 引入的阻断项,批准该 exact head,但不授予合并权限;上面的 UI 红项仍是独立 merge-readiness hold。

English verdict: APPROVE - exact head fbd56efe262e75d6dc0ac3f00224addf58ea6d7f restores three reproduced baseline assertions and removes a demonstrated partial-write test-oracle race without production changes; focused base/head checks, ten Host-suite repetitions, lint, DCO, and every changed-code CI shard passed. Two unrelated UI jobs fail identically on the immutable base and remain a separate merge-readiness hold.

@Duang777

Copy link
Copy Markdown
Collaborator Author

Exact-head run 36692413558 completed with all four Python test shards, all three TypeScript shards, kernel static checks, Windows PowerShell, Stage 2C, and coverage passing. The aggregate pytest log records SHARDS_RESULT=success; its failure is inherited from the same run's two execution-chip UI jobs.

The independent UI repair #5345 is now green on exact head c33543eaae57f33e28c82f0c85be27216bbe785b with 20 passing checks, including dashboard-acceptance, chat-bundle-browser, Frontstage Pages, Release Artifacts, and merge-gate. No UI change is being copied into this PR.

After #5345 lands, this branch can be synchronized once and rerun without mixing the two baseline repairs.

@mergify

mergify Bot commented Sep 30, 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, @Duang777.

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 Sep 30, 2026

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

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.

3 participants