Skip to content

statement: export the closed set of operation shapes - #270

Merged
Kiran01bm merged 1 commit into
mainfrom
kiran01bm/statement-op-kinds
Oct 28, 2026
Merged

Kiran01bm merged 1 commit into
mainfrom
kiran01bm/statement-op-kinds

Conversation

@Kiran01bm

Copy link
Copy Markdown
Collaborator

Exports statement.OpKinds(), the closed set of operation shapes, with a test that it matches exactly the OpKind constants ops.go declares.

Why

A registry of the operations pg-sprite can run that cannot be undone is coming next. Its completeness test has to walk every operation shape and fail when a new one is unclassified, the way TestRefusalRegistryIsComplete walks statement.Kinds(). Statement kinds have that accessor; operation shapes do not.

What

  • statement.OpKinds() returns every OpKind, OpUnrecognized first.
  • TestOpKindsIsClosedAndDescribed parses the ops.go iota block and fails if OpKinds() misses or duplicates a constant, or if a shape falls through to the catch-all Describe() label.
  • The test helper declaredIotaValues now takes the file to parse, so the same check reads ops.go as well as statement.go.

No behaviour changes: nothing calls OpKinds() yet.

Before / after

A later PR adds OpDropPolicy to the ops.go iota block and forgets the new list.

Before                                        After

const ( … OpReindex; OpDropPolicy )           const ( … OpReindex; OpDropPolicy )
no list of op kinds exists                    OpKinds() still ends at OpReindex
  → a registry keyed on op kinds cannot         → TestOpKindsIsClosedAndDescribed fails:
    tell that OpDropPolicy is missing             "OpKinds() must enumerate exactly the
                                                   OpKind constants ops.go declares"
                                                → the author adds it, and the registry
                                                  then has to classify it

🤖 Generated with Amp (Claude Opus 4.6)

A registry keyed on the operation shape needs to walk every shape to prove
none is unclassified, as the refusal registry walks Kinds().
@Kiran01bm
Kiran01bm marked this pull request as ready for review October 28, 2026 02:35
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-28T02:35:12.570984Z
We couldn’t complete this review. Comment @codex review to try again.
a4c5c45 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@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.

@JashLal

JashLal commented Oct 28, 2026

Copy link
Copy Markdown
Collaborator

🤖 Correctness review on Jash’s behalf at a4c5c4579d769f5e75d3132957a6b48d9338c572.

Verdict: no concrete correctness blocker found in the full diff. This adds an enumeration API and completeness checks for a future operation registry; it does not implement that registry or change an existing execution path.

The new OpKinds() constructs a fresh slice on each call, so callers cannot mutate a shared backing list. TestOpKindsIsClosedAndDescribed checks the sentinel position, duplicate entries, equality with the declared iota values, and non-sentinel fallthrough to the catch-all description. Both existing helper call sites still explicitly parse statement.go; the new call parses ops.go. No test functions or assertions were removed or weakened.

Action items: none identified within the inspected scope.

Verification and limits: reviewed the PR description and complete two-file diff, with a second read-only review. All 16 reported CI checks passed, including build, unit tests, PostgreSQL 14–18, Supabase compatibility, and the built-artifact smoke test. The separate automated Codex review could not run because of usage limits. Exact-head repository instructions, full surrounding source (including the unchanged enum declarations and AST helper implementation), and inline review threads could not be retrieved because the GitHub API requests failed. Therefore the source-to-enumeration correspondence was not independently checked beyond the diff and CI evidence. No local build or tests ran.

Generated by Codex, with a GPT-6.1 Sol second review.

@JashLal

JashLal commented Oct 28, 2026

Copy link
Copy Markdown
Collaborator

🤖 Product review at a4c5c4579d769f5e75d3132957a6b48d9338c572.

OSS adoption: the additive statement.OpKinds() API gives library consumers a supported way to enumerate operation shapes, including the unknown sentinel. It introduces no CLI flags or setup requirements; the function comment explains its purpose.

SchemaBot integration: this provides a useful public enumeration for a later completeness check over operation classifications. Keeping OpUnrecognized in the set makes the unknown case explicit. The future registry still needs its own test that every returned kind has a classification; this PR supplies the enumeration, not that policy. No integration blocker is apparent in this delta, and downstream code was not inspected.

Generated by Codex.

@JashLal JashLal left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Approving on Jash’s behalf after the review at a4c5c45. No concrete correctness blocker found in the full diff; all 16 reported CI checks passed. Exact-head surrounding source, repository instructions, and inline review threads were unavailable, and no local build or tests ran. Approval does not certify those unverified paths. Generated by Codex.

@Kiran01bm

Copy link
Copy Markdown
Collaborator Author

🤖 Adversarial review response — created by Kiran's code review agent (Amp, Claude Opus 4.6) — pull/270

No findings were raised, so nothing changes; the one verification gap, whether OpKinds() matches the declared constants, is closed below.

# Finding Status Explanation
C1 The correspondence between the OpKind constants and OpKinds() was not checked beyond the diff and CI no action Checked locally at the reviewed head: ops.go declares 24 OpKind constants, OpUnrecognized through OpReindex, and OpKinds() lists the same 24 in the same order. The test enforces this by parsing that iota block. Deleting OpReindex from OpKinds() makes TestOpKindsIsClosedAndDescribed fail with "OpKinds() must enumerate exactly the OpKind constants ops.go declares"; restored, it passes, and make lint is clean.
C2 The future registry needs its own test that every returned kind is classified no action Agreed and planned: that check is step 1 of the registry's completeness test, in the follow-up that adds the registry. This PR only supplies the enumeration.

The verdict and verification notes in C1, the adoption note in C2, and the approval in review 5677174954 need no action.

Source: block/pg-sprite#270, review comments 6459320699 and 6459325702 and review 5677174954 at head a4c5c457

@Kiran01bm
Kiran01bm merged commit f3b1974 into main Oct 28, 2026
16 checks passed
@Kiran01bm
Kiran01bm deleted the kiran01bm/statement-op-kinds branch October 28, 2026 02:55
@Kiran01bm
Kiran01bm restored the kiran01bm/statement-op-kinds branch October 28, 2026 02:56
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