Repository navigation
Open
Description
Description
#1290 bypasses shared-template caching for every HTML page once any async-capable HTML stream processor is registered (processed-template reads, reservations and stores are skipped before lookup). This keeps output correct, but an operator who enables allow_async_html_finish loses template caching for the whole publisher. This issue covers the cold-miss path described in #1241: on a shared-template cold miss, the finish completes before the template is validated and stored.
Combining the two is feasible when the finish output depends only on the document, not on the request. The first consumer (article signing) fits this: the same article text produces the same signature.
Proposal
- Factories declare
async_finish_output_cacheable(), defaulting tofalse. Shared-template caching stays enabled only when every registered async factory is cacheable; otherwise the current bypass applies. - Cold miss: run the ordered finish, then validate and store the finished output.
- Hit: serve the stored finished output and assemble the per-request auction suffix. The async finish is not re-run.
- Never store the template from fallback output (stage failure, timeout or overflow). The fallback response is still served.
Open questions
- Freshness: finish output can depend on outside state (for example key rotation or revocation). Is the template TTL sufficient, or is a purge hook needed?
- Hit execution: integrations needing per-request work cannot use the cacheable path. Is that acceptable as a documented constraint?
- Cold-miss latency: the reservation is held for the duration of the async call. How should concurrent misses for the same page behave?
- Seam: a replacement must keep the
</body>seam marker exactly once. Confirm the existing marker-count guard covers the store path.
Done when
- Maintainers agree on the cacheability declaration and the open questions above
- Cacheable async finish stores finished output on cold miss and serves it on hit without re-running the finish
- Fallback output is never stored, with tests for failure, timeout and overflow
- Non-cacheable async factories keep the current bypass
- Template-cache ESI and inline harnesses pass with a cacheable async consumer registered
- Operator and integration docs describe the caching behavior
Affected area
HTML processing / JS injection
Activity