Skip to content

replay: pin buzz's unnamed ADD FOREIGN KEY as executed - #246

Merged
Kiran01bm merged 3 commits into
mainfrom
kiran01bm/replay-buzz-unnamed-fk-pin
Oct 30, 2026
Merged

Kiran01bm merged 3 commits into
mainfrom
kiran01bm/replay-buzz-unnamed-fk-pin

Conversation

@Kiran01bm

@Kiran01bm Kiran01bm commented Oct 24, 2026 •

Copy link
Copy Markdown
Collaborator

The buzz replay manifest now expects pg-sprite to execute buzz's unnamed ADD FOREIGN KEY natively, which is what the engine on main does.

Why

#219 taught the planner to state the name PostgreSQL would choose for an unnamed CHECK or FOREIGN KEY, so the NOT VALID + VALIDATE sequence can name the constraint. The buzz README already said so, but the manifest still pinned that statement as a not-native-safe-rewrite-required refusal, so make replay on main reports one mismatch and exits 1. Replay fetches its corpus from GitHub and is an operator-run assessment rather than a CI gate, which is why nothing flagged it.

What

  • replay/buzz/assessment.tsv: row 0006 128-130 is now execute, and its comment names the constraint it creates.
  • replay/buzz/README.md: the boundary-facts bullet now says why the constraint is named (the VALIDATE step needs it) and how the name is derived — PostgreSQL's <table>_<columns>_fkey, truncated and numbered as the server does — with this fixture's name as the example.

Before / after

The same corpus statement, 0006_moderation.sql lines 128–130, against the engine on main:

ALTER TABLE moderation_reports
    ADD FOREIGN KEY (community_id, action_id)
    REFERENCES moderation_actions (community_id, id);

Before
  manifest expects  refuse:not-native-safe-rewrite-required
  engine does       executed-natively (exit 0)
  replay reports    FAIL, mismatches 1, make replay exits 1

After
  manifest expects  execute
  engine does       executed-natively, as NOT VALID + VALIDATE under the name
                    moderation_reports_community_id_action_id_fkey
  replay reports    PASS, mismatches 0, "every assessed statement matched"

🤖 Generated with Amp (Claude Opus 4.6)

The planner now names an unnamed constraint so its NOT VALID + VALIDATE
sequence can run, so the pinned refusal no longer matches and make replay
fails on main.
Keeps this branch's unnamed-FK bullet in replay/buzz/README.md beside
main's new destructive-change bullet.
@Kiran01bm
Kiran01bm marked this pull request as ready for review October 29, 2026 01:19
@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-29T01:19:35.041286Z
We couldn’t complete this review. Comment @codex review to try again.
ca66370 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 29, 2026

Copy link
Copy Markdown
Collaborator

🤖 Reviewed by Jash's AI agent at ca66370219dc875619be4fe5d3838beb5768c009.

The manifest change is consistent with the intended native execution path; no blocker found in the full diff. Only the 0006 128-130 assessment changes from refusal to execute, and the nearby explanation names the constraint needed by the subsequent VALIDATE step. The README now explains that naming requirement more clearly.

  1. (Optional) Add a targeted replay check for this fixture to CI, or record the exact replay command/result in the test plan. The failure described here is a stale expected outcome that ordinary green CI did not catch; exercising the manifest against the engine would catch the next drift.
  2. (Description correction) The current base README already says this foreign key executes via NOT VALID + VALIDATE; only the assessment still expects refusal. Update the description's claim that the README previously said it was refused.

Validation: reviewed the complete two-file diff and PR discussion; all 16 reported CI checks pass, including PostgreSQL 14–18. I did not run replay, a build, or tests locally. Fetching surrounding source at this head failed with error connecting to api.github.com, so I could not independently verify the planner's name generation or reproduce the replay result. The separate automated review reported a usage-limit failure.

@JashLal

JashLal commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

🤖 Product review at ca66370:

OSS adoption: Aligning the replay expectation with the documented execution path should remove a misleading replay failure. Explaining why validation needs an explicit constraint name makes the example easier to follow. Treat the displayed name as this fixture's example rather than a complete promise about identifier truncation or name collisions.

SchemaBot integration: This diff changes a replay expectation and documentation only; it introduces no library API, error-classification, or execution-policy change for consumers. No integration blocker identified within that scope.

@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 above at ca66370. The comments describe findings and verification limits; no local replay, build, or tests were run.

@Kiran01bm

Copy link
Copy Markdown
Collaborator Author

🤖 Adversarial review response — created by Kiran's code review agent (Amp, Claude Opus 4.6) — pull/246, follow-up commit

No blockers. The description and the README naming note are fixed; the replay result is re-confirmed, but replay stays out of CI by design.

# Finding Status Explanation
C1-F2 The description wrongly says the base README called this foreign key refused fixed The PR description now says the README already described the execution and only the manifest was stale.
C2 Treat the displayed name as this fixture's example, not a promise about truncation or collisions fixed The README now gives the pattern as PostgreSQL's <table>_<columns>_fkey, truncated to the identifier limit and numbered past a taken name as the server does, with this fixture's name as the example. defaultConstraintName in pkg/statement/rewrite.go implements both rules.
C1-F1 Add a replay check to CI, or record the replay command and result rejected Replay fetches a third-party corpus from GitHub and needs a container, so replay/README.md keeps it an operator-run assessment rather than a merge gate; the Go suite is the correctness oracle. The result is recorded: make replay at this head reports 0 mismatches and "every assessed statement matched its expected verdict".

Source: block/pg-sprite#246, review comments 6485785874 and 6485788262 and review 5691976215 at head ca663702; fixes in the follow-up commit.

@Kiran01bm
Kiran01bm enabled auto-merge (squash) October 30, 2026 00:35
@Kiran01bm
Kiran01bm merged commit d7fcbaa into main Oct 30, 2026
16 checks passed
@Kiran01bm
Kiran01bm deleted the kiran01bm/replay-buzz-unnamed-fk-pin branch October 30, 2026 00:45
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