Skip to content

Cart-count summary endpoint for content-page badges (ADR 0017) - #6

Merged
DanMat merged 1 commit into
mainfrom
feat/cart-count-endpoint
Sep 3, 2026
Merged

DanMat merged 1 commit into
mainfrom
feat/cart-count-endpoint

Conversation

@DanMat

@DanMat DanMat commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

A public GET /ext/shop/cart/summary{count} (JSON, no-store), so a theme can show the cart count on a page-cached content page without baking a per-visitor count into the shared cache.

  • Read-only (summary(), never mints); the count is a pure function of the caller's own opaque HttpOnly nb_cart cookie (no id param → no IDOR; no cookie → 0).
  • Count only — no lines, token, or PII.
  • Being JSON + no-store keeps it out of the page cache (core caches only 200 text/html), so it can never leak across visitors.

Reviewed via both skills, security-green. Tests: count-only JSON + no-store (never cached); no cart → 0; reading never mints. Pairs with the Aurora header fetch (separate PR).

🤖 Generated with Claude Code

Add a public GET /ext/shop/cart/summary → {count} (no-store, JSON), so a theme can
show the cart count on a page-CACHED content page without baking a per-visitor
count into the shared cache. Read-only (StorefrontCart::summary, never mints); the
count is a pure function of the caller's own opaque HttpOnly nb_cart cookie (no id
param → no IDOR; no cookie → 0). Count only — no lines, token, or PII. Being JSON
+ no-store keeps it out of the page cache (core caches only 200 text/html).

Reviewed via both skills, security-green. Tests: count-only JSON + no-store never
cached; no cart → 0; reading never mints.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@DanMat
DanMat merged commit 24f2a87 into main Sep 3, 2026
2 checks passed
@DanMat
DanMat deleted the feat/cart-count-endpoint branch September 3, 2026 18:19
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