From 92598a61b185c8871325e53701234ee788a26378 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 26 Oct 2026 14:28:27 +0000 Subject: [PATCH 1/2] fix(console): keep the build-identity define out of the vitest projects' process.env Vitest moves every import.meta.env.* / process.env.* define into the main process's process.env while it resolves a project's config, so the console project's VITE_APP_VERSION (the build's git sha) reached app-shell's getConsoleBuild() in other projects' workers. The console vitest config now drops those keys from the merged vite config; the build keeps them. Claude-Session: https://claude.ai/code/session_01KpXmBvpnCGgpgx8hNbqsso Co-authored-by: Claude --- ui/apps/console/vitest.config.ts | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/ui/apps/console/vitest.config.ts b/ui/apps/console/vitest.config.ts index b8da0e6e4b3..1617fef5a71 100644 --- a/ui/apps/console/vitest.config.ts +++ b/ui/apps/console/vitest.config.ts @@ -7,8 +7,23 @@ import rootConfig from '../../vitest.config.mts'; // (objectui#3384). import viteConfig from './vite.config.ts'; +// The console BUILD bakes its identity as a `define` on +// `import.meta.env.VITE_APP_VERSION` (objectui#12970) — and vitest does not +// scope such a define to the project that declares it. While it resolves a +// project's config it moves every `import.meta.env.*` / `process.env.*` define +// into the main process's `process.env` (`deleteDefineConfig` in vitest's +// cli-api chunk), which the workers of EVERY project inherit. So the console's +// git sha surfaced in app-shell's `getConsoleBuild()` and turned +// `buildIdentity-12970`'s "reads null" case red in full runs, depending on +// shard layout (#26126). Those defines stay in the build and stop here; no +// console test reads them. +const LEAKS_INTO_PROCESS_ENV = /^(import\.meta\.env|process\.env)\./; +const testDefine = Object.fromEntries( + Object.entries(viteConfig.define ?? {}).filter(([key]) => !LEAKS_INTO_PROCESS_ENV.test(key)) +); + export default mergeConfig( - mergeConfig(rootConfig, viteConfig), + mergeConfig(rootConfig, { ...viteConfig, define: testDefine }), defineConfig({ test: { // The root config no longer sets global setupFiles (they moved into the From c35f17627a176768952c66f51edafa99a1ad603b Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 26 Oct 2026 14:29:28 +0000 Subject: [PATCH 2/2] chore(changeset): console build-identity define stays out of the test projects Claude-Session: https://claude.ai/code/session_01KpXmBvpnCGgpgx8hNbqsso Co-authored-by: Claude --- .changeset/26126-console-version-define-test-leak.md | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 .changeset/26126-console-version-define-test-leak.md diff --git a/.changeset/26126-console-version-define-test-leak.md b/.changeset/26126-console-version-define-test-leak.md new file mode 100644 index 00000000000..e8c9e6d12f5 --- /dev/null +++ b/.changeset/26126-console-version-define-test-leak.md @@ -0,0 +1,10 @@ +--- +'@object-ui/console': patch +--- + +fix(console): the console's build-identity define no longer leaks into the other ui test projects + +Clause-②: no (build/test configuration only; no exported type or runtime contract change; the console production build keeps its version stamp) +Metadata-protocol: none + +The console's Vite config bakes `import.meta.env.VITE_APP_VERSION` (the build's version, else the git short sha) as a `define`. The console's vitest project merges that config, and vitest moves every `import.meta.env.*` / `process.env.*` define into the main process's `process.env` while it resolves a project's config, so every other ui test project's workers inherited the console's git sha. App-shell's `getConsoleBuild()` then read that sha instead of `null`, and `buildIdentity-12970`'s "reads null" case went red in full ui runs. The console's vitest config now drops those keys from the merged Vite config. `vite build` still bakes the version exactly as before.