feat(contract): invitation-list convergence + signature order/interop vectors #239

Merged
amiryahaya merged 1 commit from feat/contract-hygiene-236 into main 2026-11-20 14:17:00 +01:00
Owner

Resolves #236 — three cross-platform contract breaks, all invisible until now.

1. Invitations list contract broken at runtime

Server sends {items, total, page, page_size, total_pages} with per-item {id, tenant_id, invited_by_id, email, invited_user_id, role, status, short_code, message, expires_at, created_at} — iOS decoded a {data: [...]} envelope with a required tenant_name the server never sends → both list screens failed to decode at runtime, and the old fixtures pinned the drifted shape.

  • Server: list queries now Include(Tenant/InvitedBy) and emit tenant_name + invited_by_name (DisplayName falling back to Email) — also fixes desktop's blank tenant_name rendering.
  • iOS: Received/SentInvitationsResponse decode the real paged envelope (typealias over PagedInvitationsResponse<T>); TenantInvitation aligned to the DTO (invited_by_name string, message; invited_by object dropped — server never sent it); InvitationsListView renders invitedByName.
  • Server-side shape assertions added to ListReceivedInvitations test (#236 review: removing tenant_name again must fail the server suite).

2. Signature blob order (latent, desktop parity)

wrapKeyForRecipient dual blob now mlDSA ‖ kazSIGN (desktop sign_with_key order — ML-DSA is a fixed 3309 bytes while the KAZ signature is message-length-dependent, so only ML-first supports a deterministic split). Currently latent — nothing transmits the blob yet — fixed before it can matter.

3. Signature interop vectors

tests/fixtures/ml-kem-hybrid-vectors.json extended to 8 sections: desktop KAZ-SIGN-256 + ML-DSA-65 signatures verify on iOS, and iOS-signed vectors verify under desktop Rust (verify_ios_interop_fixture with mandatory >= 2 per section — regeneration can't void the proof).

Also

  • APIClient date decoding made fractional-seconds-tolerant, extracted into makeDecoder() + 4 unit tests (server DateTimeOffset values carry fractional digits that plain .iso8601 rejects).
  • Dead KAZ-SIGN level-128 compat size constants and the unused invitedByNameLabel removed (commit message of the amended commit originally overclaimed this covered stale comments too — those were fixed separately in-tree).

Tests

iOS: 476 tests, 0 failures, 1 documented skip (keychain entitlements). Desktop failsulit-crypto: 40/40 incl. both signature-vector consumers. Server suite: 1110/0 via dotnet exec (local dotnet test runner has a broken testhost cache — run delegated to api-ci).

Resolves #236 — three cross-platform contract breaks, all invisible until now. ## 1. Invitations list contract broken at runtime Server sends `{items, total, page, page_size, total_pages}` with per-item `{id, tenant_id, invited_by_id, email, invited_user_id, role, status, short_code, message, expires_at, created_at}` — iOS decoded a `{data: [...]}` envelope with a required `tenant_name` the server never sends → **both list screens failed to decode at runtime**, and the old fixtures pinned the drifted shape. - Server: list queries now `Include(Tenant/InvitedBy)` and emit `tenant_name` + `invited_by_name` (DisplayName falling back to Email) — also fixes desktop's blank tenant_name rendering. - iOS: `Received/SentInvitationsResponse` decode the real paged envelope (typealias over `PagedInvitationsResponse<T>`); `TenantInvitation` aligned to the DTO (`invited_by_name` string, `message`; `invited_by` object dropped — server never sent it); InvitationsListView renders `invitedByName`. - Server-side shape assertions added to ListReceivedInvitations test (#236 review: removing tenant_name again must fail the server suite). ## 2. Signature blob order (latent, desktop parity) `wrapKeyForRecipient` dual blob now `mlDSA ‖ kazSIGN` (desktop `sign_with_key` order — ML-DSA is a fixed 3309 bytes while the KAZ signature is message-length-dependent, so only ML-first supports a deterministic split). Currently latent — nothing transmits the blob yet — fixed before it can matter. ## 3. Signature interop vectors `tests/fixtures/ml-kem-hybrid-vectors.json` extended to 8 sections: desktop KAZ-SIGN-256 + ML-DSA-65 signatures verify on iOS, and iOS-signed vectors verify under desktop Rust (`verify_ios_interop_fixture` with mandatory >= 2 per section — regeneration can't void the proof). ## Also - APIClient date decoding made fractional-seconds-tolerant, extracted into `makeDecoder()` + 4 unit tests (server DateTimeOffset values carry fractional digits that plain `.iso8601` rejects). - Dead KAZ-SIGN level-128 compat size constants and the unused `invitedByNameLabel` removed (commit message of the amended commit originally overclaimed this covered stale comments too — those were fixed separately in-tree). ## Tests iOS: 476 tests, 0 failures, 1 documented skip (keychain entitlements). Desktop failsulit-crypto: 40/40 incl. both signature-vector consumers. Server suite: 1110/0 via dotnet exec (local `dotnet test` runner has a broken testhost cache — run delegated to api-ci).
feat(contract): invitation-list convergence + signature order/interop vectors (#236)
All checks were successful
Security CI / security-scan (pull_request) Successful in 3m19s
API CI / migrations (pull_request) Successful in 7m56s
API CI / build-and-test (pull_request) Successful in 7m11s
e31b320ddd
The invitations list screens decoded a contract the server never produced,
and the iOS dual-signature blob order diverged from desktop.

Server: GET /api/invitations + /sent now Include(Tenant/InvitedBy) and emit
tenant_name + invited_by_name (DisplayName falling back to Email) per item —
fixes desktop's blank tenant_name rendering and gives iOS real names.

iOS: Received/SentInvitationsResponse decode the server's paged envelope
{items, total, page, page_size, total_pages} (was a data-envelope the server
never sent — both list screens failed to decode at runtime); TenantInvitation
aligns to the list DTO (invited_by_name string, message; invited_by object
dropped — server never sent it); APIClient decoder extracted into
makeDecoder() with fractional-seconds-tolerant ISO8601 date decoding (server
DateTimeOffset values carry fractional digits) + 4 unit tests.

Signatures: wrapKeyForRecipient dual blob now mlDSA ‖ kazSIGN (desktop
crypto_service sign_with_key order — ML-DSA fixed 3309 makes ML-first the
only deterministic split; KAZ-SIGN length is message-dependent). Signature
interop pinned bidirectionally in tests/fixtures/ml-kem-hybrid-vectors.json:
desktop KAZ-SIGN-256 + ML-DSA-65 vectors verify on iOS and iOS-signed
vectors verify under desktop Rust (failsulit-crypto
verify_ios_interop_fixture with mandatory non-empty sections).

Suite: 476 tests, 0 failures, 1 documented skip. Desktop failsulit-crypto:
40/40. Server suite: 1110/0 via dotnet exec (local dotnet test runner has a
broken testhost cache).
Sign in to join this conversation.
No description provided.