fix(governance-store): propagate cascade_seq store read error#3015
Merged
Conversation
CascadeUpgrade::apply computed the migration's governance-position pin (`cascade_seq`) with `.ok()`/`.flatten()`, swallowing both the namespace resolve error and the gov-head read error. A transient store read failure would pin `cascade_seq = None` on the affected node while peers that read successfully pinned `Some(seq)` for the same op, diverging the cohort comparison the migration-status rollup performs. Propagate the read error via `?` instead. A genuinely-absent gov-head still yields `None` (no pin); only an actual store error now fails the apply, keeping the pinned state deterministic across nodes. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011sjZkyNWU9gHaSjnVTfnaV
Contributor
There was a problem hiding this comment.
🤖 MeroReviewer
Reviewed by 1 agents | Quality score: 85% | Review time: 137.3s
✅ No Issues Found
All agents reviewed the code and found no issues. LGTM! 🎉
🤖 Generated by MeroReviewer | Review ID: review-f7991528
Contributor
Documentation ReviewThe following documentation may need updates based on the changes in this PR:
|
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.
Description
This PR fixes a critical error handling bug in the cascade upgrade logic that could cause cohort divergence across the cluster.
The Problem:
The code was using
.ok()to swallow read errors when fetching the namespace governance head, treating transient store errors the same as genuinely-absent heads. This is unsafe because:cascade_seqtoNonecascade_seqtoSome(seq)The Fix:
Changed the error handling to propagate read errors with
?while still allowing genuinely-absent heads to result inNone. This ensures:NonepinsThe refactoring also improves code clarity by separating the namespace resolution from the head lookup, making the error handling intent explicit.
Test plan
Existing tests cover the cascade upgrade logic. The change is defensive—it prevents a failure mode rather than adding new functionality. CI should pass with no additional test changes needed.
Wire contract (SDK gate)
N/A — no HTTP wire DTOs or routes changed.
Documentation update
N/A — internal implementation detail.
https://claude.ai/code/session_011sjZkyNWU9gHaSjnVTfnaV