Repository navigation
fix(gbrain): strip leaked db env for PGLite probes - #1931
maxpetrusenkoagent wants to merge 2 commits into
Conversation
PGLite configs may have no database_url to seed, so buildGbrainEnv used to pass through caller DATABASE_URL values loaded from a project .env. That made gbrain probes try an unrelated app DB and falsely classify healthy local brains as broken-db. When config indicates local PGLite and has no database_url, drop DATABASE_URL and GBRAIN_DATABASE_URL unless GSTACK_RESPECT_ENV_DATABASE_URL=1 is set. Add regression coverage at the env helper and local-status probe layers. Closes garrytan#1917
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
|
Autoreview: CLEANnnVerified:n- bun test test/build-gbrain-env.test.ts test/gbrain-local-status.test.tsn |
garrytan
left a comment
There was a problem hiding this comment.
Reviewed against main. Correct fix for #1917, well-tested.
Verified:
- The PGLite-config branch strips both
DATABASE_URLandGBRAIN_DATABASE_URLso Bun's project.envautoload can't make the probe hit an unrelated app database and misclassify a healthy file-backed brain asbroken-db. Theengine === "pglite" || database_pathdetection covers both config shapes. - The
GSTACK_RESPECT_ENV_DATABASE_URL=1opt-out still works (early return precedes the strip), and the legacy no-signal config keeps today's pass-through behavior — the regression test rewrite makes that explicit. - The
fail-on-database-urlfake-gbrain behavior is a nice direct proof of the leak path.
Coordination note (no action needed from you): the fix-wave PR from garrytan/triage-high-priority-prs touches the same neighborhoods — it removes the GBRAIN_PREPARE auto-set block just below your hunk in lib/gbrain-exec.ts (#1965) and extends the same makeEnv/makeFakeGbrainScript unions in test/gbrain-local-status.test.ts (a "slow" behavior for #1964). Whichever lands second has small mechanical conflicts; resolution keeps both sides. One heads-up for the docblock: the wave deletes the "sets GBRAIN_PREPARE=true" paragraph your hunk sits next to — keep the wave's version of that paragraph, your PGLite paragraph above it.
Thanks — this closes #1917.
Signed-off-by: maxpetrusenkoagent <[email protected]>
|
@maxpetrusenkoagent Rewrite this against current main and validate the current GBrain configuration paths. The environment cleanup is still needed, but this branch conflicts and is far behind. |
|
Thank you, @maxpetrusenkoagent. Your fix is folded into v1.91.19.0 (#3025), which is now merged, and you're credited as a co-author on the release commit and in the CHANGELOG. Closing this PR because the change is on main now. |
Summaryn- strip leaked DATABASE_URL values when a PGLite gbrain config has no database_urln- keep explicit config database_url and GSTACK_RESPECT_ENV_DATABASE_URL behavior unchangedn- add regressions for buildGbrainEnv and local status probingnnFixes #1917.nn## Verificationn- bun test test/build-gbrain-env.test.ts test/gbrain-local-status.test.tsnn## Notesn- Branch is based on the fork main because the agent token lacks GitHub workflow scope for pushing upstream workflow history changes.n