Skip to content

Provide resolver cache configuration#77

Merged
Vladyslav-Kuksiuk merged 6 commits into
masterfrom
improve-cache-behavior
Jul 1, 2026
Merged

Provide resolver cache configuration#77
Vladyslav-Kuksiuk merged 6 commits into
masterfrom
improve-cache-behavior

Conversation

@Vladyslav-Kuksiuk

Copy link
Copy Markdown
Collaborator

This PR provides configuration for the resolver cache and cache tests.

Resolves this issue.

@Vladyslav-Kuksiuk Vladyslav-Kuksiuk self-assigned this Jun 26, 2026
@Vladyslav-Kuksiuk Vladyslav-Kuksiuk marked this pull request as ready for review June 30, 2026 15:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 the fragmentation resolver to support a configurable cache size (enabling small-cache tests) and adds test coverage to prove least-recently-used (LRU) eviction behavior in the resolver cache, as requested in issue #62.

Changes:

  • Made fragmentation.NewResolver accept a cache limit and return an error for invalid limits, introducing DefaultResolverCacheLimit for the default behavior.
  • Updated embedding/parsing and embedding orchestration to construct resolvers using the default cache limit (handling the new constructor signature).
  • Added fragmentation tests that exceed the cache capacity to validate LRU eviction, plus a guard test for invalid cache limits.

Reviewed changes

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

Show a summary per file
File Description
fragmentation/resolver.go Exposes a default cache limit constant and changes NewResolver to accept a cache limit and validate it.
fragmentation/fragmentation_test.go Adds LRU eviction coverage (insert beyond limit) and invalid-limit coverage; introduces small test helpers.
embedding/processor.go Updates processor construction to create a resolver with the default cache limit using the new API.
embedding/parsing/instruction.go Updates instruction content resolution to lazily create a resolver using the default cache limit when needed.
embedding/parsing/instruction_test.go Adds a test to verify default/shared resolver behavior leads to cached results across repeated content reads.
embedding/parsing/context.go Updates context creation to use a resolver constructed with the default cache limit.
embedding/orchestration.go Updates orchestration to create a shared resolver with the default cache limit for processing required docs.

Comment thread fragmentation/resolver.go
// Returns:
// *Resolver - resolver with an independent cache.
// error - when cacheLimit is below one.
func NewResolver(cacheLimit int) (*Resolver, error) {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

It is the whole PR intention, to have it configurable.

Comment thread embedding/processor.go
Comment on lines +68 to +71
resolver, err := fragmentation.NewResolver(fragmentation.DefaultResolverCacheLimit)
if err != nil {
return Processor{}, err
}

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This cache limit is not intended to be configured by the user, for now.

@Oleg-Melnik Oleg-Melnik left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM with Copilot’s comments addressed before merging.

@Vladyslav-Kuksiuk Vladyslav-Kuksiuk merged commit 5b34314 into master Jul 1, 2026
4 checks passed
@Vladyslav-Kuksiuk Vladyslav-Kuksiuk deleted the improve-cache-behavior branch July 1, 2026 12:21
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.

Add coverage for LRU cache eviction

4 participants