mirror of
https://github.com/garrytan/gstack.git
synced 2026-09-10 06:58:59 +02:00
fix(gbrain): DSNs percent-encode the password; body reads retry; stdout drains
Three codex-adversarial findings in the provision port: (1) raw DB_PASS interpolation — a reserved character (/ # ? % @) restructured the URI, provisioning succeeded, and every consumer then failed to parse the DSN (unusable billable orphan); now encodeURIComponent, round-trip pinned. (2) await res.text() sat outside the transport try — a server that sent headers then reset the stream was an uncaught exit 1 instead of a retry-then-exit-8. (3) The bin entrypoint called process.exit() after unawaited stdout writes, truncating piped JSON; exitCode lets writes drain.
This commit is contained in:
@@ -17,10 +17,13 @@
|
||||
|
||||
import { runProvision } from '../lib/gbrain-supabase-provision';
|
||||
|
||||
// exitCode, not process.exit(): exit() drops pending stdout writes, which
|
||||
// truncates piped JSON / large listings; setting exitCode lets writes drain
|
||||
// and the process exit naturally.
|
||||
runProvision(process.argv.slice(2)).then(
|
||||
(code) => process.exit(code),
|
||||
(code) => { process.exitCode = code; },
|
||||
(error) => {
|
||||
process.stderr.write(`gstack-gbrain-supabase-provision: ${(error as Error)?.stack ?? error}\n`);
|
||||
process.exit(1);
|
||||
process.exitCode = 1;
|
||||
},
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user