Skip to content

fix(integrations): local Postgres fixtures no longer drop numeric, character and timestamp modifiers - #370

Merged
allisonmahmood merged 1 commit into
mainfrom
fix/336-fixture-modifiers
Sep 24, 2026
Merged

allisonmahmood merged 1 commit into
mainfrom
fix/336-fixture-modifiers

Conversation

@allisonmahmood

Copy link
Copy Markdown
Owner

Local Postgres fixtures dropped the source's type modifiers. A numeric(8,2) column became plain numeric under .patchy/dev, so inserting 9.995 read back as "9.995" locally but "10.00" from the source. timestamp(0) kept fractions, character(4) lost its padding, and varchar(4) accepted values the source refuses. Closes #336.

Stacked on #369 (branch fix/340-array-elements).

Discovery now reads each column's atttypmod, decodes it and stores the result as structured integers on the snapshot's column type. numeric(8,2) becomes modifiers: [8, 2]; for arrays the modifiers apply to the element. Fixture DDL and the fixture header render range-checked modifiers for numeric, varchar, bpchar, timestamp and timestamptz. For example, "pg_catalog"."numeric"(8,2) or "pg_catalog"."timestamptz"(3)[]. The source's formatted type string is still never executed. A modifier that fails validation excludes the column as unsupported_type. Domains still resolve to their base type without their own modifiers, and the schema-drift check still compares types without modifiers. Snapshots discovered before this change carry no modifiers until they are rediscovered.

The snapshot schema change is in docs/API.md. docs/product.md and the patchy-postgres project skill now describe the new fixture types.

Tests:

  • New Parity.test.ts case runs the same reads natively and against the dev fixture over numeric(8,2), numeric(4), timestamp(0), timestamptz(3), character(4), varchar(4) and numeric(8,2)[]. It failed on the base branch with the values the issue reports and passes now. It also checks that an over-length varchar(4) fixture row is refused locally with SQLSTATE 22001.
  • New Mapping.test.ts case covers decoding (including a negative numeric scale), rendering, rejected modifiers and the unchanged drift check.
  • pnpm typecheck and pnpm lint pass. On a loaded machine, pnpm test had 959 passed and 2 failed, both 5-second timeouts (Operations.test.ts, Runtime.test.ts). Re-run alone, both files pass.

Implemented by Claude Opus 5.5 via Claude Code (foreman run orchestrated by Claude Fable 5.1).

@github-actions github-actions Bot added area:server Touches the server area area:docs Touches the docs area area:integrations Company connections and integration implementations size:m 100-500 changed lines labels Sep 23, 2026
Base automatically changed from fix/340-array-elements to main September 24, 2026 15:28
…d timestamp modifiers

Discovery now records each column's validated type modifiers as structured
integers on the snapshot's column type (numeric(8,2) is [8, 2]), decoded from
atttypmod rather than the formatted type string. Fixture DDL and the fixture
header render them for numeric, varchar, bpchar, timestamp and timestamptz
(and their arrays), so local inserts round and refuse like the source. Domains
still resolve to their base without their own modifiers; drift checks keep
comparing modifier-free types.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@allisonmahmood
allisonmahmood force-pushed the fix/336-fixture-modifiers branch from e567dea to bbf2b84 Compare September 24, 2026 15:29
@allisonmahmood
allisonmahmood merged commit 0eda19f into main Sep 24, 2026
8 checks passed
@allisonmahmood
allisonmahmood deleted the fix/336-fixture-modifiers branch September 24, 2026 15:37
allisonmahmood added a commit that referenced this pull request Sep 24, 2026
Stacked on #370 (branch fix/336-fixture-modifiers).

`Patches.sharedTables` had no production caller. It kept its own `sharedSources` query and listing loop alive, while discovery already goes through `read`/`companyInventory` and declaration resolution uses singular `sharedTable`. Closes #325.

This deletes the plural service member, the `sharedSources` query, the implementation and the returned property, plus the one `sharedTables` assertion in the lifecycle test. The rest of that test stays. Singular `sharedTable`, `read`, `companyInventory` and `readInventory` are unchanged.

Caller check: a repo-wide grep for `sharedTables`/`sharedSources` (all file types) hit only the deleted code and that one assertion. There is no bracket or type-index access. The helpers the code used (`serving`, `dieOnSchemaError`, `readInventory`) still have other callers. The glossaries don't name the member.

Tests: `pnpm typecheck` and `pnpm lint` pass, and `Patches.test.ts` passes 31/31. The full `pnpm test` run gave 960 passed and 2 failed: two 5s timeouts in `packages/integrations/src/postgres/{Operations,Runtime}.test.ts` while other suites were running on the machine. Re-run alone, both files pass 9/9.

Implemented by Claude Opus 5.5 via Claude Code (foreman run orchestrated by Claude Fable 5.1).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:docs Touches the docs area area:integrations Company connections and integration implementations area:server Touches the server area size:m 100-500 changed lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

integrations: local Postgres fixtures discard supported source type modifiers

1 participant