Two green PRs, two production gaps

fix/3687-frontmatter-and-vary. Both earlier PRs passed CI and both were incomplete in production. The common cause is one habit: asserting the layer we write instead of the byte a caller receives.

Why CI could not see either gap

GapWhat the test assertedWhat production served
frontmatter withFrontmatter() plus 3 route handlers /developers.md renders on a 4th path, no block
Vary a grep of next.config.mjs for the string string is in the config, absent from the response

Both assertions were true. Neither was about what a client gets.

Gap 1: 5 of 7 surfaces had a header block measured live

SurfaceRenders viaBeforeAfter
/auth.mdstandalone route------
/pricing.mdstandalone route------
/api-policy.mdstandalone route------
/index.mdapi/md------
/docs/*.mdapi/md------
/developers.mdpage-markdown.ts# OrchestKit by…---
/yonyon.mdpage-markdown.ts# Yonyon: the…---

Wrapped in pageMarkdown(), the choke point every twin passes through, so a new slug cannot be added with a body and no header.

Gap 2: cache-key simulator pick a URL and what a cache stored first

One URL, two bodies. Whether a shared cache may reuse a stored response depends on the Vary that response carried when it was stored.

URL
State

Why the config value never arrives

Not a guess. Next's own source, then confirmed against production bytes.

// next/dist/server/base-server.js
setVaryHeader(req, res, isAppPath, resolvedPathname) {
  ...
  res.appendHeader('vary', baseVaryHeader);   // appends, never overwrites
}

On the same production response that shows only the RSC tokens in Vary, every other header from the same next.config block is present: Link, X-Frame-Options, Referrer-Policy, Strict-Transport-Security, Access-Control-Allow-Origin. So the block applies, and Vary specifically does not survive. The fix sets it on the response middleware returns, which is the object the framework then appends to.

Verified, and not yet verified

44 test files / 559 tests green in docs/site, 21 of them new and asserting response bytes rather than source strings.