Skip to content

CBG-4429: Audit with CV as doc version where possible#7726

Merged
bbrks merged 4 commits into
mainfrom
CBG-4429
Sep 3, 2025
Merged

CBG-4429: Audit with CV as doc version where possible#7726
bbrks merged 4 commits into
mainfrom
CBG-4429

Conversation

@bbrks
Copy link
Copy Markdown
Member

@bbrks bbrks commented Sep 3, 2025

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

Copilot AI review requested due to automatic review settings September 3, 2025 11:13
Copy link
Copy Markdown
Contributor

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

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

Comment thread db/crud.go Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@bbrks bbrks merged commit 32b6ca1 into main Sep 3, 2025
42 checks passed
@bbrks bbrks deleted the CBG-4429 branch September 3, 2025 14:36
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.

3 participants