You are an independent reviewer. Critique the plan against the actual repository.
code
Project directory:
/Users/user_c042661f/Documents/reigh-workspace/reigh-app
User intent summary:
The intent is to make the persisted Reigh video editor timeline (TimelineConfig plus AssetRegistry) have one documented, reusable domain interpretation, so UI loading/editing, Remotion rendering, imports, and agent tools stop making their own conflicting decisions about shape, migration, serialization, validation, and duration. This is a foundation sprint: preserve current editor behavior, centralize the domain rules, add targeted tests, and clearly mark any paths that cannot yet be migrated without overreaching.
Original idea:
Video editor developer platform Sprint 1: canonical timeline domain model.
Context:
The Reigh video editor under src/tools/video-editor has useful primitives, but it is not yet easy for developers or agents to build on top of. Current pain points include multiple timeline shapes (TimelineClip, ClipMeta, ResolvedTimelineClip, TimelineData rows/meta/clipOrder), inconsistent duration semantics across UI/render/agent paths, Reigh-specific dependencies mixed into editor provider/components, and mutation paths that require internal knowledge.
This sprint is the first two-week slice. It must preserve the current Reigh app behavior while establishing the domain foundation for later ports/adapters, headless core, clip-type plugins, command bus, render pipeline hooks, and UI slots.
Goal:
Create a canonical timeline domain layer that all current editor paths can use without changing user-visible functionality.
Primary outcomes:
Establish one documented canonical interpretation of persisted TimelineConfig + AssetRegistry.
Centralize repair/migration/canonicalization, duration calculation, validation, serialization, and structured errors.
Remove or reduce divergent duration/shape logic between UI, Remotion renderer, import, and ai-timeline-agent paths.
Prepare for agent-safe editing by defining validation/dry-run-friendly primitives, even if the full command bus ships in a later sprint.
Important constraints:
Do not rewrite the video editor.
Do not change visible editor behavior except to fix clear inconsistencies.
Keep the existing Reigh editor page and shell working.
Keep current tests passing; add targeted tests for canonical domain behavior.
Avoid broad UI refactors in this sprint unless required to route through the domain layer.
Do not make plugin registries or UI slots yet; only shape the domain layer so those later sprints are easier.
UI load repairs/migrates before use, but ai-timeline-agent reads raw DB config.
UI duration helpers and agent timeline tools can interpret clips with missing from/to differently.
Some render paths compute sequence duration manually instead of using shared duration helpers.
Import validation and editor serialization validation may accept/reject different shapes.
Poll sync may advance configVersionRef before accepting polled data, potentially weakening conflict detection.
Pinned shot group metadata is not maintained consistently by backend clip CRUD.
Success criteria:
There is a canonical domain module/API for timeline normalization, duration, validation, and serialization.
UI, renderer, import, and agent paths either use this API or have explicit follow-up tasks for remaining migration.
Tests cover equivalent duration/canonicalization behavior across at least UI/domain and agent/import-adjacent helpers.
Current editor functionality remains intact.
The resulting API is understandable for a later command bus and agent edit layer.
Deliverable:
A code diff plus a concise notes section explaining the canonical domain boundary, remaining non-canonical call sites, and recommended Sprint 2 work.
User notes and answers:
Clarification decisions for Sprint 1: keep canonical domain API local to src/tools/video-editor/domain for now, while aligning with @banodoco/timeline-schema types and leaving package extraction as a later decision. Canonical persistence remains TimelineConfig + AssetRegistry; TimelineData rows/meta/clipOrder stay editor-only projection. Duration rule: define one shared helper that treats hold as explicit duration, otherwise uses from/to when present and may use AssetRegistry duration as a controlled fallback for media clips with missing to; preserve current visible behavior where tests reveal risk and document any mismatch. Canonicalization should return normalized in-memory data plus warnings/repair metadata; persistence may serialize repaired canonical output only on explicit save/import/agent write, not merely on read. Unknown clip types remain accepted with structured warnings and placeholder behavior. Structured errors should be stable and agent-readable with codes, paths, severity, and suggested repair. Pinned shot group consistency and poll-sync configVersion conflict behavior should be included only if low-risk; otherwise produce explicit follow-up tasks. Import and ai-timeline-agent should be planned to use the same canonical helpers; implement the smallest safe migration in Sprint 1 and document remaining raw paths. Validation boundary: hard errors for impossible/unsafe state, warnings for repairable legacy shape, missing optional metadata, unknown future clip types, and missing assets where placeholder behavior exists.
Intent Check
This sprint is still a foundation slice, not a rewrite. The persisted canonical source remains TimelineConfig + AssetRegistry. TimelineData, renderer-resolved clips, rows/meta/clipOrder, and agent command views are projections/adapters. The goal is to centralize interpretation while preserving current editor behavior and documenting call sites that cannot be safely migrated in this slice.
Phase 0: Baseline and Characterization
Run targeted tests first, then add characterization tests before changing behavior:
bash
npm run test -- src/tools/video-editor/lib/config-utils.test.ts src/tools/video-editor/lib/timeline-data.test.ts src/tools/video-editor/lib/migrate.test.ts src/tools/video-editor/lib/serialize.test.ts src/tools/video-editor/hooks/usePollSync.test.ts src/tools/video-editor/hooks/useTimelineCommit.test.tsx src/tools/video-editor/hooks/useTimelinePersistence.test.tsx
npm run test:edge:unit -- supabase/functions/timeline-import supabase/functions/ai-timeline-agent
Add characterization coverage for existing load/repair/write behavior:
Duplicate track IDs and duplicate clip IDs, including cascading -dup-N suffix cleanup.
Legacy pinned group children conversion.
repairShotGroupContiguity behavior.
migrateToFlatTracks behavior, including legacy track names and background hold clip injection.
Current UI zero-duration behavior for clips missing to when no registry is available.
Current agent duration behavior for clips missing to when registry duration is available.
Current UI save boundary behavior in useTimelinePersistence.ts, proving what object is passed to provider.saveTimeline before adding a canonical write guard.
These tests decide where Sprint 1 can safely change behavior and where compatibility wrappers must preserve legacy behavior.
Phase 1: Create an Acyclic Domain Boundary
Create src/tools/video-editor/domain/ as the owning layer for canonical interpretation. It must be runtime-safe for both browser/editor tests and Supabase edge function source:
No React imports.
No browser APIs.
No @/ aliases.
No imports from lib/config-utils.ts, lib/timeline-data.ts, hooks, components, or renderer files.
Only import persisted/shared types from src/tools/video-editor/types/index.ts by relative path if needed.
Initial files:
diagnostics.ts: stable TimelineDiagnostic types and codes.
registry.ts: AssetRegistry normalization, validation, preservation rules, and diagnostics.
duration.ts: registry-aware and registry-free duration helpers.
repair.ts: lifted repair/migration primitives currently owned by lib/migrate.ts, moved only after characterization tests pin behavior.
domain/* owns duration, registry interpretation, validation, repair, normalization, and serialization.
lib/config-utils.ts, lib/migrate.ts, lib/serialize.ts, and lib/timeline-data.ts become compatibility/adaptation layers that may import domain/*.
domain/* must never import those lib/* compatibility modules.
Phase 2: Define AssetRegistry Semantics
Because duration fallback and render URL resolution depend on AssetRegistry, Sprint 1 must define the registry half of the persisted source, not only timeline clips.
Canonical registry rules:
Preserve unknown asset metadata unless it is impossible or unsafe to serialize.
Hard error when asset_registry is not an object or assets is not an object.
Warning for asset entries that are not objects; ignore them for duration and URL resolution.
Warning for missing or non-string file; keep the entry but treat it as unresolved for render/import diagnostics.
Warning for non-finite or negative duration; keep the original metadata if serialization currently allows it, but do not use it for duration fallback.
Warning for unknown or malformed type; preserve it and treat the asset as unknown media unless an existing path requires a stricter type.
Duration helpers may use only finite positive registry durations.
Add domain/registry.test.ts for malformed entries, unknown metadata preservation, invalid duration exclusion, missing file, and stable diagnostic codes/paths.
Phase 3: Define Duration APIs Without Breaking Existing Callers
Do not force registry fallback through old clip-only helpers. Add two explicit APIs:
getCanonicalClipDurationSeconds(clip, registry, options): registry-aware canonical helper for callers that have AssetRegistry.
getLegacyClipDurationSeconds(clip) or compatibility wrapper behavior through config-utils.ts: preserves existing clip-only semantics where no registry is available.
Canonical duration rule:
hold wins when finite and positive.
Else, finite from and to produce to - from.
Else, for media clips with a valid registry asset duration, use asset.duration - from when from exists, otherwise asset.duration.
Invalid, missing, or non-positive speed is repaired to 1 with a warning on read and on write for Sprint 1, matching existing UI sanitization behavior and avoiding a new write rejection policy.
Seconds-domain helpers may return 0 where canonical data is incomplete; frame helpers clamp only at render/frame conversion boundaries when a rendered sequence needs at least one frame.
Migration rule:
Callers with only clip keep legacy behavior through compatibility wrappers.
Callers with config + registry move to canonical helpers.
Any call site that cannot receive registry without broad signature churn is listed in the final notes as a remaining non-canonical duration path.
Phase 4: Preserve Existing Repair Semantics
Lift existing repair behavior into domain/repair.ts only after characterization tests are in place. The lifted implementation must preserve current semantics for:
repairConfig duplicate handling.
repairShotGroupContiguity.
migrateToFlatTracks.
Legacy pinned-group conversion.
Legacy track/background behavior.
Compatibility modules should delegate to these domain functions so existing imports continue to work. normalizeTimelineConfig should compose these exact repair steps and attach diagnostics; it should not invent new repair behavior in Sprint 1.
Read behavior remains non-persistent: normalization may repair in memory and report diagnostics, but UI load/poll/read paths must not write repaired data merely because they read it.
Phase 5: Add a UI Save-Boundary Guard
Route the actual UI persistence boundary through domain serialization, not just rows/config adapters.
In useTimelinePersistence.ts, before provider.saveTimeline(timelineId, nextData.config, expectedVersion, registry), run the save payload through a small helper such as:
ts
prepareTimelineForSave(nextData.config, registry)
That helper should normalize, validate, and serialize via domain/serialize.ts, then pass the serialized config and registry to provider.saveTimeline. This keeps edit-path internals stable while ensuring all explicit UI saves share the canonical write boundary.
Required tests:
useTimelinePersistence save passes domain-serialized config to provider.saveTimeline.
Read/load normalization does not call save by itself.
Write-time warnings are available to the save path for logging or future UI surfacing, without adding new user-visible UI in Sprint 1.
Do not refactor DataProvider.saveTimeline broadly unless this local hook-level guard misses another concrete write path. If another UI write path bypasses useTimelinePersistence.ts, document it as a remaining non-canonical writer with file path and reason.
Phase 6: Route Editor and Renderer Call Sites Deliberately
First migrate low-risk call sites that already have or can cheaply receive AssetRegistry:
buildTimelineData / row assembly paths where both TimelineConfig and AssetRegistry are available.
Renderer sequence duration calculations in TimelineRenderer.tsx and related Remotion components where resolved clips or registry-backed metadata are available.
Attachment and selected-media helpers if they already have asset registry context.
Keep configToRows(config) signature stable if broad churn is required. Add a registry-aware sibling or options parameter only where call sites can be updated safely, for example configToRows(config, { assetRegistry }), while preserving old behavior when omitted.
Audit and classify all direct duration call sites from rg, including:
Each call site must either use the canonical helper or be documented as intentionally legacy/registry-unavailable with a follow-up.
Phase 7: Route Agent Semantics and Write Feedback
Replace the private registry-aware duration helper in supabase/functions/ai-timeline-agent/tools/timeline.ts with the domain duration helper, but preserve current command behavior unless tests show a clear bug.
Normalize once after DB load, carry diagnostics into findIssues or logs, and serialize through domain serialization before saveTimelineConfigVersioned.
Agent tool output must not claim an unrepaired value was persisted. After each mutating command:
Apply the command mutation.
Run domain normalization/validation/serialization in dry-run mode before save.
If write-time repairs changed requested fields, include those repairs in the command result message and diagnostics.
For setClipProperty, either reject impossible unsafe values before mutation or report the persisted repaired value, for example speed 0 repaired to 1.
Save only the domain-serialized output.
Pin command-level behavior with focused tests for operations that depend on duration or write repair:
splitClip bounds and mutation output.
trimClip validation and mutation output.
duplicateClip placement.
queryTimeline gap/overlap reporting.
findIssues duration-related messages.
selectedClips.ts live timeline duration context.
setClipProperty result text when write serialization repairs invalid speed.
This keeps agent-safe editing honest without building the full command bus in Sprint 1.
Phase 8: Route Import Without Persisting Raw Parsed Shape
Keep @banodoco/timeline-schema validation as the first shape gate, but use its parsed output and the domain serialized output for persistence:
Parse body.timeline with TimelineConfigSchema.safeParse.
Parse or normalize body.asset_registry with domain/registry.ts.
Run domain normalization/validation on parsed timeline plus registry.
Reject hard errors with structured details.
Persist serializeCanonicalTimeline(...) output, not the raw body timeline and not only validated.timeline if that object still reflects raw input.
Warnings may be logged in Sprint 1 to avoid response-contract churn. Exposing warnings in the API response is a Sprint 2/API compatibility decision unless an existing response field already supports it.
Phase 9: Narrow Pinned Groups and Poll Sync
Pinned groups:
Sprint 1 only validates and warns on stale clipIds, missing clips, wrong trackId, stale snapshots, and legacy shapes.
Do not prune clipIds, drop empty groups, or mutate pinned group state during serialization in Sprint 1.
Backend clip CRUD consistency remains a documented follow-up unless a tiny, already-tested fix is discovered during implementation.
Poll sync:
Keep this scoped to the known conflict-detection issue.
Add or update a focused test showing configVersionRef only advances after accepting a polled payload.
Implement the fix only if it is localized to usePollSync.ts and does not require broader persistence refactoring. Otherwise, leave code unchanged and record the test/follow-up explicitly.
src/tools/video-editor/domain/duration.test.ts: hold, from/to, missing to with registry fallback, missing registry legacy behavior, invalid speed repair, frame clamping.
src/tools/video-editor/domain/repair.test.ts: lifted existing repair/migration semantics exactly match current behavior.
src/tools/video-editor/domain/normalize.test.ts: diagnostics for repaired legacy shape, duplicate IDs, missing assets, unknown clip types, pinned group stale refs, no persistence on read.
src/tools/video-editor/domain/serialize.test.ts: explicit write serialization preserves allowed extras/theme metadata and does not prune pinned groups in Sprint 1.
src/tools/video-editor/hooks/useTimelinePersistence.test.tsx: explicit UI saves pass domain-serialized config/registry to provider.saveTimeline.
Existing UI tests for timeline-data, config-utils, serialize, renderer-derived duration, and poll sync.
Edge tests for timeline-import/handler.test.ts, ai-timeline-agent/tools/timeline.test.ts, and selectedClips.test.ts, including command-level duration and write-repair feedback behavior.
Observable Success Criteria
A documented public domain API exists under src/tools/video-editor/domain and has no React/browser/Vite-alias dependencies.
TimelineConfig + AssetRegistry are documented and tested as the canonical persisted source; TimelineData and resolved renderer/agent views are documented projections.
Asset registry interpretation is centralized with stable diagnostics for malformed entries, invalid durations, missing files, unknown types, and metadata preservation.
Existing repair/migration semantics are characterized and preserved through the new domain boundary.
Registry-aware duration helpers are used by UI/render/agent/import paths that have registry context; remaining registry-free call sites are documented with reasons.
UI explicit saves through useTimelinePersistence.ts serialize through the canonical boundary before calling provider.saveTimeline.
Normalization returns structured diagnostics and does not persist repairs on read.
Explicit save/import/agent writes serialize through the canonical boundary, and import persists serialized canonical output rather than raw request shape.
Agent command results reflect write-time repairs or rejections, so persisted values do not contradict tool output.
Pinned group handling in Sprint 1 is validation/diagnostics only, with destructive cleanup deferred.
Targeted UI and edge tests cover duration fallback, registry normalization, normalization diagnostics, serialization, repair preservation, import persistence, UI save boundary, and agent consistency.
code
Plan metadata:
{
"version": 3,
"timestamp": "2026-05-02T17:08:38Z",
"hash": "sha256:31dc4dfdd21749284087db5618151c6e684ff5a22c076c0c6675927180c041b1",
"changes_summary": "Addressed the remaining significant gaps while narrowing scope back to the original foundation sprint. R11 is handled by naming the actual UI save boundary in useTimelinePersistence.ts and requiring a small canonical serialization guard there before provider.saveTimeline, without broad provider refactoring unless another concrete bypass is found. R12 is handled by adding an explicit domain/registry.ts scope, registry diagnostic policy, and tests so AssetRegistry is treated as half of the canonical persisted source. R13 is handled by requiring mutating agent tools to run post-mutation dry-run normalization/serialization and report write-time repairs or rejections, preventing tool output from claiming values that were not persisted. Scope growth is constrained: pinned-group cleanup, API warning response changes, full command bus work, broad UI signature churn, and provider-wide rewrites remain deferred unless a small localized fix is required to enforce the canonical boundary.",
"flags_addressed": [
"R11",
"R12",
"R13"
],
"questions": [
"Should import warnings remain log-only for Sprint 1 unless an existing response field can carry them without API churn?",
"For registry-unavailable UI call sites, is documenting legacy duration behavior acceptable for Sprint 1 if changing signatures would touch broad UI editing surfaces?"
],
"success_criteria": [
"Domain API exists under src/tools/video-editor/domain with documented canonical persistence/projection boundary and no UI/runtime-incompatible dependencies.",
"TimelineConfig + AssetRegistry are both covered by canonical normalization, validation, diagnostics, serialization, and tests.",
"Existing repair and migration semantics are characterized by tests and preserved through the new domain boundary.",
"Shared registry-aware duration helpers are used by UI/render/agent/import paths that have registry context; remaining registry-free call sites are documented with reasons.",
"UI saves through useTimelinePersistence.ts pass domain-serialized config and registry to provider.saveTimeline.",
"Normalization returns structured diagnostics and does not persist repairs on read.",
"Explicit save/import/agent writes serialize through the canonical boundary, and import persists serialized canonical output rather than raw request shape.",
"Agent command results reflect write-time repairs or rejections, including invalid speed repair, so tool output matches persisted state.",
"Pinned group handling in Sprint 1 is validation/diagnostics only, with destructive cleanup deferred.",
"Targeted UI and edge tests cover duration fallback, registry normalization, normalization diagnostics, serialization, repair preservation, import persistence, UI save boundary, and agent consistency."
],
"assumptions": [
"Existing UI behavior is the compatibility baseline unless characterization tests reveal a clear inconsistency that can be fixed safely.",
"Some old clip-only helpers will remain as compatibility wrappers in Sprint 1 because adding AssetRegistry everywhere would create broad signature churn.",
"Supabase edge function runtime can import relative TypeScript source already used by the repo, but cannot rely on Vite-only aliases or browser-facing modules.",
"Invalid speed <= 0 should be repaired to 1 with diagnostics in Sprint 1 to preserve current behavior, but agent command output must report that repair instead of claiming the invalid value persisted.",
"Pinned shot group data should not be destructively repaired until backend CRUD consistency is addressed deliberately.",
"Unknown registry metadata should be preserved unless it is impossible or unsafe to serialize."
],
"delta_from_previous_percent": 36.98
}
code
Existing flags:
[
{
"id": "R6",
"concern": "Scope creep: putting asset URL resolution and ResolvedTimelineConfig projection inside the canonical domain boundary risks expanding this sprint into provider/render adapter work. URL resolution is async and provider-specific, while the stated canonical persistence contract is TimelineConfig + AssetRegistry; making resolve.ts part of the public domain API could couple the domain to render/runtime concerns instead of keeping it as a pure persisted-data interpretation layer.",
"status": "disputed",
"severity": "minor"
},
{
"id": "R11",
"concern": "The plan says explicit UI saves should serialize through the canonical boundary, but it does not name the actual save boundary that currently persists nextData.config directly. In useTimelinePersistence.ts, doSave calls provider.saveTimeline(timelineId, config: nextData.config, expectedVersion, registry); several edit paths construct config through rowsToConfig or serializeForDisk, but others can assemble/migrate data and still leave nextData.config as the persisted object. Without routing doSave or DataProvider.saveTimeline through domain serialization, Sprint 1 can still have non-canonical UI writes even if import and agent writes are fixed.",
"status": "addressed",
"severity": "significant"
},
{
"id": "R12",
"concern": "The AssetRegistry half of the canonical persisted source is still under-specified. The plan mentions parsing or normalizing body.asset_registry, but the concrete domain files/tests focus on timeline clips, duration, pinned groups, and serialization; there is no explicit registry schema/diagnostic policy for invalid assets entries, non-string file, non-finite/negative duration, bad type, or preserving unknown registry metadata. Since duration fallback and render URL resolution depend on registry entries, this can leave import, UI, and agent paths sharing a timeline config interpretation while still diverging on asset registry interpretation.",
"status": "addressed",
"severity": "significant"
},
{
"id": "R13",
"concern": "Agent write repair can make tool results lie unless the plan includes a post-mutation validation/repair feedback step. The plan decides invalid speed <= 0 is repaired to 1 on write, while current agent setClipProperty delegates numeric speed edits and returns success strings based on the requested value. If domain serialization silently repairs speed: 0 to 1, the LLM/user can see \u201cSet speed ... to 0\u201d while the persisted timeline contains 1; similar issues can happen for other repaired fields. The plan should require command results or diagnostics to reflect write-time repairs, not just serialize before .",
"status": "addressed",
"severity": "significant"
}
]
code
Requirements:
- Reuse existing flag IDs when the same concern is still open.
- verified_flag_ids should list previously addressed flags that now appear resolved.
- Focus on concrete issues that would cause real problems.
- Robustness level: thorough. Be exhaustive. Flag edge cases, missing error handling, performance concerns, and anything that could cause problems in production even if unlikely.
- Verify that the plan remains aligned with the user's original intent (above), not just internal plan quality.
- Flag scope creep explicitly when the plan grows beyond the original idea or recorded user notes. Use the phrase "Scope creep:" in the concern so the orchestrator can surface it.
- Do not rubber-stamp the plan.
- Assign severity_hint carefully: "likely-significant" for issues that would
cause real product or implementation problems. "likely-minor" for cosmetic,
nice-to-have, issues already covered elsewhere, or implementation details
the executor will naturally resolve by reading the actual code (e.g. exact
line numbers, missing boilerplate, export lists).
{"flags":[{"id":"R14","concern":"The plan can accidentally change visible UI load/edit behavior for legacy media clips that have an asset registry duration but no to. In the actual repo, buildTimelineData(config, registry) always has a registry, but configToRows still uses clip-only duration via getClipSourceDuration, so missing to currently becomes 0 - from, not the asset duration. Phase 6 says to migrate row assembly paths that have TimelineConfig + AssetRegistry to registry-aware duration, while the characterization list only pins UI zero-duration behavior when no registry is available. That misses the risky real case: UI load with a registry available. If changed, clips can visibly grow on load and rowsToConfig can later persist a synthesized to.","category":"correctness","severity_hint":"likely-significant","evidence":"src/tools/video-editor/lib/timeline-data.tsbuildTimelineData receives registry, but configToRows(config) calls local getClipDurationSeconds, which delegates to getClipSourceDuration(clip) from config-utils.ts; getClipSourceDuration returns (clip.to ?? 0) - (clip.from ?? 0) and ignores registry."},{"id":"R15","concern":"The UI save-boundary guard is incomplete unless it also reconciles local TimelineData and signatures with the serialized payload. The plan routes provider.saveTimeline through domain serialization, but current useTimelinePersistence marks the save as successful using nextData.signature/nextData.stableSignature. If domain serialization repairs speed, duplicate IDs, pinned metadata, or registry shape before persistence, the server has a different canonical payload than the editor's local data and lastSavedSignatureRef; poll sync can then treat the editor's own saved echo as a foreign update or reload unexpectedly.","category":"correctness","severity_hint":"likely-significant","evidence":"src/tools/video-editor/hooks/useTimelinePersistence.ts saves nextData.config/nextData.registry, then on success sets lastSavedSignatureRef.current = nextData.stableSignature. usePollSync.ts rejects/accepts polled payloads by comparing polledStableSignature against lastSavedSignatureRef.current."},{"id":"R16","concern":"Agent registry writes still bypass the proposed canonical registry boundary. The plan says agent writes should serialize through the domain before saveTimelineConfigVersioned, but that DB helper only persists config. The actual add-media and swap command path writes new asset registry entries separately with upsert_asset_registry_entry before the timeline config save, using raw AssetRegistryEntry objects. That means agent-created registry entries can remain non-canonical and are not protected by the same validation/version handshake as the config.","category":"correctness","severity_hint":"likely-significant","evidence":"supabase/functions/ai-timeline-agent/tools/registry.ts handles add-media and swap by calling supabaseAdmin.rpc(\"upsert_asset_registry_entry\", { p_entry: assetEntry }), then calls saveTimelineConfigVersioned. supabase/functions/ai-timeline-agent/db.tssaveTimelineConfigVersioned accepts only config: TimelineConfig and calls update_timeline_config_versioned, not the asset-registry RPC."},{"id":"R17","concern":"Scope creep: Phase 7 now requires post-mutation dry-run normalization, repair-aware result rewriting, and command-level tests across split, trim, duplicate, query, issue detection, selected clips, and setClipProperty. That is directionally aligned with agent-safe editing, but it is larger than the sprint's foundation goal and crosses into command-bus/tool UX behavior. Without a narrower minimum, this can consume the sprint and delay the core domain boundary. A safer Sprint 1 bar is to canonicalize/validate before save, cover the known duration and speed-repair cases, and explicitly defer broad result-message harmonization for non-duration commands.","category":"completeness","severity_hint":"likely-minor","evidence":"The original constraints say not to build the full command bus and to avoid overreaching; the plan's Phase 7 expands into many agent command behavior assertions beyond the known speed repair and duration inconsistency."}],"verified_flag_ids":["R11","R12","R13"],"disputed_flag_ids":["R6"]}