Skip to content

docs: fixes and refresh architecture map - #47

Merged
Kiran01bm merged 2 commits into
mainfrom
kiran01bm/docs-why-introspect
Aug 19, 2026
Merged

docs: fixes and refresh architecture map#47
Kiran01bm merged 2 commits into
mainfrom
kiran01bm/docs-why-introspect

Conversation

@Kiran01bm

Copy link
Copy Markdown
Collaborator

Summary

A new-user pass over docs/architecture.md: adds a "Why introspect?" section explaining why pg-sprite derives schema models by execute-and-introspect rather than by transforming parsed DDL into an in-memory model, and brings the surrounding sections (pipeline diagram, stage table, package map) up to date with the code.

What

  • New "Why introspect — ask PostgreSQL, don't reimplement it?" subsection: the failure mode of AST transformation (a Go reimplementation of PostgreSQL's DDL semantics that drifts across versions 14 → 18), then the seven concrete steps a declarative diff takes — parse for admission, scratch schema in a transaction, execute the desired DDL, introspect the catalogs, roll back, model-vs-model diff, re-enter parse → classify → lint. Closes with the honest limit (an empty scratch table says nothing about rewrite/lock cost, so the classifier still predicts) and links the recorded decision in low-level-design.md.
  • Corrects the pipeline diagram: diff output chains back through the parse boundary before classification, rather than feeding classify directly; the CLI box now lists all six commands.
  • Adds a Live DB? column to the five-stage table — only Introspect touches the database — with a note mapping that to the commands (lint/suggest/fmt run fully offline; diff/dry-run connect for facts; migrate for facts and execution).
  • Refreshes the package map: adds pkg/suggest, lists the suggest command, and replaces pkg/preflight's stale phase note with the gates that exist today (size guard, tiered privilege checks, partition support).
  • Adds a table of contents and phrases the explainer headings as questions.

Why

The INTROSPECT box in the pipeline diagram and the one-line rationale in the stage table state what happens but not why the alternative loses. New readers coming from tools that do AST-based diffing keep asking this; the answer deserves a scannable, step-by-step home in the architecture doc. Whether a command needs a live connection is the first practical question a new user hits, and the package map had fallen behind the code.

New-user-facing walkthrough in architecture.md: why execute-and-introspect
beats reimplementing PostgreSQL's DDL semantics in Go, and the steps a
declarative diff actually takes (parse, scratch schema, execute, introspect,
roll back, diff model-vs-model, re-enter parse -> classify).

Also corrects the pipeline diagram: diff output chains back through the
parse boundary before classification (diffplan canonicalizes and classifies
via pkg/statement), rather than feeding classify directly. Adds a table of
contents matching the house style of the other design docs.
New-user-facing walkthrough in architecture.md: why execute-and-introspect
beats reimplementing PostgreSQL's DDL semantics in Go, and the steps a
declarative diff actually takes (parse, scratch schema, execute, introspect,
roll back, diff model-vs-model, re-enter parse -> classify).

Also corrects the pipeline diagram: diff output chains back through the
parse boundary before classification (diffplan canonicalizes and classifies
via pkg/statement), rather than feeding classify directly. Adds a table of
contents, a per-stage "Live DB?" column noting only Introspect needs a
connection, and refreshes the package map (suggest command and pkg/suggest,
preflight's privilege and partition gates).
@Kiran01bm
Kiran01bm marked this pull request as ready for review August 19, 2026 07:02
@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 changed the title docs: explain why the planner introspects, refresh architecture map docs: fixes and refresh architecture map Aug 19, 2026
@Kiran01bm
Kiran01bm merged commit db53eed into main Aug 19, 2026
8 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