Read registered company roster and evidence baseline

SI
6d ago
+197-0

Problem and result

Company onboarding currently exposes roster and Context evidence through separate operations. Add read_context_company_baseline to return bounded, independently paged registered artists, professionals and source metadata under the existing owner/member policy. This is the first read primitive for app#2116's company baseline milestone, not a complete assessment.

Preserves separate IDs, excludes withdrawn sources and removed versions, returns no raw documents/URLs, and explicitly identifies missing company links, catalog coverage, source attribution, review and rights assessment. No new tables or business-row changes, provider calls or billing dependency.

Validation

  • Six new database regressions failed before implementation; all seven tests (including inherited release lifecycle) pass on disposable PostgreSQL 15 and 17.
  • Coverage includes cross-organization/revoked access, browser-role denial, namesakes, source withdrawal, and 50+1 pagination in every section.
  • Adds the suite to existing CI PostgreSQL 15/16; diff checks pass.
  • Minimal legacy fixture plus actual Context/professional migrations; not a full schema replay or hosted verification.

Release and limits

Requires existing professional roster and release-case migrations. Release database first, verify function and service-only permissions, then deploy the companion API. No production changes performed. Live reads/pages are not an immutable snapshot; registered links do not prove representation or ownership. The pending wallet-identity PR is independent.

Part of https://github.com/recoupable/app/issues/2116 and model adoption https://github.com/recoupable/app/issues/2147. Does not close either milestone.


Summary by cubic

Adds read_context_company_baseline, a service-role-only read that returns registered artists, organization professionals, and non-withdrawn Context source metadata in independently paged sections under the existing owner/member policy. It replaces the separate roster and Context evidence operations in company onboarding and is the first read primitive for app#2116's company baseline milestone, not a complete assessment.

Behavior

  • Returns only source metadata, never raw documents, URLs, or storage paths, and excludes withdrawn sources and removed versions.
  • Rejects invalid, foreign, withdrawn, or wrong-section cursors with one generic error that never discloses other organizations' records.
  • Preserves separate IDs with no name merging or implied representation or ownership.
  • The response explicitly names uncovered gaps in company links, catalog coverage, attribution, review, and rights.
  • Eight tests pass on disposable PostgreSQL 15 and 17 and now run in CI.

Migration

  • Adds no new tables or business-row changes; requires the deployed professional roster and release-case migrations.
  • Release the migration first and verify the function signature and service-only grants before deploying the companion API consumer.
  • Live pages are not immutable snapshots; each section pages independently and an omitted cursor restarts that page.