fix(config): decouple dotenv load from parsing so defaults test is deterministic (BUNYIP-102) #236

Merged
Claude-Run merged 1 commit from fix/bunyip-102-config-dotenv-decouple into main 2026-06-26 03:59:56 +02:00
Member

Config::from_env() loaded a repo-root .env via dotenvy::dotenv() as part of
parsing, so test_config_defaults could not control its process env: a developer
.env setting RUST_LOG=info,bunyip_api=debug (and the other vars the test clears)
was re-injected and clobbered the asserted code defaults. The test passed in CI
(clean checkout) but failed on any dev box with a populated .env, including
inside just check-container.

Split from_env() into the dotenvy load plus a pure from_env_inner() that reads
only the current process env. Production from_env() still loads .env. The test
now removes the relevant vars and calls from_env_inner(), so a repo-root .env
can no longer re-inject values mid-test.

#BUNYIP-102

Config::from_env() loaded a repo-root .env via dotenvy::dotenv() as part of parsing, so test_config_defaults could not control its process env: a developer .env setting RUST_LOG=info,bunyip_api=debug (and the other vars the test clears) was re-injected and clobbered the asserted code defaults. The test passed in CI (clean checkout) but failed on any dev box with a populated .env, including inside just check-container. Split from_env() into the dotenvy load plus a pure from_env_inner() that reads only the current process env. Production from_env() still loads .env. The test now removes the relevant vars and calls from_env_inner(), so a repo-root .env can no longer re-inject values mid-test. #BUNYIP-102
fix(config): decouple dotenv load from parsing so defaults test is deterministic (BUNYIP-102)
All checks were successful
E2E / Playwright against deployment (pull_request) Successful in 1m4s
Check / fmt + clippy + build + tests (pull_request) Successful in 18m59s
Create release / Create release from merged PR (pull_request) Has been skipped
57b41c9c6d
Config::from_env() loaded a repo-root .env via dotenvy::dotenv() as part of
parsing, so test_config_defaults could not control its process env: a developer
.env setting RUST_LOG=info,bunyip_api=debug (and the other vars the test clears)
was re-injected and clobbered the asserted code defaults. The test passed in CI
(clean checkout) but failed on any dev box with a populated .env, including
inside just check-container.

Split from_env() into the dotenvy load plus a pure from_env_inner() that reads
only the current process env. Production from_env() still loads .env. The test
now removes the relevant vars and calls from_env_inner(), so a repo-root .env
can no longer re-inject values mid-test.

#BUNYIP-102
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
psa-systems/bunyip!236
No description provided.