Skip to content

test(app-shell): pre-filter the Studio address guard's walk before parsing - #37198

Merged
objectstack-fleet[bot] merged 1 commit into
mainfrom
claude/issue-37174-studio-address-guard-timeout
Nov 25, 2026
Merged

objectstack-fleet[bot] merged 1 commit into
mainfrom
claude/issue-37174-studio-address-guard-timeout

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Fixes #37174

Clause-②: no
Metadata-protocol: none

维护者速读

  • 用户无感:只改界面工作区里的一份守卫测试,产品代码一行未动。
  • 为什么做:这份「禁止手拼工作室地址」的守卫在繁忙的 CI 分片上超时,把一个无关的合并请求两次挤出合并队列,这次修复为它解围。
  • 出错会怎样:最坏是守卫漏看某个文件里的手拼地址;新加的对照测试正是为这种情况变红而设,改动随时可直接撤回。
  • 要你做什么:无。

What changes

Test-only: one file, ui/packages/app-shell/src/views/studio-design/studioAddress.guard.test.ts. No product file, no published file (@object-ui/app-shell is private and ships dist only), hence skip-changeset. This unblocks PR #37114, whose Test UI shard timed out on this case twice (queue run 45501281672; PR job 138901843717).

  • Pre-filter before parsing. The walk case TypeScript-parsed every non-test ui source (2,378 files at this head) inside the default 15 s budget. A raw-text gate, maySpellStudioAddress, now keeps the parse to the sources that may spell an address (123 of 2,378 here).
  • The gate is a superset of the matcher by construction, and wider than the card's two words. Reading the matcher showed /studio plus STUDIO_ROOT_PATH is not exact:
    • The matcher also flags a template or + on STUDIO_LANDING_PATH (it is in ROOT_NAMES).
    • The matcher reads COOKED literal text, so '\x2fstudio', '\57\163tudio', '/stud\u{69}o' and a line continuation inside the word all cook to /studio while the raw text holds no /studio. Identifiers cook \u escapes the same way (STUDIO_ROOT_PATH).
    • So the gate matches each of the three words with every character in any of those spellings (itself, identity escape, \x, \u, \u{}, legacy octal), with line continuations allowed between characters.
    • A JSX attribute string is not cooked (TypeScript keeps / as is), so its raw text is its text.
    • The header comment on the gate gives the argument.
  • New control, "the pre-filter keeps every source the matcher flags". It runs over one shared fixture list, FLAGGED_SPELLINGS: the first case's eight spellings plus ten escaped and STUDIO_LANDING_PATH forms. Each fixture's only hit is that spelling. The control asserts the matcher flags it once and the gate passes it. It also asserts that the builder file fires the matcher and passes the gate, and that a source naming no address is dropped. The first case now asserts the matcher over the same list, so the two cannot drift apart.
  • Existing controls kept. The walk still has to reach StudioDesignSurface.tsx and StudioRoute.tsx, and the builder still fires the matcher inside the walk case.
  • Explicit budget. The walk case now runs under { timeout: 60_000 } as the second line of defence; the measured wall time is below.

Tests

Wall time of the walk case, before and after (local, shared box, under os-verify-lock)
  • Before (base 95734fef75, unchanged file): no ui source outside the builder spells one 4471ms. File total: Duration 5.79s.
  • After (45151aec2b): no ui source outside the builder spells one 873ms; the pre-filter keeps every source the matcher flags 18ms. File total: Duration 1.48s, Tests 3 passed (3).
  • Probe at the same tree: walk 24 ms, reading every file 166 ms, the gate's regex over all 2,378 texts 47 ms. The rest of the before figure was the parse.
Ablation 1: the gate drops everything (`MAY_SPELL_STUDIO_ADDRESS.test(text) && false`)

Made through scripts/ablation-replace.mjs. Result: ok mutation landed: anchor 1 -> 0, blob fdd866a33090 -> b763c5694c5f.

  • × the pre-filter keeps every source the matcher flags, failing with AssertionError: const a = '/studio';: expected false to be true. Tests 1 failed | 2 passed (3).
  • The walk case stayed GREEN under this ablation (196 ms, no file parsed, so no offender). That is the hole the new control closes.
  • Restore: ok restored: blob == HEAD (fdd866a33090) and git diff HEAD is empty.
Ablation 2: the card's two-word filter (`/studio` or `STUDIO_ROOT_PATH` as plain substrings)

Made through the same tool. Result: ok mutation landed: anchor 1 -> 0, blob fdd866a33090 -> dbb5d30c77b9.

  • × the pre-filter keeps every source the matcher flags, failing with AssertionError: const a2 = '\x2Fstudio';: expected false to be true. Tests 1 failed | 2 passed (3).
  • Restore: ok restored: blob == HEAD (fdd866a33090) and git diff HEAD is empty.
