Skip to content

test(acpmux): bare-pr-refs gives the code block's highlighter customElements, so it never fails on a slow runner - #23251

Merged
teamleaderleo merged 3 commits into
feat-cmux-nextfrom
fix/bare-pr-refs-custom-elements
Oct 21, 2026
Merged

teamleaderleo merged 3 commits into
feat-cmux-nextfrom
fix/bare-pr-refs-custom-elements

Conversation

@teamleaderleo

@teamleaderleo teamleaderleo commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator

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:

ReferenceError: customElements is not defined
  at node_modules/@pierre/diffs/dist/components/web-components.js:6:43

The test's jsdom shim installs HTMLElement but not customElements. The code block's highlighted card (HighlightedCode.tsx, which imports @pierre/diffs) loads lazily after the first frame (CodeBlock.tsx loadHighlightedCode), 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.

  1. The test awaits loadHighlightedCode(), so the import always lands inside it. The red is then the same on every host.
  2. The shim installs customElements from 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.
  • Not run: CI on this head (pending).

Agent session: huge-blue

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.


Summary by cubic

Fixes the flaky bare-pr-refs test that failed on slow CI runners with ReferenceError: 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 the diffs-container shadow root—and asserts no link appears there. The jsdom shim installs customElements plus 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.

View guided diff Turn on auto-fix

teamleaderleo and others added 2 commits October 21, 2026 09:22
…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
@teamleaderleo teamleaderleo added the risk:low Risk tier (docs/ci/risk-tiers.md) label Oct 21, 2026
@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Owned by compaction-rows on huge-blue · session

@github-actions

Copy link
Copy Markdown
Contributor

cmux status (one comment, edited in place; each line is updated by the job that owns it)

Review 5a94733: HQ feed card · gallery before/after runs · checks

App of this head (app.zip, kept 1 day)

gh workflow run reload-build.yml -R manaflow-ai/cmux --ref feat-cmux-next -f tag=pr23251 -f ref=fix/bare-pr-refs-custom-elements -f platform=macos -f backend_mode=local

@blacksmith-sh

blacksmith-sh Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Found 15 test failures on Blacksmith runners:

Failures

Test View Logs
test/agent-pane-scrollbar-full-height.test.ts/agent-pane-scrollbar-full-height.test View Logs
test/agent-pane-scrollbar-full-height.test.ts/agent-pane-scrollbar-full-height.test View Logs
test/composer-claude-split.test.ts/composer-claude-split.test View Logs
test/composer-claude-split.test.ts/composer-claude-split.test View Logs
test/home-composer-menu.test.tsx/home-composer-menu.test.tsx View Logs
test/home-composer-menu.test.tsx/home-composer-menu.test.tsx View Logs
test/home-quote-selection.test.tsx/home-quote-selection.test.tsx View Logs
test/home-quote-selection.test.tsx/home-quote-selection.test.tsx View Logs
test/markdown-wide-width-layout.test.ts/markdown-wide-width-layout.test View Logs
test/markdown-wide-width-layout.test.ts/markdown-wide-width-layout.test View Logs

...and 5 more test failures. View all on Blacksmith

Fix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Bead cx-f75g6 created for this PR by the cmux coordinator.

…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
@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

codex-review: SHIP at 5a94733

Reviewed the bare-pr-refs customElements wait; it only hardens test synchronization and no correctness bug found.

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

codex-review: SHIP at 32e07ce

  • Reviewed the current diff, its focused tests, and the affected call paths; no correctness bug found.

@teamleaderleo
teamleaderleo merged commit 50abcfe into feat-cmux-next Oct 21, 2026
@teamleaderleo
teamleaderleo deleted the fix/bare-pr-refs-custom-elements branch October 21, 2026 09:56
@github-actions

Copy link
Copy Markdown
Contributor

Shipped in:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:low Risk tier (docs/ci/risk-tiers.md)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant