Clarify cookie header tests and remove duplicate callback serde test#660
Open
ChristianPavilonis wants to merge 2 commits intomainfrom
Open
Clarify cookie header tests and remove duplicate callback serde test#660ChristianPavilonis wants to merge 2 commits intomainfrom
ChristianPavilonis wants to merge 2 commits intomainfrom
Conversation
aram356
requested changes
Apr 30, 2026
Collaborator
aram356
left a comment
There was a problem hiding this comment.
Summary
Test-only change closing real coverage gaps; CI is green and production behavior is unchanged. One blocking concern around a brittle assertion in the new UTF-8 test, plus two nitpicks.
Blocking
🔧 wrench
- Brittle assertion on error message text —
cookies.rs:370couples the test to the literal message string set incookies.rs:108. Asserting on the variant alone (InvalidHeaderValue { .. }) is sufficient and survives reasonable message rewording.
Non-blocking
📝 note
- Issue #454 wording is stale — the "Done when" says invalid UTF-8 should return
None, buthandle_request_cookiesactually returnsErr(InvalidHeaderValue)(mapped to400 Bad Requestinerror.rs:111). The PR test correctly exercises the real API; worth mentioning when closing #454 so the discrepancy is documented.
⛏ nitpick
- Explain why the bytes are invalid UTF-8 —
\xF0\x90\x80is a truncated 4-byte sequence; a one-line comment above the literal helps future readers. ts-ec=valid-prefixadds no coverage —to_str()validates the entire byte slice, so a bareb"\xF0\x90\x80"would exercise the same path more clearly.
CI Status
- fmt: PASS
- clippy: PASS
- rust tests: PASS (cookies::tests 25/25, models::tests 10/10 verified locally)
- js tests: PASS
- browser/integration tests: PASS
Collaborator
Author
|
Addressed the requested changes in 09b7694:
Verification:
Also noting for Issue #454: the original wording saying invalid UTF-8 should return |
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
Cookieheader path inhandle_request_cookiesChanges
crates/trusted-server-core/src/cookies.rsHeaderValue::from_bytes(...)to exercise the realInvalidHeaderValuebranch.crates/trusted-server-core/src/models.rsCloses
Closes #454
Closes #456
Test plan
cargo test --workspacecargo clippy --workspace --all-targets --all-features -- -D warningscargo fmt --all -- --checkcd crates/js/lib && npx vitest runcd crates/js/lib && npm run formatcd docs && npm run formatcargo build --package trusted-server-adapter-fastly --release --target wasm32-wasip1fastly compute serveChecklist
unwrap()in production code — useexpect("should ...")tracingmacros (notprintln!)