AdPilot · Corpus
T-024 — Library edit flow + asset versioning
T-024 — Library edit flow + asset versioning
Frozen spec for the T-024 build: edit an existing creative without starting over — "Edit in Studio" hands the asset's context to the creative editor, remix iterates a version, duplicate forks independently, and every regeneration's lineage is retrievable.
Decisions
- Scope (Q1): the assets page (
apps/web-next/app/assets/page.tsx) in the Next console carries the library, the version strip, remix/duplicate, and the edit-in-studio handoff (a localStorage session consumed by/previewspost-paint). A version = a new asset in the source's lineage: parent = source, version = parent.version + 1, shared root; a duplicate roots an independent lineage at v1. File bytes are copied so every version is self-contained in the DAM. - Implementer — file copy: the DAM keys files as data/assets/{id}.{ext};
a referenced file would break delete/replace semantics, so remix and
duplicate copy the bytes (
writeFileAtomic). - Implementer — shared-table coupling: migration
services/api/internal/store/migrations/0009_asset_versions.sqladds the three lineage columns with defaults (additive-only; existing rows read as v1 roots). The integrations table the couple detector flags shares only the store file, not semantics.
Surface-area deltas
services/api/internal/domain/types.go— Asset gains parentAssetId/rootAssetId/version.services/api/internal/store/assets.go— versioning columns through scan/insert,AssetLineage,UpsertAssetVersionFields.services/api/internal/api/handlers_asset_versions.go— lineage query, remix, duplicate; 3 new routes inservices/api/internal/api/server.go.apps/web-next/app/assets/page.tsx— the assets page.apps/web-next/app/layout.tsx— nav link.apps/web-next/app/previews/page.tsx— consumes the handoff session (reads post-paint, preloads the brief).apps/web-next/lib/api.ts— listAssets/lineage/remix/duplicate methods.apps/web-next/lib/types.ts—Asset+AssetLineageEntrytypes.apps/web-next/lib/demo.ts— demo-engine parity for the versioning surface.- Tests:
services/api/internal/api/asset_versions_test.go— remix lineage with current marker, copied bytes, remix-of-remix, duplicate independence, 404s, seeded assets rooted. - Bookkeeping: the card's git-mv sides
(
tasks/00-backlog/T-024-library-studio-edit-flow.md/tasks/10-in-progress/T-024-library-studio-edit-flow.md) and this specdocs/tech-spec/T-024.md.
Verification
Go gates: go test ./... (6/6 packages; 5 new test functions). Web gates:
npm run build (strict), jest, eslint. Seed pinned tests still pass —
seeded assets read as v1 roots after the migration defaults.
Out of scope
Real Studio regeneration wiring (the generation provider call on remix is the T-005/T-017 follow-up), diff visualization between versions, mobile.