Skip to content

Add parse cache#603

Draft
micheleorselli wants to merge 6 commits intomainfrom
add-parse-cache
Draft

Add parse cache#603
micheleorselli wants to merge 6 commits intomainfrom
add-parse-cache

Conversation

@micheleorselli
Copy link
Copy Markdown
Member

@micheleorselli micheleorselli commented Mar 29, 2026

wip:

  • the current cache implementation does not consider in Runner::doRun we have $config->getClassSetRules() which can return multiple ClassSet objects, so either we create a separate cache per ClassSet of we fix the implementation to have one single cache
  • the cache object relies on __destruct to save the cached result back, I'm not totally sure this is ok 🤔
  • caching serialized objects opens to the problem of rehydrating an object with a different shape than the one cached. we should test this scenario
  • how do we manage cache expiration? e.g we cache a file, then the file is deleted -> how do we purge it from the cache?
  • maybe it is worth testing Symfony Cache component

micheleorselli and others added 5 commits March 29, 2026 21:05
…application

Runner::check now explicitly builds a FilesToParse collection from the ClassSet,
iterates it to produce a ParsedFiles structure, then applies rules to the parsed
class descriptions. The two data structures act as cache points between pipeline
stages.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Introduces ParseResultCache interface and FileParseResultCache which persists
parse results to disk keyed by (filename, md5(content)). Runner accepts an
optional cache via constructor; when provided, files whose content hash matches
the cached entry are not re-parsed. The cache flushes to disk on destruction
only when entries were written.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 29, 2026

Codecov Report

❌ Patch coverage is 98.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 98.29%. Comparing base (9498feb) to head (58a6dd2).

Files with missing lines Patch % Lines
src/CLI/Config.php 85.71% 1 Missing ⚠️
src/CLI/Runner.php 97.29% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main     #603      +/-   ##
============================================
- Coverage     98.31%   98.29%   -0.03%     
- Complexity      681      706      +25     
============================================
  Files            86       89       +3     
  Lines          1960     2047      +87     
============================================
+ Hits           1927     2012      +85     
- Misses           33       35       +2     

☔ 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.

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.

1 participant