Repository navigation
test: shared golden vectors for the canonical anchor-name encoding - #7
Merged
Merged
Conversation
The router fix for contracts #34 item 1 (efs-project/contracts#55) re-encodes decoded web3:// path segments into EFSIndexer's canonical form. That only works if it produces exactly the bytes the SDK's encodeName produces; the TS and Solidity sides have drifted before (media types, twice). One shared vector file, run by both suites, turns that drift into a test failure on whichever side moved. The vectors are written from an independent restatement of specs/02 (not generated by encodeName), so this test checks the codec rather than snapshotting it. 157 accept vectors (every ASCII byte, literal `%` cases, UTF-8, NFC), 18 rejects both sides enforce, and 2 SDK-only rejects (not-NFC, which the contract cannot check). Each accept vector also records whether the name stays reachable through a generic client that percent-decodes the path: `%2F`, `50%20off` and `100%25` do not. The file is ASCII-only so an NFC-normalizing editor cannot rewrite the not-NFC vectors. Verified: pnpm typecheck, lint (biome ci), full test suite (1030 passed), changeset status. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
4 of 5 tasks
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
Adds
packages/sdk/test/fixtures/anchor-names.vectors.jsonand a test (names-vectors.test.ts) that checksencodeName/decodeName/asCanonicalNameagainst it. Test-only; no published code changes (empty changeset).Why
efs-project/contracts#55 implements contracts #34 item 1: the router re-encodes each decoded
web3://path segment into EFSIndexer's canonical form, so generic clients can open names likemy notes.txt. That only works if the router produces exactly the bytes the SDK'sencodeNamewrites. The TS and Solidity sides have drifted before (media-type validation, twice). This file is the single artifact both suites run, so drift fails a test on whichever side moved. The contracts PR vendors a copy.What's in the file
.), dot names that aren't dot-segments, reserved bytes inside names, literal%cases, non-ASCII UTF-8 (stays literal, never%C3%A9), and NFC inputs. Each one recordsinput,canonical, anddecodedUrlReachable.encodeURIComponentoutput).decodedUrlReachable: falsemarks the known ambiguity: a human name that literally contains a canonical escape (%2F,50%20off,100%25) can't be reached by its percent-decoded URL, only by the canonical form.The vectors were written from an independent restatement of specs/02, not generated by
encodeName, so the test checks the codec rather than snapshotting it. The file is ASCII-only (non-ASCII and DEL are\u-escaped) so an NFC-normalizing editor can't silently rewrite the not-NFC vectors.Test plan
pnpm typecheckpnpm lint(biome ci)pnpm --filter @efs/sdk test: 1030 passed, including the 177 new vector casespnpm changeset status --since=origin/mainAgents involved
Claude Opus 5.5 (SDK dev session) wrote the vectors and test, at the request of the contracts-issues agent working on #55.
🤖 Generated with Claude Code