Skip to content

[Context] Persist versioned sources, module results and context document lineage #2121

Open

Description

@sswiftdrtv

Parent epic: #2116

Priority and sequence

P0 within the Context Engine epic · CE05. Required for the first two-song/two-brief checkpoint.

Customer journey

A customer returns next week. Recoup can retrieve what it learned, where it came from and which version was used, instead of starting over.

Customer value and architecture

Turn one-off generation context into reusable, inspectable product data.

Scope

  • Add persisted source/source-version, media reference, extraction result, accepted topic-document version, document-input relationship and brief-snapshot concepts with enforced subject references.
  • Include durable request/module/attempt/accounting references agreed with CE06/CE07; table names are finalized after the baseline.
  • Retain origin, publication/event/retrieval/analysis timestamps and precision, fingerprints, visibility, coverage, raw versus normalized output, model/prompt/recipe/schema versions and source citations.
  • Keep storage access-controlled and removable; separate provider URLs from retained bytes and record reference-only versus approved production-asset status.
  • Use additive database-repository migrations, indexes and scoped access rules; keep existing artist/song/catalog readers compatible. All API database calls use the repository Supabase access-layer pattern.

Acceptance criteria

  • Each result and document can be reconstructed from stable input versions and recipe references.
  • Source versions and accepted document versions are immutable history with an explicit current pointer, subject to defined deletion/retention rules.
  • Private storage and row access follow CE04; no source/subject reference points to an unconstrained or missing entity.
  • Migration tests cover existing data compatibility and a safe disable/rollback strategy without dropping customer data.
  • Schema supports independent module commits rather than one final all-or-nothing Sites snapshot.

Blocking dependencies

These are completion prerequisites, mirrored by native GitHub blocked-by links. Contracts, fixtures and independent scaffolding may begin earlier.

Execution gates

Draft migrations can be developed with fixtures; production migration PR/merge waits for CE01 conflict handling.

Validation

Synthetic migration, foreign-key, access, source-version and lineage tests; demonstrate artist/recording/release distinctions and old reader compatibility.

Owning implementation

Database repository migrations + API lib/supabase access layer

Delivery conventions

Shared API business logic serves HTTP, MCP and workers; clients do not duplicate it. Validate input with Zod and use the existing Supabase access layer. Database changes go through database-repository migrations and PRs. Use Vercel Workflows for new durable work. Reuse existing credits and record costs without exposing credentials or private traces. Every owning repository uses a feature branch and PR; distinguish fixture, local, merged and deployed verification.

Activity

  1. added
    enhancementNew feature or request
    priority:P0Required for the first shared Sites and external Widgets release
    on Sep 20, 2026
  2. sidneyswift commented on Nov 6, 2026

    @sidneyswift
    Collaborator

    Partly done. Context sources, immutable source versions and results, documents with a current pointer, execution records, saved brief snapshots and private audio results are on main (recoupable/database#72, recoupable/database#74, recoupable/database#77, recoupable/database#78, recoupable/database#79).

    Still open: immutable history for accepted document versions (draft recoupable/database#99 with recoupable/api#1004), a documented disable/rollback test, and the access and withdrawal checks owned by recoupable/api#2120 and recoupable/api#2124.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestpriority:P0Required for the first shared Sites and external Widgets release

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions