Skip to content

test(ui/scripts): take the vi-mock-inherit test's whole-repo readings once, at collection - #27804

Merged
objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/project-thread-70aald
Oct 30, 2026
Merged

objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/project-thread-70aald

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

domain:ui#2 · os-bill · session_01Utp6CY2n1JmZZKrHgtp9jC

Requested by Bill · project thread
Fixes #27449

Clause-②: no
Metadata-protocol: none

维护者速读

  • 改了什么:check-vi-mock-inherit.test.ts 里读真实仓库的三个读数(全量 scan、门禁 CLI 一次运行、@object-ui/i18n 的 scan)每个文件只取一次,在 describe 体(收集阶段)里取,三个慢用例不再在自己的 15 秒预算里重扫整个仓库。
  • 为什么改:这三个用例空闲各 5.4–6.0 秒、四核满载下 6.9–7.7 秒,再翻一倍负载就会贴近 15 秒超时,和 main red: ui/scripts/__tests__/check-i18n-dead-keys.test.ts:1714 times out at 15 s on Test UI (10/16) (push CI on 45c9be5f); the same sha passed in the merge queue #27423 是同一形态。按裁决不调超时、不跳过、不重试、不改断言。
  • 风险与回滚:只动一个测试文件,断言逐条不变;读数被冻结,用例之间无法互相污染;读数若抛错,错误被保存并只让读它的那个用例失败,不会在收集阶段弄死整个文件。回滚即 revert 本 PR。
  • 先看:ui/scripts/__tests__/check-vi-mock-inherit.test.ts 顶部新增的 realTree 备忘块(含 once / warm),以及 repo state 和 the sweep 两个 describe 体里的取值行。
  • 两分钟验证:pnpm --dir ui exec vitest run scripts/__tests__/check-vi-mock-inherit.test.ts,预期 83 passed,三个原慢用例各在约 1 毫秒内完成。
  • 需要你做的:无,席位落地。

What changes

ui/scripts/__tests__/check-vi-mock-inherit.test.ts only. scripts/check-vi-mock-inherit.mjs is untouched: no seam was needed.

  • A module-level realTree memo takes each whole-repository reading once per file: gate = scan(repoRoot), cli = one run of node scripts/check-vi-mock-inherit.mjs over the tree, and i18n = scan(repoRoot, { covered: [I18N], floors: {} }). Values are frozen (arrays and plain objects, recursively) with the same frozen() helper test(ui/scripts): take the dead-keys sweep's whole-repo readings once, at collection #27437 introduced, so a case that sorted or spliced one in place would throw instead of leaking into the next case.
  • repo state — the gate is green on this tree takes realTree.gate() (it already scanned in its body; now through the memo) and warms realTree.cli in its body. The case puts the census in the verdict, so a reader sees the population reads the held CLI output instead of spawning the CLI itself.
  • the sweep — every @object-ui/i18n factory inherits… warms realTree.i18n in its body. no @object-ui/i18n factory freezes the surface and walked a real population… read the one held scan instead of each running its own.
  • One addition over test(ui/scripts): take the dead-keys sweep's whole-repo readings once, at collection #27437's shape: once() also holds a reading that THREW and rethrows it to each case that reads it, and warm() takes the reading at collection without letting the throw escape. Without it, a red CLI (non-zero exit) would throw during collection and fail the whole file with 0 cases run; before this PR it failed only the census case. Measured below: the failure stays in that one case.

Why

The ruling on the card: take each reading once per file, at collection, through a frozen memo, so no case walks the repo; never raise a timeout, skip, retry or change an assertion. Every expect line is byte-identical; only where the value comes from moved.

Collection is the right home. ui/AGENTS.md (测试纪律) puts warm-up cost where no test or hook timeout bounds it and rules out a beforeAll, whose 10 s hookTimeout is narrower than the 15 s testTimeout.

Tests

Measured on this container (4 cores, a shared box). "Load" means four node -e 'for(;;){}' CPU burners beside the run, the method #27437 used. Every run went through scripts/pm/os-verify-lock.sh. Per-case durations come from vitest's JSON reporter; the file figure is its Duration line.

leg puts the census in the verdict… no @object-ui/i18n factory freezes… walked a real population… file Duration (import / tests) result
before, idle 5950 ms 5627 ms 5415 ms 25.67 s (6.17 / 19.07) 83/83
before, load 7748 ms 6897 ms 7373 ms 33.12 s (7.56 / 25.08) 83/83
after, idle 0.8 ms 0.2 ms 0.2 ms 20.43 s (17.80 / 2.25) 83/83
after, load 1.0 ms 0.2 ms 0.1 ms 27.61 s (23.82 / 3.27) 83/83

After the change the slowest cases in the file are the three THE DEATH legs (each spawns a child vitest over a temp root, not the repository): about 0.6 s idle and up to 1.0 s loaded. The collection phase grows by the readings it now takes, about 11.6 s idle and 16.3 s loaded; no timeout bounds that phase. The tests phase drops from 19.07 s to 2.25 s idle and from 25.08 s to 3.27 s loaded, and the file's total wall drops by about 5 s either way. The "after" rows were measured at the final head 2d8468bb (after the merge of main).

Failure-locality probe (one run, then restored): the cli reading was pointed at a non-existent script, so the CLI exits non-zero. Result: Tests 1 failed | 82 passed (83), the one failure being puts the census in the verdict… with Error: Command failed: node scripts/no-such-gate.mjs. The file was restored with git checkout HEAD -- under a trap; proof: git hash-object equals git rev-parse HEAD:<file>, and git diff HEAD is empty.

Acceptance notes

  • ui/ is a private workspace root ("private": true) and this is a test file, so nothing publishes: the PR carries skip-changeset.
  • The card's "Done when" readings that need CI runs after merge are the seat's to read.
  • No assignee and no reviewer were set on this PR: the project's routing rule asks nobody before the seat's ACCEPT and review.

Verification

Gates derived by node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack at 2d8468bb, plus node scripts/check-sdui-manifest.mjs and pnpm --dir ui run type-check:scripts. Each command's exit code and the --ran reconciliation are in the os-dev report on #27449.

Local gate exit codes
node scripts/check-closing-keyword-parity.mjs :: exit 0
node scripts/check-closing-keyword-parity.mjs --self-test :: exit 0
node scripts/check-comment-mask-corpus.mjs :: exit 0
pnpm check:cross-package-test-inputs :: exit 0
pnpm check:driver-memory-census :: exit 0
pnpm check:engine-double-contract :: exit 0
pnpm check:gitlink-declared :: exit 0
pnpm check:nul-bytes :: exit 0
pnpm check:published-files :: exit 0
pnpm check:query-options-erasure :: exit 0
pnpm check:refd-timer-probe :: exit 0
pnpm check:tier-file-adoption :: exit 0
pnpm check:type-check-coverage :: exit 0
pnpm check:type-check-debt :: exit 0
pnpm check:undeclared-dep-imports :: exit 0
pnpm check:watch-hint-literal :: exit 0
pnpm check:where-matcher :: exit 0
node scripts/check-sdui-manifest.mjs :: exit 0
pnpm --dir ui run type-check:scripts :: exit 0
pnpm --dir ui exec vitest run scripts/ :: exit 0
(the first `vitest run scripts/` run exited 1 before `@objectstack/spec` was built: 16 files failed on `Cannot find package '@objectstack/spec/...'`, none of them this file; after `pnpm --filter @objectstack/spec build` it ran 169 files passed, 2 skipped, 4902 tests passed)
dispatch-gates --ran: 18 derived families accounted for, 18 run, 0 NOT-MEASURED

Human Minimum

  • 1. Schemas start as Zod; packages/spec holds no runtime logic. (not touched)
  • 2. Every name I added uses the casing for its kind.
  • 3. No formatter ran; pnpm lint passes. (CI owns the lint run)
  • 4. One issue, one branch off an up-to-date main, one pull request.
  • 5. A change that publishes carries a changeset. This one publishes nothing: it is a test file under the private ui/ root, so the PR carries skip-changeset.
  • 6. packages/spec touched: n/a.
  • 7. No hand edits to content/docs/references/, packages/*/CHANGELOG.md or content/docs/releases/.
  • 8. Title, body and comments are in English. (The 维护者速读 block is the repo's Chinese summary convention.)

Generated by Claude Code

@objectstack-fleet objectstack-fleet Bot added the skip-changeset PR has no user-facing published change; bypasses the changeset gate label Oct 29, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:ui#2 · os-bill · session_01Utp6CY2n1JmZZKrHgtp9jC

席位核对

ACCEPT · head 2d8468bb215f98b7d4f9fdb933a56c005cf396b8 · 2026-10-30T00:03Z

  1. Shape: draft → main, Fixes #27449, attribution block on top, label skip-changeset (ui/scripts tests ship nothing). One file: ui/scripts/__tests__/check-vi-mock-inherit.test.ts (+69 / −5). The checker .mjs is untouched. No assignee, no reviewer.
  2. Card rule met (seat read the diff):
  3. Gates (check-runs on this head): 44 success, 16 skipped, 0 red.
    • Named runs: Lint & Repo Gates 123805251095, TypeScript Type Check 123806655073, Test UI 123804863316, Lint · PM dispatch-gates 123803027858.
    • The dev's derived gates: 18/18 run, 0 NOT-MEASURED, plus check-sdui-manifest and type-check:scripts.
  4. Contract review: not owed. Clause-②: no, Metadata-protocol: none (a test file only).
  5. Accepted deviation: once() also holds a reading that THREW, and warm() swallows it at collection. A red CLI then fails only the case that asserts on it (probe: 1 failed, 82 passed) instead of killing the whole file at collection. Accepted: the failure still reaches the asserting case, which is how it surfaced when the case ran the CLI itself.
  6. Landing: not governed (check-governed-merges --pr 27804: NOT governed), +69 / −5. The seat lands it: ready + auto-merge now.

Generated by Claude Code

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review October 30, 2026 00:04
@objectstack-fleet
objectstack-fleet Bot enabled auto-merge October 30, 2026 00:04
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Oct 30, 2026
Merged via the queue into main with commit b83baed Oct 30, 2026
61 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-70aald branch October 30, 2026 00:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/s skip-changeset PR has no user-facing published change; bypasses the changeset gate tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

check-vi-mock-inherit test: three cases scan the whole repository inside their 15 s budget (same timeout shape as #27423)

1 participant