test: verify guest adoption workspace routing

Merged
SI
3d ago
+166-0

Add the missing guest-adoption routing coverage through the real handler, authentication-context validation, owner authorization and processor. Mock only credential/membership lookups and RPC/dispatch boundaries. The eight cases verify personal and organization actor/owner routing, denied/malformed scope, domain membership recheck, credential refusal, retained claim cookies, and handling of mocked expired/foreign-claimed/replay answers.

Only a new test suite and two bounded README paragraphs change. Existing guest/transport/owner/workflow tests are reused, including fresh-start capability behavior and duplicate-worker skipping. No production behavior, claim policy, destination UI, migration or attribution changes.

Validation: baseline34tests/5suites passed (not claimed as RED); a temporary wrong-owner production mutation failed the organization routing assertion, then production was restored byte-identical and all8newcases passed again. Scoped lint/format passed. Repository-settings scoped TypeScript passed; an exploratory strict=true run reported one existing transitive nullability error in unchanged canAccessAccount.ts. Independent review recorded in handoff.

Mocked RPC idempotent/rejection answers are source fixtures, not DB transaction or intended-account hosted/browser proof. Redispatching the existing guest ID does not itself prove extraction deduplication. Root owns final exact-head review/CI/merge.


Summary by cubic

Adds guest-adoption workspace routing coverage through the real handler, authentication-context validation, owner authorization, and processor, mocking only credential/membership lookups and RPC/dispatch boundaries.

  • The eight new cases in guestWorkspaceRouting.test.ts verify personal and organization actor/owner routing, denied and malformed scopes never reaching private storage or dispatch, domain membership recheck, credential refusal, retained claim cookies, and mocked expired/foreign-claimed/replay answers.
  • Two README paragraphs document the routing source contract and note that mocked RPC answers don't prove DB idempotency, extraction deduplication, or hosted-account/browser behavior.
  • No production behavior, claim policy, destination UI, migration, or attribution changes; existing guest/transport/owner/workflow tests are reused.