Skip to content

Add SessionStart hook so tests/typecheck work in web sessions#178

Open
IanMayo wants to merge 1 commit into
mainfrom
claude/css-import-error-main-5nl4y6
Open

Add SessionStart hook so tests/typecheck work in web sessions#178
IanMayo wants to merge 1 commit into
mainfrom
claude/css-import-error-main-5nl4y6

Conversation

@IanMayo

@IanMayo IanMayo commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

What & why

The reported "CSS-import error failing tests / yarn typecheck was failing" turned out not to be a code bug. On main:

  • yarn build, yarn build:standalone (CSS correctly inlined), and yarn typecheck all pass.
  • The full Playwright suite — all 111 tests pass — once a compatible browser is available.
  • tsc doesn't even resolve the import './gramframe.css' side-effect import in a JS file (verified: renaming the CSS file away still passes typecheck), so the CSS import cannot cause a typecheck failure.

The real cause: a fresh Claude Code on the web session starts with no node_modules, so every command fails before doing any work — yarn typechecktsc: not found, yarn buildvite: not found, and yarn test additionally needs a Playwright browser that matches the pinned @playwright/test@1.54.1 (build 1181).

Change

A synchronous SessionStart hook that, in remote sessions:

  1. Runs yarn install
  2. Runs yarn playwright install chromium (fetches the build the pinned version expects)

Files:

  • .claude/hooks/session-start.sh — the hook (idempotent, non-interactive)
  • .claude/settings.json — registers the hook

Validation

  • ✅ Hook runs cleanly and is idempotent (second run = no-op)
  • yarn typecheck passes
  • ✅ Playwright test passes against the installed browser with the default config

The hook is synchronous: it guarantees deps are ready before the agent starts (no race), at the cost of slightly slower session startup. Can be switched to async if faster startup is preferred. Once merged to the default branch, all future web sessions will use it.

🤖 Generated with Claude Code

https://claude.ai/code/session_016apmoXLgCfaB4NEFJZ64QM


Generated by Claude Code

A fresh Claude Code on the web session starts with no node_modules, so
yarn typecheck, yarn test and yarn build all fail (tsc/vite not found)
until dependencies are installed. Add a synchronous SessionStart hook
that runs `yarn install` and fetches the Chromium build the pinned
@playwright/test version expects, so typecheck and the Playwright suite
work out of the box in remote sessions.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016apmoXLgCfaB4NEFJZ64QM
@github-actions

Copy link
Copy Markdown
Contributor

PR Preview

Preview deployment is ready! View Preview

Last updated: 2026-06-25T20:30:08.730Z

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