Persist scoped catalog cases and immutable evidence history

Merged
SS
1mo ago
+411-0

Catalog diligence work needs to resume across sessions without treating saved workpapers as verified provider results. This adds private, versioned catalog cases over Context access and source foundations, with service-only save/read/list RPCs, revision conflict checks, workspace-scoped idempotency and immutable history.

Withdrawal or removal of linked source evidence redacts the affected source and transitive findings/actions, including historical reads and idempotent replay. Unrelated records remain available; partial projections cannot be blindly saved. Stable creation-order pagination supports continuation. Saved content remains customer_assertion; these functions perform no provider actions or financial calculations.

Validation: disposable PostgreSQL 15 and 17 clusters each pass both lifecycle/access and concurrent-writer tests. Coverage includes real service-role privileges, scope isolation, stale writes, immutable history, pagination, membership revocation, source withdrawal, historical source-version binding and retry redaction. No hosted migration was applied.

Rollout: apply after existing Context/release-case authorization prerequisites and before the dependent catalog API operations. Roll back dependent API paths first and retain history; do not drop persisted work as routine rollback.

Progress toward recoupable/app#2277, recoupable/app#2279 and recoupable/app#2306. This PR does not complete the provider/live-release acceptance criteria.

Summary by CodeRabbit

  • New Features
    • Added private catalog cases with versioned snapshots and save, read, and list operations.
    • Case access is restricted to authorized service operations. Reads flag withdrawn or unavailable source evidence and dependent records as withheld, and the resulting snapshot cannot be saved.
    • Added revision conflict handling, idempotent saves, and paginated case listings.
  • Documentation
    • Added guidance on prerequisites, limits, access controls, evidence handling, and rollout and rollback.