Repository navigation
ci(release): packed-install checks DevTool serves its client assets (FIX-1334) - #2378
Conversation
…FIX-1334) The release path already builds DevTool's client assets (release:build, #1844) and the publish refuses without them (prepublishOnly, #1846). What nothing checked is the packed copy: `pnpm pack` skips prepublishOnly and packs a devtool with no dist-client at exit 0, and every import still passes, because only getAssetPath() needs the directory. Appends one entry to the packed-install job's CHECKS list. It asks the installed @flow-state-dev/devtool for its assets, requires them to sit inside the installed package, serves them the way `fsdev dev` does, and fetches index.html plus every script and stylesheet it references. It checks each content type, because serve()'s SPA fallback answers a missing asset with a 200 and index.html. Red: on the pre-fix release build (packages:build only, as every release script ran at f27d9e3), the other three checks pass and this one fails at getAssetPath. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HNTQkGXCUryuVD2TEBLi6G
|
The latest updates on your projects. Learn more about Vercel for GitHub. 3 Skipped Deployments
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Process guards is failing, and this PR did not cause it. The spec-folder guard fails on Generated by Claude Code |
Second look + architecture passVerdict: the approach is right. Serving the installed assets over HTTP and asserting content-type is the smallest check that catches both the missing Worth fixing in this PR
Refactor opportunity (the PR is the second copy, so this is the moment)
Notes, no action
No blocking findings. Items 1 and 2 are the ones I'd carry into a push; 4 is the refactor worth taking (here or as a follow-up). Generated by Claude Code |
There was a problem hiding this comment.
Simplify pass — verdict: ship it (with optional tidy-ups)
What was broken: pnpm pack skips prepublishOnly, so @flow-state-dev/devtool can tarball without dist-client while every import check still passes. getAssetPath() and fsdev dev are the first real consumer surfaces.
Why this approach is right: The fixture deliberately does what a consumer does — getAssetPath() from the installed package, serve() with staticDir, then HTTP — and it catches the SPA fallback footgun (missing asset → 200 + index.html). Tarball listing, re-running check-assets.mjs on the install tree, or prepack alone are all simpler but weaker; they do not prove serve() actually serves the bundled chunks with correct types. I would not replace this check with one of those.
Where complexity crept in (optional, not blocking):
- Fixture duplication —
serve-devtool.mjsmirrorsserve.mjs(fail, minimal flow,createFlowState,serve,try/finally). A sharedfixtures/packed-serve-lib.mjs(copied alongside the entry script) or a singleserve.mjswith a--devtoolmode would shrink ~40 lines without changing behavior. run.mjsspawn harness — the new CHECK copies the samecopyFileSync+spawnSync+ verdict parsing as the server CHECK. A tinyrunFixture({ file, okSubstring, failPrefix })would keep timeout/encoding logic in one place.- Flow boilerplate for static smoke — spinning up a noop flow is heavy, but it matches
fsdev devwiring (basePath,staticDir). I would not remove it unless@flow-state-dev/nodegains a static-only helper (out of scope here). - Fast-fail belt — if you want less CI noise when assets are totally missing, asserting
dist-client/index.html(and maybe hashed chunks) inside the devtool tarball duringpackAllis cheap and complementary; it should stay in addition to this HTTP step, not instead of it.
Skipped as larger refactors: invoking fsdev dev / CLI discovery (breaks tarball-only isolation), HTML parsers in the consumer sandbox (new deps), merging into Playwright e2e (wrong layer).
No major concerns on performance (one extra Node cold start, sequential fetches on loopback with two assets today) or directory smell — one new fixture beside serve.mjs is consistent.
Approving; inline notes are nits you can take or leave.
Sent by Cursor Automation: Review For Best Approach
Brings in #2376's review round (importPass, wildcard expansion, the vitest probe fixture, resolvedGraph removed). No conflicts: the DevTool check is appended after the server check, which the base did not touch. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HNTQkGXCUryuVD2TEBLi6G
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5f8e04635c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Code Snob. A smaller shape meets the same contract. Fold it from #2379 and close that POC unmerged after this PR lands. Do not merge the POC.
Two cuts, both in the new check:
serve-devtool.mjsbuilds a noop handler, two Zod schemas, and never calls the action.defineFlow({ kind, actions: {} })is enough to handserve()a flow. Drophandlerandzod.- The new
CHECKSentry copies the server check'scopyFileSync/spawnSync/": ok"/": FAIL"block. OnerunFixture(project, file, stem)runs both. Each fixture still names its own failure, andserve.mjsstays as it is.
The check-entry comment restates the fixture. One line is enough: pnpm pack skips prepublishOnly.
Left alone on purpose: the separate fixture (already decided on this PR), the content-type walk, and the containment check. Those are the contract.
The POC is 35 insertions and 63 deletions on top of this head. Green still prints devtool: ok (2 asset(s) …). Missing dist-client still fails at getAssetPath. index.html without assets/ still fails on content-type text/html for the script.
Sent by Cursor Automation: Code Snob
Review round 1 on #2378. - Codex P2: the check fetched only what index.html references directly. Assets the bundle itself references, like the two SVG marks, could be missing and still pass, because the SPA fallback answers them with index.html. The fixture now also fetches every `/assets/` file named in a fetched script or stylesheet, and checks each one's type. It fails on a build with the SVGs removed; the previous fixture passed it. - Cursor and Code Snob: one runFixture(project, file, stem) helper shared by the serve and DevTool checks, and a one-line CHECKS comment. The flow is defineFlow({ kind, actions: {} }) with no handler or zod. realpathSync is called once. Asset kinds are plain "js" | "css" | "svg" | "other" instead of RegExp pseudo-enums. Folds POC #2379. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HNTQkGXCUryuVD2TEBLi6G


