Skip to content

feat(workflow): review coverage survives a migration renumber merge (PP-ncxx.4) - #2436

Closed
timothyfroehlich wants to merge 11 commits into
mainfrom
fix/PP-ncxx.4-renumber-merge-coverage
Closed

timothyfroehlich wants to merge 11 commits into
mainfrom
fix/PP-ncxx.4-renumber-merge-coverage

Conversation

@timothyfroehlich

Copy link
Copy Markdown
Owner

Summary

Implements the §8.12 change approved in #2434 (PP-ncxx.4). A merge of main whose only resolution renumbers the branch's migrations now keeps the PR's review coverage, so a renumber no longer needs a new review round.

_is_pure_merge_from_main still accepts clean merges. A merge commit that doesn't match the clean merge now goes through _is_migration_renumber_merge, which requires all of the following:

  • The clean merge conflicts only under drizzle/, and every path outside drizzle/ matches it.
  • Main's drizzle/ files are unchanged; only the journal grows.
  • The journal is main's entries followed, in order, by one entry per branch migration. Each has the same name, the next idx (matching its file number), and a when later than everything before it.
  • Each renumbered .sql is byte-identical to the reviewed one (same blob).
  • The only files added under drizzle/ are those entries' SQL and snapshots.

Snapshots aren't compared: they're regenerated and hold no SQL that runs. Inherited coverage now records inherited_via, so the gate and handoff text print "migration renumber merge from main" instead of "pure merge from main".

Also updates AGENTS.md §5 and the pinpoint-pr-workflow skill.

Merge order: #2434 (spec), then #2427 (adds db-renumber-migration.sh, which the skill text names), then this. After #2434 lands I'll merge main here and delete its divergence row.

Test plan

  • pnpm run check; pnpm run check:python (554 passed)
  • New test_pr_gates.py cases: a renumber merge inherits the record with the new message; five variants stay stale (renumbered SQL changed, when not later, a change outside drizzle/, main's migration edited, the old SQL file left behind); a clean merge still reports "pure merge from main"

🤖 Generated with Claude Code

…PP-ncxx.4)

_is_pure_merge_from_main now also accepts a merge of main whose only
resolution renumbers the branch's Drizzle migrations after main's: conflicts
only under drizzle/, everything else equals the clean merge, main's drizzle/
untouched, and each renumbered migration keeps its name, gets the next idx
and a later when, and has byte-identical SQL. Gate and handoff text name
which rule carried the coverage.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
pin-point Ready Ready Preview Oct 7, 2026 2:14am UTC

Request Review

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On a runner with no global git user, git refuses to start a merge, so the
conflict fixtures produced an ordinary commit instead of a merge commit.
The existing conflict-resolution test passed without ever exercising a
merge; the new renumber test failed. Both now pass the identity env and
assert MERGE_HEAD exists.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- the branch may change nothing under drizzle/ but its own migrations and
  the journal, so taking main's drizzle/ cannot drop a reviewed edit
- journal top-level fields and the renumbered entries' other fields must
  match
- merge-tree runs once per merge commit
- tests for an extra snapshot, a changed journal field, an edited main
  entry, a dropped branch edit, and a conflict outside drizzle/
- skill: a hand-resolved conflict outside drizzle/ still needs a review

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- the branch journal must be the merge base's journal plus appended
  entries, so a reviewed edit to an existing entry or field is not dropped
- jq fails with error() instead of a FAIL marker a tag name could contain
- parse merge-tree's conflicted section with awk, stopping at the first
  blank line
- tests for two branch migrations, a tag containing FAIL, a later clean
  merge keeping the renumber label, and a dropped journal edit

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…mber (PP-ncxx.4)

A conflict-free merge whose tree differs from the clean merge reached the
renumber check, so a merge that edited the branch's own snapshot inherited
coverage. Require a drizzle/ conflict and a higher idx for every entry.
Qualify the AGENTS.md §8.12 reference.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…md and REVIEW.md (PP-ncxx.4)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@timothyfroehlich

Copy link
Copy Markdown
Owner Author

Claude Code review (medium)

Reviewed head 3c83067 with /code-review medium. 60 findings: 15 fixed, 45 declined.

