Repository navigation
feat(dev): keep dev and mock code out of release bundles - #168
Merged
Merged
Conversation
Signed-off-by: Bugs5382 <12115015+Bugs5382@users.noreply.github.com>
Signed-off-by: Bugs5382 <12115015+Bugs5382@users.noreply.github.com>
Signed-off-by: Bugs5382 <12115015+Bugs5382@users.noreply.github.com>
Bugs5382
marked this pull request as ready for review
October 7, 2026 11:05
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
Mock mode and the dev "Copy for UI issue" button are dev-only features, but
nothing proved their code actually drops out of a release build. This adds
scripts/check-release-bundle.mjs, run in CI against the default build, thatfails if a release bundle still carries
__CRYPTOS_DEV_UI_ISSUE__,__CRYPTOS_MOCK__orc2pa.The fixtures (
lib/mock-fixtures.real.ts) and their empty-array stand-in(
lib/mock-fixtures.stub.ts) swap at build time through avite.config.tsresolve.aliaskeyed onVITE_FLEET_MODE(vialoadEnv, so a.envfileand the shell agree) and on running under Vitest, so every build and every
test keeps reading the same
@/lib/mock-fixturesspecifier and seedinglib/nodes.ts/lib/certs.tssynchronously and eagerly, exactly as before --a release build's alias just points at the empty stand-in instead, so its
array spreads nothing and the real fixture data and the
__CRYPTOS_MOCK__marker never reach that bundle. The labels both mock and live data use
(
roleLabels,identityStateLabels,summarize) stay split out intolib/fleet/labels.ts, since they're not fixture data.Verified on the actual built output, not just the check: a default build
contains none of the mock fixture data (checked beyond the marker, by
grepping for fixture content like node names and CNs); a
VITE_FLEET_MODE=mockor
DEV_UI_ISSUE_COPY=truebuild correctly fails the check, naming the file.Closes #163
Test plan
npm run lint(eslint + prettier) cleannpm run test-- 895/895 across all three workspaces (console 651,api-client 3, ui 241)
node --test scripts/*.test.mjs-- 9 cases: dist-shape validation(missing/empty dist, missing index.html, missing assets/*.js), each of
the three markers individually, the clean-pass case, and the
entry-point guard with a space in both the script's own path and the
dist path
npm run buildthennode scripts/check-release-bundle.mjs apps/console/dist-- "release bundle clean"; direct grep for fixture content (not just
the marker) confirms none of it reached the bundle
VITE_FLEET_MODE=mockandDEV_UI_ISSUE_COPY=truebuilds -- the checkcorrectly fails each one and names the offending chunk; CI runs both as
a positive control before the real build's check
updates: the mock store is still seeded synchronously at module load,
so deep links and the default topology selection behave exactly as on
main(e.g.node-detail.test.tsx's deep-link tests query the DOMsynchronously right after render, no
findBy/waitFor, and pass)