fix: Always write sync status instead of comparing against stale cache - #261
Merged
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Stale cached status can still produce an incorrect lastTransitionTime.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Ensures reconciliation status patches are always written to avoid stale-cache races.
Changes:
- Always patches computed status.
- Skips status writes after successful deletion reconciliation.
- Updates the deleted-resource test.
File summaries
| File | Description |
|---|---|
src/controller.rs |
Revises status patching and deletion behavior. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 1
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| // Always write the status. Deciding off the cached resource_sync.status races with our own | ||
| // patches: a retry can start before the cache has seen the previous write, skip the patch, and | ||
| // leave the condition latched at the wrong value. A no-op patch does not bump resourceVersion. | ||
| if let Some(status) = reconcile_status(&resource_sync, &result) { |
hansenreid
approved these changes
Sep 2, 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.
Follow-up to #260. The status patch was still gated on comparing the computed status against the cached object, which races with our own writes: a retry can start before the cache has seen the failure patch, compute False equal to the stale cached status, skip the patch, and leave the condition latched at True. We're seeing exactly this in prod, a reconcile fails, succeeds 90ms later on retry, and the condition stays True indefinitely.