Round Finding Disposition
1 scripts/workflow/_pr-gates.sh — A renumber merge that also resolved a conflict outside drizzle/ (schema.ts) goes stale although the docs suggest it is covered Fixed in 9e9ba38
1 scripts/workflow/_pr-gates.sh — A reviewed branch edit under drizzle/ other than its migration is silently dropped while coverage carries over Fixed in 9e9ba38
1 scripts/workflow/_pr-gates.sh — Journal top-level fields and the added entries' version/breakpoints are not compared Fixed in 9e9ba38
1 scripts/workflow/_pr-gates.sh — With criss-cross history a single git merge-base can miscompute the branch's migrations Declined: A wrong merge base can only make the check fail (stale, so a normal review), never pass: each pair still needs a matching name and byte-identical SQL.
1 scripts/workflow/_pr-gates.sh — merge-tree runs twice per non-clean merge commit, and the whole check repeats for each checker Fixed in 9e9ba38
1 .agents/skills/pinpoint-pr-workflow/SKILL.md — Docs name db-renumber-migration.sh and the new §8.12, neither on main yet Declined: The merge orchestrator sequences #2434 and #2427 before this PR, and main is merged in to drop the divergence row before handoff.
1 scripts/workflow/_pr-gates.sh — Changes §8.12 behavior without a same-PR spec update or divergence row Declined: Tim wants spec changes merged ahead of the implementation; #2434 carries the approved §8.12 text and the divergence row, which this PR deletes after merging main.
1 scripts/tests/test_pr_gates.py — Several enforced conditions have no negative test Fixed in 9e9ba38
1 scripts/workflow/_pr-gates.sh — Regenerated snapshots are not compared, so a corrupted snapshot inherits coverage Declined: Approved §8.12 requires byte-identical SQL; drizzle-kit regenerates the snapshot by design, and comparing it would mean reimplementing drizzle-kit's schema diff.
2 scripts/workflow/_pr-gates.sh — Branch-side journal edits to existing entries or top-level fields are dropped while coverage carries over Fixed in 99c9e1e
2 scripts/workflow/_pr-gates.sh — The regenerated snapshot's prevId is not checked Declined: CI's migration order check fails a broken prevId chain on every PR head, so such a merge cannot pass CI.
2 .agents/skills/pinpoint-pr-workflow/SKILL.md — Docs name db-renumber-migration.sh, which is not on main yet Declined: Declined in round 1: the orchestrator merges #2427 before this PR.
2 scripts/workflow/_pr-gates.sh — Code cites §8.12 conditions but the spec on this branch still says one exception Declined: Declined in round 1: #2434 carries the approved spec and divergence row and merges first.
2 scripts/workflow/_pr-gates.sh — A migration on both sides (cherry-picked) makes a valid renumber merge stale Declined: Stale only means a normal review; cherry-picked migrations are not a PinPoint workflow.
2 scripts/workflow/_pr-gates.sh — A tag containing FAIL rejects a valid renumber merge Fixed in 99c9e1e
2 scripts/workflow/_pr-gates.sh — sed range misparses merge-tree output when the conflicted section is empty Fixed in 99c9e1e
2 scripts/tests/test_pr_gates.py — No tests for two branch migrations or a renumber merge followed by a clean merge Fixed in 99c9e1e
2 scripts/workflow/_pr-gates.sh — The merge analysis repeats for the Claude and Codex checkers and across scripts Declined: Gate calls run a handful of times per PR; memoizing would add state to a sourced library for no user-visible gain.
2 scripts/workflow/_pr-gates.sh — The pure-merge fallback label is repeated in three consumers Declined: The default keeps older summaries readable and is one phrase; centralizing it adds a helper three call sites must import.
3 .agents/skills/pinpoint-pr-workflow/SKILL.md — db-renumber-migration.sh is not in the repo Declined: Re-raised round-1 decline: #2427 adds it and merges first; main is merged in before handoff.
3 scripts/workflow/_pr-gates.sh — The deployment skill's regenerate protocol produces new tag names the gate rejects Declined: #2427 replaces that protocol with db-renumber-migration.sh, which keeps the tag name and SQL; it merges first.
3 docs/feature-specs/pr-lifecycle-monitoring.md — §8.12 not updated in this PR Declined: Re-raised round-1 decline: #2434 carries the approved spec change and merges first.
3 scripts/workflow/_pr-gates.sh — Regenerated snapshot content and prevId are not checked Declined: Re-raised round-2 decline: CI's migration order check fails a broken prevId chain on every PR head.
3 scripts/workflow/_pr-gates.sh — Byte-identical SQL may mean something different after main's new migration Declined: A clean merge of main carries the same new-context risk and §8.12 accepts it; CI applies every migration in order and fails a broken one.
3 scripts/workflow/_pr-gates.sh — The merge kind travels through a global variable Declined: The two callers read it on the next line; returning it via stdout would need a subshell around a function that also sets no other state.
3 scripts/workflow/_pr-gates.sh — clean_tree is parsed from merge-tree output in two places Declined: One head -n1 on a value passed in; adding a parameter for it does not reduce risk.
3 scripts/workflow/merge-handoff.sh — The renumber label in the handoff output has no test Fixed in 4fd1ef6
4 .agents/skills/pinpoint-pr-workflow/SKILL.md — db-renumber-migration.sh is not in the repo Declined: Re-raised: #2427 adds it and merges before this PR.
4 scripts/workflow/_pr-gates.sh — The documented regenerate protocol produces a new tag name the gate rejects Declined: #2427 replaces that protocol with db-renumber-migration.sh, which regenerates with --name to keep the tag; it merges first.
4 AGENTS.md — The gate implies hand-editing the journal, contradicting 'never resolve drizzle/meta manually' Declined: The script regenerates the journal with drizzle-kit; nothing is hand-edited. #2427's skill text documents that path.
4 scripts/workflow/_pr-gates.sh — New snapshot content is never checked Declined: Re-raised round-2 decline: CI's order check fails a broken prevId chain; content is regenerated by drizzle-kit.
4 scripts/workflow/_pr-gates.sh — A conflict-free merge that edits the branch's own snapshot passes as a renumber merge Fixed in 828f310
4 scripts/workflow/_pr-gates.sh — Byte-identical SQL may mean something different after main's new migrations Declined: Re-raised round-3 decline: a clean merge carries the same risk and CI applies every migration in order.
4 scripts/workflow/_pr-gates.sh — Header comment misstates which when the new entry must exceed Fixed in 828f310
4 scripts/workflow/_pr-gates.sh — Merge analysis repeats per checker Declined: Re-raised round-2 decline.
4 AGENTS.md — Bare (§8.12) reference is ambiguous inside AGENTS.md Fixed in 828f310
5 .agents/skills/pinpoint-pr-workflow/SKILL.md — db-renumber-migration.sh is not on main Declined: Re-raised: #2427 adds it and merges before this PR.
5 scripts/workflow/_pr-gates.sh — Renumbered snapshot content is never checked Declined: Re-raised round-2 decline: CI's order check fails a broken prevId chain; drizzle-kit regenerates content.
5 scripts/workflow/_pr-gates.sh — Byte-identical SQL may mean something different after main's migrations Declined: Re-raised round-3 decline.
5 scripts/workflow/_pr-gates.sh — A schema.ts conflict disqualifies the merge, though the script expects one resolved first Declined: Deliberate: a hand-resolved schema.ts is a change someone has to review (§8.12: every path outside drizzle/ matches the clean merge); the docs now state the condition.
5 AGENTS.md — AGENTS.md and REVIEW.md omit the conditions the gate enforces Fixed in a28cd47
5 scripts/workflow/_pr-gates.sh — Gate supports N renumbered migrations while the script supports one Declined: The manual protocol can renumber several; the N case is tested (two_migrations), and restricting to one would refuse a valid merge.
5 scripts/workflow/_pr-gates.sh — Merge kind returned through a global Declined: Re-raised round-3 decline.
5 scripts/workflow/_pr-gates.sh — Merge analysis repeats per checker Declined: Re-raised round-2 decline.
6 scripts/workflow/_pr-gates.sh — Regenerated snapshot content is not checked Declined: Re-raised round-2 decline: CI's order check fails a broken prevId chain on every PR head.
6 .agents/skills/pinpoint-pr-workflow/SKILL.md — db-renumber-migration.sh is not on main Declined: Re-raised: merge order is #2427 then this PR; the orchestrator sequences it.
6 scripts/workflow/_pr-gates.sh — A schema.ts conflict disqualifies the merge Declined: Re-raised round-5 decline: deliberate, and AGENTS.md/REVIEW.md now state the drizzle/-only condition.
6 scripts/workflow/_pr-gates.sh — Merge kind returned through a global Declined: Re-raised round-3 decline.
6 scripts/tests/test_pr_gates.py — No test for successive renumber merges or reversed parent order Fixed in 3c83067
6 scripts/tests/test_merge_handoff.py — drizzle_files duplicates write_migrations Declined: A 15-line test fixture in two test files; below the Rule of Three, and the two harnesses build repos differently.
6 scripts/workflow/_pr-gates.sh — Merge analysis repeats per checker Declined: Re-raised round-2 decline.
6 scripts/workflow/_pr-gates.sh — idx arithmetic assumes contiguous journal idx Declined: CI's order check enforces idx == position on every PR, so main's journal cannot gain a gap.
7 scripts/workflow/_pr-gates.sh — Gate checks the merge's shape, not that the renumber script's checks ran Declined: Re-raised (rounds 3 and 5): approved §8.12 requires byte-identical SQL, and CI applies every migration in order.
7 .agents/skills/pinpoint-pr-workflow/SKILL.md — db-renumber-migration.sh is not on main Declined: Re-raised: merge order is #2427 then this PR.
7 scripts/workflow/_pr-gates.sh — Renumbered snapshot is accepted without a check Declined: Re-raised round-2 decline.
7 scripts/workflow/_pr-gates.sh — A schema.ts conflict disables inheritance Declined: Re-raised round-5 decline.
7 scripts/workflow/_pr-gates.sh — Inheritance label returned through a global Declined: Re-raised round-3 decline.
7 scripts/workflow/_pr-gates.sh — Merge analysis repeats per checker Declined: Re-raised round-2 decline.
7 scripts/workflow/_pr-gates.sh — inherited_via fallback repeated in three consumers Declined: Re-raised round-2 decline.
7 scripts/tests/test_merge_handoff.py — drizzle_files duplicates write_migrations Declined: Re-raised round-6 decline.

—Claude

@timothyfroehlich

Copy link
Copy Markdown
Owner Author

Shelved: with CORE-ARCH-017 (#2449) moving migrations into their own early PRs, renumber collisions should be rare and cheap, so this tooling isn't worth finishing now. The branch is kept for revival. —Claude

This branch was successfully deployed

1 active deployment
Preview — 3c83067b Deployed Oct 7, 2026 by vercel[bot]
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