Skip to content

perf(cache): keep the source manifest out of per-request metadata - #21

Merged
brianvarskonst merged 6 commits into
mainfrom
fix/cache-meta-source-resources
Oct 23, 2026
Merged

brianvarskonst merged 6 commits into
mainfrom
fix/cache-meta-source-resources

Conversation

@brianvarskonst

Copy link
Copy Markdown
Member

Finding

Review finding K-P1: meta.json embedded source_resources, one entry for every PHP file in the kernel src and in every bundle src. ContainerCacheManager::tryUseRuntimeContainer() parses the whole file on every request, but production never validates that list (shouldValidateCachedSourceResources() is false without debug).

Change

  • Write the per-file manifest to sources.json next to meta.json; meta.json now only references it ("sources": "sources.json") and keeps source_fingerprint.
  • Read the sidecar only when source validation is enabled.
  • Metadata that still embeds source_resources (previous releases) is accepted unchanged; a metadata file without either form fails validation and rebuilds.

Verification

  • RuntimeCacheCompatibilityTest asserts the sidecar layout, a warm hit, invalidation after a source edit, and the embedded legacy form.
  • composer cs, composer static-analysis and the cache test suites pass locally in a PHP 8.5.12 container.

brianvarskonst and others added 6 commits October 23, 2026 23:41
meta.json carried source_resources, one entry per PHP file of the kernel and every
bundle, and was parsed on every request although production never validates that
list. The manifest now lives in sources.json next to meta.json and is read only
when source validation is enabled. Metadata that still embeds source_resources is
accepted unchanged.
RuntimeCacheCompatibilityTest exceeded the 500-line class limit.
A single sources.json could be replaced by a rebuild that fails before it
publishes meta.json, so the active generation would be validated against another
source set. Name the sidecar by generation key, verify it against the container
class, remove it with its container, and skip the read under the immutable policy.
@brianvarskonst
brianvarskonst merged commit cba702e into main Oct 23, 2026
3 checks passed
@brianvarskonst
brianvarskonst deleted the fix/cache-meta-source-resources branch October 23, 2026 22:30
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