Skip to content

fix(plugin): unblock paperclip-plugin-wavex build on fresh checkouts#29

Merged
aimerdoux merged 1 commit into
mainfrom
fix/plugin-build-pool-b-tab-counts
May 19, 2026
Merged

fix(plugin): unblock paperclip-plugin-wavex build on fresh checkouts#29
aimerdoux merged 1 commit into
mainfrom
fix/plugin-build-pool-b-tab-counts

Conversation

@aimerdoux
Copy link
Copy Markdown
Owner

Summary

Two bugs that hard-fail the wavex plugin build, neither one caught by CI (the test workflow doesn't run pnpm --filter @wavex-os/paperclip-plugin-wavex build — only the dev-server flow does). Both were live on main after #27 + #28; the plugin's dist/ stayed stale on every fresh checkout, so Mission Control loaded a UI bundle missing F1-F6 + Pool B.

Bug 1 · Hardcoded user path in build-ui.mjs

import { build } from "/Users/dylanriedweg/wavex-os/node_modules/.pnpm/esbuild@0.27.7/node_modules/esbuild/lib/main.js";

Pre-existing — only worked on the original author's machine. esbuild isn't a direct dep of this package (and pnpm's isolated store hides it from a bare import "esbuild"), so the workaround was the absolute path.

Fix: glob the workspace's .pnpm store for whichever esbuild version is installed, import its main.js via file URL:

const pnpmStore = resolve(__dirname, "../../node_modules/.pnpm");
const esbuildDir = readdirSync(pnpmStore).find((d) => /^esbuild@\d/.test(d));
const esbuildMain = pathToFileURL(join(pnpmStore, esbuildDir, "node_modules", "esbuild", "lib", "main.js"));
const { build } = await import(esbuildMain.href);

Robust across machines and esbuild minor-version bumps.

Bug 2 · Record<View, number> missing the new "pool-b" key

I added "pool-b" to the View type union in #28 but didn't update countByTab in MissionControlPage.tsx. tsc fails:

MissionControlPage.tsx(94,9): error TS2741:
Property '"pool-b"' is missing in type
'{ decisions: number; stream: number; ... }'
but required in type 'Record<View, number>'.

Fix: added "pool-b": 0 with a comment noting that Pool B doesn't have a backend-driven badge yet — the mission-control-tab-counts RPC predates it. Future: surface pillar_suggest_calls_24h - pillar_suggest_success_24h as the badge when chips are failing.

Verification

$ pnpm --filter @wavex-os/paperclip-plugin-wavex build
> tsc && node build-ui.mjs
  dist/ui/index.js  235.8kb
✓ bundled to ./dist/ui/index.js

After both fixes, plugin builds to a fresh 235.8kb bundle that includes PoolBHealthWidget. Paperclip's dev server now loads the new "Pool B" subnav tab.

Why CI didn't catch this

The Test workflow runs pnpm test (vitest) but not pnpm --filter ... build. The plugin build is only exercised at dev boot via the dev:wavex-plugin:build script — which has || echo 'wavex plugin build skipped', so a build failure doesn't even surface in dev mode (the user just gets a stale bundle and a missing tab with no error message).

A follow-up could either:

  • Make dev:wavex-plugin:build exit non-zero on build failure, OR
  • Add pnpm -r build to the CI Test job so plugin build errors surface

Out of scope for this fix.

🤖 Generated with Claude Code

Two bugs that surfaced trying to build the wavex plugin locally after
#27 + #28. Neither one was caught by OSS CI because the plugin build
isn't run on the test workflow; the build is only exercised at dev
boot time via `pnpm dev:wavex-plugin:build`. Both bugs hard-fail the
build so the plugin's dist/ never refreshes — the Mission Control UI
loads a stale bundle that doesn't include any of the F1-F6 or Pool B
work.

1. **Hardcoded user path in build-ui.mjs**

   The esbuild import was pinned to
   `/Users/dylanriedweg/wavex-os/node_modules/.pnpm/esbuild@0.27.7/...`
   — works only on the original author's machine. esbuild isn't a
   direct dep of this package so a bare `import "esbuild"` also fails
   (pnpm's isolated store hides it). Replaced with a glob over the
   workspace root's `.pnpm` store that picks up whichever esbuild
   version is installed:

   ```js
   const pnpmStore = resolve(__dirname, "../../node_modules/.pnpm");
   const esbuildDir = readdirSync(pnpmStore).find((d) => /^esbuild@\d/.test(d));
   const esbuildMain = pathToFileURL(join(pnpmStore, esbuildDir, ...));
   const { build } = await import(esbuildMain.href);
   ```

   Robust across machines and esbuild minor-version bumps.

2. **`Record<View, number>` missing the new `"pool-b"` key**

   #28 added `"pool-b"` to the `View` type union but didn't update
   `countByTab`, which is typed `Record<View, number>`. tsc:

       MissionControlPage.tsx(94,9): error TS2741: Property '"pool-b"'
       is missing in type ... but required in type 'Record<View, number>'

   Added `"pool-b": 0` with a comment noting that Pool B Health
   doesn't have a backend-driven badge yet — the
   `mission-control-tab-counts` RPC predates it. A follow-up can
   surface `pillar_suggest_calls_24h - pillar_suggest_success_24h`
   as the badge value when chips are failing.

After both fixes, plugin builds to a fresh 235.8kb dist/ui/index.js
that includes the PoolBHealthWidget. Paperclip dev server now loads
the new "Pool B" subnav tab.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@aimerdoux aimerdoux merged commit 703e214 into main May 19, 2026
1 check passed
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.

1 participant