From 06fec3371a9fc28494736dd126d8992f66372a9a Mon Sep 17 00:00:00 2001 From: Michael Sverdlov Date: Sat, 21 Mar 2026 15:44:31 +0200 Subject: [PATCH] fix: tolerate node_modules path differences in lib/ verification Without a lockfile, npm may hoist transitive dependencies differently across environments. esbuild embeds node_modules paths as comments and __commonJS keys in the bundle, causing the byte-for-byte lib/ check to fail even when the actual code is identical. Use `git diff -I 'node_modules/'` to ignore hunks where every changed line is a node_modules path annotation, while still catching real source drift. --- .github/workflows/unit-tests.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 1ca9943..34e87c6 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -42,7 +42,12 @@ jobs: # If lib/ is not rebuilt after src/ changes, the action will run stale code. - name: Verify lib/ is compiled and up to date run: | - if [[ -n "$(git status lib/ --porcelain)" ]]; then + # -I ignores hunks where every changed line matches the pattern. + # Without a lockfile, npm may hoist transitive deps differently, + # causing only node_modules path comments/keys to differ in the bundle. + UNTRACKED=$(git ls-files --others --exclude-standard lib/) + MEANINGFUL_DIFF=$(git diff -I 'node_modules/' -- lib/) + if [[ -n "$UNTRACKED" || -n "$MEANINGFUL_DIFF" ]]; then echo "::error::lib/ is out of sync with src/. Run 'npm run build' and commit the changes." git diff -- lib/ exit 1