Repository navigation
test(acpmux): bare-pr-refs gives the code block's highlighter customElements, so it never fails on a slow runner - #23251
Conversation
…its test Red: "a reference in a code span or a code block is not a link" failed on CI with ReferenceError: customElements is not defined, from @pierre/diffs' web components, whenever the code block's lazy highlighter (CodeBlock.tsx loadHighlightedCode) settled while the test ran; on a fast host it settled after. The test now awaits that load, so the failure is the same everywhere: bun test test/bare-pr-refs.test.tsx, 3 pass 1 fail. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Session: https://cmux.com/deeplink/agent?harness=claude&session=01a15c77-62d9-78b2-8cc3-73561b989bb5&host=huge-blue
…stomElements The test's jsdom shim installed HTMLElement but not customElements, so @pierre/diffs' web component registration (HighlightedCode.tsx imports it) threw at import. Now the shim installs it and restores it after. bun test test/bare-pr-refs.test.tsx: 4 pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Session: https://cmux.com/deeplink/agent?harness=claude&session=01a15c77-62d9-78b2-8cc3-73561b989bb5&host=huge-blue
|
Owned by compaction-rows on huge-blue · session |
|
cmux status (one comment, edited in place; each line is updated by the job that owns it) Review App of this head (app.zip, kept 1 day)
|
|
Found 15 test failures on Blacksmith runners: Failures
...and 5 more test failures. View all on Blacksmith
|
|
Bead |
…card The card loaded inside act now commits in the test, and on CI it then threw for the DOM constructors the shim lacked (CSSStyleSheet, SVGElement). Install them as render-fence.test.tsx does, and read the code where the card draws it, in its shadow root, with no link there. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Session: https://cmux.com/deeplink/agent?harness=claude&session=01a15c77-62d9-78b2-8cc3-73561b989bb5&host=huge-blue
|
codex-review: SHIP at 5a94733 Reviewed the bare-pr-refs customElements wait; it only hardens test synchronization and no correctness bug found. |
|
codex-review: SHIP at 32e07ce
|
|
Shipped in:
|
Problem
webviews/test/bare-pr-refs.test.tsx"a reference in a code span or a code block is not a link" failed on #23212's CI run with:The test's jsdom shim installs
HTMLElementbut notcustomElements. The code block's highlighted card (HighlightedCode.tsx, which imports@pierre/diffs) loads lazily after the first frame (CodeBlock.tsxloadHighlightedCode), and the library registers its web component at import time. On a slow runner that import settles while the test is still running, so it fails. On a fast host it settles after the test, so it passes. That's why the eight latest base runs pass it. The test came from #22893.Change
Test only.
loadHighlightedCode(), so the import always lands inside it. The red is then the same on every host.customElementsfrom jsdom, and restores it after the test.No assertion changes.
Changelog
none
Observed / Not run
bun test test/bare-pr-refs.test.tsx: with commit 1 alone, 3 pass and 1 fail (ReferenceError: customElements is not defined, CI's error). With commit 2: 4 pass.Agent session: huge-blue
🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need.Summary by cubic
Fixes the flaky
bare-pr-refstest that failed on slow CI runners withReferenceError: customElements is not defined. The code block's highlighted card lazily imports@pierre/diffs, which registers its web component at import time and builds its lines with the DOM's constructors. On slow hosts that import could land mid-test; on fast hosts it landed after.The test now awaits
loadHighlightedCode()so the import always settles inside the test, then reads the code block where the card draws it—in thediffs-containershadow root—and asserts no link appears there. The jsdom shim installscustomElementsplus all DOM constructors (HTML*,SVG*,CSS*,Shadow*,Document*) and restores them afterward. No assertion changes.Written for commit 32e07ce. Summary will update on new commits.