From dbe4e81d806c7897c518bc4d595351004ac79c85 Mon Sep 17 00:00:00 2001 From: LingSiewWin Date: Thu, 11 Jun 2026 18:03:31 +0800 Subject: [PATCH] dist-check: ignore machine-local absolute paths in the staleness diff Root cause of the chronic red runs (found via run 27339123329 logs): bun inlines __filename/__dirname as absolute string literals for CJS deps (bindings, cbor-extract), so a bundle built on a Mac and CI's Linux rebuild can never be byte-identical. git diff -I now ignores lines differing only by those machine paths; real code changes still fail the guard. --- .github/workflows/dist-check.yml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/dist-check.yml b/.github/workflows/dist-check.yml index f4ac18d..6e07a43 100644 --- a/.github/workflows/dist-check.yml +++ b/.github/workflows/dist-check.yml @@ -35,10 +35,15 @@ jobs: - name: Fail if committed dist is stale run: | # Guard the five RUNTIME bundles (hooks, drain, auth, mcp) — the code - # marketplace installs actually execute. dist/connect/* are content- - # hashed browser assets whose filenames vary across bun builds; a - # rename there is not staleness, so exclude them from the diff. - if ! git diff --exit-code -- cortex-plugin/dist ':(exclude)cortex-plugin/dist/connect'; then + # marketplace installs actually execute. Two classes of machine-local + # noise are excluded so the check is deterministic: + # - dist/connect/*: content-hashed browser assets whose FILENAMES + # vary across bun builds; a rename there is not staleness. + # - absolute build paths: bun inlines __filename/__dirname literals + # for CJS deps (bindings, cbor-extract), so the committed bundle + # carries the builder's machine path and CI's rebuild carries + # /home/runner/... — ignore lines that differ only by that. + if ! git diff -I'(/Users/|/home/runner/|/home/[^/]+/work/)' --exit-code -- cortex-plugin/dist ':(exclude)cortex-plugin/dist/connect'; then echo "::error::cortex-plugin/dist is out of date with src. Run 'bun run build:plugin' and commit the result." exit 1 fi