Conversation
Third step of #1889. With the purge in place, the responses about one extension or namespace no longer have to expire to stop being wrong - they are dropped when they stop being true - so the CDN may keep them for a week instead of revalidating against the registry every time. Surrogate-Control rather than a longer Cache-Control, because a browser cache cannot be purged: a week there would pin an old version in front of a reader with no way to reach them. The CDN reads the header and strips it, so the endpoints keep the Cache-Control they had - most of these say no-cache, and browsers go on revalidating every time. What changes is who answers the revalidation. Applied only where all of it holds: purging is configured, so something will actually drop it; the response carries a surrogate key, so there is a key to drop it by; and its endpoint marked it public, so an authenticated response is left alone. A GET that succeeded, at that. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
netomi
added this pull request to stack #2218
September 15, 2026 19:58
This was referenced Sep 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Third step towards #1889. Stacked on #2215 (which is stacked on #2214) — review those first; this PR's own diff is one class, one property and its tests.
What changes
With purging in place, the responses about one extension or namespace no longer have to expire to stop being wrong — they are dropped when they stop being true. So the CDN may keep them for a week instead of asking the registry every time.
Surrogate-Controlrather than a longerCache-Control, because a browser cache cannot be purged: a week there would pin an old version in front of a reader with no way to reach them. The CDN reads the header and strips it before the response reaches anyone else, so what changes is not how often browsers revalidate — it is who answers the revalidation.Where it applies, and why that list
A
ResponseBodyAdviceadds the header only where all of this holds:/api/-/search,/api/-/query,extensionquery— about no single extension, so nothing to purge them bypublic/api/{namespace}/verify-patsets noCache-Controlat all, and is left aloneGETthat succeededThe third one is the important one: the endpoint has already decided whether a shared cache may hold its response, and this only extends how long — it never makes something cacheable that was not.
ResponseBodyAdvicerather than an interceptor becausepostHandleruns after a large body may already have been flushed, and a committed response takes no further headers;beforeBodyWriteruns while they are still ours to set.Configuration
ovsx.cdn.surrogate-cache-durationP7DSince what the CDN holds is dropped when it stops being true, the duration bounds how long a purge that never landed stays visible, rather than how fresh the registry looks. Zero turns the header off.
Not included
File TTLs.
StorageUtil.getCacheControlstill caps files at 1 day, down from 30, with aTODOexplaining that CDN invalidation was missing — but files are served by redirect to storage, so their cached response carries no surrogate key and is not purgeable. Raising that number needs the key stored as blob metadata at upload time, which is its own change.Testing
SurrogateCacheControlAdviceTestdrives the advice through the tagging interceptor, since what it does depends on what that put there: a purgeable response gets the header; an untagged one, a response never marked public, a failed one, a write, and a registry with no configured provider do not.Full server suite green (1443 tests); pre-commit hooks pass.
One thing worth flagging from building this: the advice is picked up by
@WebMvcTestslices, where its configuration bean is not, and the first version of it tookCdnPurgeConfigby constructor — which broke 389 tests across every slice. It resolves the bean through anObjectProviderinstead, so a context without it is simply a context with no CDN.🤖 Generated with Claude Code