Skip to content

test(contracts): add auth + crypto + attachments schema coverage (Phase 4 U4) - #229

Merged
h4yfans merged 1 commit into
mainfrom
debt/phase-4-u4-contracts-auth-crypto
Apr 16, 2026
Merged

test(contracts): add auth + crypto + attachments schema coverage (Phase 4 U4)#229
h4yfans merged 1 commit into
mainfrom
debt/phase-4-u4-contracts-auth-crypto

Conversation

@h4yfans

@h4yfans h4yfans commented Apr 16, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds Zod schema validation tests for 8 contract files in the auth, crypto, and attachments cluster. 198 tests covering happy paths, boundary values, enum validation, optional fields, and deterministic CBOR field ordering.

Part of Phase 4 U4 of tech-debt-remediation.md.

Files

  • auth-api.test.ts — OTP, device register, PKCE OAuth, refresh token rotation
  • ipc-auth.test.ts — renderer-to-main auth command shapes
  • ipc-devices.test.ts — device list/rename/revoke/link command shapes
  • crypto.test.ts — passphrase verify, key rotation, recovery phrase envelopes
  • cbor-ordering.test.ts — pins canonical field order (drift breaks Ed25519 signatures)
  • ipc-crypto.test.ts — key derivation + rotation request shapes
  • ipc-attachments.test.ts — attachment IPC command + manifest shapes
  • blob-api.test.ts — R2 blob metadata (size bounds, content_hash)

Test plan

  • All 8 files run via vitest --project shared — 198 passed
  • Each schema covers minimal valid input, invalid field rejection, optional fields, enum boundaries
  • CBOR field-order table pinned (any accidental reorder fails CI since signed bytes would diverge)
  • Coordinator: run pnpm --dir apps/desktop test:coverage for line coverage report

Adds Zod schema validation tests for 8 contract files in the auth, crypto,
and attachments cluster. 198 tests cover happy paths, boundary values,
enum validation, optional fields, and deterministic CBOR field ordering.

Files:
- auth-api.test.ts — OTP, device register, PKCE OAuth, refresh token rotation
- ipc-auth.test.ts — renderer-to-main auth command shapes
- ipc-devices.test.ts — device list/rename/revoke/link command shapes
- crypto.test.ts — passphrase verify, key rotation, recovery phrase envelopes
- cbor-ordering.test.ts — pins canonical field order (drift breaks signatures)
- ipc-crypto.test.ts — key derivation + rotation request shapes
- ipc-attachments.test.ts — attachment IPC command + manifest shapes
- blob-api.test.ts — R2 blob metadata (size bounds, content_hash)

Part of Phase 4 U4 of tech-debt-remediation plan.
@h4yfans
h4yfans merged commit f10adfd into main Apr 16, 2026
4 checks passed
h4yfans added a commit that referenced this pull request May 6, 2026
Adds Zod schema validation tests for 8 contract files in the auth, crypto,
and attachments cluster. 198 tests cover happy paths, boundary values,
enum validation, optional fields, and deterministic CBOR field ordering.

Files:
- auth-api.test.ts — OTP, device register, PKCE OAuth, refresh token rotation
- ipc-auth.test.ts — renderer-to-main auth command shapes
- ipc-devices.test.ts — device list/rename/revoke/link command shapes
- crypto.test.ts — passphrase verify, key rotation, recovery phrase envelopes
- cbor-ordering.test.ts — pins canonical field order (drift breaks signatures)
- ipc-crypto.test.ts — key derivation + rotation request shapes
- ipc-attachments.test.ts — attachment IPC command + manifest shapes
- blob-api.test.ts — R2 blob metadata (size bounds, content_hash)

Part of Phase 4 U4 of tech-debt-remediation plan.
@h4yfans
h4yfans deleted the debt/phase-4-u4-contracts-auth-crypto branch May 6, 2026 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant