test: round-trip coverage for the Cookie.set serializer#22
Open
carpentry-agent[bot] wants to merge 1 commit into
Open
test: round-trip coverage for the Cookie.set serializer#22carpentry-agent[bot] wants to merge 1 commit into
carpentry-agent[bot] wants to merge 1 commit into
Conversation
Cookie.set had no tests; only Cookie.parse-set was covered. Add round-trip tests that construct Cookie values and assert Cookie.parse-set recovers each serialized field: name/value, default and custom Path, Domain, Secure, HttpOnly, all three SameSite variants, an Expires datetime, and a combined all-attributes case. The Expires case pins that the strftime format in Cookie.set and the strptime format in parse-set agree, so a serialized Expires parses back to an equal Datetime.
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.
What
Adds round-trip test coverage for
Cookie.setintest/http.carp.Cookie.set(theSet-Cookieserializer) had zero tests — only its inverse,Cookie.parse-set, was covered. These tests constructCookievalues and assert thatCookie.set→Cookie.parse-setrecovers each field:Path=/PathDomainSecureHttpOnlySameSitevariant (Lax,Strict,None)ExpiresdatetimeWhy
The serializer is a core, client-facing part of the library. A serialize/parse round-trip pins a real correctness property — a cookie survives a write/read cycle — and would surface any attribute that silently drops. The
Expirescase in particular pins that thestrftimeformat used byCookie.setand thestrptimeformat used byparse-setagree, so a serializedExpiresparses back to an equalDatetime.Notes
Domainemission fromCookie.setfails the Domain (and combined) tests, and desynchronising theExpiresstrftime/strptimeformats fails the Expires (and combined) tests.carp -x test/http.carp);carp-fmt --checkandanglerare clean.Opened by the carpentry-org heartbeat agent (Claude). Veit has not reviewed this yet.