Skip to content

Phase 1: optimistic front door with typed not-native-safe verdicts - #5

Open
Kiran01bm wants to merge 6 commits into
kiran01bm/ci-foundationsfrom
kiran01bm/phase-1-front-door
Open

Phase 1: optimistic front door with typed not-native-safe verdicts#5
Kiran01bm wants to merge 6 commits into
kiran01bm/ci-foundationsfrom
kiran01bm/phase-1-front-door

Conversation

@Kiran01bm

Copy link
Copy Markdown
Collaborator

Summary

Phase 1 — the optimistic front door. Stacked on kiran01bm/ci-foundations.

What

  • migrate --alter runs easy ALTER TABLE changes directly under strict lock/statement budgets (pkg/executor bounded optimistic attempt) and refuses everything else with a structured, machine-readable verdict (exit code 2): pkg/verdict with typed reasons, safer-idiom pointers, and an optional cause field.
  • pkg/preflight table-size guard; status command.
  • The layered DDL-understanding decision recorded in docs: real-grammar parsing (wasilibs/go-pgquery, Wasm) + execute-and-introspect on a scratch schema — never AST transformation.
  • Logging principles: stdout is product output, diagnostics via log/slog, --debug statement tracing; CLI tests assert typed outcomes, never wording.

Why

A working, safe-by-refusal executing path end to end before any planning intelligence — the thin slice the later phases deepen.

…ute-and-introspect)

The DDL-understanding trade-off is decided: classification parses via
wasilibs/go-pgquery (Wasm libpg_query; cgo pg_query_go is the
API-compatible escape hatch), shadow-table DDL and checkpoint
fingerprints come from execute-and-introspect on an engine-owned
scratch database (pg_sprite_scratch pre-provisioned, or CREATEDB to
self-provision — verified in preflight), and refusals use both layers.
Updates CO-7/ST-2/ST-6, the TCB dependency list, and the low-level
design; supersedes the pg_query_go + AST-surgery assumption.
migrate gates statements through go-pgquery (ALTER TABLE only; index
maintenance is pointed at CONCURRENTLY), size-guards the table via
pg_table_size over the partition tree, attempts the change under SET
LOCAL lock/statement budgets, and ends in a structured verdict —
executed-natively, or refused with a typed reason and exit code 2.
The verdict seam is what Phase 11 maps to ExecutionModeBlocked.
Closes the two behavioral coverage gaps from the Phase 1 coverage review:
the status command's live-session output (pid/state/query fields against a
held pg-sprite session) and the lock-budget refusal wording, which were
previously untested paths.
…flag

Establishes the observability posture early: stdout carries only command
output, diagnostics go through log/slog to stderr, errors are logged once
at the entry point, and credentials are never logged. sloglint/forbidigo
enforce the mechanical half; --debug wires the previously unreachable pgx
statement tracing in pkg/dbconn plus migrate lifecycle events.
Log text and human-facing prose are no longer a test surface (rule added
to AGENTS.md, aligned with SchemaBot's observability guidance). The
lock-vs-statement budget distinction was only visible in prose, so the
verdict gains a typed machine-readable cause field, and status gains
--json so its tests can assert structured session fields.
The action's default binary is built with an older Go than the module
targets and cannot load the v2 config; SHA-pinning also satisfies the
semgrep and zizmor unpinned-action checks.
@Kiran01bm
Kiran01bm marked this pull request as ready for review August 5, 2026 09:35
@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.

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.

1 participant