feat(eventcore-fs): replica-id fingerprint + conflict check #400
No reviewers
Labels
No labels
adr
automated
bug
chore
dependencies
documentation
enhancement
epic
github-actions
P1-high
P2-medium
P3-low
release
research
rust
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Slipstream/eventcore!400
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/392-replica-identity"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Implements issue #392 / ADR-0044: hardens replica identity for merge mode against the copy trap.
Problem
Each working copy has a machine-local
replica_id. The.gitignorekeeps it out ofgit clone, but acp -rof a working tree (including.eventcore/) can still duplicate a writer's identity — making divergent forks invisible (silent corruption, the worst failure class).Change
replica_idis bound to a working-copy fingerprint (OS machine id + absolute repo path +.gitinode), recorded in a gitignored.eventcore/replica_fingerprint. On open, a fingerprint mismatch (acp -rto a new path, a move, a restored backup) regenerates a fresh id — so the copy gets a distinct id on its next write (a detectable fork rather than silent sharing).detect_forks(andstatus/reconcile) fail loud withFsEventStoreError::ReplicaIdentityConflictwhen two concurrent transactions carry the samereplica_id— they cannot have come from one linear writer — instead of silently merging a corrupt history.FsConfig::with_replica_idsets the id verbatim for containers/CI/provisioned replicas; the collision check still applies as a backstop.FileEventStore::replica_id()exposes this clone's current write identity.Acceptance (ADR-0044)
cp -rof a working tree, then a write in the copy, yields a distinctreplica_id(proven bycp_r_of_a_working_tree_yields_a_distinct_replica_id, which actuallycp -rs the store dir and writes).replica_idwith inconsistent parent sets surfaceReplicaIdentityConflictfromdetect_forks(proven byconcurrent_transactions_sharing_a_replica_id_surface_a_conflict).Tests
replica_identity_test.rs(2 tests). Full crate suite 43 passed; workspace clippy/fmt clean (stable 1.96).Closes #392
This PR enhances the replica identity mechanism by binding it to a working-copy fingerprint and introducing a collision check during reconciliation. The changes appear well-structured and include comprehensive tests, making it safe to merge.
Walkthrough
replica_idfield toFsConfigwith a method to set it explicitly.ReplicaIdentityConflictto handle identity conflicts.load_or_create_replica_idfunction to the newreplicamodule.check_replica_collisionsto detect identity conflicts during reconciliation.LLM usage and cost
Estimated total USD: $0.040753 via https://api.openai.com and https://api.openai.com