Files
orca/src/preload/e2e-config.ts
T
JinjingandOrca 1bad08d9a8 test(terminal): retention-budget force-park e2e with a retentionLimit override (C1 6b)
ORCA_E2E_TERMINAL_RETENTION_LIMIT flows preload → e2e-config →
getTerminalParkingPolicyOverrides (exposeStore-gated, positive-integer
only) so a spec can shrink the force-park budget to 1. The Docker-gated
spec opens two remote worktrees on one relay target (second pre-seeded
remote repo), disables terminalSshViewParking to make both un-parkable,
hides both behind the local context, and proves the older one force-parks
while the last-active exemption spares the newest; re-activating the
evicted worktree restores the marker tail via relay replay.

Co-authored-by: Orca <help@stably.ai>
2026-07-28 13:21:54 -07:00

29 lines
1.2 KiB
TypeScript

import { createE2EConfig } from '../shared/e2e-config'
const preloadEnv = (
import.meta as ImportMeta & {
env?: { MODE?: string; VITE_EXPOSE_STORE?: boolean | string }
}
).env
function isEnvFlagEnabled(value: boolean | string | undefined): boolean {
return value === true || value === 'true'
}
// Why: `--mode e2e` must be enough for manual rebuilds used with SKIP_BUILD=1;
// keeping this out of a root .env file makes the test-only toggle less visible.
const exposeStore = preloadEnv?.MODE === 'e2e' || isEnvFlagEnabled(preloadEnv?.VITE_EXPOSE_STORE)
// Why: preload is the renderer's audited bridge into Electron startup state.
// Renderer code should consume a typed config object from this bridge instead
// of reading test-only env vars directly.
export const preloadE2EConfig = createE2EConfig({
headless: process.env.ORCA_E2E_HEADLESS === '1',
exposeStore,
userDataDir: process.env.ORCA_E2E_USER_DATA_DIR ?? null,
// Why: Number('') is 0 and Number(undefined) is NaN; both coerce to null so
// only a real positive override reaches the renderer parking policy.
terminalParkingDelayMs: Number(process.env.ORCA_E2E_TERMINAL_PARKING_DELAY_MS) || null,
terminalRetentionLimit: Number(process.env.ORCA_E2E_TERMINAL_RETENTION_LIMIT) || null
})