Skip to content

Commit b31510a

Browse files
[Agent: Claude] docs(patch): document HEAD-304 large-file divergence + align legacy PATCH 204 headers with lwsEnabled (review findings 2, 3)
- finding 2 (comment only, no behavior change): the conversionPending HEAD re-check in handleHead can 304 where a real GET would 406 for RDF files > HEAD_FULL_READ_MAX_BYTES, because negotiateHeadFileContentType already resolves those optimistically (skips the checkServable probe). Documented as the same JavaScriptSolidServer#13.2.2 divergence budget the neighboring large-file comments already describe — HEAD-only, GET still 406s with no ETag, corrupt >1 MiB RDF is the rare case this budget accepts - finding 3: the legacy JSON-LD PATCH 204 arm (handlePatch) now passes lwsEnabled to getAllHeaders, matching patchTurtleFamilyResource's 204 — a --lws pod's .jsonld PATCH 204 now carries the same LWS Link/ Accept-Patch headers a .ttl PATCH 204 already sends. Verified byte-identical for --lws-off (every lwsEnabled branch in getAllHeaders/getResponseHeaders is a truthy check, so passing request.lwsEnabled when it's false/undefined is identical to the omitted-argument default) Co-Authored-By: Claude Opus 4.8 <[email protected]>
1 parent af2c4df commit b31510a

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

‎src/handlers/resource.js‎

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1774,6 +1774,14 @@ export async function handleHead(request, reply) {
17741774
// #4: the early checks above deferred here (conversionPending) because
17751775
// this conversion could 406 — now that negotiateHeadFileContentType
17761776
// resolved without one, re-check If-None-Match before falling through.
1777+
// Review finding 2: for RDF files > HEAD_FULL_READ_MAX_BYTES,
1778+
// negotiateHeadFileContentType already skipped the checkServable probe
1779+
// (its own large-file optimism, docstring above) and resolved
1780+
// optimistically — so this 304 can fire where a real GET would 406.
1781+
// Same #13.2.2 divergence budget as that optimism: a corrupt >1 MiB
1782+
// RDF document is far rarer than a valid one, HEAD-only (a client can
1783+
// only have gotten the variant validator from a prior HEAD), and GET
1784+
// still 406s with no ETag either way. Not a new gap — inherited.
17771785
if (ifNoneMatch && conversionPending) {
17781786
const check = checkIfNoneMatchForGet(ifNoneMatch, headEtag);
17791787
if (!check.ok && check.notModified) {
@@ -2560,7 +2568,14 @@ export async function handlePatch(request, reply) {
25602568
}
25612569

25622570
const origin = request.headers.origin;
2563-
const headers = getAllHeaders({ isContainer: false, origin, resourceUrl });
2571+
// Finding 3 (review round): align with patchTurtleFamilyResource's 204 —
2572+
// pass lwsEnabled so a --lws pod's .jsonld PATCH 204 carries the same
2573+
// LWS Link/Accept-Patch headers a .ttl PATCH 204 already does. Safe: every
2574+
// lwsEnabled use in getAllHeaders/getResponseHeaders is a truthy check, so
2575+
// this is byte-identical to the prior call when request.lwsEnabled is
2576+
// false/undefined (the --lws-off case) — only the --lws-ON output gains
2577+
// the headers it was already missing.
2578+
const headers = getAllHeaders({ isContainer: false, origin, resourceUrl, lwsEnabled: request.lwsEnabled });
25642579
Object.entries(headers).forEach(([k, v]) => reply.header(k, v));
25652580

25662581
// Emit change notification for WebSocket subscribers

0 commit comments

Comments
 (0)