Skip to content

feat(coderd/database/migrations/chatdmig): stop route on migrations below an early-taken version - #16

Merged
ibetitsmike merged 6 commits into
mainfrom
mike/fork-upstream-stacks-1-version-guard
Nov 9, 2026
Merged

ibetitsmike merged 6 commits into
mainfrom
mike/fork-upstream-stacks-1-version-guard

Conversation

@ibetitsmike

@ibetitsmike ibetitsmike commented Nov 8, 2026 •

Copy link
Copy Markdown
Owner

Xum opened this PR on behalf of @ibetitsmike.

Part of #6.

golang-migrate keeps one version per database. When the fork takes an upstream migration from an open coder/coder branch before upstream main numbers it for good (the queue stack brings 000640_chat_queued_message_busy_behavior from coder#30073), Mike's daily server records that version. If upstream main later lands a different migration at or below it, the next sync would bring that file and golang-migrate would skip it silently.

This PR adds coderd/database/migrations/chatdmig/early.txt, the checked-in list of migrations the fork took early (<version> <name> <source>, shipped empty; the queue-stack PR adds 000640). chatdmig route now fails with exit code 1, before it writes routes.txt, when a new upstream migration that is not in the list has a version at or below a listed one. A listed migration routes normally, and a known migration that upstream renumbers is still followed by name. fork-sync already stops on any exit code other than 0 and 3, so no workflow change was needed. The README gets a short "Migrations taken early" section and lists this as a third case where a person takes over a sync.

Tests: TestRouteEarly runs route on a temp migrations tree. One case shows the guard refuses and leaves routes.txt unchanged, one shows the early migration itself routes to chatd, and three show malformed early.txt lines (field count, non-numeric and short version) fail. Each was shown to fail with the guard, the name exemption or the matching line check removed.

Validation: go vet and go test for cmd/chatdmig, chatdmig check, chatdmig route (no diff on routes.txt), and the chatdmig package suite against a scratch Postgres. No new dependencies.

Review: Codex did not answer @codex review within 30 minutes, so an Opus code-quality review of 26fff65c85 served as the interim gate: PASS with two P3 findings (README listed only two sync stops; two early.txt line checks were untested). Both are fixed in 21ed3bf068.

@ibetitsmike

Copy link
Copy Markdown
Owner Author

@codex review

@ibetitsmike

Copy link
Copy Markdown
Owner Author

@codex review

Xum (AI agent) requested this on behalf of @ibetitsmike (pstack parity lead). Codex is now installed on the fork; head 21ed3bf068.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-09T00:03:53.305807Z e62cbe2 Manual request
ℹ️ 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 chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 21ed3bf068

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

…rations against early.txt

UAT found that a migration already in routes.txt could be renumbered onto or
below an early version without route noticing, and that early entries at or
below the split were never checked. Route now checks new and renumbered
migrations, and rejects early entries at or below the split.
@ibetitsmike

Copy link
Copy Markdown
Owner Author

@codex review

Xum acted for Mike: requested review of 23b0824, which fixes UAT round 1 findings (renumbered routed migrations bypassed the early check; early entries at or below the split were never checked).

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: 23b0824f52

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

…n and validate early.txt in check

Answers Codex review: a migration listed in early.txt was compared with the
other early entries, and a malformed early.txt passed fork-ci because check
never read it. Ledger versions are now compared as numbers, so an unpadded
hand-edited line no longer looks renumbered.
@ibetitsmike

Copy link
Copy Markdown
Owner Author

@codex review

Xum acted for Mike: requested review of e62cbe2, which answers the three findings on 5623042 (two fixed, one tracked in #21).

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: e62cbe24dc

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ibetitsmike

Copy link
Copy Markdown
Owner Author

UAT

  • Round 1: FAIL on 906869fcfd9a9ad4da274aa6fd19bb3687e14548. Coder Agents chat ccd8fc6c-4efd-4e22-b05e-dae03127c06e. Found that a migration already in routes.txt could be renumbered onto or below an early version without a refusal (HIGH), and that early entries at or below the split were never checked (MEDIUM). Fixed in 23b0824f52. Two pre-existing issues are tracked in chatdmig: fork-sync masks route exit 3, and route writes routes.txt before validating #20.
  • Round 2: PASS on 5623042d9d04a8e3995a35796e4e59a6fb009dfa. Same chat ccd8fc6c-4efd-4e22-b05e-dae03127c06e. 10/10 requirements passed, including the round 1 repro (now exits 1 and leaves routes.txt byte-identical), the boundary and below-split cases, a no-false-positive case, the real tree, go test and the fork-sync simulation. One LOW finding: an unpadded routes.txt version caused a false refusal.

Head e62cbe24dc only answers review. It answers the Codex findings on 5623042d9d (every early.txt name is now exempt, and check now validates early.txt) and the round 2 LOW finding (ledger versions are compared as numbers). Each change has a test. The real tree and the queue-stack tree still route clean.

Xum acted for Mike: posted the UAT record for this PR.

@ibetitsmike

Copy link
Copy Markdown
Owner Author

Xum (AI agent) merged this on behalf of @ibetitsmike as the pstack parity lead.

Lead merge check on head e62cbe24dc: fork-ci green (run 42537838168), Codex clean on this head, 0 unresolved threads, UAT round 2 PASS on 5623042d9d with later commits answering review only (recorded above), lead diff review of main.go and early.txt passed, chatd split rules respected (chatdmig tooling only). Previous deploy c97ebc1794 confirmed healthy first.

@ibetitsmike
ibetitsmike merged commit 33b0bb6 into main Nov 9, 2026
5 checks passed
@ibetitsmike
ibetitsmike deleted the mike/fork-upstream-stacks-1-version-guard branch November 9, 2026 00:13
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