Skip to content

Cache-Control opt-in default + CLAUDE.md production-hardening checklist#31

Merged
amrtgaber merged 2 commits into
mainfrom
chore/claude-md-and-cache-hardening
Jun 28, 2026
Merged

Cache-Control opt-in default + CLAUDE.md production-hardening checklist#31
amrtgaber merged 2 commits into
mainfrom
chore/claude-md-and-cache-hardening

Conversation

@amrtgaber

Copy link
Copy Markdown
Contributor

Transfers two general-case lessons from a sibling service's live-event launch into the template.

Changes

fix: default Cache-Control to no-store; caching is opt-in

The cache middleware set public, max-age=3600 on every 200 GET — including authenticated, per-user, or mutable responses like the notes example resource. That caches private data at shared/CDN caches and in the browser (a read-after-write staleness and potential cross-user exposure foot-gun). Every response now defaults to no-store; an endpoint that serves genuinely public, cacheable data opts in by setting its own Cache-Control, which the middleware leaves intact.

Behavior change: GET responses are no longer cached unless they explicitly opt in.

docs: add CLAUDE.md

Agent-facing orientation, the template's conventions, and a provider-agnostic production hardening checklist distilled from running a sibling service through a high-traffic live event: validate migrations against real Postgres (tests use SQLite + never run Alembic), expand→transition→contract schema changes, non-blocking startup readiness, log exception types, keep static-reference reads off hot paths, merge ≠ deploy, and more.

Test plan

  • uv run ruff check . — pass
  • uv run ruff format --check . — pass
  • uv run pytest — 32 passed

The middleware previously set `public, max-age=3600` on every 200 GET, which
would cache authenticated, per-user, or mutable responses (e.g. the notes
example resource) at shared/CDN caches and in the browser — a read-after-write
staleness and potential cross-user exposure foot-gun. Default every response to
`no-store` instead; an endpoint that serves genuinely public, cacheable data
opts in by setting its own Cache-Control, which the middleware leaves intact.
Agent-facing orientation, the template's conventions (cache opt-in, proxy-aware
rate limiting, SQLite-tests vs Postgres-prod, structured logging), and a
provider-agnostic "production hardening" checklist distilled from running a
sibling service through a high-traffic live event: validate migrations against
real Postgres, expand→transition→contract schema changes, non-blocking startup
readiness, log exception types, keep static-reference reads off hot paths, and
more.
@amrtgaber
amrtgaber merged commit 346a402 into main Jun 28, 2026
2 checks passed
@amrtgaber
amrtgaber deleted the chore/claude-md-and-cache-hardening branch June 28, 2026 20:27
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