Skip to content

schemadiff: describability refusals — partitions, FKs, unlogged, collations, sequence ownership - #55

Merged
Kiran01bm merged 3 commits into
mainfrom
kiran01bm/ws8-fk-partition-refusal
Aug 21, 2026
Merged

schemadiff: describability refusals — partitions, FKs, unlogged, collations, sequence ownership#55
Kiran01bm merged 3 commits into
mainfrom
kiran01bm/ws8-fk-partition-refusal

Conversation

@Kiran01bm

Copy link
Copy Markdown
Collaborator

Summary

Follow-up to #52: the render/export path now fails closed on the two shapes the single-table model cannot represent — partitioned tables and tables involved in foreign-key relationships in either direction — and the repo gains an explicit public capability statement.

What

  • Introspect captures partition identity (relispartition, pg_get_partkeydef) and incoming foreign keys (ReferencedBy, self-referential FKs excluded) on the model.
  • Render refuses a partitioned parent/partition and a table other tables reference, each with its own typed error; a table carrying outgoing FKs already surfaces the parse gate's typed error.
  • Diff treats partitioning as table identity: a partition-key or attachment mismatch between live and desired is a typed ErrUnsupportedChange, never a silent zero diff.
  • Docs: docs/limitations.md gains a "Declarative model boundaries" table (FKs both directions, partitioned tables, non-table objects, one table per file); README gains a "What pg-sprite does not do yet" section; AGENTS.md instructs that every capability-changing PR and every release sweep updates both.

Why

A rendered baseline of a partitioned table or an FK-involved table would look complete while being silently wrong — the model carries no partition bounds and no incoming-FK topology, so an exported file would drop them without a trace. Refusing with a typed error keeps the WS-8/WS-9 baseline-onboarding path trustworthy, and the capability docs make the v1 boundary explicit before users point the tool at a database.

Before / after

before:                                       after:
  Introspect(partitioned / FK-involved)         Introspect(partitioned / FK-involved)
        │                                             │  (+ partition key, ReferencedBy)
        ▼                                             ▼
  Render ──▶ plain CREATE TABLE file            Render ──▶ typed refusal
             (PARTITION BY / FK topology                   (names the boundary,
              silently dropped)                             nothing emitted)

@Kiran01bm
Kiran01bm marked this pull request as ready for review August 20, 2026 09:59
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@Kiran01bm
Kiran01bm marked this pull request as draft August 20, 2026 10:00
@Kiran01bm Kiran01bm changed the title schemadiff: refuse rendering partitioned tables and FK-involved tables schemadiff: describability refusals — partitions, FKs, unlogged, collations, sequence ownership. Aug 20, 2026
@Kiran01bm
Kiran01bm force-pushed the kiran01bm/ws8-fk-partition-refusal branch from 5f0aef5 to 9b5a2d1 Compare August 20, 2026 19:42
Kiran01bm and others added 3 commits August 21, 2026 09:45
The single-table model carries no partition topology and no incoming
foreign-key relationships, so a rendered baseline of either would look
complete while being silently wrong. Fail closed with typed errors
instead, and document the declarative-model boundaries (FKs in either
direction, partitioned tables, non-table objects) in limitations.md and
the README so the v1 capability surface is explicit.
A foreign key on a partitioned referencing table is mirrored onto every
partition in pg_constraint; without the conislocal filter (already used
by introspectConstraints) ReferencedBy reported one entry per partition
clone, and a partitioned self-referential FK leaked its clones past the
self-reference exclusion. Tests pin both cases; ErrUnsupportedChange's
doc comment now covers its partition-difference call sites.
…enders

Address the #52 adversarial review: Render's two proofs (ParseDesired
admissibility, diff-to-zero) are structurally blind to omission, so the
facts the model cannot carry now refuse instead of silently vanishing
from the baseline. serialType requires a genuine pg_depend OWNED BY edge
(Column.SequenceOwned), not the serial-style sequence name; unlogged
tables and explicit column collations refuse on both render and diff
with their own typed sentinels; a zero-column table renders (). Also
excludes partition clones from ReferencedBy (conislocal), matching
introspectConstraints.

Amp-Thread-ID: https://ampcode.com/threads/T-01a01341-1d4b-7198-a602-a7ea4b7c4884
Co-authored-by: Amp <amp@ampcode.com>
@Kiran01bm
Kiran01bm force-pushed the kiran01bm/ws8-fk-partition-refusal branch from 9b5a2d1 to 5e62e46 Compare August 20, 2026 23:50
@Kiran01bm Kiran01bm changed the title schemadiff: describability refusals — partitions, FKs, unlogged, collations, sequence ownership. schemadiff: describability refusals — partitions, FKs, unlogged, collations, sequence ownership Aug 20, 2026
@Kiran01bm
Kiran01bm changed the base branch from kiran01bm/ws8-pull-renderer to main August 20, 2026 23:50
@Kiran01bm
Kiran01bm marked this pull request as ready for review August 20, 2026 23:50
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@Kiran01bm Kiran01bm closed this Aug 21, 2026
@Kiran01bm Kiran01bm reopened this Aug 21, 2026
@Kiran01bm
Kiran01bm merged commit 6329b0e into main Aug 21, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants