ZDDC/zddc/internal/apps
ZDDC ed7a7fc9c0 perf(server): ETag + max-age=0 on embedded HTML responses
The apps subsystem previously sent Cache-Control: public, max-age=300|3600,
must-revalidate but no ETag. With must-revalidate and no validator, the
browser cannot return 304 — it has to refetch the full body once max-age
expires. For mdedit that's 920 KB on every reload after an hour.

Add a content-addressed ETag (sha256 hex prefix, 32 chars) to:
- apps/handler.go's serveBody + serveEmbedded (both paths now emit ETag
  + handle If-None-Match short-circuit to 304)
- handler/directory.go's embedded:browse fallback (mirror behavior so
  the bare-directory landing serves the same way)

Drop max-age to 0 with must-revalidate: every page load revalidates,
but a matching ETag returns 304 with empty body. Steady-state cost of
a reload drops from N KB to a few hundred bytes. When the binary is
redeployed, the ETag changes (content hash) and the next request
returns 200 with the new bytes.

Tests in apps/handler_test.go cover both paths:
- TestServer_Embedded_ConditionalGET: full GET, matching INM, stale INM
- TestEmbeddedETag_Stable: same bytes → same ETag, different → different

Live smoke (curl against zddc-server -root /tmp/empty):
  GET /            → 200, ETag set, body = 80919 bytes (landing.html)
  GET / + INM:tag  → 304 Not Modified, empty body
2026-05-04 07:49:17 -05:00
..
embedded chore(embedded): cut v0.0.16-beta with public-landing fix 2026-05-04 07:49:17 -05:00
apps.go feat(zddc-server): apps fetch+cache subsystem with cascade overrides 2026-05-01 15:25:25 -05:00
apps_test.go feat(zddc-server): apps fetch+cache subsystem with cascade overrides 2026-05-01 15:25:25 -05:00
availability.go feat(browse): generic directory listing tool — default at folder URLs 2026-05-03 19:56:51 -05:00
availability_test.go feat(zddc-server): apps fetch+cache subsystem with cascade overrides 2026-05-01 15:25:25 -05:00
cache.go feat(zddc-server): apps fetch+cache subsystem with cascade overrides 2026-05-01 15:25:25 -05:00
cache_test.go feat(zddc-server): apps fetch+cache subsystem with cascade overrides 2026-05-01 15:25:25 -05:00
embed.go perf(server): ETag + max-age=0 on embedded HTML responses 2026-05-04 07:49:17 -05:00
fetch.go feat(zddc-server): apps fetch+cache subsystem with cascade overrides 2026-05-01 15:25:25 -05:00
handler.go perf(server): ETag + max-age=0 on embedded HTML responses 2026-05-04 07:49:17 -05:00
handler_test.go perf(server): ETag + max-age=0 on embedded HTML responses 2026-05-04 07:49:17 -05:00
singleflight.go feat(zddc-server): apps fetch+cache subsystem with cascade overrides 2026-05-01 15:25:25 -05:00
singleflight_test.go feat(zddc-server): apps fetch+cache subsystem with cascade overrides 2026-05-01 15:25:25 -05:00
versions.go feat(zddc-server): CLI flags, --version, CWD-default ZDDC_ROOT 2026-05-01 15:43:31 -05:00