Repository navigation
Conversation
|
Droid finished @gregns1's task —— View job Review summary (validator pass): Most of the new ISGR test helpers look solid and should reduce flakiness. One edge case remains: the snapshot API currently can’t represent or validate legacy documents that truly have no HLV, which can make “peer unchanged” assertions misleading or fail unexpectedly. |
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The new HLV comparator lacks negative coverage for current and merge-version mismatches.
Review effort: Balanced
Findings: 1
Open (2)
What changed in this PR
Adds stronger ISGR test assertions by comparing replicated document state across peers.
Changes:
- Adds reusable document replication assertion helpers.
- Validates HLVs, revision ancestry, channels, bodies, tombstones, and attachments.
- Migrates replication tests to the stronger assertions.
| File | Description |
|---|---|
rest/utilities_testing_isgr.go |
Implements ISGR document comparison helpers. |
rest/utilities_testing_isgr_test.go |
Tests encoded-revision HLV comparisons. |
rest/revocation_test.go |
Strengthens revocation replication checks. |
rest/replicatortest/replicator_test.go |
Migrates general replication assertions. |
rest/replicatortest/replicator_test_legacy_rev_test.go |
Migrates legacy-revision assertions. |
rest/replicatortest/replicator_conflict_test.go |
Strengthens conflict-resolution checks. |
rest/blip_api_crud_test.go |
Strengthens process-revision replication validation. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| source.WaitForTombstoneRevIDOnly(doc2ID, deleteVersion) | ||
| sgrRunner.RequireDocReplicated(doc2ID, source, dest, deleteVersion) |
There was a problem hiding this comment.
Drop the duplicate wait. WaitForDocReplicated already waits on source, tombstones included.
| source.WaitForTombstoneRevIDOnly(doc2ID, deleteVersion) | |
| sgrRunner.RequireDocReplicated(doc2ID, source, dest, deleteVersion) | |
| sgrRunner.WaitForDocReplicated(doc2ID, source, dest, deleteVersion) |
| sgrRunner.RequireDoc(docID, activeRT, rest.ExpectedISGRDoc{Version: expVersion}) | ||
| sgrRunner.RequireDoc(docID, passiveRT, passiveDocBeforeReplication) | ||
| } else { | ||
| sgrRunner.RequireDocReplicated(docID, activeRT, passiveRT, expVersion) |
There was a problem hiding this comment.
Race in the v4 local-wins case: expVersion.CV is read from activeRT at lines 6554-6562, right after the replication starts and often before the conflict is resolved. Local wins mints a new CV, so the wait can time out on a stale CV. Pass only the rev tree ID and check the CV source after the wait. The remote-wins branch also gets a barrier through RequireDocUnchanged.
Lines 6550-6563 are outside the diff: once this is applied, you can delete that block and use *remoteWinsVersion in the remote-wins branch.
| sgrRunner.RequireDoc(docID, activeRT, rest.ExpectedISGRDoc{Version: expVersion}) | |
| sgrRunner.RequireDoc(docID, passiveRT, passiveDocBeforeReplication) | |
| } else { | |
| sgrRunner.RequireDocReplicated(docID, activeRT, passiveRT, expVersion) | |
| sgrRunner.RequireDoc(docID, activeRT, rest.ExpectedISGRDoc{Version: expVersion}) | |
| sgrRunner.RequireDocUnchanged(docID, activeRT, passiveRT, passiveDocBeforeReplication) | |
| } else { | |
| doc := sgrRunner.WaitForDocReplicated(docID, activeRT, passiveRT, test.expectedFinalVersion) | |
| if sgrRunner.IsV4Protocol() { | |
| // local wins mints a new CV on activeRT during resolution, so only its source is known up front | |
| assert.Equal(t, activeRT.GetDatabase().EncodedSourceID, doc.HLV.SourceID) | |
| } |
There was a problem hiding this comment.
I'm made changes to make the code better on this test but we don't mint a new CV on local wins for HLV. only the rev tree ID changes.


CBG-5829
Helper function to assert on documnet details rather than just waiting for a specific version to arrive at a given peer.
Pre-review checklist
base.UD(docID),base.MD(dbName))docs/apiDependencies (if applicable)
Integration Tests