Repository navigation
fix(web): accept the weak kit ETag in If-Match - #116
Merged
Merged
Conversation
Production answers GET /api/v1/kits/@h/n with ETag W/"g<n>": Cloudflare weakens the worker's strong ETag when it compresses the response. Clients that echo the header they received got 400 invalid_request, so the documented If-Match flow failed in production. Accept the W/ prefix; the generation still has to match exactly, and a stale one is still 412. Also document that the admin secret on a kit read is anonymous (401) and only a write that presents it gets 404, as production answers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The production smoke for #88 (2026-10-20 09:43 +07, worker version d06de037) showed two problems:
GET /api/v1/kits/@h/nreturnsETag: W/"g<n>"even though the worker sets the strong"g<n>". Cloudflare weakens strong ETags when it compresses a response. A client that sends that header back inIf-Match, as the docs describe, gets 400invalid_request, so the documented CAS flow is broken in production.Changes
kit-http.ts:If-Matchnow also acceptsW/"g<n>"andW/"<n>". The generation must still match exactly: a stale one is still 412 and a disagreement with the body is still 400.*, lists,W/g0and a lowercasew/are still 400.docs/personal-kits-api.md: documents the weak form and the admin-secret read and write statuses.Test plan
pnpm vitest run apps/web/tests/personal-kits: 10 files, 391/391 passed.pnpm --filter web typecheck: exit 0.If-Match.Rollback: revert, or set
SKILLX_PERSONAL_KITS_APIto"0".Docs impact:
docs/personal-kits-api.mdupdated (If-Match forms, admin secret statuses).Refs #88
🤖 Generated with Claude Code