A refused store closes its pool; pin the key's columns and uniqueness
The startup check's refusal left the store's pool open: the process exits on it in production, but the connection outlived the refusal. createStore now closes a store it refuses. Two live cases the first run showed undefended (mutants D6 and D9): a unique key replaced by a plain index on the same columns, and by a unique index on other columns of the same count. The read-only-role case also checks that no session of the role outlives the refusal. The fixture's owner pool ignores the connection ends its own forced drop causes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
804f41f5f7
commit
b5d7b6b0cc
2 changed files with 31 additions and 0 deletions
|
|
@ -29,6 +29,9 @@ export async function createStore(config: HeimdallConfig): Promise<HeimdallStore
|
|||
// wrongly. Startup prints this error, so it names only the input and a
|
||||
// code, and carries no cause.
|
||||
const code = (error as { code?: unknown }).code;
|
||||
// A refused store is never handed out, so it is closed here: its pool
|
||||
// would otherwise hold the connection open.
|
||||
await store.close().catch(() => undefined);
|
||||
throw new Error(
|
||||
`Postgres storage could not be prepared (${typeof code === "string" ? code : "error"}); check GC_ACCESS_DATABASE_URL_FILE.`
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in a new issue