Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR updates audit logging to use Current Version (CV) as the document version where possible, improving consistency with the new version vector approach. The changes address CBG-4429 by preferring CV over RevTreeID in audit events while maintaining backwards compatibility.
Key changes:
- Introduces
CVOrRevTreeID()helper methods that prefer CV but fallback to RevTreeID - Updates audit logging calls to use CV where the document state is available
- Maintains RevTreeID usage for attachment events where CV is not yet determined
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| db/document.go | Adds CVOrRevTreeID() helper methods for SyncData and DocVersion structs |
| db/database.go | Updates document resync audit to use CV when available |
| db/crud.go | Updates document update/delete audit events to use CV, keeps RevTreeID for attachment events with explanatory comment |
| rest/audit_test.go | Updates test assertions to use CV, fixes require.Equal parameter order, and removes HLV skip condition |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
torcolvin
approved these changes
Sep 3, 2025
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.
CBG-4429
Some cases aren't possible to use CV (i.e. attachments being written before the document has been written - reliant on CAS macro expansion to determine CV) - they are kept as RevTree IDs with a comment explaining why. This is considered a known-issue that we may not fix.
Integration Tests
GSI=true,xattrs=truehttps://jenkins.sgwdev.com/job/SyncGatewayIntegration/62/