Skip to content

feat: finish PARTIALs — HTTP cache headers + ISR revalidate webhook - #481

Merged
tayebmokni merged 2 commits into
mainfrom
feat/finish-partials-b
May 26, 2026
Merged

feat: finish PARTIALs — HTTP cache headers + ISR revalidate webhook#481
tayebmokni merged 2 commits into
mainfrom
feat/finish-partials-b

Conversation

@tayebmokni

Copy link
Copy Markdown
Contributor

Closes #80, #86.

Two PARTIAL items finished from triage:

  • packages/go/middleware/httpcache: ETag + Vary on safe (GET/HEAD) responses with per-route opt-in
  • Webhook fired on POST/PUT publish to NEXT_REVALIDATE_URL/api/revalidate?path=... so apps/web's ISR pages refresh

(The fragment cache + comment-hook + queue-metrics scope from the original wave is left for a follow-up — the agent socket-died mid-implementation.)

🤖 Generated with Claude Code

tib0o0o and others added 2 commits May 26, 2026 13:15
Closes #80 (partial).

Adds a per-route opt-in middleware that emits ETag, optional Vary,
and Cache-Control headers on GET/HEAD responses, and short-circuits
matching If-None-Match requests to 304 Not Modified.

The buffering writer respects Cache-Control: no-store / private set
by upstream handlers (the auth middleware's 401 responses, the
admin REST surface's session-scoped reads) and falls back to a
direct passthrough past Options.MaxBodyBytes to avoid materialising
streaming endpoints in memory.

POST/PUT/PATCH/DELETE pass through untouched — no allocation, no
header munging.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Signed-off-by: Mohamed Tayeb Mokni <tayeb.mokni@gmail.com>
Closes #86 (partial).

Adds an outbound HTTP webhook fired by apps/api/internal/rest/posts on
create/update events that land or remove a row from "published" status.
POSTs to {NEXT_REVALIDATE_URL}/api/revalidate?path=...&secret=... so
the apps/web Next.js side can clear its ISR cache without waiting for
the next revalidate interval.

Configurable via:
- GONEXT_NEXT_REVALIDATE_URL  — apps/web origin
- GONEXT_NEXT_REVALIDATE_SECRET — shared secret

Either-empty disables the hook (chassis-without-renderer deployments).
Notify failures are logged at Warn and swallowed — staleness for a few
seconds is the right degrade behavior for a successful publish.

The new revalidate.Client lives at packages/go/webhooks/revalidate
rather than reusing packages/go/webhooks/delivery (which is the
user-facing fan-out system with signed bodies + DLQ + retries). ISR
revalidation is the opposite shape: single chassis-internal endpoint,
fire-and-forget, best-effort.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Signed-off-by: Mohamed Tayeb Mokni <tayeb.mokni@gmail.com>
@tayebmokni
tayebmokni enabled auto-merge (squash) May 26, 2026 17:33
@tayebmokni
tayebmokni merged commit 6a96d92 into main May 26, 2026
11 of 15 checks passed
@tayebmokni
tayebmokni deleted the feat/finish-partials-b branch May 26, 2026 17:41
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.

HTTP cache headers (Cache-Control, ETag, Vary)

2 participants