Repository navigation
fix(console): keep the remaining fixture stores out of release builds - #170
Merged
Merged
Conversation
Move the inline seed data in lib/enrollment.ts, lib/profiles.ts, lib/adapters.ts and lib/audit.ts into mock-fixtures.real.ts, alongside mockNodes, so vite.config.ts's existing resolve.alias swap excludes it from a release build the same way. Each store gets its own tripwire marker, and check-release-bundle.mjs gains one test per marker. Signed-off-by: Bugs5382 <12115015+Bugs5382@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
The console's release build still shipped the inline mock fixtures in
lib/enrollment.ts,lib/profiles.ts,lib/adapters.tsandlib/audit.ts:each store's
seed()built its array from a literal at module scope, so itwas always part of the bundle regardless of
fleetMode()'s runtime check.Mock data must never mix with live (#163).
This follows #168's pattern for
lib/mock.ts: the four stores' literalfixtures move into
mock-fixtures.real.ts(new exports alongsidemockNodes), with a matching empty export inmock-fixtures.stub.ts.vite.config.ts's existingresolve.aliasswap already picks between thetwo files, so no new alias is needed; each store's own
seed()now justcopies from the imported array. Each new fixture export gets its own
tripwire marker (
__CRYPTOS_MOCK_ENROLLMENT__,__CRYPTOS_MOCK_PROFILES__,__CRYPTOS_MOCK_ADAPTERS__,__CRYPTOS_MOCK_AUDIT__), andscripts/check-release-bundle.mjsgains all four, with a test per marker(added first, confirmed to fail, then the markers were wired in).
No behavior change: mock mode shows the same fixtures as before, and a
release build still passes the bundle check.
Testing
node --test scripts/*.test.mjsnpm test(workspace vitest suites; one unrelated pkcs12 determinism testtimed out under parallel load, passed on its own re-run)
npm run lintnpm run build, thennode scripts/check-release-bundle.mjs apps/console/dist(clean)Closes #169