Add CI gate for dist/mcp/server.js freshness
The committed bundle is the only thing that ships, but CI only checked that it compiled — never that it matched src/, and never that it could start. - Fail when a fresh build differs from the committed dist/mcp/server.js, mirroring the existing dist/openapi.json gate, with the same actionable error. This is viable now: the bundle is byte-reproducible with the current toolchain (a rebuild of the committed file is byte-identical). Before the #114 rebuild it was not, which is why this was previously left out. - Keep booting the freshly built bundle through a handshake, since a bundle that cannot start is invisible to source-level tests.
This commit is contained in:
1 parent
5e4c5bb727
commit
b0bad7e33d
2 files changed
+4
No files matched your search
@@ -48,6 +48,7 @@ jobs:
|
||||
- name: Build MCP Plugin & Verify
|
||||
run: |
|
||||
bun run build:plugin
|
||||
git diff --exit-code dist/mcp/server.js || (echo "::error::dist/mcp/server.js is out of sync with src/. Run 'bun run build:plugin' and commit changes." && exit 1)
|
||||
# Boot the freshly built bundle and complete an MCP handshake. A bundle that cannot start
|
||||
# is invisible to source-level tests — this has regressed before, when circular imports
|
||||
# scrambled zod's initialisation order and shipped an entry point that never answered.
|
||||
|
||||
@@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Added
|
||||
- **CI Gate for `dist/mcp/server.js` Freshness**: the MCP build step now fails when the committed bundle does not match a fresh build from `src/`, mirroring the existing `dist/openapi.json` gate, and then boots the freshly built bundle through an MCP handshake. The artifact is the only thing that ships, so a stale or unbootable bundle is now caught in CI rather than at runtime.
|
||||
|
||||
### Fixed
|
||||
- **MCP Server Bundle Could Not Start At All**: the plugin shipped `dist/mcp/server.js` as its MCP entry point, but that bundle threw `TypeError: ... is not a constructor` while loading and never answered a single request. Because MCP defaults to off, it failed silently — enabling it produced no `seal_cli` tool and no visible error.
|
||||
- Root cause: the MCP entry (`src/server.ts`) was circularly entangled with the CLI command graph (`server → cli/runner → cli/commands/mcp → server`, and `server → cli/runner → cli/commands/http → http/routes → server`). When `bun build --target=node` flattened that cycle together with zod's own `core ↔ classic` cycle, zod's class initialisers ended up ordered after the top-level `z.lazy()` call the SDK makes at import time, leaving `ZodLazy` undefined at call time.
|
||||
|
||||
Reference in new issue
Block a user