Skip to content

🔍 Fix Chromium search and stop its CI test from hanging#346

Merged
joshbermanssw merged 7 commits into
mainfrom
fix/search-functionality
Jun 19, 2026
Merged

🔍 Fix Chromium search and stop its CI test from hanging#346
joshbermanssw merged 7 commits into
mainfrom
fix/search-functionality

Conversation

@joshbermanssw

Copy link
Copy Markdown
Member

TL;DR

Two parts of the same problem: search silently failed in Chromium (loaded pagefind.js via window.eval("import(...)"), which Chromium blocks without CSP 'unsafe-eval'), and the search-tests CI job that guards it hangs for hours when its Playwright install wedges on the runner's apt lock. This fixes both — eval-free Pagefind loading, and a hang-proof install step.

How

App fix — search.tsx
Replace window.eval("import(...)") with await import(/* webpackIgnore */ /* turbopackIgnore */ url) using an origin-qualified URL. No eval means no 'unsafe-eval' requirement; the ignore comments are what the eval was hacking around — they keep the bundler from resolving the runtime-only pagefind.js. The catch now logs the real error instead of swallowing it.

CI fix — search-test.yml

  • timeout-minutes: 15 on the job and 8 on the install step, so a wedge fails fast instead of sitting "running" for GitHub's 6h default.
  • Each install attempt is wrapped in timeout 180 and retried up to 3×. A hang isn't a non-zero exit, so a plain retry never fires — capping each attempt kills a stuck apt and lets the retry ride out the transient dpkg lock.

Why both in one PR

The search-tests check is required by the main-branch-protection ruleset, so the app fix can't merge while the check hangs. Hardening the workflow in the same PR makes the required check reliable again.

Reviewer notes

  • WASM CSP caveat. Pagefind uses WebAssembly; a strict CSP could still need 'wasm-unsafe-eval'. With the error now logged, that case is diagnosable instead of silent.

Tests

Search verified in dev Chromium (Playwright): the box loads pagefind.js and returns real results with no error banner. Biome passes on search.tsx.

joshbermanssw and others added 3 commits June 19, 2026 12:53
Search loaded pagefind.js via window.eval("import(...)"), which requires
CSP 'unsafe-eval'. Under Chromium's stricter enforcement the eval was
blocked, throwing an importError that surfaced the generic "Unable to load
search functionality" message — and the real error was swallowed, making it
hard to diagnose.

Replace the eval hack with a real dynamic import marked webpackIgnore/
turbopackIgnore (which is what the eval was working around) using an
origin-qualified URL, and log the underlying error instead of discarding it.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The search-tests job had no timeout, so when the "Install Playwright
browsers" step hung it sat in_progress for ~2h (GitHub's 6h default before
auto-fail), holding the PR check pending. Add a 15-min job timeout and an
8-min cap on the install step so a hang fails fast and visibly instead.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ut + retry

The install step wedges intermittently when `--with-deps` blocks on the
runner's apt/dpkg lock. A plain retry can't help because a hang is not a
non-zero exit. Wrap each attempt in `timeout 180` so a stuck apt is killed,
then retry up to 3 times to ride out the transient lock — all inside the
existing 8-minute step budget.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 19, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
tina-docs Ready Ready Preview, Comment Jun 19, 2026 5:10am

Request Review

playwright install --with-deps fetched and unpacked fine, then hung in the
apt configure phase with zero output until the timeout fired — every attempt,
deterministically. The cause is apt blocking on an interactive frontend
(needrestart/debconf) with no TTY, so the previous per-attempt-timeout-plus-
retry just repeated the identical stall and then overran the step cap.

Set the debconf frontend to Noninteractive in the debconf database before
install so the sudo apt-get Playwright spawns reads it and never prompts.
Drop the retry loop (the failure was deterministic, not transient).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
0xharkirat
0xharkirat previously approved these changes Jun 19, 2026

@0xharkirat 0xharkirat left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

…nload

The debconf fix resolved the apt hang (apt now completes in ~3s), which
revealed a second, distinct hang: the chromium archive downloads to 100% and
then Playwright stalls with no output until the step cap.

Split the working apt step from the browser download. Wrap only the browser
install in a per-attempt timeout + retry (sized to fit under the step cap, so
a stall is killed and retried rather than blowing the whole budget), and turn
on DEBUG=pw:install to capture what Playwright does if it stalls again.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The browser install hung deterministically at "extracting archive" (download
hit 100%, then silence until the timeout). Root cause: .nvmrc is `lts/*`, which
now resolves to Node 24, and Playwright 1.54's unzip path hangs on Node 24.

Add an optional node-version override to the setup-deps action and pin the
search-test job to Node 22 (previous LTS). Other workflows are unaffected
(the input defaults to empty, falling back to node-version-file).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The site is served under a base path (/tinadocs), so navigateToDocs needs it
to reach /tinadocs/docs. workflow_call already accepted it; add the same input
to workflow_dispatch so manual runs can target a real preview correctly.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@0xharkirat 0xharkirat left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@joshbermanssw joshbermanssw merged commit 6a4e1bc into main Jun 19, 2026
9 checks passed
@joshbermanssw joshbermanssw deleted the fix/search-functionality branch June 19, 2026 05:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants