CLAUDE.md states this as an absolute:
Every Postgres identifier is schema-qualified to current_schema() (quote / currentSchemaName in src/util/pgIdentifiers.ts). Unqualified names resolve through search_path and would reach a same-named table in another schema — the hazard applies to DDL, drops, catalog probes and row-count estimates alike.
Measured in the tree, pgIdentifiers is imported by exactly four files, all DDL/catalog:
src/config/resetAllDatabases.ts
src/config/alignPostgresColumnTypes.ts
src/config/addMissingColumns.ts
src/config/dropStaleCheckConstraints.ts
Every raw-SQL DML site uses bare identifiers:
src/task/bootstrap/feedFilings.ts:92 — SELECT DISTINCT "filing_date" FROM "filings"…
src/task/bootstrap/feedFilings.ts:129 — … FROM "filings" WHERE "filing_date" = $1
src/storage/spac/SpacDealReplace.ts:154 — DELETE FROM "spac_deal" …
src/storage/form-8k-event/Form8KEventReplace.ts:83 — DELETE FROM "form_8k_events" …
src/storage/entity/cikNameBulkWriter.ts:110 — INSERT INTO "cik_names" …
src/task/document/selectFilingsToConvert.ts:250-262 — FROM "filings" f LEFT JOIN "filing_document" d …, plus FROM "spac" s at :246. Added this window.
Nothing is broken today — sec's own deployments run in one schema — but the rule as written is not the rule the code follows, and a new call site landed under it without anyone noticing, which is exactly how a stated-but-unenforced contract stops being useful.
Ask: pick one and make them agree.
- Qualify the DML sites through
quote / currentSchemaName like the DDL tier already does; or
- Scope the CLAUDE.md rule explicitly to DDL, drops and catalog access, and say why DML is exempt (a single-schema
search_path is the deployment assumption).
Second, smaller item in the same paragraph. CLAUDE.md:238-240 enumerates the raw-SQL call sites as:
Call sites: cikNameBulkWriter.ts, Form8KEventReplace.ts, SpacDealReplace.ts (writes); feedFilings.ts (reads).
grep -rn "resolveSqlBackend(" src --include=*.ts | grep -v test returns seven non-test files — the four above plus src/task/spac/spacCandidateScan.ts:230, src/cli/queries/DbStatus.ts:187, and src/task/document/selectFilingsToConvert.ts:177-181. The list should either be complete or be replaced by the grep that produces it.
(For the record, the new site is otherwise careful: selectFilingsToConvert.ts:175-181 gates the fast path on every table the query reads, so one non-durable repo demotes the whole query to the repository path.)
Found during the 2026-08-31 review. Snapshot: workglow-dev/prd → analysis/grades/2026-08-31/sec-detailed.md §4.2.
CLAUDE.md states this as an absolute:
Measured in the tree,
pgIdentifiersis imported by exactly four files, all DDL/catalog:src/config/resetAllDatabases.tssrc/config/alignPostgresColumnTypes.tssrc/config/addMissingColumns.tssrc/config/dropStaleCheckConstraints.tsEvery raw-SQL DML site uses bare identifiers:
src/task/bootstrap/feedFilings.ts:92—SELECT DISTINCT "filing_date" FROM "filings"…src/task/bootstrap/feedFilings.ts:129—… FROM "filings" WHERE "filing_date" = $1src/storage/spac/SpacDealReplace.ts:154—DELETE FROM "spac_deal" …src/storage/form-8k-event/Form8KEventReplace.ts:83—DELETE FROM "form_8k_events" …src/storage/entity/cikNameBulkWriter.ts:110—INSERT INTO "cik_names" …src/task/document/selectFilingsToConvert.ts:250-262—FROM "filings" f LEFT JOIN "filing_document" d …, plusFROM "spac" sat:246. Added this window.Nothing is broken today — sec's own deployments run in one schema — but the rule as written is not the rule the code follows, and a new call site landed under it without anyone noticing, which is exactly how a stated-but-unenforced contract stops being useful.
Ask: pick one and make them agree.
quote/currentSchemaNamelike the DDL tier already does; orsearch_pathis the deployment assumption).Second, smaller item in the same paragraph. CLAUDE.md:238-240 enumerates the raw-SQL call sites as:
grep -rn "resolveSqlBackend(" src --include=*.ts | grep -v testreturns seven non-test files — the four above plussrc/task/spac/spacCandidateScan.ts:230,src/cli/queries/DbStatus.ts:187, andsrc/task/document/selectFilingsToConvert.ts:177-181. The list should either be complete or be replaced by the grep that produces it.(For the record, the new site is otherwise careful:
selectFilingsToConvert.ts:175-181gates the fast path on every table the query reads, so one non-durable repo demotes the whole query to the repository path.)Found during the 2026-08-31 review. Snapshot:
workglow-dev/prd→analysis/grades/2026-08-31/sec-detailed.md§4.2.