Repository navigation
fix(privacy,test): expire every parent cookie domain, correct two stale test claims - #418
Conversation
…le test claims Closes the three CodeRabbit findings on promote #416. Each was verified against the source before changing anything. 1. src/lib/consent.ts — GA cookie withdrawal missed the registrable domain on multi-label public suffixes. `labels.slice(-2)` sends `www.example.co.uk` to `co.uk` and never `example.co.uk`, so a cookie on the real registrable domain survived withdrawal. Which parent IS registrable needs a public-suffix list the browser does not expose, so enumerate every parent instead of assuming two labels — matching the function's existing "the misses are inert" design. The bare TLD is skipped since no host can set a cookie there. Latent rather than live: for `www.payload-components.xyz`, `slice(-2)` already yielded `payload-components.xyz`, the correct domain. It bit only hosts under a two-part suffix. Verified the new enumeration across host shapes — `www.example.co.uk` now reaches `example.co.uk`, `a.b.example.com` reaches both parents, `payload-components.xyz` and `localhost` are unchanged. No test pinned the old behaviour: consent.e2e sets its cookies with no domain, which the pre-existing `''` entry covers, and the change is purely additive. 2. tests/e2e/frontend.e2e.spec.ts — a comment still called the overrun ceiling "deliberately loose 60px" after #413 tightened it to 50px. The neighbouring line 245 reference is deliberate history ("It was 60px, but…") and is left alone; only the claim about the current value was wrong. 3. tests/int/painted-contrast.int.spec.ts — the fixture carried `'.stat-value (no glyph pixels)'`, but the producer pushes the bare selector (painted-contrast.ts:572) and the label supplies the reason. The two lists genuinely differ in shape — `unresolvedSelectors` IS pushed pre-suffixed (:229, :233), so that fixture is correct and untouched — and the asymmetry is now written down so the next edit does not "fix" the wrong one. Scope note: this makes the fixture faithful to what the producer emits. It does not couple the two — the spec imports only `formatPaintedContrastReport` and never calls `measurePaintedTextContrast`, which needs a browser. Local: lint, format:check, tsc --noEmit, test:int (32 files / 379 tests) green. The consent behaviour itself is covered by consent.e2e in release-gate. Co-Authored-By: Claude Opus 5 <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Review limit reached
Next review available in: 57 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
#585) Every docs page threw minified React #418 (server-rendered text did not match the client) in production. Docs pages are prerendered at their internal route (/en/docs/...) and served at the public URL (/docs/...). fumadocs-ui/provider/next hands Fumadocs next/navigation's pathname, which reads /en/docs while prerendering and /docs in the browser. Fumadocs matches its chrome against that pathname, so the static HTML missed the page tree: the mobile TOC trigger said "On this page" where the client rendered the page title, and the prev/next footer and breadcrumb were missing. pnpm dev renders on request at the public URL, so it never reproduced. publicPathname() maps a route pathname to the URL the browser shows, and FumadocsRootProvider wires Fumadocs to Next.js like the stock provider except for that pathname. The docs and blog layouts use it. The blog had no pathname-derived chrome, but it sat on the same stock provider. The new frontend e2e check fails on the unfixed production build with the #418 error and passes with the fix. The int spec covers publicPathname and rejects stock-provider imports. Co-authored-by: Claude Opus 5.5 <[email protected]>
Closes all three CodeRabbit findings from promote #416. I verified each against the source before changing anything — all three were real, though one is less severe than labelled.
1.
src/lib/consent.ts— GA withdrawal missed the registrable domainCodeRabbit rated this Major; it's real but latent, with no live impact, and that distinction is worth stating.
labels.slice(-2)sendswww.example.co.uktoco.ukand neverexample.co.uk, so a_gacookie on the actual registrable domain survives withdrawal. But for your host,www.payload-components.xyz,slice(-2)already yieldspayload-components.xyz— the correct domain. It bit only hosts under a two-part public suffix.Which parent is registrable needs a public-suffix list the browser doesn't expose, so enumerate every parent rather than assuming two labels. That matches the function's own existing design — its comment already says the misses are inert:
The bare TLD is skipped because no host can set a cookie there. Verified across host shapes:
www.payload-components.xyzpayload-components.xyz— unchangedwww.example.co.ukexample.co.uk,co.uk— the fixa.b.example.comb.example.com,example.compayload-components.xyz.hostalready in the set)localhostNo test pinned the old behaviour:
consent.e2esets its cookies with no domain, which the pre-existing''entry covers, and this change is purely additive.2.
tests/e2e/frontend.e2e.spec.ts— stale ceiling claimA comment still called the overrun ceiling "deliberately loose 60px" after #413 tightened it to 50px. One-word fix.
Note I deliberately left line 245 alone — its "It was 60px, but…" is intentional history explaining why it was tightened, not drift. Only the claim about the current value was wrong.
3.
tests/int/painted-contrast.int.spec.ts— fixture didn't match the producerThe fixture carried
'.stat-value (no glyph pixels)', but the producer pushes the bare selector (painted-contrast.ts:572) and the report label supplies the reason — so the expected output was a string the producer never emits.The two lists genuinely differ in shape, which is what makes this easy to get wrong in either direction:
unresolvedSelectorsis pushed pre-suffixed (:229,:233), so that fixture is correct and I left it untouched. I wrote the asymmetry into the comment so the next edit doesn't "fix" the wrong one.Scope note, to avoid overclaiming: this makes the fixture faithful to what the producer emits. It does not couple the two — the spec imports only
formatPaintedContrastReportand never callsmeasurePaintedTextContrast, which needs a browser. A producer-side shape change still wouldn't fail this spec; closing that would need a different test.Verification
lint,format:check,tsc --noEmit,test:int(32 files / 379 tests) all green locally. The consent behaviour itself is covered byconsent.e2einrelease-gate.