Skip to content

fix replacement command invariants - #56

Merged
rdlabo merged 1 commit into
mainfrom
fix/replace-prepared-invariants
Aug 11, 2026
Merged

fix replacement command invariants#56
rdlabo merged 1 commit into
mainfrom
fix/replace-prepared-invariants

Conversation

@rdlabo

@rdlabo rdlabo commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

What changed

  • make replacePrepared preserve the replaced command's queue position
  • reject replacement when another command exists for the same aggregate
  • require replacement commands to preserve the companion-key footprint
  • normalize optimistic companion confirmedValues at the Kit persistence boundary
  • derive the persisted replica transaction from normalized companion metadata

Why

Devin identified two replacement invariants that were not closed by PR #55: replacing a command could orphan companion optimistic state, and a replacement could move behind later commands for the same aggregate. Follow-up review also found that raw product companion rows could overwrite the authoritative confirmed baseline.

The replacement contract is now deliberately narrow: it atomically substitutes the only command for an aggregate, at the same queue position and with the same projection responsibility. Optimistic projections cannot change the confirmed baseline.

Validation

  • Kit focused offline sync: 108/108 passed
  • Kit full suite: 43 files / 721 tests passed
  • npm run lint -- --quiet passed
  • git diff --check passed
  • manager review: APPROVE
  • third-party acceptance review: APPROVE

@netlify

netlify Bot commented Aug 11, 2026

Copy link
Copy Markdown

Deploy Preview for rdlabo-ionic-angular-library ready!

Name Link
🔨 Latest commit 486e3d3
🔍 Latest deploy log https://app.netlify.com/projects/rdlabo-ionic-angular-library/deploys/6a7b51a9fa887d0008b8aab8
😎 Deploy Preview https://deploy-preview-56--rdlabo-ionic-angular-library.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@rdlabo
rdlabo marked this pull request as ready for review August 11, 2026 16:45

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 3 additional findings.

Open in Devin Review

@rdlabo
rdlabo merged commit c689a95 into main Aug 11, 2026
12 checks passed
@rdlabo
rdlabo deleted the fix/replace-prepared-invariants branch August 11, 2026 16:51
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