Skip to content

CBG-5134: attachment fetch is in wrong place when loading from bucket by CV#8032

Merged
bbrks merged 4 commits intomainfrom
CBG-5134
Jan 28, 2026
Merged

CBG-5134: attachment fetch is in wrong place when loading from bucket by CV#8032
bbrks merged 4 commits intomainfrom
CBG-5134

Conversation

@gregns1
Copy link
Copy Markdown
Contributor

@gregns1 gregns1 commented Jan 27, 2026

CBG-5134

  • Was always fetch current revision attachments when loading from bucket. This is not correct when dealing with backup revision.

Pre-review checklist

  • Removed debug logging (fmt.Print, log.Print, ...)
  • Logging sensitive data? Make sure it's tagged (e.g. base.UD(docID), base.MD(dbName))
  • Updated relevant information in the API specifications (such as endpoint descriptions, schemas, ...) in docs/api

Dependencies (if applicable)

  • Link upstream PRs
  • Update Go module dependencies when merged

Integration Tests

Copilot AI review requested due to automatic review settings January 27, 2026 12:57
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 fixes a bug where attachment fetching was incorrectly occurring when loading backup revisions from the bucket. The fix ensures that attachments are only fetched for the current revision, not for backup revisions accessed by their current version (CV).

Changes:

  • Moved attachment fetching logic inside the conditional block that handles current revision loading
  • Added test coverage to verify that fetching a backup revision (when the current revision has attachments) correctly returns an empty attachments map

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
db/revision_cache_interface.go Moved attachments = doc.Attachments() inside the conditional block to prevent fetching attachments for backup revisions
db/attachment_test.go Added test to verify backup revision retrieval doesn't incorrectly fetch current revision attachments
Comments suppressed due to low confidence (1)

db/attachment_test.go:11

  • The fmt import is used only for fmt.Sprintf in test setup code. This is acceptable for tests, but verify that no debug logging with fmt.Print* functions remains in the codebase.
import (

bbrks
bbrks previously approved these changes Jan 27, 2026
@bbrks bbrks enabled auto-merge (squash) January 28, 2026 11:17
@bbrks bbrks merged commit 5ae1cfa into main Jan 28, 2026
43 of 44 checks passed
@bbrks bbrks deleted the CBG-5134 branch January 28, 2026 11:24
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