load_postgres_env in crates/registry-breg/src/request_store.rs (around line 1206), and the equivalent duplicated helper in crates/registry-breg/tests/postgres_request_events.rs, crates/registry-breg/tests/postgres_request_upgrade_retention.rs, and crates/registry-breg/tests/postgres_request_activation.rs, fall back to reading /private/tmp/registry-cr-plain-gqgr39oa/test.env whenever BREG_TEST_DATABASE_URL is unset, silently sourcing BREG_TEST_DATABASE_URL from that fixed path if it exists.
Failure scenario: on a machine or CI runner where that exact temp path happens to exist (e.g. left over from an unrelated process, or an environment that reuses predictable temp directories), these Postgres tests silently pick up a stray BREG_TEST_DATABASE_URL instead of failing with a clear "environment variable not set" error, making test behavior depend on incidental filesystem state.
Suggested fix:
- Remove the hard-coded fallback path and rely solely on the
BREG_TEST_DATABASE_URL environment variable, letting the tests skip or fail clearly when it is unset.
- If a local convenience file is still wanted, read a repo-relative, gitignored
.env path documented in the crate README instead of an absolute machine-specific path.
Noticed while reviewing #1189; pre-existing, not merge-blocking.
load_postgres_envincrates/registry-breg/src/request_store.rs(around line 1206), and the equivalent duplicated helper incrates/registry-breg/tests/postgres_request_events.rs,crates/registry-breg/tests/postgres_request_upgrade_retention.rs, andcrates/registry-breg/tests/postgres_request_activation.rs, fall back to reading/private/tmp/registry-cr-plain-gqgr39oa/test.envwheneverBREG_TEST_DATABASE_URLis unset, silently sourcingBREG_TEST_DATABASE_URLfrom that fixed path if it exists.Failure scenario: on a machine or CI runner where that exact temp path happens to exist (e.g. left over from an unrelated process, or an environment that reuses predictable temp directories), these Postgres tests silently pick up a stray
BREG_TEST_DATABASE_URLinstead of failing with a clear "environment variable not set" error, making test behavior depend on incidental filesystem state.Suggested fix:
BREG_TEST_DATABASE_URLenvironment variable, letting the tests skip or fail clearly when it is unset..envpath documented in the crate README instead of an absolute machine-specific path.Noticed while reviewing #1189; pre-existing, not merge-blocking.