fix(frontend): keep the MSW worker in step with the lockfile (#6222)

The tracked frontend/public/mockServiceWorker.js is generated by msw and pinned
at 2.14.7, while package-lock.json installs 2.15.0. msw rewrites the worker on
postinstall, so npm ci leaves the tree dirty on a clean checkout and every
contributor either commits an unrelated 30-line diff or discards it.

Regenerate the worker for the locked version and add a check that compares it
against the installed runtime, wired into make verify and CI so the pair cannot
drift again.
This commit is contained in:
n0ctal
2026-08-18 16:44:55 +05:00
committed by GitHub
parent 5c7ca5b579
commit f75ea08ab4
2 changed files with 8 additions and 1 deletions
+5 -1
View File
@@ -41,6 +41,10 @@ lint: lint-go lint-fe ## All linters
typecheck: ## tsc --noEmit
cd $(FRONTEND) && npm run typecheck
.PHONY: msw-worker-check
msw-worker-check: ## Verify the tracked worker matches the installed MSW runtime
cmp $(FRONTEND)/public/mockServiceWorker.js $(FRONTEND)/node_modules/msw/lib/mockServiceWorker.js
.PHONY: test-go
test-go: dist-stub ## Go tests (shuffle, no cache)
go test -shuffle=on -count=1 $(GO_PKGS)
@@ -75,5 +79,5 @@ build-storybook: ## Build the static Storybook (compile-checks all stories)
# The PR gate. Matches ci.yml: codegen freshness, both linters, typecheck,
# both test suites, a full build, and the Storybook compile-check.
.PHONY: verify
verify: gen-check lint typecheck test build build-storybook ## Full local gate (mirrors CI)
verify: gen-check lint typecheck msw-worker-check test build build-storybook ## Full local gate (mirrors CI)
@echo "verify: OK"