Repository navigation
fix(console): keep the build-identity define out of the other ui test projects - #26197
Conversation
…ts' 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 <noreply@anthropic.com>
… projects Claude-Session: https://claude.ai/code/session_01KpXmBvpnCGgpgx8hNbqsso Co-authored-by: Claude <noreply@anthropic.com>
席位核对 · ACCEPT · seat
|
⛔ merge queue 构建失败 — 先分诊,再决定要不要重排队列构建 40353572789 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集), 分类: 失败的 job(日志抽取,best effort):
跨 PR 相同签名(24h,按失败测试文件聚合):
历史信号:
分诊清单:
Generated by Claude Code · merge-queue-triage workflow (#4859) |
Requested by Steve · project thread
Fixes #26126
Clause-②: no (build/test configuration only; no exported type or runtime contract change; the console production build keeps its version stamp)
Metadata-protocol: none
What changes
ui/apps/console/vitest.config.tsnow drops everyimport.meta.env.*/process.env.*key from the console Vite config'sdefinebefore merging it into the console test project.ui/apps/console/vite.config.tsis untouched, sovite buildstill bakesimport.meta.env.VITE_APP_VERSION(the build'sVITE_APP_VERSION, else the git short sha) exactly as before.buildIdentity-12970.test.tsis unchanged; it stays the pin.Mechanism (measured, vitest 4.1.10 in
ui/node_modules)vitest:projectplugin runsdeleteDefineConfigin each project's Viteconfighook. That function writes everyimport.meta.env.*/process.env.*define into the main process'sprocess.envand deletes it from the define.resolveProjectsinitialises the projects concurrently (limitConcurrency(availableParallelism)), so the console project's config hook races the other projects' Vite config resolution.VITE_APP_VERSIONup in its own env snapshot (Vite readsVITE_*fromprocess.env).buildIdentity.tsreads(import.meta as ...).env, which Vite serves from that snapshot, sogetConsoleBuild()returns the sha instead ofnull. Which project wins the race is timing, which is why the queue build for fix(types): the @object-ui/types/zod mirrors keep an unknown key instead of silently dropping it #26019 went red and earlier builds did not.A throwaway probe in a
unitworker (base config,VITE_APP_VERSIONunset in the shell) readprocess.env.VITE_APP_VERSION === 'c35f1762' (that tree's HEAD)in 6 of 6 runs while the import-meta read stayednull: the leak intoprocess.envis deterministic, and the red depends on the resolution order.Measurement
confighook on theunitproject, so it resolves after the console projectvitest.config.tsAssertionError: expected 'c35f1762' (that tree's HEAD) to be null(1 failed, 10 passed), the same failure as queue run 40325012039CI=true pnpm --dir ui run test --shard=10/16(unfiltered, all projects incl. console; the leg that holdsbuildIdentity-12970and 9 console files)b0841718)buildIdentity-12970passed; 363/364 files, 4955 passed. The one red wascheck-i18n-dead-keys.test.tstiming out at 15 s while the gate sweep loaded the box; it passes when run alonevitest.config.tsbuildIdentity-12970passed (the race was won that time); one unrelated red, see Acceptance notesSo the natural race did not lose in 2 targeted runs, 6 probe runs and 1 shard run here. The red was reproduced deterministically only by forcing the resolution order. The probe and the delay hook were throwaway and are not in the diff. Narrowing declared: one shard of 16, not the whole suite, because a full local run takes several hours on this box; CI's Test UI runs all 16 legs.
Acceptance notes
ui/packages/app-shell/src/preview/__tests__/DraftChangesPanel.securityLink.test.tsx("offers the named item as a control that asks for that surface, inside Studio") fails 3 of 3 times when run alone on main601c7738and on this branch, and it failed in the base shard leg. It is not touched by this diff (the dom project never sees the removed define). Handed to the seat; it may show up on this PR's Test UI.VITE_APP_VERSIONbeforevitest runstill turns the "reads null" case red. That is the test reading its build environment as written, not the leak, and nothing in CI exports it.Local gates (head
b0841718)node scripts/pm/dispatch-gates.mjs --commands: 27 families, each run, all exit 0;--ranreconciliation: 27 derived, 27 run, 0 NOT-MEASURED (a derived zero).eslint apps/console/vitest.config.ts: exit 0.tsc -b tsconfig.node.json --forceinui/apps/console(the program that type-checks this file): exit 0.pnpm --filter '@object-ui/console^...' build, thenCI=true vite buildinui/apps/consolewithVITE_APP_VERSIONunset: lock verdict exit 0, 10273 modules. The bundle still bakes the stamp:dist/assets/index-*.jscarriesVITE_APP_VERSION:with valueb0841718(the git short sha of HEAD).Generated by Claude Code