Skip to content

[feature] Add optional maxsize to MemoryCacheEvaluator - #304

Merged
ptomecek merged 1 commit into
mainfrom
feature/memory-cache-maxsize
Dec 1, 2026
Merged

ptomecek merged 1 commit into
mainfrom
feature/memory-cache-maxsize

Conversation

@ptomecek

Copy link
Copy Markdown
Collaborator

Description

MemoryCacheEvaluator keeps every result for the life of the evaluator. That is costly when a model returns something large, such as a dataframe built once and read by a few downstream models, and ccflow has no cache scoped to part of a run.

This adds an optional maxsize field. When set, the cache keeps at most maxsize results: a cache hit refreshes the entry, and storing a new result evicts the least recently used ones. The default of None keeps today's unbounded behaviour. Models that should share a bounded cache use the same evaluator instance, as before.

Because maxsize is a public field, it is part of the evaluator's token. The default evaluator's cache keys are unchanged. One small behaviour change: results and ids are now stored after evaluation succeeds, so a failed call no longer leaves an entry in ids.

Type of Change

  • Bug fix
  • New feature
  • Documentation update
  • Refactor / code cleanup
  • CI / build configuration
  • Other (describe below)

Checklist

  • Linting passes (make lint)
  • Tests pass (make test); the only local failures are the test_lerna_* tests, which fail on main in the same environment
  • New tests added for new functionality
  • Documentation updated (if applicable)
  • Changelog / version bump (if applicable)

MemoryCacheEvaluator keeps every result for the life of the evaluator,
which is costly when results are large. The new maxsize field bounds the
cache: hits refresh an entry, and storing a new result evicts the least
recently used entries beyond maxsize. The default of None keeps the
cache unbounded.

Results and ids are now stored after evaluation succeeds, so a failed
call no longer leaves an entry in ids.

Signed-off-by: Pascal Tomecek <40371786+ptomecek@users.noreply.github.com>
@github-actions

github-actions Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Test Results

    1 files  ±0      1 suites  ±0   2m 49s ⏱️ -32s
1 655 tests +5  1 653 ✅ +8  2 💤  - 3  0 ❌ ±0 
1 742 runs  +5  1 740 ✅ +8  2 💤  - 3  0 ❌ ±0 

Results for commit eae81ba. ± Comparison against base commit f43013d.

This pull request skips 1 and un-skips 4 tests.
ccflow.tests.enums.test_pydantic ‑ test_json_schema_no_csp
ccflow.tests.enums.test_pydantic ‑ test_json_schema_csp
ccflow.tests.examples.test_calculator.TestCalculatorCli ‑ test_cli
ccflow.tests.examples.test_etl.TestEtl ‑ test_cli
ccflow.tests.utils.test_tokenize.TestAdversarialFixes ‑ test_function_docstring_still_stripped

♻️ This comment has been updated with latest results.

@codecov

codecov Bot commented Nov 30, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.07692% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 93.67%. Comparing base (424a17f) to head (eae81ba).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
ccflow/evaluators/common.py 85.71% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #304      +/-   ##
==========================================
+ Coverage   93.63%   93.67%   +0.04%     
==========================================
  Files         205      205              
  Lines       23158    23395     +237     
  Branches     1519     1541      +22     
==========================================
+ Hits        21683    21916     +233     
- Misses       1181     1185       +4     
  Partials      294      294              

☔ View full report in Codecov by Harness.
📢 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.

@ptomecek
ptomecek marked this pull request as ready for review December 1, 2026 13:06
@ptomecek
ptomecek merged commit 3b0ed5c into main Dec 1, 2026
20 checks passed
@ptomecek
ptomecek deleted the feature/memory-cache-maxsize branch December 1, 2026 13:52
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