Repository navigation
test(Conformance): pin the rewriting-client redirect paths; build preprocess once (#359) - #369
Merged
Merged
Conversation
…process once (#359) Follow-up to #360's post-merge review: - Tests pin the per-attempt reset of the prepared request under a client's own `retry`, the early return for a preparation that fails after the client's rewrite, and the refusal of a `Location` on the rewritten host over another port or over `https`. - The client's `preprocess` is built once per request, as `execute` builds it, so a `mapRequestInput` function runs once rather than once per attempt. - A rewritten URL with no origin (`"null"`) never makes a `Location` with no origin a path on the kit's origin. - A refused hop is named by the `Location` the server sent, not the kit-origin URL it was translated to. - The path-prefix caveat is documented in `docs/conformance.md` §1.2 and on `resolvedLocation`. Follow-ups to #368's review (#352): a test pins that a refusal probe answered by a 3xx the kit reads as the answer itself still fails; a test is renamed to match the skip it asserts; §9 no longer says `include-unsupported-endpoint` could fail with "got no response". Claude-Session: https://claude.ai/code/session_0187g2QpzaHqEzX8GJxiJBVc Co-Authored-By: Claude <noreply@anthropic.com>
9 tasks done
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
Refs #359 — follow-up to #360, from its post-merge review. Refs #352 — three nits from #368's post-merge review, listed separately below. Re-located against trunk at d182132 (after #366's
step/sendsplit and per-hoprequestTimeout, and #368's refusal rules).#360 follow-ups (
src/internal/conformance/core.ts,src/Conformance.test.ts,docs/conformance.md)Should-fix — test gaps:
retry(rewrite(mapRequestEffect(refusing, f)))where attempt 1 prepares and the transport refuses it, and attempt 2's preparation fails.spec/target/reachable's note names the preparation failure and does not say the transport "followed itself" a redirect.mapRequestEffect(rewrite(canned), fail), the rewrite before the failing preparation. The note is the preparation failure, not a transport-followed redirect.http://127.0.0.1:4010, a308tohttp://127.0.0.1:4011/live/…and tohttps://127.0.0.1:4010/live/…are both refused (nothing under/liveis requested;spec/target/reachablenames theLocation).docs/conformance.md§1.2 and onresolvedLocation: a client that rewrites the path too (adds a prefix) adds it again to a followed hop's path, as it does to a relativeLocation's.Nits — behaviour:
preprocessbuilt once.client.preprocess(request)is now built once per request, outside theEffect.suspend, with the per-attempt reset of the capture still inside it. AHttpClient.mapRequestInputfunction now runs once per request, as underexecute, not once perretryattempt. Under feat(Conformance):skipandrequestTimeoutoptions (#302) #366 each hop is its ownstep, so each hop still builds its own (one request, one build); the existing retry-under-requestTimeouttest still passes. New test pinssent === 2 × mappedunderretry({ times: 1 }).resolvedLocationno longer matches a rewritten origin of"null", so adata:/mailto:/custom-schemeLocationis not read as a path on the kit's origin. New test with a client rewriting ontox-local://127.0.0.1:4010.Locationthe server sent (resolved against the kit's URL as before), not the kit-origin URL it was translated to. New test: a rewriting client whose server redirects every request to itself onhttp://127.0.0.1:4010is named by that URL at the hop cap.#368 follow-ups (Refs #352; no behaviour change)
docs/conformance.md§9 no longer saysspec/query/include-unsupported-endpointcould fail with "got no response";unknown-query-parameteranddelete-response, which are not refusal rules, keep it.3xxthe kit reads as the answer itself (a302with noLocation, a304) still fails both feat(Conformance): probeinclude/sorton an endpoint that does not declare them (#261) #278 rules with "was not rejected".The duplicated redirect note (
spec.ts~1454–1460 andcore.tsundecidedByRedirects) is left as it is, as asked.Mutation checks
Each mutant was applied alone and the whole of
src/Conformance.test.tsrun; each was killed, and only by the test(s) aimed at it:prepared = Option.none()per attempthostnameinstead of origin inresolvedLocationhttpscasespreprocessinside the suspend again"null"origin guard3xxas "says nothing" insaysNothingOfRefusal302/304casesVerification
pnpm install --frozen-lockfile— passvp run build— passvp check— pass (0 errors; no new warnings on changed lines)vp run check(sources, type-level tests, examples, emitted declarations) — passvp run -r test:unit— pass (3426 + 45 + 43 + 55)vp run docgen— passfallow audit --base origin/trunk— pass ("No issues in 4 changed files"; 3 inherited complexity findings excluded by the gate).fallow audit --format json --quiet --explain --gate-marker agent— verdictpass.Changeset
.changeset/conformance-same-origin-redirects.md(patch) is not in the@thomasfosterau/effect-jsonapi@0.16.3tag, so it is still unreleased and is edited in place rather than adding a new one. The feat(Conformance): one policy for a refusal probe that says nothing (#352) #368 follow-ups change no behaviour and need none.Notes
HttpClient.mapRequest/mapRequestInput; a client that rewrites nothing is unaffected.Location, or one not on the rewritten origin, the quoted URL is unchanged.🤖 Generated with Claude Code
Generated by Claude Code