From 8a032f02d15338a47bbe917bcde066e6519bb983 Mon Sep 17 00:00:00 2001 From: yunyingk Date: Tue, 15 Sep 2026 16:07:41 +0800 Subject: [PATCH] Drop the byte-diff gate; keep booting the freshly built bundle MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CI disproved the freshness gate on the first run: an ubuntu rebuild of the macOS-built committed dist/mcp/server.js differs, and the diff is entirely minified identifier renaming (N->S, A->I, q->p) with identical code. The minifier does not allocate names reproducibly across platforms and Bun versions, so a byte-for-byte gate cannot work here without pinning the toolchain and matching runners. Keep the check that does hold: boot the freshly built bundle and complete an MCP handshake. Booting is what #114 actually needed — the byte diff would not have caught that bug either, since the broken bundle was in sync with its broken source. --- .github/workflows/ci.yml | 10 +++++++--- CHANGELOG.md | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1ea513a..151b2c3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,12 +48,16 @@ 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. - # Re-running the server tests here points them at the artifact just built instead of the - # one committed to the tree. + # Re-running the server tests here points them at the artifact just built, not the + # committed one. + # + # Deliberately no byte-for-byte check that the committed bundle matches a fresh build: + # the minifier allocates identifiers differently across platforms and Bun versions, so it + # is not reproducible across runners. Measured on this PR: an ubuntu rebuild of the + # macOS-built committed file differed only by renamed minified variables (N/S, A/I, q/p). bun test src/server.test.ts - name: Verify Binary Compilation diff --git a/CHANGELOG.md b/CHANGELOG.md index a5fd9a9..ea378df 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ 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. +- **CI Boots the Packaged MCP Bundle**: the MCP build step now starts the freshly built `dist/mcp/server.js` and completes a handshake, instead of only checking that it compiles. The artifact is the only thing that ships, so an unbootable bundle is now caught in CI rather than at runtime. Deliberately **not** a byte-for-byte freshness diff: the minifier allocates identifiers differently across platforms and Bun versions, so the bundle is not reproducible across runners — measured, an ubuntu rebuild of the macOS-built committed file differs only in renamed minified variables with identical code. ### 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.