1 Commits
Author SHA1 Message Date
CatoandClaude Opus 5.5 c88dc22cdf fix(build): keep fs out of the browser bundle, and catch that class in verify (main cannot deploy since #900) (#904)
* fix(build): keep fs out of the browser bundle — the exit-contract matcher gets a Node-free home

loki#900 made activity-status.ts import EXIT_CONTRACT_PATTERN from
agent-config.ts. activity-status is shared with client components (the
Activity feed strips the contract from a dispatch before showing it), and
agent-config imports `fs` — so `fs` landed in the browser bundle and
`next build` failed: "Module not found: Can't resolve 'fs'". Four deploys of
main were refused; production kept serving the previous release, but nothing
merged after #900 could ship either.

`verify` could not see it: CI deliberately does not run `next build`, so a
client/server boundary break only surfaces at deploy.

The heading and the matcher move to src/lib/exit-contract.ts, which imports
nothing. agent-config builds the full contract from that heading; the client
and the lane prompt read the matcher from the Node-free module.

Proved by the step that failed: `pnpm run build` against a schema-only
Postgres, exactly as the deploy runs it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016YJVAanfj8keVSXyZnTemh

* test(build): catch a Node builtin in the browser bundle before the deploy does

verify does not run `next build`, so a client/server boundary break only
surfaces when the deploy builds — after the PR has merged. That is how #900
reached main and blocked every deploy.

client-bundle-node-free.ts walks the client graph the way Turbopack does,
without building: from every "use client" module through static value
imports, stopping at "use server" modules (RPC stubs on the client), and
fails on any builtin Next does not polyfill for the browser.

Proved against the real break: with #900's activity-status.ts it reports
exactly the two errors the deploy printed — `fs` in agent-config.ts and in
session-paths.ts via activity-status.ts <- project-intent-panel.tsx — and on
this branch it reports none.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016YJVAanfj8keVSXyZnTemh

* style: format

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-25 03:01:32 -07:00