Skip to content

test(dsh): clean up temporary admission fixtures - #8640

Merged
huangruiteng merged 1 commit into
mainfrom
codex/dsh-cleanup-admission-fixtures
Nov 12, 2026
Merged

huangruiteng merged 1 commit into
mainfrom
codex/dsh-cleanup-admission-fixtures

Conversation

@loopx-agent

Copy link
Copy Markdown
Collaborator

The DSH admission-to-closeout tests left a temporary Git repository behind for each case. Register cleanup as soon as the fixture directory is created, and dispose the continuation driver before removing it, including when an assertion fails.

Validation: TypeScript checks and all 10 admission-to-closeout integration tests passed. The original focused test left one Git repository after a successful run; the updated suite left none. A separate run injected a failure after git init and also left no fixture directory. The unrelated sibling directory survived both checks.

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.

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

Reviewer: model_agent · gpt-6.1-sol · OpenAI · runtime_reported · max

本次评审对应提交 fcef7822f54059172461229f1e2dca333a0f90be。

无阻塞发现。相同十项测试都通过;主干留下十个 Git 仓库,候选没有遗留。初始化后故障也只清理自己的目录。

动机 / Motivation

运行 DSH 插件真实准入/结算测试的贡献者。DSH 的准入到结算集成测试每项都创建临时 Git 仓库。执行完未清目录,断言在最后的 dispose 前失败也无法走原清理。候选注册当前 Vitest 的结束钩子。相同十项测试通过,主干留下十个临时仓库,候选零个;git init 后故障时,主干留下一个,候选零个。验证本地测试夹具生命周期和原 LoopX CLI;未运行实际 DSH 账户、模型或发版路径。

改动思路 / Approach

由创建资源的 fixture 注册清理,driver 继续管理自身停止;Vitest 逆序保证该组先停 driver。限定测试文件,保留现有生产 driver 和其余测试的 try/finally。 fixture 在拿到自己的目录后立即登记结束清理。现有 runner 逆序等待 hooks,因此后注册的 driver.dispose 会先结束。 目录与 hook driver hook

具体改动 / Changes

关键代码讲解

fixture 的资源边界来自 mkdtemp 返回的精确路径;rm 不扩大到父目录。主要参数组把原结尾 dispose 移到 finished hook,断言中断后也会运行。其余两组已有 try/finally,不需要重构。原十项用例、CLI 请求、File authority 与结算断言仍在。 原 dispose 行为

以 base b7c9178 的 docs/development/good-smokes.md 为准。fixture_cleanup 经成功及故障路径验证;scope_preserved 经真实 CLI 及同级保留验证。 原测试约束

对主干的风险 / Risks

同一版本的 Vitest 和 Node 对照执行两版,每版十项都通过。独立临时根的遗留目录从 10 到 0。另将 git remote add 控制为在真实 git init 后退出 77,两版都在预期断言失败,遗留从 1 到 0,同级文件均保留。

语义与 CI 对齐

候选类型检查和快速 premerge 通过。只调整已有集成套件的 teardown,没有新的默认运行时、CLI 或授权;没有查询托管 CI。

我的整体评价 / Verdict

代码评审通过。保持 fixture owner 统一释放资源,原语义覆盖仍在,当前无需为同一局部行为增加抽象。本次评审覆盖现有宿主与 CLI 行为。验证本地测试夹具生命周期和原 LoopX CLI;未运行实际 DSH 账户、模型或发版路径。

English verdict: APPROVE. At fcef782, the existing ten integration cases still pass, and their temporary Git repositories are removed on success and the injected setup failure.

@huangruiteng
huangruiteng merged commit d9432f2 into main Nov 12, 2026
31 of 41 checks passed
@huangruiteng
huangruiteng deleted the codex/dsh-cleanup-admission-fixtures branch November 12, 2026 08:18
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