The problem
DevTool's page, scripts and styles (
dist-client) are built by a separate step, not by the package's normal build. If a release leaves that step out,@flow-state-dev/devtoolstill publishes, and the firstfsdev deva user runs throws.The release path already handles this:
release:buildbuilds the assets (#1844), and the publish refuses without them (#1846). The gap is in CI. No job installs a packed DevTool and asks it for its assets.pnpm packskips the publish guard and packs a DevTool with nodist-clientat exit 0, and every import check still passes. So nothing notices the break until release day.What this does
It adds one check to the packed-install job (leg a) that FIX-1431 creates. It does not add a job. The check installs the packed DevTool into an empty project and does what
fsdev devdoes:node_modules;It fails if any of those is missing or comes back as the wrong type.
Reproduced first (D2 / ER-17): the hole is already closed on
main(5886ca846). The result and the commits that closed it are on the Linear issue. This PR is the guard that keeps it closed.What's asked of you
Nothing here is yours to decide. This is a bug on the direct route, so this PR is the only gate.
Parts worth reviewing closely
scripts/packed-install/fixtures/serve-devtool.mjs: the content-type assertion.serve()answers every unknown path withindex.htmland a 200. Without the content-type check, an asset build that copiedindex.htmlbut notassets/would pass. Red state B below shows the check catching that case.getAssetPath(). It requires the asset directory to be inside the installed package. A leftoverdist-clientin the repo can't reach the consumer project anyway. The check is cheap and states the anti-game rule outright.RELEASING.md. It gains one paragraph saying the publish hook doesn't coverpnpm packand that this job does.Stacks on #2376 (FIX-1431, leg a). Base is
fix/fix-1431. When #2376 merges, this PR will be retargeted tomain.Linear FIX-1334 · epic FIX-1635 (
specs/epics/FIX-1635/, ER-2) · merges after #2376How to review this
Engineering calls
CHECKSentry, not a second job or a change tocheck-assets.mjs. This follows the epic (PLAN: "1431 creates it, 1334 adds to it, neither adds a second"). TheprepublishOnlyguard stays as it is. It covers the publish, and this check covers CI.dist-client/index.htmlis in the tarball. ER-2 says DevTool serves its assets from an installed copy. A listing would pass a half-copied build.serve.mjs. Each check names its own failure (devtool: FAIL at <step>), andserve.mjsstays FIX-1431's.classifyImport. It is the fixture, and red states A and B below exercise it.Everything else: reproduction, control, verification
Reproduction on
main5886ca846(does not reproduce):rm -rf packages/devtool/dist-client && pnpm release:build: exit 0,dist-client/{index.html,assets}presentpnpm packinpackages/devtool: 5dist-cliententriesdist-clientmoved aside,pnpm publish --dry-run: exit 1,refusing to publish without the DevTool apppnpm pack: exit 0, 0dist-cliententriesClosed by
9507b8a65(#1844,release:build) and2ab5d589b(#1846,prepublishOnly). The last commit with the hole isf27d9e31b, where every release script ranpackages:buildonly.Green (this branch, after
pnpm release:build):node scripts/packed-install/run.mjs→✓ packed install: 4 check(s) passed on 27 package(s), anddevtool: ok (2 asset(s) from /tmp/fsd-packed-install-…/node_modules/@flow-state-dev/devtool/dist-client).Red A: the pre-fix release build. This is
f27d9e31b's release path,packages:buildwith nobuild:assets. It ran withTURBO_FORCE=true, because a local turbo cache replays a previously builtdist-clientas abuildoutput. Result: exit 1. The three FIX-1431 checks pass and only this one fails:Red B: half-copied assets (
index.htmlpresent,assets/removed). Exit 1:Other checks:
node --checkon both scripts.pnpm knip:ciexits 0. The existingpackages/core/test/packed-install-check.test.tspasses (7/7). The--controlstep is unchanged: it runs only the import check.Files
scripts/packed-install/run.mjs: oneCHECKSentry, header list updatedscripts/packed-install/fixtures/serve-devtool.mjs: new, runs inside the consumer project.github/workflows/ci.yml: step name onlydocs/contributing/RELEASING.md: job description, plus the pack-vs-publish paragraph🤖 Generated with Claude Code
https://claude.ai/code/session_01HNTQkGXCUryuVD2TEBLi6G
Generated by Claude Code
Note
Low Risk
Changes only CI scripts and release docs; no published package or runtime behavior changes.
Overview
Extends the packed-install release gate so CI catches a broken
@flow-state-dev/devtooltarball even whenpnpm packskipsprepublishOnlyand import-only checks still pass.A fourth check runs a new fixture (
serve-devtool.mjs) in the empty consumer project: resolvegetAssetPath()from the installed package, servedist-clientlikefsdev dev, fetchindex.html, and load every referenced script/stylesheet with content-type assertions (so SPA fallback cannot mask missingassets/). The CI step name and RELEASING.md are updated to document that this job—not publish hooks—covers the pack path.Reviewed by Cursor Bugbot for commit 5f8e046. Configure here.