Skip to content

fix(store): apply repairable cloud-upgrade mutations even when a blocker is queued#452

Merged
Alan-TheGentleman merged 1 commit into
mainfrom
fix/cloud-repair-partial-apply-446
May 29, 2026
Merged

fix(store): apply repairable cloud-upgrade mutations even when a blocker is queued#452
Alan-TheGentleman merged 1 commit into
mainfrom
fix/cloud-repair-partial-apply-446

Conversation

@Alan-TheGentleman
Copy link
Copy Markdown
Collaborator

Summary

Closes #446engram cloud upgrade repair --apply was all-or-nothing: if any non-repairable blocker existed among repairable findings, it returned Applied: false and repaired nothing. The message also named Findings[0] (lowest seq, usually a repairable entry) instead of the actual blocker.

Change

RepairCloudUpgrade (internal/store/store.go): when both repairable findings and a blocker are present with apply: true, apply the repairable subset first, then return Class: Blocked with Applied: true, the count repaired, and the actual blocker's seq + entity_key in the message.

Test plan

TDD red→green. New sub-test seeds a low-seq repairable mutation + a high-seq blocker, calls RepairCloudUpgrade(apply: true), and asserts Applied: true, Class == Blocked, and the message names the blocker's seq (not the repairable entry). go test ./internal/store/... and -race clean.

Notes

Passed adversarial review: partial apply runs in its own withTx (atomic), is idempotent (re-running skips repaired entries), and the only non-test caller makes no control-flow decision on Applied.

…ker is queued (#446)

Previously RepairCloudUpgrade returned Applied:false and skipped all repairs
when BlockedCount > 0, even if RepairableCount was also > 0. The message also
always picked Findings[0] (lowest seq, often a repairable entry) instead of
the first non-repairable finding, and omitted entity_key.

Now the repairable subset is applied first inside the existing transaction
path; the blocked report then carries Applied:true, accurate counts, and a
message that scans Findings for the first non-repairable entry (with
entity_key) so operators see the actual blocker.
Copilot AI review requested due to automatic review settings May 29, 2026 12:15
@Alan-TheGentleman Alan-TheGentleman added the type:bug Bug fix label May 29, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes issue #446 where engram cloud upgrade repair --apply aborted the entire repair pass when any non-repairable blocker existed among findings, and produced a misleading manual-action message pointing at Findings[0] (lowest seq) rather than the actual blocker.

Changes:

  • In RepairCloudUpgrade, apply the repairable subset when apply=true regardless of whether a blocker is present, then return Class=Blocked with Applied=true.
  • Select the message finding by scanning for the first non-repairable entry (instead of Findings[0]) and include entity_key in the formatted message; differentiate messages for apply=true mixed vs apply=false mixed vs blocker-only cases.
  • Add a regression sub-test seeding a low-seq repairable observation mutation and a high-seq blocked relation mutation, asserting Applied=true, Class=Blocked, and that the message names the blocker's seq and entity_key.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
internal/store/store.go Restructures RepairCloudUpgrade to apply repairable subset before reporting blockers, picks the real blocker for the message, and adds entity_key to manual-action text.
internal/store/store_test.go New sub-test under TestUpgradeRepairDryRunAndApply covering the mixed repairable+blocked scenario described in #446.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Alan-TheGentleman Alan-TheGentleman merged commit 1858513 into main May 29, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type:bug Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cloud upgrade repair: aborta findings reparables ante un blocker y el mensaje apunta al seq equivocado

2 participants