Repository navigation
test(app-shell): warm @objectstack/lint at module scope so the DraftChangesPanel security-link case passes alone - #26241
Merged
Conversation
…hangesPanel security-link suite
The "inside Studio" case failed when its file ran alone: the panel's
security block renders only after securityPostureLint's dynamic
import('@objectstack/lint') resolves, and that first transform was paid
inside findByTestId's 1000 ms window (the block arrived at ~1 s). The
sibling securityProblems suite already warms the same specifier at
module scope; this file now does too. Assertion and timeout unchanged.
Claude-Session: https://claude.ai/code/session_014sjSLK4TBwwZM9jfTM2nEN
Co-authored-by: Claude <noreply@anthropic.com>
Contributor
Author
席位核对 · ACCEPT · seat
|
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.
Requested by Steve · project thread
Fixes #26199
Clause-②: no (one test file)
Metadata-protocol: none
What it was
Neither a lost block nor a fixture that predates #26056. The security block in
DraftChangesPanelrenders only aftersecurityPostureLintresolves its function-bodyimport('@objectstack/lint').DraftChangesPanel.securityLink.test.tsxnever warmed that module, so when the file ran alone the first transform was paid inside the first case's 1000 msfindByTestIdwindow. The second case passed because the module was cached by then. The siblingDraftChangesPanel.securityProblems.test.tsxalready warms the same specifier at module scope for exactly this reason (ui/AGENTS.md, test discipline: an unbounded module load counted inside a bounded window).All readings below are the one file run alone, from
ui/,vitest run --maxWorkers=2 packages/app-shell/src/preview/__tests__/DraftChangesPanel.securityLink.test.tsx, under the shared verify lock.main7111e14, unchangedscripts/ablation-replace.mjs, restored, blob equals HEAD)So the panel renders the block every time; #26056 only moved the margin. The block arriving at about one second is the whole defect.
The change
One module-scope
import '@objectstack/lint';with a comment, inui/packages/app-shell/src/preview/__tests__/DraftChangesPanel.securityLink.test.tsx. Same specifier as the component, so its dynamic import resolves from the ESM cache. The cost moves into the file's import phase, which no test or hook timeout bounds, so the result no longer depends on what ran before it in the shard. Assertions and timeouts are untouched; nothing is skipped or quarantined.Tests
DraftChangesPanelfile inpreview/__tests__:vitest run --maxWorkers=2 packages/app-shell/src/preview/__tests__/DraftChangesPanelgave 18 files and 96 tests passed. The full app-shell package is left to CITest Core, a declared narrowing.origin/main(head 99fa874) touched nothing underui/packages/app-shell,packages/lint,packages/specorpnpm-lock.yaml, so the readings carry over.Gates
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstackderived 24 commands at 0f7f928. All 24 exited 0.--ranreconciliation: 24 derived, 24 run, 0 NOT-MEASURED, all with recorded exit codes. Type-check lanes are left to CI.Changeset
None, with
skip-changeset: the diff is one file under__tests__/, which the app-shell build excludes fromdist, andfilesships onlydist,src/styles.css, README, CHANGELOG and LICENSE. An empty-frontmatter changeset is refused here byscripts/check-empty-changeset.mjs.Acceptance notes
🤖 Generated with Claude Code
https://claude.ai/code/session_014sjSLK4TBwwZM9jfTM2nEN
Generated by Claude Code