Skip to content

Avoid pushing null values into KVCachedFile cache#440

Merged
ihtefyw merged 1 commit into
mainfrom
luigi/null-value-kv-cached-file
Jul 24, 2026
Merged

Avoid pushing null values into KVCachedFile cache#440
ihtefyw merged 1 commit into
mainfrom
luigi/null-value-kv-cached-file

Conversation

@ihtefyw

@ihtefyw ihtefyw commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Currently, querying a value from the file in the kv_cached_file could result into pushing a null value into the cache if it was not present on the file.
This PR fixes it and adds a test for it

Copilot AI left a comment

Copy link
Copy Markdown

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 prevents KVCachedFile.Get from caching missing keys by returning early when the underlying KVFile.Get returns nil, and adds a test to ensure the cache remains unmodified on such misses.

Changes:

  • Add an early return in KVCachedFile.Get when the backing file returns nil (unknown key).
  • Extend the existing “unknown key” test to assert the cache does not contain the key after the miss.

Reviewed changes

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

File Description
go/backend/kv_file/kv_cached_file.go Avoids caching absent values by returning immediately when the backing file returns nil.
go/backend/kv_file/kv_cached_file_test.go Adds an assertion that a miss (Get returning nil) does not populate the cache.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov

codecov Bot commented Jul 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
go/backend/kv_file/kv_cached_file.go 85.71% <100.00%> (+0.24%) ⬆️

... and 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ihtefyw
ihtefyw merged commit 0c1a2f6 into main Jul 24, 2026
5 checks passed
@ihtefyw
ihtefyw deleted the luigi/null-value-kv-cached-file branch July 24, 2026 14:22
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