Skip to content

[Release Packs][RP-03] Persist resumable pack jobs with bounded spending #2257

Open

Description

@sswiftdrtv

Parent epic: #2254

Work package: RP-03 · Depends on: RP-02

Problem and deliverable

Add the smallest job/asset/attempt persistence required by RP-02, reusing existing Context request/brief IDs and media storage. Do not build a second artist identity or catalog model.

Files

  • database/supabase/migrations/<timestamp>_release_pack_jobs.sql (new)
  • api/lib/supabase/release_pack_jobs/ (new)
  • api/lib/supabase/release_pack_assets/ (new)
  • api/lib/content/packs/ (new)
  • api/app/api/content/packs/route.ts (new)
  • api/app/api/content/packs/[id]/route.ts (new)
  • api/app/api/content/packs/[id]/estimate/route.ts (new)
  • api/app/api/content/packs/[id]/generate/route.ts (new)
  • api/app/api/content/packs/[id]/retry/route.ts (new)

Action items

  • Add the smallest job/asset/attempt persistence required by RP-02, reusing existing Context request/brief IDs and media storage. Do not build a second artist identity or catalog model.
  • Implement owner/organization access, durable revision/fingerprint checks, idempotent creation/submission, claim/lease semantics and per-asset attempt receipts through table-specific Supabase helpers.
  • Quote the selected mixed deliverables and supported operations including generation, transcription, composition, inspection/upscale when charged, and a bounded repair allowance. Do not multiply the legacy per-video number and call it a complete quote.
  • Use existing credit charging/idempotency mechanisms. Enforce the approved ceiling atomically across parallel assets/retries; reject an expired or changed quote before provider submission.
  • Allow zero artists and no GitHub sandbox. Save a task brief inside the job without creating an artist, catalog, org or public knowledge-base entry.
  • Return completed assets plus actual remaining blockers on partial failure. Retrying reuses successful work and reconciles uncertain provider submissions before any duplicate call.

Done when

  • A fresh authenticated account with no roster or repository creates and resumes the same job.
  • Two concurrent generate/retry requests do not duplicate provider work or charges; a timeout does not blindly resubmit.
  • Cross-account/organization reads, edits, run IDs and exports are denied. Stale approval cannot authorize changed music or deliverables.
  • Budget exhaustion returns partial results and the specific next action; it never automatically buys credits or switches accounts.

Validation

  • Write failing Vitest tests before API implementation; test state, auth, concurrency, idempotency, quote changes and ceiling enforcement with provider stubs.
  • Migration tests cover ownership/RLS and atomic claims; apply migration in preview before API preview.
  • Run pnpm test lib/content/packs plus relevant credit tests, lint and build. No direct production database patch.

Source references and boundaries

Re-read current main and existing related PRs before implementation. New files listed above are proposed implementation locations. Use the owning repository's feature branch and PR; update the parent PR matrix as soon as a PR opens. No shipped or live behavior is implied by this ticket. Store/legal/provider and real-account evidence remain distinct from source checks.

Activity

  1. sidneyswift commented on Nov 6, 2026

    @sidneyswift
    Collaborator

    Shipped and deployed: private pack jobs, assets, revision-bound quotes and atomic budget holds (recoupable/database#119, recoupable/api#1064), plus provider-identity recovery and quote binding (recoupable/api#1135, recoupable/api#1137).

    A live prepare and quote passed without an artist or repository, on an existing account.

    Left: the same create-and-resume run on a fresh account, which RP-09 and CD-12 also cover. Keeping open until that run passes.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions