Repository navigation
test(ui/scripts): take the vi-mock-inherit test's whole-repo readings once, at collection - #27804
Merged
Merged
Conversation
… once, at collection Claude-Session: https://claude.ai/code/session_01Utp6CXUtMecKADTTusrK3z Co-authored-by: Claude <noreply@anthropic.com>
…reads it Claude-Session: https://claude.ai/code/session_01Utp6CXUtMecKADTTusrK3z Co-authored-by: Claude <noreply@anthropic.com>
Contributor
Author
|
domain:ui#2 · os-bill · session_01Utp6CY2n1JmZZKrHgtp9jC 席位核对ACCEPT · head
Generated by Claude Code |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 秒预算里重扫整个仓库。ui/scripts/__tests__/check-i18n-dead-keys.test.ts:1714times out at 15 s onTest UI (10/16)(push CI on45c9be5f); the same sha passed in the merge queue #27423 是同一形态。按裁决不调超时、不跳过、不重试、不改断言。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.tsonly.scripts/check-vi-mock-inherit.mjsis untouched: no seam was needed.realTreememo takes each whole-repository reading once per file:gate=scan(repoRoot),cli= one run ofnode scripts/check-vi-mock-inherit.mjsover the tree, andi18n=scan(repoRoot, { covered: [I18N], floors: {} }). Values are frozen (arrays and plain objects, recursively) with the samefrozen()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 treetakesrealTree.gate()(it already scanned in its body; now through the memo) and warmsrealTree.cliin its body. The caseputs the census in the verdict, so a reader sees the populationreads the held CLI output instead of spawning the CLI itself.the sweep — every @object-ui/i18n factory inherits…warmsrealTree.i18nin its body.no @object-ui/i18n factory freezes the surfaceandwalked a real population…read the one held scan instead of each running its own.once()also holds a reading that THREW and rethrows it to each case that reads it, andwarm()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
expectline 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 abeforeAll, whose 10 shookTimeoutis narrower than the 15 stestTimeout.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 throughscripts/pm/os-verify-lock.sh. Per-case durations come from vitest's JSON reporter; the file figure is itsDurationline.puts the census in the verdict…no @object-ui/i18n factory freezes…walked a real population…Duration(import / tests)After the change the slowest cases in the file are the three
THE DEATHlegs (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 head2d8468bb(after the merge ofmain).Failure-locality probe (one run, then restored): the
clireading was pointed at a non-existent script, so the CLI exits non-zero. Result:Tests 1 failed | 82 passed (83), the one failure beingputs the census in the verdict…withError: Command failed: node scripts/no-such-gate.mjs. The file was restored withgit checkout HEAD --under a trap; proof:git hash-objectequalsgit rev-parse HEAD:<file>, andgit diff HEADis empty.Acceptance notes
ui/is a private workspace root ("private": true) and this is a test file, so nothing publishes: the PR carriesskip-changeset.Verification
Gates derived by
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstackat2d8468bb, plusnode scripts/check-sdui-manifest.mjsandpnpm --dir ui run type-check:scripts. Each command's exit code and the--ranreconciliation are in the os-dev report on #27449.Local gate exit codes
Human Minimum
packages/specholds no runtime logic. (not touched)pnpm lintpasses. (CI owns the lint run)main, one pull request.ui/root, so the PR carriesskip-changeset.packages/spectouched: n/a.content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.Generated by Claude Code