Conversation
Adds a dedicated unit test for web/lib/base64.ts, which was previously uncovered (no base64 test file) despite sitting on the auth and transaction path (signatures, serialized base64 transactions, account data). Covered behavior: - empty -> empty encoding - known-value roundtrips (including 0x00/0xff/0x80) - encode output byte-identical to the Buffer reference across many lengths - roundtrips across the 0x8000 String.fromCharCode chunk boundary (the chunkSize constant keeps btoa spreads under the argument limit) - btoa and Buffer fallback branches agree Verified locally: - npm test --workspace @agentvouch/web -- base64 (5 passed) - full web suite: 142 files / 1187 tests passed - format:check, typecheck, lint:web all pass
This branch was successfully deployed
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 a dedicated unit test for
web/lib/base64.ts— the bytes-only base64helpers used on the auth and transaction path (wallet signatures, serialized
base64 transactions, account data). These had no dedicated test file despite
being security- and money-adjacent, while sibling boundary helpers
(
chainAddress.ts,registeredAt.ts) are pinned with behavioral tests(AGENTS.md §3.24: pure helpers get real behavioral tests, not grep-tests).
The test pins:
encodeBase64(new Uint8Array(0))→""0x00/0xff/0x80and 12-byte inputencodeBase64output is byte-identical to theBuffer.from(...).toString( "base64")reference across 0, 1_000, and 10_000-byte inputs0x8000String.fromCharCodechunk boundary(the
chunkSize = 0x8000constant exists to keep btoa spreads under theargument limit; sizes at and past the boundary are pinned explicitly)
btoaandBufferfallback branches agree on a 2048-byte input (thebtoa branch is hidden and restored in a finally block)
Tests / verification
npm test --workspace @agentvouch/web -- base64→ 1 file, 5 tests passednpm run format:check→ passnpm run typecheck(web) → passnpm run lint:web→ passfails in the local Linux sandbox because
DATABASE_URL(a gitignored Vercelenv secret) is absent — a pre-existing environment condition, not this change
(the PR adds only a test file under
web/__tests__, never compiled into thebuild). Vercel is the authoritative web build gate.
Not verified
is blocked on missing
DATABASE_URL, attributed to the sandbox, not the diff.Scope
One new file:
web/__tests__/lib/base64.test.ts. No source changes.