Skip to content

Conversation

@gregns1
Copy link
Contributor

@gregns1 gregns1 commented Feb 2, 2026

CBG-4542

  • Adds config option to write to rev cache if we want to
  • By default we will not write to the rev cache on a documnet write

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 February 2, 2026 16:05
Copy link
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 introduces a configurable option to control whether document revisions are inserted into the revision cache during write operations. By default, revisions will no longer be automatically cached on write, improving memory efficiency by only caching revisions when they are read from the database.

Changes:

  • Added InsertOnWrite configuration option to RevCacheConfig with a default value of false
  • Updated tests to accommodate the new caching behavior by either enabling InsertOnWrite or explicitly loading revisions into the cache
  • Fixed test assertions to reflect the expected cache miss counts with the new default behavior

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
rest/config.go Adds the InsertOnWrite field to the RevCacheConfig struct
rest/server_context.go Propagates the InsertOnWrite configuration to revision cache options
db/revision_cache_interface.go Adds InsertOnWrite field to RevisionCacheOptions
db/crud.go Conditionally inserts revisions into cache based on InsertOnWrite setting
docs/api/components/schemas.yaml Documents the new insert_on_write API parameter
rest/revocation_test.go Enables InsertOnWrite for a test that requires revisions to be cached on write
rest/attachment_test.go Adds explicit cache preload when flushCache is false
db/revision_cache_test.go Updates cache miss count assertions and adds cache preloading where needed
rest/changestest/changes_api_test.go Re-enables skipped test and updates expected results for pruned documents

func TestChangesIncludeDocs(t *testing.T) {
base.SetUpTestLogging(t, base.LevelInfo, base.KeyNone)
t.Skip("pending CBG-4542")
base.SetUpTestLogging(t, base.LevelInfo, base.KeyAll)
Copy link

Copilot AI Feb 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Debug logging level base.KeyAll should be removed. Use base.KeyNone for test logging unless debugging is actively needed.

Copilot generated this review using guidance from repository custom instructions.
@github-actions
Copy link

github-actions bot commented Feb 2, 2026

Redocly previews

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.

2 participants