Repository navigation
Description
What is missing today
cassette.Load in internal/cassette/io.go:91 refuses an interaction when the request method is empty, when the request URI is empty, or when the response status is outside 100..999. It never checks that the recorded URI is a URI at all.
Every consumer then has to cope with the malformed value on its own, and each one falls back to the raw string:
cassette.Key(internal/cassette/match.go:24) keepspath = request.URIandquery = ""whenurl.ParseRequestURIfails, so the interaction is filed under a key that no HTTP client can produce.cassette.observedPath(internal/cassette/openapi.go:175) returns the raw URI as the OpenAPI path key.lab.targetURL(internal/lab/http.go:63) fails at request time, soequal verifyreports the interaction as a transport failure instead of refusing the cassette.
The consequence is that a hand-edited or third-party cassette with a malformed URI, for example /v1/a%zz or /v1/a b, loads without any message. equal replay binds the interaction to a key that can never be requested, so the sandbox holds an interaction that is dead. equal export writes the raw string as a path key into the OpenAPI document, and the CI only validates the OpenAPI schema of the shipped examples/openapi.json, so nothing catches it.
docs/ARCHITECTURE.md states the rule for the replay path: "At startup, EQUAL validates the complete cassette and precomputes request keys into queues." The CHANGELOG.md entry for 0.2.0 states the promise for the export path: "Add equal export: generate a valid OpenAPI 3.1 JSON document from recorded traffic."
What done means
equal replay --cassette FILErefuses a cassette whose interaction URI is not a request URI. The message names the interaction id and the URI, and the process exits1before the listener starts.equal verify,equal exportandequal inspectrefuse the same cassette with the same message and exit1.- An interaction whose URI is a valid origin-form path, for example
/v1/users/42?include=profile, and an interaction whose URI is a valid absolute URL are both still accepted. examples/cassette.jsonlstill loads, and the document thatequal export --cassette examples/cassette.jsonlwrites keeps the samepaths,parameters,requestBodyandresponsesasexamples/openapi.json.go test -count=1 ./...passes, with one test for an interaction whose URI is not a request URI.go vet ./...passes.- The exit codes stay as they are:
0success,1a runtime error,2a usage error,3an incompatible candidate.
Boundary
- Zero runtime dependencies. The standard library is enough.
- No change to the
equal/v1cassette format, to the recorded fields or to the redaction behaviour. - No network call, no telemetry, no account, no service.
- The replay, verify, export and inspect commands keep their current arguments and their current output.
- Do not add vendor links or endorsements to the documentation, and do not trade a documentation change for this fix.
Activity
Balanov commentedon Nov 15, 2026
Thank you for the report, and for the fix. @ShahadatTest opened pull request #4 and it is merged: a cassette whose request URI does not parse, or that carries raw whitespace, is refused at load time with the interaction id and the URI in the message. It ships in equal 0.2.1.
A malformed cassette that loads quietly and then replays under an unreachable key is a trap. Thank you for the report and for the fix.