Skip to content

Restore process env after memory-mount tests - #465

Merged
TheGreatAxios merged 2 commits into
mainfrom
cl-7182-restore-process-env-after-memory-mount-tests-so-walking
Aug 29, 2026
Merged

TheGreatAxios merged 2 commits into
mainfrom
cl-7182-restore-process-env-after-memory-mount-tests-so-walking

Conversation

@TheGreatAxios

Copy link
Copy Markdown
Contributor

Fixes https://linear.app/abklabs/issue/CL-7182/restore-process-env-after-memory-mount-tests-so-walking-skeleton-stays

apps/hub/src/memory-mount.test.ts deleted DATABASE_URL in afterEach when a test never called stashEnv. The walking-skeleton job then runs every DATABASE_URL-gated suite in one Bun process; later drizzle suites saw no URL and failed under E2E_REQUIRED=1. Main has been red on that step since #462.

This snapshot KEYS at module load and restores them after every test. stashEnv only clears for the current test. A same-file assertion locks the restore after a non-stash resolveMemoryEmbed path.

Local proof: bun test apps/hub/src/memory-mount.test.ts packages/evals/src/store/store.test.ts — the evals store suite (the first CI failure) now runs after memory-mount and passes.

afterEach currently deletes DATABASE_URL when a test never called
stashEnv. Snapshot KEYS at module load and assert they survive a
non-stash resolveMemoryEmbed test so later drizzle suites in the same
process still see the original env.
Snapshot KEYS at module load and restore them in afterEach. stashEnv
only clears for the current test. Non-stash resolveMemoryEmbed tests
no longer delete DATABASE_URL, so later drizzle suites in the same
Bun process still see the original env.

@TheGreatAxios TheGreatAxios left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critique · comment

afterEach restores KEYS (including DATABASE_URL) from the module-load snapshot; stashEnv only clears for the current test.

  • apps/hub/src/memory-mount.test.ts:24-52 — originals captured at load; restoreOriginalEnv writes them back after every test.
  • apps/hub/src/memory-mount.test.ts:54-58 — stashEnv only clears.
  • apps/hub/src/memory-mount.test.ts:112-116 — pin after a non-stash resolveMemoryEmbed path.

No product-code changes outside this file. Walking-skeleton on main should go green once this lands.

@TheGreatAxios
TheGreatAxios merged commit 3d5ee25 into main Aug 29, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant