Skip to content

fix(console): keep the remaining fixture stores out of release builds - #170

Merged
Bugs5382 merged 1 commit into
mainfrom
fix/169-fixture-stores
Oct 9, 2026
Merged

Bugs5382 merged 1 commit into
mainfrom
fix/169-fixture-stores

Conversation

@Bugs5382

@Bugs5382 Bugs5382 commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

What and why

The console's release build still shipped the inline mock fixtures in
lib/enrollment.ts, lib/profiles.ts, lib/adapters.ts and lib/audit.ts:
each store's seed() built its array from a literal at module scope, so it
was 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' literal
fixtures move into mock-fixtures.real.ts (new exports alongside
mockNodes), with a matching empty export in mock-fixtures.stub.ts.
vite.config.ts's existing resolve.alias swap already picks between the
two files, so no new alias is needed; each store's own seed() now just
copies 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__), and
scripts/check-release-bundle.mjs gains 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.mjs
  • npm test (workspace vitest suites; one unrelated pkcs12 determinism test
    timed out under parallel load, passed on its own re-run)
  • npm run lint
  • npm run build, then node scripts/check-release-bundle.mjs apps/console/dist (clean)
  • grepped the built dist for distinctive fixture strings (none found)

Closes #169

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>
@Bugs5382
Bugs5382 marked this pull request as ready for review October 9, 2026 20:32
@github-actions github-actions Bot added the fix Bug fix (fix). Patch. label Oct 9, 2026
@Bugs5382
Bugs5382 merged commit aee62b8 into main Oct 9, 2026
18 checks passed
@Bugs5382
Bugs5382 deleted the fix/169-fixture-stores branch October 9, 2026 20:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix Bug fix (fix). Patch.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(console): keep the remaining fixture stores out of release builds

1 participant