fix(state): make foundation migrations failure-atomic - #216
Draft
seonghobae wants to merge 5 commits into
Draft
Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This was referenced Sep 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #80 #192 #213. Draft child of exact #212@
32b070c3ef2456efc58dc56733531f24fcbaf4f3.Executed hostile RED
Test-only exact
284ea3c4188f8533416a6ac68cdda6325c5565d6left production migrations byte-identical to #212 and added onlytests/postgres_foundation_migration_atomicity.rs.Hosted CI
34257768388, rust job102167794974, acquired GitHub-hostedubuntu-24.04, passed exact checkout/toolchain/cargo fmt --check, then failed inTest; Clippy was skipped. The parent exact head was already GREEN and the only child semantic delta was the two PostgreSQL 18.4 hostile regressions:CREATE TABLE reputation_source_generationand before privilege/RLS/policy completion, then requires no generation table to survive and clean replay to succeed;CREATE FUNCTION wardnet_admit_reputation_source_generationand before PUBLIC execution revocation, then requires 0001 to remain, the partial function to be absent, and clean 0002 replay to succeed.This is semantic migration-failure RED, not runner/bootstrap/formatting noise.
Minimal causal repair and exact-current GREEN
Current exact head is
7c7b980b7a2f41e2a369a71bb32e945de7f30bfd, five commits ahead and zero behind exact parent #212. The complete child delta is five files only: the hostile PostgreSQL regression, explicit transaction bracketing in forward migrations 0001 and 0002, one Proposed ADR covering the complete 0001→0003 failure-atomic boundary, and the Unreleased CHANGELOG entry.The production repair is PostgreSQL-native and minimal: 0001 and 0002 now each own one explicit
BEGIN/COMMITtransaction, matching 0003. It does not addIF NOT EXISTS, normalize unknown partial state, create cluster roles, weaken FORCE RLS/privileges, enableStateAuthority::Postgres, or introduce foreign-owner behavior.Hosted CI
34258628942, rust job102170699585, is terminal SUCCESS on unchanged exact7c7b980b...: hostedubuntu-24.04acquisition, exact checkout, pinned toolchain, formatting, all locked workspace tests including both PostgreSQL 18.4 injected foundation-migration rollback/replay regressions and the existing publication/recovery suites, and strict Clippy all passed.Submitted reviews: 0. No predecessor result is promoted as current-head GREEN.
Remaining stack and recovery boundary
Keep Draft behind #212. #210 remains the next recovery-order invariant: after 0003 rollback/reapply recreates the
SECURITY DEFINERpublication function under the migration principal, deployment must reconverge the existing idempotentdeploy/postgresql/reputation_state_roles.sqlbefore runtime publication authority is considered restored. Do not move role creation into schema migrations to manufacture recovery GREEN.#80/#192 still own actual deployment-principal mapping, repository/transaction wiring, pooled tenant-context checkout/reset, crash/retry, backup/restore and immutable protected release acceptance.
StateAuthority::Postgresremains fail closed.No force update, destructive rebase, predecessor evidence reuse, self/model approval, routine bypass, gate weakening, no-op workflow churn, mutable foreign dependency, source copy or cross-service SQL.