Derived gates at 45151ae (`dispatch-gates.mjs --commands`, 27 commands)
  • 26 of 27 exited 0 on the first pass.
  • pnpm --dir ui exec vitest run scripts/ first went red, 22 files failing with Cannot find package '@objectstack/spec/ui': the fresh worktree had no packages/spec/dist. After pnpm --filter @objectstack/spec build it went green: Test Files 172 passed | 2 skipped (174), Tests 5131 passed | 2 skipped (5133), VERDICT command-exit 0.
  • node scripts/check-nul-bytes.mjs and a control-byte grep over the file are clean. eslint --no-inline-config on the file exits 0.
  • Whole @object-ui/app-shell package suite (2,443 test files, --maxWorkers=2 on a shared box): NOT MEASURED. Reason: still running after 70 minutes when this PR was opened. The CI Test UI shards own that verdict.

Acceptance notes

  • The two-word pre-filter the card proposed would have missed STUDIO_LANDING_PATH and every escaped spelling (ablation 2). The filter was widened to stay an exact superset, as the dispatch asked.
  • On today's tree the widened gate passes the same 123 files the two-word filter would. The widening costs no parse time.
  • node scripts/pm/overlap-check.mjs: VERDICT clean exit 0 (origin/main 95734fef75, 0 PR heads share the file).

Verification

Read first:

  1. The doc comment above STUDIO_ADDRESS_WORDS and the regex builder under it. This is the risk hunk: the superset argument lives there.
  2. The FLAGGED_SPELLINGS list and the new control case.
  3. The walk case's maySpellStudioAddress early return and its { timeout: 60_000 }.

Two-minute check: from ui/, run pnpm --filter @object-ui/app-shell exec vitest run --root ../.. --reporter=verbose packages/app-shell/src/views/studio-design/studioAddress.guard.test.ts. Expect three passing cases, with the walk case at about 1 s instead of about 4.5 s.


Generated by Claude Code

…rsing

The guard TypeScript-parsed every ui source (about 2,400 files) inside the
default 15 s budget and timed out on loaded Test UI shards. A raw-text gate
now keeps the parse to sources that may spell an address: each of the
matcher's three words with every character in any spelling a string,
template or identifier cooks back to it (escapes, line continuations), so
it is a superset of the matcher by construction. A new control holds the
gate to every spelling the matcher flags and to the builder file; the walk
case gets an explicit 60 s budget as the second line of defence.

Claude-Session: https://claude.ai/code/session_01QSeKYpEsWWE9Y5YtSsDgqZ
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ

席位核对 — ACCEPT · L1 · head 45151aec2b984b73f61ef2eafd2dbf018d7f3796 · 2026-11-25T03:47Z

L1 for card #37174 (p0: the studioAddress.guard timeout ejected two independent queue groups, anchor #37181). The seat dispatched it; the dev report is 7152099725.

  • Shape. One file, ui/packages/app-shell/src/views/studio-design/studioAddress.guard.test.ts (+98 −10). Test-only, skip-changeset, draft. The Fixes #37174 line closes only this card.
  • Fix.
    • A raw-text gate, maySpellStudioAddress, decides which files reach the TypeScript parse. At this head it lets 123 of 2,378 ui sources through.
    • The walk case drops from 4,471 ms to 873 ms (measured locally) and carries an explicit { timeout: 60_000 } as a second line of defence.
  • Premise corrected and covered.
    • The card's two-word filter (/studio, STUDIO_ROOT_PATH) was not an exact superset of the matcher. The matcher also reads STUDIO_LANDING_PATH and cooked text: \x2f, /, \u{…}, legacy octal and line continuations all cook to the same text.
    • The gate matches each word in every spelling that cooks back to it.
    • One FLAGGED_SPELLINGS list (the 8 original spellings plus 10 escaped and LANDING forms) drives both the matcher case and a new control.
  • The control closes the hole an ablation shows.
    • With the gate returning false, the walk case stays green but the new control goes red.
    • With the card's two-word filter, the control goes red on '\x2Fstudio'.
    • Both restores were verified (blob == HEAD).
  • Gates.
    • dispatch-gates derived 27 commands and all 27 exit 0. The ui/scripts vitest needed a spec build first.
    • The full @object-ui/app-shell suite: 2,442 files and 23,116 tests pass.
    • overlap-check is clean.
    • K = 9.
  • Deviations accepted.
    • The empty-branch probe push was refused by the classifier and not retried by another route.
    • The package suite ran after the body was written; the report carries the reading.
    • The commit trailer was fixed to the model-free pair before the first push.
  • Landing. Tier S, test-only and not governed, so the seat lands it once every check is green: at this head, 38 success, 18 expected skip, 0 failed, 0 pending, mergeable clean. After merge it unblocks docs(qa): re-point list type-size and drill-container checklist clauses to later rulings #37114 (a4-C), fix(console): a session answered "not shown" sends no first-run checklist reads on later opens #37184 and the re-queue of the PRs this timeout ejected. Queue-flake anchor: packages/app-shell/src/views/studio-design/studioAddress.guard.test.ts #37181 closes with ui test flake: studioAddress.guard "no ui source outside the builder spells one" times out at 15 s under shard load (ejected #37114 twice) #37174.

No must-fix, no should-fix.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 25, 2026 03:47
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 25, 2026
Merged via the queue into main with commit bc3ec37 Nov 25, 2026
57 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-37174-studio-address-guard-timeout branch November 25, 2026 04:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/m 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.

ui test flake: studioAddress.guard "no ui source outside the builder spells one" times out at 15 s under shard load (ejected #37114 twice)

2 participants