Skip to content

Conversation

@C-Pro
Copy link
Owner

@C-Pro C-Pro commented Dec 4, 2025

allow KVCache ListByPrefix to be accessed from Locker and Updater wrappers

@codecov
Copy link

codecov bot commented Dec 4, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.24%. Comparing base (6be9a39) to head (d4da89d).
⚠️ Report is 6 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #18      +/-   ##
==========================================
+ Coverage   97.98%   99.24%   +1.26%     
==========================================
  Files           8        8              
  Lines        1190     1192       +2     
==========================================
+ Hits         1166     1183      +17     
+ Misses         18        7      -11     
+ Partials        6        2       -4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

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 enables KVCache to be used with the Locker and Updater wrapper types by refactoring the ListByPrefix method to use interface-based type assertions instead of concrete type checks. Previously, only the KV wrapper could be used with ListByPrefix in these wrappers; now both KV and KVCache implementations are supported.

Key changes:

  • Introduced listerByPrefix[V] interface to enable duck typing for any cache implementing ListByPrefix
  • Updated type assertions in Locker and Updater to use the new interface instead of checking for concrete *KV[V] type
  • Added test coverage for KVCache usage with both wrappers

Reviewed changes

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

File Description
locker.go Defines listerByPrefix interface and updates ListByPrefix method to use interface-based type assertion
locker_test.go Adds TestLockerListByPrefixCache to verify KVCache works with Locker wrapper
updater.go Updates ListByPrefix method to use interface-based type assertion (interface defined in locker.go)
updater_test.go Adds TestUpdaterListByPrefixCache to verify KVCache works with Updater wrapper

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

Comment on lines +131 to +133
type listerByPrefix[V any] interface {
ListByPrefix(prefix string) ([]V, error)
}
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

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

[nitpick] The listerByPrefix interface is currently defined in locker.go but is also used in updater.go. While this works since both files are in the same package, it would be better to define this interface in a more central location (e.g., doc.go alongside the Geche interface) for better code organization and discoverability. This makes it clearer that this is a shared interface used across multiple wrapper types.

Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@C-Pro C-Pro merged commit 9fa9cd0 into main Dec 4, 2025
5 checks passed
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