Add rollback for optimistic asset registry updates. Three sites in useAssetManagement, useStaleVariants, useSwitchToFinalVideo fire-and-forget server persists. On failure, revert local patchRegistry with save:false and show error toast.
code
Batch framing:
- Execute batch 1 of 5.
- Actionable task IDs for this batch: ['T1']
- Already completed task IDs available as dependency context: []
Actionable tasks for this batch:
[
{
"id": "T1",
"description": "Add unpatchRegistry to useTimelineCommit.ts and export the new type in timeline-state-types.ts. Implementation: add a useCallback after patchRegistry (after line 356) that mirrors patchRegistry but destructures the target assetId out of both current.registry.assets and current.resolvedConfig.registry, then reassembles via assembleTimelineData and calls commitData with save: false. Add TimelineUnpatchRegistry = (assetId: string) => void type to timeline-state-types.ts after line 33. Return unpatchRegistry from the hook alongside patchRegistry (add to the return object at line 366).",
"depends_on": [],
"status": "pending",
"executor_notes": "",
"files_changed": [
"reigh-app/src/tools/video-editor/hooks/useTimelineCommit.ts",
"reigh-app/src/tools/video-editor/hooks/timeline-state-types.ts"
],
"commands_run": [],
"evidence_files": [],
"reviewer_verdict": ""
}
]
code
Completed task context (already satisfied, do not re-execute unless directly required by current edits):
[]
Prior batch deviations (address if applicable):
None
Batch-scoped sense checks:
[
{
"id": "SC1",
"task_id": "T1",
"question": "Does unpatchRegistry correctly destructure the assetId out of BOTH registry.assets AND resolvedConfig.registry, and does commitData get called with save:false?",
"executor_note": "",
"verdict": ""
}
]
code
Assistant
User
Assistant
Executing batch 2 for T2 and T3. I’m reading the state-layer plumbing and useStaleVariants call path first, then I’ll patch both tasks together and verify with repo-aware status and TypeScript/tests.
Assistant
I found pre-existing modifications in useTimelineState.types.ts and VideoEditorProvider.tsx. I’m diffing those before editing so I can layer unpatchRegistry in without trampling unrelated work.
Assistant
I’ve got the plumbing map. Next edit is the five-layer unpatchRegistry thread plus the stale-variant rollback/toast path, then I’ll typecheck and inspect the repo-aware diff.
Assistant
The code compiles. I’m doing a targeted audit pass now: unpatchRegistry usage across the five plumbing sites for SC2, and the exact capture/rollback ordering in useStaleVariants for SC3, then I’ll checkpoint batch 2.
Assistant
User
Assistant
Executing batch 3 for T4 and T5. I’m reading useAssetManagement, useSwitchToFinalVideo, the TimelineEditor call site, and the shot-group mutation helpers first so I can wire the rollback path without guessing at the reverse-edit behavior.
Assistant
TimelineEditor.tsx and useSwitchToFinalVideo.ts are already dirty in the worktree. I’m diffing them now and checking the shot-group mutation guards before I edit, so the rollback changes land on top of existing work instead of overwriting it.
Assistant
The main risk in T5 is the reverse path for updateToLatestVideo. I verified the stock helper no-ops when the old and new generation IDs match, so I’m adding a guarded fallback mutation that restores the old videoAssetKey directly instead of relying on that helper alone.
Assistant
The TypeScript pass is clean. I’m running the full useClipEditing.test.ts module now because that’s where the existing useSwitchToFinalVideo coverage lives, and it’s the highest-signal runtime check for the batch 3 changes.
Assistant
The existing useSwitchToFinalVideo test module passed. I’m doing a final audit pass for the two sense checks: unpatchRegistry(assetId) in useAssetManagement, and the full persistPromise/rollback/unpatch chain in useSwitchToFinalVideo plus the TimelineEditor wiring.
Assistant
I have the batch 3 implementation locked. I’m writing the checkpoint now with the exact verification results, including the useClipEditing.test.ts module pass and the note that useTimelineState.ts already carried the unpatchRegistry pass-through from T2, so T4 only needed the useAssetManagement side of that contract.
Assistant
User
Assistant
Executing batch 4 validation for T6. I’m running the exact TypeScript and Vitest commands from the plan first, then I’ll patch any failing mocks or signatures and rerun until the full hook suite and VideoEditorProvider.test.tsx are green.
Assistant
The full hook suite and provider test are in flight. I already have a clean tsc --noEmit; next step is just reading the failing output, if any, and patching the affected mocks or signatures before rerunning the same full commands.
Assistant
Validation is clean: tsc passed, the full hooks suite passed, and VideoEditorProvider.test.tsx passed. No code or test-file edits were required in this batch, so I’m writing the checkpoint with the exact command results and the explicit SC6 acknowledgment.
Assistant
{"output":"Completed batch 4 task T6 and wrote a checkpoint to .megaplan/plans/add-rollback-for-optimistic-20260413-0218/execution_batch_4.json. Validation passed without additional code or test edits: succeeded, passed with 18 test files / 102 tests, and passed with 1 test file / 3 tests.","files_changed":[".megaplan/plans/add-rollback-for-optimistic-20260413-0218/execution_batch_4.json"],"commands_run":["git -C reigh-app status --short -- src/tools/video-editor/hooks src/tools/video-editor/contexts/VideoEditorProvider.test.tsx src/tools/video-editor/hooks/useExternalDrop.test.tsx src/tools/video-editor/hooks/useClipEditing.test.ts","npx tsc --noEmit","npx vitest run --config config/testing/vitest.config.ts src/tools/video-editor/hooks/","npx vitest run --config config/testing/vitest.config.ts src/tools/video-editor/contexts/VideoEditorProvider.test.tsx"],"deviations":[],"task_updates":[{"task_id":"T6","status":"done","executor_notes":"Ran the full validation commands for this plan stage without narrowing scope: , , and . All passed ( clean, 18 hook test files / 102 tests passed, provider test file / 3 tests passed), so no additional fixes or mock updates were required in this batch.","files_changed":[],"commands_run":["npx tsc --noEmit","npx vitest run --config config/testing/vitest.config.ts src/tools/video-editor/hooks/","npx vitest run --config config/testing/vitest.config.ts src/tools/video-editor/contexts/VideoEditorProvider.test.tsx"]}],"sense_check_acknowledgments":[{"sense_check_id":"SC6","executor_note":"Confirmed all required validation passed: succeeded, ran clean with 18 test files / 102 tests passing, and passed with 3 tests. The targeted areas called out in the plan (, , ) all passed within those runs."}]}
User
Assistant
Batch 5 is final verification, so I’m doing two things in parallel: rerunning the full validation commands from batch 4, and preparing a temporary script that exercises the rollback bug path directly before I delete it.
Assistant
The temporary verification script is going into reigh-app/.tmp-rollback-check.tsx so it can use relative imports instead of alias resolution. It will exercise the useSwitchToFinalVideo failure path end-to-end: optimistic patch, persist rejection, reverse edit, registry unpatch, toast call, then it will exit nonzero if any part of the rollback is wrong.
Assistant
The full rerun is green again. I’m executing the temporary rollback script now; after it passes, I’ll delete it so the final batch leaves only the planned checkpoint artifact.
Assistant
tsx CLI hit a sandbox IPC restriction. I’m switching to node --import tsx, which uses the same loader without the blocked IPC server, then I’ll remove the temporary script once it runs.
Assistant
The temporary script failed, but the sandbox swallowed the reason because I muted console.error inside the script. I’m patching it to print the actual assertion or runtime error on failure, then I’ll rerun and fix the script itself rather than guessing.
Assistant
The rollback script passed. I’m deleting the temporary file now so the final batch leaves only the checkpoint artifact and the recorded verification results.
Assistant
Final verification is complete. I’m checkpointing T7 with the rerun results, the passing temporary rollback script, and the note that the script was deleted after execution so there’s no extra repo artifact from the final batch.
Assistant
Full execution tracking source of truth (`finalize.json`):
{
"baseline_test_command": "pytest --tb=no -q --no-header",
"baseline_test_failures": [],
"baseline_test_note": "Run all video-editor hook tests before starting. The plan touches useTimelineCommit, useTimelineState, contexts, and three consumer hooks. Existing tests for useSwitchToFinalVideo live in useClipEditing.test.ts. No existing tests for useStaleVariants or useAssetManagement rollback paths.",
"tasks": [
{
"id": "T1",
"description": "Add unpatchRegistry to useTimelineCommit.ts and export the new type in timeline-state-types.ts. Implementation: add a useCallback after patchRegistry (after line 356) that mirrors patchRegistry but destructures the target assetId out of both current.registry.assets and current.resolvedConfig.registry, then reassembles via assembleTimelineData and calls commitData with save: false. Add TimelineUnpatchRegistry = (assetId: string) => void type to timeline-state-types.ts after line 33. Return unpatchRegistry from the hook alongside patchRegistry (add to the return object at line 366).",
"depends_on": [],
"status": "pending",
"executor_notes": "",
"files_changed": [
"reigh-app/src/tools/video-editor/hooks/useTimelineCommit.ts",
"reigh-app/src/tools/video-editor/hooks/timeline-state-types.ts"
],
"commands_run": [],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T2",
"description": "Thread unpatchRegistry through the state layer alongside patchRegistry. Follow every site that receives/passes patchRegistry and add unpatchRegistry next to it. Files: (1) useTimelineState.ts \u2014 destructure unpatchRegistry from save (line ~89), pass to useAssetManagement call (line ~206), pass to useTimelineEditorContextValue (line ~284). (2) useTimelineState.types.ts \u2014 add unpatchRegistry: TimelineUnpatchRegistry to TimelineEditorOpsContextValue (after line 142). (3) useTimelineState.contexts.ts \u2014 add unpatchRegistry: TimelineUnpatchRegistry to the UseTimelineEditorContextValueArgs interface (after line 83), include in the return memo (after line 216), add to dependency array (after line 243). (4) useTimelineSave.ts \u2014 add unpatchRegistry: commit.unpatchRegistry (after line 78). (5) VideoEditorProvider.tsx \u2014 add unpatchRegistry: editor.unpatchRegistry (after line 249).",
"depends_on": [
"T1"
],
"status": "pending",
"executor_notes": "",
"files_changed": [
"reigh-app/src/tools/video-editor/hooks/useTimelineState.ts",
"reigh-app/src/tools/video-editor/hooks/useTimelineState.types.ts",
"reigh-app/src/tools/video-editor/hooks/useTimelineState.contexts.ts",
"reigh-app/src/tools/video-editor/hooks/useTimelineSave.ts",
"reigh-app/src/tools/video-editor/contexts/VideoEditorProvider.tsx"
],
"commands_run": [],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T3",
"description": "Add rollback to useStaleVariants.updateAssetToCurrentVariant (useStaleVariants.ts:169-214). Before the patchRegistry call at line 200, capture const previousEntry = entry and const previousFile = entry.file. Replace the .catch at line 203-205 to also call patchRegistry(assetKey, previousEntry, previousFile) and toast.error('Failed to update variant'). Import toast: import { toast } from '@/shared/components/ui/runtime/sonner' (matches useClipEditing.ts in same directory). Keep the existing console.error line.",
"depends_on": [
"T1"
],
"status": "pending",
"executor_notes": "",
"files_changed": [
"reigh-app/src/tools/video-editor/hooks/useStaleVariants.ts"
],
"commands_run": [],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T4",
"description": "Add rollback to useAssetManagement.registerGenerationAsset (useAssetManagement.ts:292-295). (1) Add unpatchRegistry to the UseAssetManagementArgs interface (after patchRegistry at line 41). (2) Destructure unpatchRegistry in the hook body (line ~243 area). (3) Replace the .catch at line 293-295 to also call unpatchRegistry(assetId) and toast.error('Failed to save asset'). (4) Import toast: import { toast } from '@/shared/components/ui/runtime/sonner'. (5) Add unpatchRegistry to the useCallback dependency array at line 298. (6) In useTimelineState.ts, update the useAssetManagement call (line ~206) to pass unpatchRegistry.",
"depends_on": [
"T2"
],
"status": "pending",
"executor_notes": "",
"files_changed": [
"reigh-app/src/tools/video-editor/hooks/useAssetManagement.ts",
"reigh-app/src/tools/video-editor/hooks/useTimelineState.ts"
],
"commands_run": [],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T5",
"description": "Add rollback to useSwitchToFinalVideo (useSwitchToFinalVideo.ts). (1) Add unpatchRegistry to UseSwitchToFinalVideoArgs interface (after line 21, import TimelineUnpatchRegistry type). (2) Refactor registerFinalVideoAsset (line 25-42) to return { assetKey, persistPromise } instead of just assetKey \u2014 remove the void ... .catch() from the helper, return persistPromise: registerAsset(assetKey, assetEntry). (3) In switchToFinalVideo (line 51-70): destructure { assetKey, persistPromise }, add .catch on persistPromise that calls buildSwitchShotGroupToImagesMutation({ currentData: dataRef.current, shotId, rowId }), applies the reverse mutation via applyEdit, calls unpatchRegistry(assetKey), and shows toast.error('Failed to save asset'). (4) In updateToLatestVideo (line 72-91): before the forward edit, capture oldVideoAssetKey from dataRef.current?.config.pinnedShotGroups (find group with matching shotId, trackId===rowId, mode==='video'). On persist failure: call buildUpdateShotGroupToLatestVideoMutation with oldVideoAssetKey to restore, applyEdit the reverse, unpatchRegistry(assetKey), toast. (5) Import toast from @/shared/components/ui/runtime/sonner. (6) Add unpatchRegistry to both useCallback dep arrays. (7) In TimelineEditor.tsx (line ~499-505), pass unpatchRegistry to the useSwitchToFinalVideo call.",
"depends_on": [
"T2"
],
"status": "pending",
"executor_notes": "",
"files_changed": [
"reigh-app/src/tools/video-editor/hooks/useSwitchToFinalVideo.ts",
"reigh-app/src/tools/video-editor/components/TimelineEditor/TimelineEditor.tsx"
],
"commands_run": [],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T6",
"description": "Run TypeScript compilation and all existing video-editor hook tests. Fix any type errors or test failures introduced by T1-T5. Commands: (1) cd reigh-app && npx tsc --noEmit (2) cd reigh-app && npx vitest run --config config/testing/vitest.config.ts src/tools/video-editor/hooks/ (3) cd reigh-app && npx vitest run --config config/testing/vitest.config.ts src/tools/video-editor/contexts/VideoEditorProvider.test.tsx. Key areas to watch: useClipEditing.test.ts has existing useSwitchToFinalVideo tests (line 468+) that pass registerAsset \u2014 they'll need updating if the hook signature changed. Also useExternalDrop.test.tsx mocks patchRegistry but not unpatchRegistry \u2014 may need a vi.fn() added. VideoEditorProvider.test.tsx mocks patchRegistry at line 152 \u2014 add unpatchRegistry: vi.fn() alongside it.",
"depends_on": [
"T3",
"T4",
"T5"
],
"status": "pending",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T7",
"description": "Run tests relevant to the changed files to verify correctness and check for regressions \u2014 run the full test file/module, not just individual functions. Find and run the project's existing test suite \u2014 do NOT create new test files. If any test fails, read the error, fix the code, and re-run until all tests pass.",
"depends_on": [
"T6"
],
"status": "pending",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"evidence_files": [],
"reviewer_verdict": ""
}
],
"watch_items": [
"TOAST IMPORT: Plan says @/shared/components/ui/toast but the correct import for hooks in this directory is import { toast } from '@/shared/components/ui/runtime/sonner' (matches useClipEditing.ts, 88 uses vs 4). Use sonner.",
"TEST CONFIG: Always run vitest with --config config/testing/vitest.config.ts from reigh-app/. Do NOT use bare npx vitest \u2014 the @ alias won't resolve without the config.",
"EXISTING TESTS: useSwitchToFinalVideo tests live in useClipEditing.test.ts:468+, not their own file. They pass registerAsset as a mock \u2014 will need updating for the new unpatchRegistry arg and the refactored registerFinalVideoAsset return type.",
"MOCK UPDATES: useExternalDrop.test.tsx:189, VideoEditorProvider.test.tsx:152, and useClipEditing.test.ts:640 all mock hook args including patchRegistry \u2014 each needs unpatchRegistry: vi.fn() added to avoid runtime errors.",
"FLAG-002 (open, minor): tsconfig.app.json excludes test files, so tsc --noEmit won't typecheck new test files. For test type coverage, rely on vitest compilation instead.",
"unpatchRegistry IMPLEMENTATION: Mirror patchRegistry exactly but destructure the assetId out. Key pattern: const { [assetId]: _removed, ...remainingAssets } = current.registry.assets ?? {}. Don't forget to also rebuild resolvedConfig.clips with the removed asset (clips referencing the removed asset should get assetEntry: undefined).",
"updateToLatestVideo ROLLBACK GUARD: buildUpdateShotGroupToLatestVideoMutation has a no-op guard when currentGenerationId === targetGenerationId. The reverse call passes the same targetGenerationId but a different assetKey. Verify during implementation that the guard checks the asset key's generationId, not the param \u2014 if the guard no-ops, use a raw metaUpdates mutation instead.",
"DEBT: This plan does NOT create new test files for rollback paths (plan Steps 6 test creation was downscoped to avoid scope creep). Existing tests + typecheck + manual verification are the validation strategy.",
"SAVE:FALSE INVARIANT: Both patchRegistry and unpatchRegistry call commitData with save:false. This is critical \u2014 rollback must never trigger a server save of the reverted state."
],
"sense_checks": [
{
"id": "SC1",
"task_id": "T1",
"question": "Does unpatchRegistry correctly destructure the assetId out of BOTH registry.assets AND resolvedConfig.registry, and does commitData get called with save:false?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC2",
"task_id": "T2",
"question": "Is unpatchRegistry threaded through every site that already passes patchRegistry? Check: useTimelineSave, useTimelineState, useTimelineState.contexts, useTimelineState.types, VideoEditorProvider. Missing any one site will cause a runtime undefined error.",
"executor_note": "",
"verdict": ""
},
{
"id": "SC3",
"task_id": "T3",
"question": "Does the rollback in useStaleVariants correctly capture the ORIGINAL entry (before the updatedEntry mutation) and pass it to patchRegistry on failure? The capture must happen before line 200.",
"executor_note": "",
"verdict": ""
},
{
"id": "SC4",
"task_id": "T4",
"question": "Does useAssetManagement.registerGenerationAsset call unpatchRegistry(assetId) \u2014 not patchRegistry \u2014 on failure? And is unpatchRegistry in the useCallback dep array?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC5",
"task_id": "T5",
"question": "In useSwitchToFinalVideo: (1) Does registerFinalVideoAsset now return { assetKey, persistPromise } and NOT fire-and-forget internally? (2) Does switchToFinalVideo reverse with buildSwitchShotGroupToImagesMutation? (3) Does updateToLatestVideo capture oldVideoAssetKey BEFORE the forward edit? (4) Is unpatchRegistry passed from TimelineEditor.tsx?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC6",
"task_id": "T6",
"question": "Do all existing tests pass? Specifically: useClipEditing.test.ts (useSwitchToFinalVideo tests at line 468+), useExternalDrop.test.tsx, VideoEditorProvider.test.tsx \u2014 all need unpatchRegistry mocks added. Does tsc --noEmit pass?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC7",
"task_id": "T7",
"question": "Did the verification tests pass? Were any regressions found and fixed?",
"executor_note": "",
"verdict": ""
}
],
"meta_commentary": "This is a 6-task plan touching ~10 files. The core risk is threading: unpatchRegistry must be plumbed through the same 5-layer chain as patchRegistry, and missing any link causes a runtime undefined. T2 is the most tedious task (pure plumbing) but also where errors are most likely.\n\nToast import gotcha: the plan says @/shared/components/ui/toast but the hooks directory convention (useClipEditing.ts, TimelineEditor.tsx) uses @/shared/components/ui/runtime/sonner. Use sonner.\n\nThe updateToLatestVideo rollback (T5) has a known uncertainty: the buildUpdateShotGroupToLatestVideoMutation no-op guard may block the reverse mutation if it checks targetGenerationId rather than the asset key's generationId. If the reverse mutation returns null, the executor should read the guard logic in shot-group-commands.ts and either bypass it or construct a raw metaUpdates mutation.\n\nTest files for rollback paths (plan Step 6) were intentionally omitted \u2014 the existing test suite + typecheck + sense checks are sufficient validation for this scope. The existing useSwitchToFinalVideo tests in useClipEditing.test.ts will need mock updates but should not need new test cases.\n\nExecution order: T1 first (foundation), then T2 (threading), then T3/T4/T5 in parallel (each is an independent file), then T6 (validation). T4 has a minor dependency on T2 because useTimelineState.ts needs the unpatchRegistry pass-through to useAssetManagement, but T4 can batch that edit.",
"validation": {
"plan_steps_covered": [
{
"plan_step_summary": "Step 1: Add unpatchRegistry to useTimelineCommit + type to timeline-state-types.ts",
"finalize_task_ids": [
"T1"
]
},
{
"plan_step_summary": "Step 2: Thread unpatchRegistry through state layer (useTimelineState, types, contexts)",
"finalize_task_ids": [
"T2"
]
},
{
"plan_step_summary": "Step 3: Add rollback to useStaleVariants.updateAssetToCurrentVariant",
"finalize_task_ids": [
"T3"
]
},
{
"plan_step_summary": "Step 4: Add rollback to useAssetManagement.registerGenerationAsset",
"finalize_task_ids": [
"T4"
]
},
{
"plan_step_summary": "Step 5: Add rollback to useSwitchToFinalVideo (switchToFinalVideo + updateToLatestVideo)",
"finalize_task_ids": [
"T5"
]
},
{
"plan_step_summary": "Step 6: Add tests for rollback paths",
"finalize_task_ids": [
"T6"
]
},
{
"plan_step_summary": "Step 7: Run existing tests and type check",
"finalize_task_ids": [
"T6"
]
}
],
"orphan_tasks": [
"T7"
],
"completeness_notes": "Steps 6 and 7 are merged into T6 (validation task). Step 6 originally called for creating new test files (useStaleVariants.test.ts, useSwitchToFinalVideo.test.ts) but this was descoped: existing tests in useClipEditing.test.ts already cover useSwitchToFinalVideo, and the validation task covers updating mocks and running the full suite. No new test files are created \u2014 this avoids scope creep while still validating correctness via typecheck + existing test suite.",
"coverage_complete": true
}
}
code
Debt watch items (do not make these worse):
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: for ordinary pairs, the new diagnosis is not well-supported by the repo. the current sync effect in /users/user_c042661f/documents/reigh-workspace/reigh-app/src/tools/travel-between-images/components/shotimageseditor/hooks/usesegmentslotmode.ts already syncs url and primaryvariantid, and the regenerate path reads exactly starturl, endurl, startgenid, endgenid, startvariantid, and endvariantid from segmentslotmode.pairdata in /users/user_c042661f/documents/reigh-workspace/reigh-app/src/domains/media-lightbox/hooks/usevideoregeneratemode.ts. adding thumburl and generationid to the sync does not, by itself, explain why an old image url is still being used for regular pairs. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: the fix is incomplete for extra trailing slots. handlepairclick can populate activepairdata from trailingpairdata when pairindex === pairdatabyindex.size in /users/user_c042661f/documents/reigh-workspace/reigh-app/src/tools/travel-between-images/components/shotimageseditor/hooks/usesegmentslotmode.ts, but the proposed sync effect only reads pairdatabyindex.get(segmentslotlightboxindex). for those trailing-slot cases fresh is undefined, so no image refresh happens. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: the merge pseudocode does not actually sync 'all image fields' as claimed. it omits id and position from change detection, and when fresh.startimage or fresh.endimage becomes null it preserves the stale previous object instead of syncing that null state. as written, it also needs explicit null-guards around spreads of prev.startimage / prev.endimage to be safe in strict typescript. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: the plan's claim that worker_state.py:200-204 (the 30-minute startup safety net) catches abandoned pods that exited before patching is slightly imprecise. line 200-204 only runs when in_startup_phase is true, which requires startup_phase to be in ('deps_installing', 'deps_verified', 'worker_starting') per line 161. a pod that exits before its first patch has startup_phase = none, so in_startup_phase is false and the code falls through to the normal timeout checks (active_stale / not_claiming) at line 207+, not the 30-minute startup cap. both paths eventually reap the worker, so the end result is the same, but the overview's reasoning (naming 200-204 specifically) is wrong. worth correcting so future readers don't mis-reason about the invariant. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: checked worker_state.py line 161 (in_startup_phase = startup_phase in (...)) against the plan's assumption that subsequent lenient writes are safe. if deps_installing succeeds but deps_verified silently fails, startup_phase stays at 'deps_installing' and the 30-minute cap from line 200-204 applies — even though the pod is actually progressing through uv sync. on a slow runpod image with cold wheel downloads, uv sync --extra cuda124 plus wan2gp deps can take 20+ minutes. there's no concrete benchmark in the plan that says the 30-minute cap is safely above the expected sync time; if uv sync legitimately takes 25 minutes and the deps_verified patch fails on a transient network blip, the orchestrator will terminate a healthy pod. plan should either bump the cap or note that deps_verified swallowing is acceptable because the cap is generously above typical sync time. (flagged 1 times across 1 plans)
[DEBT] are-the-success-criteria-well-prioritized-and-verifiable: are the success criteria well-prioritized and verifiable?: the attached success criteria are stale and do not match the current plan body. they still require 'no usestate for activepairdata', 'setactivepairdata fully removed', 'sync effect deleted', and 'onpairclick simplified to (pairindex: number) => void', which are the opposite of the current targeted-sync plan. as presented, the criteria are not usable for review or execution. (flagged 1 times across 1 plans)
[DEBT] audio-loading: getaudiodata in useeffect removes render-readiness signal (flagged 1 times across 1 plans)
[DEBT] audio-loading: same as correctness-3 — preview/render parity risk (flagged 1 times across 1 plans)
[DEBT] audio-loading: preview/render parity partially satisfied (flagged 1 times across 1 plans)
[DEBT] audio-reactivity: overlapping clips use first-found, volume not scaled (flagged 1 times across 1 plans)
[DEBT] audio-reactivity: same as audio-reactivity-1 — overlapping/volume-adjusted clips diverge from audible mix (flagged 1 times across 1 plans)
[DEBT] audio-reactivity: textclip missing globalframeprovider (flagged 1 times across 1 plans)
[DEBT] audio-reactivity: same as audio-reactivity-2 — textclipsequence missing provider (flagged 1 times across 1 plans)
[DEBT] audio-reactivity: textclip effects surface not covered (flagged 1 times across 1 plans)
[DEBT] audio-reactivity: continuous effects shared by visual and text clips (flagged 1 times across 1 plans)
[DEBT] batch-generation-pipeline: enhancement in usegeneratebatch before generatevideo() could compute prompts against a stale pair snapshot if mutations are still in flight. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-cascade-paths: cascade lookup only reads params->>'orchestrator_task_id_ref', missing shared reference paths and orchestrator-self detection. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-cascade-paths: duplicate of correctness-2 + correctness-3: invalid sql syntax and narrow cascade lookup. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-cascade-paths: shared orchestrator-reference helpers not referenced. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-cascade-paths: orchestrator tasks that crash don't get orchestrator-self cascade. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-cascade-paths: hardcoded params->>'orchestrator_task_id_ref' misses other reference paths. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-retry: crash requeue sql does not increment attempts, risking infinite requeue loop. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-retry: duplicate of correctness-1: attempts never advance on crash requeue. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-retry: missing attempts increment location in heartbeat sql. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-retry: step 6 under-scoped for real retry convergence and orchestrator-self handling. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-sql-syntax: bare select inside plpgsql is invalid — needs perform. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-testing: no multi-crash convergence test exercising attempts 0→1→2→3. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-testing: no validation that plpgsql body executes successfully. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-testing: criteria don't require proof of crash requeue convergence. (flagged 1 times across 1 plans)
[DEBT] criteria-verifiability: 'no unsafe .maybesingle()' criterion requires judgment about column uniqueness. (flagged 1 times across 1 plans)
[DEBT] criteria-verifiability: decision documentation location not specified. (flagged 1 times across 1 plans)
[DEBT] criteria-verifiability: the must criterion requiring 5 task types to exist as active db rows is not verifiable from code diff alone — it requires a live db query. (flagged 1 times across 1 plans)
[DEBT] db-fallback-testing: no new automated test for the db fallback dispatch path or dependant_on preservation for raw worker families. (flagged 1 times across 1 plans)
[DEBT] dependency-resolution: dependency resolution: the plan does not lock down the active python-version matrix even though the repo currently splits between python 3.10 local installs and a python 3.11 runpod image. (flagged 1 times across 1 plans)
[DEBT] did-the-work-fully-address-the-issue-hints-user-notes-and-approved-plan-requirements: did the work fully address the issue hints, user notes, and approved plan requirements?: the package is internally inconsistent. the plan body says to keep activepairdata in usestate and make phase 2 optional, but the attached metadata and success criteria still describe the previous derive-via-usememo / remove-setactivepairdata / simplify-onpairclick plan. that means the approved-plan requirements are only partially coherent as presented. (flagged 1 times across 1 plans)
[DEBT] did-the-work-fully-address-the-issue-hints-user-notes-and-approved-plan-requirements: did the work fully address the issue hints, user notes, and approved plan requirements?: the linux distro note is documentation-only; the generated install command in step 7 still runs apt-get install python3.10-venv python3.10-dev ffmpeg without any pre-check that the package exists. users on ubuntu 24.04+ who ignore the doc and try to copy-paste the command will hit a confusing e: unable to locate package python3.10-venv from apt rather than a targeted error from commandutils.ts. a one-line detection pre-check (e.g., apt-cache show python3.10-venv >/dev/null 2>&1 || { echo 'install deadsnakes ppa first — see readme'; exit 1; }) would convert the silent failure into an actionable error, but the plan does not add this. (flagged 1 times across 1 plans)
[DEBT] does-the-change-touch-all-locations-and-supporting-infrastructure: does the change touch all locations and supporting infrastructure?: phase 1 still misses a real supporting-data location: trailingpairdata lives outside pairdatabyindex in /users/user_c042661f/documents/reigh-workspace/reigh-app/src/tools/travel-between-images/components/shotimageseditor/hooks/usesegmentslotpresentationadapter.ts, but the proposed sync logic only considers pairdatabyindex. if trailing slot regenerate is part of the bug surface, that location is not covered. (flagged 1 times across 1 plans)
[DEBT] does-the-change-touch-all-locations-and-supporting-infrastructure: does the change touch all locations and supporting infrastructure?: the non-swallowing helper update_worker_phase_strict is a new shell function, but phase 1 step 2 introduces it only as pseudo-code. there is no concrete note that the helper must handle supabase http non-2xx responses as failures (curl returns 0 even on http 4xx/5xx by default unless -f or --fail-with-body is used). if the implementer ports update_worker_phase verbatim with only || return 0 removed, a 500 from supabase would still report success because curl's exit code is 0. the plan should specify curl --fail or explicit http status code checking in the strict variant. (flagged 1 times across 1 plans)
[DEBT] edge-test-config: plan's vitest commands use the wrong config entry point. (flagged 1 times across 1 plans)
[DEBT] edge-test-config: same as verification-3: wrong vitest config in validation commands. (flagged 1 times across 1 plans)
[DEBT] edge-test-config: success criterion references wrong test command. (flagged 1 times across 1 plans)
[DEBT] error-handling: db loader error handling convention mismatch (plan says log+null, existing loaders throw) (flagged 1 times across 1 plans)
[DEBT] error-propagation-logging: generation.ts and handler.ts logging endpoints are not directly tested. (flagged 1 times across 1 plans)
[DEBT] error-propagation-testing: no end-to-end regression test for the full symptom chain (db error → tocompletionerror metadata → handler log). (flagged 1 times across 1 plans)
[DEBT] error-propagation-testing: handler.ts metadata surfacing criterion lacks a concrete automated verifier. (flagged 1 times across 1 plans)
[DEBT] error-propagation-testing: main issue only partially validated without an integration test. (flagged 1 times across 1 plans)
[DEBT] find-the-callers-of-the-changed-function-what-arguments-do-they-actually-pass-does-the-fix-handle-all-of-them: find the callers of the changed function. what arguments do they actually pass? does the fix handle all of them?: the step 2 retry loop uses a naked sleep 2 between attempts, which adds up to 6 seconds of latency on the happy path when the first patch eventually succeeds on attempt 2 or 3. for pods where supabase is reachable but slow during the initial moments of a cold runpod start, the retry logic is fine. however, if the first attempt fails with a tls handshake delay and the retry loop sleeps 2s per attempt regardless of whether curl itself has been blocking for tens of seconds, the total startup latency penalty could be substantial. this is a minor tuning concern, not a correctness issue. (flagged 1 times across 1 plans)
[DEBT] gpu-branching-test-matrix: linux cuda128 path under-verified (flagged 1 times across 1 plans)
[DEBT] gpu-branching-ui-surface: nvidia-50 option is exposed on linux in the ui but linux cuda128 smoke test is missing (flagged 1 times across 1 plans)
[DEBT] hook-abstraction: usepairsettingshandler becomes trivial with single caller — keeping it is extra indirection. (flagged 1 times across 1 plans)
[DEBT] is-the-change-in-the-right-place-and-would-it-break-any-callers: is the change in the right place, and would it break any callers?: the optional cleanup steps are not in the right place yet. pairregionslayer does not receive pairdatabyindex today; its props are only images, imagepositionswithpending, pairinfowithpending, and callback/display props in /users/user_c042661f/documents/reigh-workspace/reigh-app/src/tools/travel-between-images/components/timeline/timelinecontainer/components/pairregionslayer.tsx. so step 4's 'pass pairdatabyindex.get(pairindex) directly' would require new prop plumbing or a different seam. (flagged 1 times across 1 plans)
[DEBT] is-the-scope-and-scale-of-the-change-appropriate: is the scope and scale of the change appropriate?: phase 2 is still under-specified for execution. step 4 says pairregionslayer should either pass pairdatabyindex.get(pairindex) directly or 'just pass the index + frame-only data', which are materially different designs. if phase 2 is kept in the plan, it needs a single concrete direction. (flagged 1 times across 1 plans)
[DEBT] is-there-convincing-verification-for-the-change: is there convincing verification for the change?: the plan still lacks an explicit automated regression test for the reported bug. step 2 is manual ('check that usevideoregeneratemode now gets the fresh url'), but there is no concrete test that opens a segment slot, changes the primary variant data, and asserts that the regenerate path sees the fresh url, generationid, and primaryvariantid. (flagged 1 times across 1 plans)
[DEBT] is-there-convincing-verification-for-the-change: is there convincing verification for the change?: the current usesegmentslotmode test remains only a smoke test in /users/user_c042661f/documents/reigh-workspace/reigh-app/src/tools/travel-between-images/components/shotimageseditor/hooks/tests/usesegmentslotmode.test.ts, and the plan does not add behavior coverage for the new sync effect. (flagged 1 times across 1 plans)
[DEBT] is-there-convincing-verification-for-the-change: is there convincing verification for the change?: no verification step covers the trailing-slot branch, even though the proposed phase 1 logic currently misses trailingpairdata refreshes. (flagged 1 times across 1 plans)
[DEBT] legacy-data-backfill: the step 8 diagnostic query only detects cross-shot pair_shot_generation_id misassociations, not same-shot misassociations caused by timeline reordering within a shot. (flagged 1 times across 1 plans)
[DEBT] lookup-consistency: other repo call sites use unordered .limit(1).maybesingle() and will remain inconsistent. (flagged 1 times across 1 plans)
[DEBT] lookup-consistency: other call sites with same unsafe pattern not covered. (flagged 1 times across 1 plans)
[DEBT] lora-management: lora tools simplified vs full ui parity (multi-stage metadata, private loras) (flagged 1 times across 1 plans)
[DEBT] media-lightbox-persistence: variant switches do not clear/restore inpaintprompt, so stale prompt state can leak across variants with no cached prompt. (flagged 1 times across 1 plans)
[DEBT] media-lightbox-persistence: removing prompt/numgenerations from the variant-keyed localstorage cache means all variants within a generation share the same prompt. this broadens existing debt-002 (variant prompt leakage). (flagged 1 times across 1 plans)
[DEBT] media-lightbox-segment-slot: media lightbox / segment slot: the targeted sync rationale does not fully explain the reported stale-url bug for regular pairs, and the proposed effect still misses trailing-slot refreshes because those can come from trailingpairdata rather than pairdatabyindex. (flagged 1 times across 1 plans)
[DEBT] number-input-nullable: plan doesn't explicitly state onchange must also accept null, though step 3 depends on it. (flagged 1 times across 1 plans)
[DEBT] number-input-nullable: disputed v1 flag — original concern about bulkclippanel being unimplementable. (flagged 1 times across 1 plans)
[DEBT] number-input-nullable: onchange null filtering not explicitly addressed in plan. (flagged 1 times across 1 plans)
[DEBT] number-input-testing: no planned tests for numberinput shared component or bulkclippanel nullable draft flow. (flagged 1 times across 1 plans)
[DEBT] orchestrator-completion-rollout: pre-existing individual_travel_segment children won't drive orchestrator completion through segment_type_config after deploy. (flagged 1 times across 1 plans)
[DEBT] orchestrator-completion-rollout: missing compatibility seam in orchestratorcore.ts:123-126 for old individual_travel_segment rows. (flagged 1 times across 1 plans)
[DEBT] orchestrator-completion-rollout: mixed old/new data during rollout can leave old orchestrators without completion counting. (flagged 1 times across 1 plans)
[DEBT] orchestrator-completion-rollout: no test or deployment guard for pre-existing individual_travel_segment children completing after worker change. (flagged 1 times across 1 plans)
[DEBT] orchestrator-completion-rollout: plan overstates backward compatibility for existing data. (flagged 1 times across 1 plans)
[DEBT] orchestrator-completion-rollout: missing rollout compatibility step for in-flight individual_travel_segment tasks. (flagged 1 times across 1 plans)
[DEBT] orchestrator-completion-rollout: pre-deploy individual_travel_segment child completing post-rollout won't be treated as segment task by checkorchestratorcompletion. (flagged 1 times across 1 plans)
[DEBT] orchestrator-completion-rollout: orchestrator.test.ts criterion too narrow to verify old individual_travel_segment compatibility. (flagged 1 times across 1 plans)
[DEBT] pair-settings-plumbing: handleopenpairsettings(pairindex, pairframedata) path in timelinetrackprelude, segmentoutputstrip, and usesegmentoutputstrip not explicitly named. (flagged 1 times across 1 plans)
[DEBT] pair-settings-plumbing: same as flag-002 — segmentoutputstrip and usesegmentoutputstrip still carry pairframedata. (flagged 1 times across 1 plans)
[DEBT] pair-settings-plumbing: timelinetrackprelude and segmentoutputstrip still forward (pairindex, pairframedata). (flagged 1 times across 1 plans)
[DEBT] plan-scope: step 3 is larger than a light megaplan warrants. (flagged 1 times across 1 plans)
[DEBT] planning-metadata: planning metadata: the attached metadata and success criteria still describe a different implementation than the current plan body, which risks sending execution and review down the wrong path. (flagged 1 times across 1 plans)
[DEBT] planning-metadata: success criteria don't cover wave 4 scope (flagged 1 times across 1 plans)
[DEBT] position-key-semantics: plan investigates a unique constraint on (parent_generation_id, child_order) which doesn't match repo semantics for position keys. (flagged 1 times across 1 plans)
[DEBT] position-key-semantics: plan weights toward child_order rather than pair_shot_generation_id as the key that matters. (flagged 1 times across 1 plans)
[DEBT] position-key-semantics: unique constraint on (parent_generation_id, child_order) not supported by repo semantics. (flagged 1 times across 1 plans)
[DEBT] prompt-composition: the plan's step 1 signature includes textbeforeprompts/textafterprompts parameters that would be applied before enhancement, double-wrapping the prompt. (flagged 1 times across 1 plans)
[DEBT] settings-defaults: workerrepopath default can go stale if user switches computertype before editing path (flagged 1 times across 1 plans)
[DEBT] settings-resolution: settings cascade missing — shot-only read diverges from form's defaults→user→project→shot merge (flagged 1 times across 1 plans)
[DEBT] settings-resolution: settings cascade missing — shot-only read (flagged 1 times across 1 plans)
[DEBT] shared-component-compatibility: numberinput changes affect callers outside video-editor (billing, travel-between-images, phaseconfigselectormodal). (flagged 1 times across 1 plans)
[DEBT] shared-component-compatibility: shared ui component blast radius not audited in plan. (flagged 1 times across 1 plans)
[DEBT] shot-linking-testing: no test covers the linkgenerationtoshot error/catch branches. (flagged 1 times across 1 plans)
[DEBT] signature-propagation: plan doesn't explicitly name timeline/index.tsx and segmentslotcontracts.ts for updates. (flagged 1 times across 1 plans)
[DEBT] signature-propagation: same as flag-001 — timeline/index.tsx and segmentslotcontracts.ts not in checklist. (flagged 1 times across 1 plans)
[DEBT] signature-propagation: five supporting contract/plumbing sites not named in the checklist. (flagged 1 times across 1 plans)
[DEBT] task-types-verification: step 3 cites wrong migration file (task_cost_configs instead of task_types) as evidence for db fallback path. (flagged 1 times across 1 plans)
[DEBT] task-types-verification: step 3 should cite task_types source, not task_cost_configs. (flagged 1 times across 1 plans)
[DEBT] task-types-verification: plan doesn't verify travel_segment and travel_stitch exist as active task_types rows using the correct table. (flagged 1 times across 1 plans)
[DEBT] test-coverage: current generation-child.test.ts is only a smoke test. (flagged 1 times across 1 plans)
[DEBT] test-coverage: no plan to verify other lookup paths choose rows consistently. (flagged 1 times across 1 plans)
[DEBT] test-coverage: no new tests for db loader or travel param merge path (flagged 1 times across 1 plans)
[DEBT] test-coverage: must-level criteria depend on manual testing rather than automated assertions (flagged 1 times across 1 plans)
[DEBT] test-coverage: no new unit tests for wave 4 tools (flagged 1 times across 1 plans)
[DEBT] test-coverage: must criteria backed by manual testing only (flagged 1 times across 1 plans)
[DEBT] test-infrastructure: no test fixtures for resources table (flagged 1 times across 1 plans)
[DEBT] timeline-drag-coordination: plan keeps two hooks instead of a single coordinator (flagged 1 times across 1 plans)
[DEBT] timeline-drag-coordination: brief says single coordinator but plan keeps separate hooks (flagged 2 times across 1 plans)
[DEBT] timeline-drag-coordination: pendingopsref retained despite brief suggesting removal (flagged 1 times across 1 plans)
[DEBT] timeline-drag-coordination: wrapper-bound listener mount wiring under-specified (flagged 1 times across 1 plans)
[DEBT] timeline-persistence: read path still assembles config and registry from separate requests (flagged 1 times across 1 plans)
[DEBT] timeline-persistence: poll sync verification not structurally changed (flagged 1 times across 1 plans)
[DEBT] timeline-persistence: backend save helpers not wired to new rpc (flagged 1 times across 1 plans)
[DEBT] timeline-persistence: read infrastructure not updated (flagged 1 times across 1 plans)
[DEBT] timeline-persistence: backend tests not in validation list (flagged 1 times across 1 plans)
[DEBT] timeline-persistence: backend callers not migrated (flagged 1 times across 1 plans)
[DEBT] timeline-persistence: broader persistence-contract problem (flagged 1 times across 1 plans)
[DEBT] timeline-persistence: backend split-save not addressed (flagged 1 times across 1 plans)
[DEBT] timeline-persistence: split polling can combine config and registry from different snapshots (flagged 1 times across 1 plans)
[DEBT] timeline-scaling: the plan only specifies a concrete fix for the default scale(1) case; explicit-scale tracks may still break blend-mode effects. (flagged 1 times across 1 plans)
[DEBT] travel-continuations: smooth continuations not threaded — agent tasks won't have continuation_config even when shot settings enable it (flagged 1 times across 1 plans)
[DEBT] travel-continuations: continuation_config omitted from form parity (flagged 1 times across 1 plans)
[DEBT] travel-payload-cleanup-scope: plan scope narrower than original user request (flagged 1 times across 1 plans)
[DEBT] travel-payload-cleanup-scope: broader create-task contract problem left untouched (flagged 1 times across 1 plans)
[DEBT] travel-payload-readers: phase 4 app-side reader audit incomplete (flagged 1 times across 1 plans)
[DEBT] travel-payload-readers: phase 4 field inventory incomplete for app-side readers (flagged 1 times across 1 plans)
[DEBT] travel-request-contract: image_variant_ids is in frontend request contract (flagged 1 times across 1 plans)
[DEBT] travel-request-contract: image_variant_ids contract change (flagged 1 times across 1 plans)
[DEBT] variant-update-b-fresh-takeover: spawn_worker does not internally call start_worker_process; harness must call both explicitly (flagged 1 times across 1 plans)
[DEBT] variant-update-b-fresh-takeover: worker_id and runpod_id must be generated and threaded distinctly; plan currently uses pod_id as both (flagged 1 times across 1 plans)
[DEBT] variant-update-b-fresh-takeover: duplicate of correctness-1 — spawn_worker two-step misstatement (flagged 2 times across 1 plans)
[DEBT] variant-update-b-fresh-takeover: duplicate of correctness-2 — worker_id/runpod_id propagation across takeover and restore paths (flagged 1 times across 1 plans)
[DEBT] variant-update-b-fresh-takeover: duplicate of correctness-1 + correctness-2 — missing create_worker_record glue and start_worker_process integration (flagged 1 times across 1 plans)
[DEBT] variant-update-b-fresh-takeover: duplicate of correctness-2 — caller contract for spawn_worker requires worker_id, not pod_id (flagged 1 times across 1 plans)
[DEBT] verification: no end-to-end render test for audio analysis timing (flagged 1 times across 1 plans)
[DEBT] verification: no automated coverage for text clips or overlapping clips with audio effects (flagged 1 times across 1 plans)
[DEBT] verification-coverage: no automated test exercises the full segment-slot opening path after cleanup. (flagged 1 times across 1 plans)
[DEBT] verification-coverage: no automated coverage that clicking a pair opens the correct modal after cleanup. (flagged 1 times across 1 plans)
[DEBT] verification-coverage: zero behavioral change criterion is not verifiable from tsc + existing tests alone. (flagged 1 times across 1 plans)
[DEBT] verification-workflow: tsconfig.app.json excludes test files, so tsc won't catch test breakage. (flagged 1 times across 1 plans)
[DEBT] worker-test-staleness: worker test in test_additional_coverage_modules.py:37 may assert stale payload structure (task_type vs family). (flagged 1 times across 1 plans)
code
Note: User chose auto-approve mode. This execution was not manually reviewed at the gate. Exercise extra caution on destructive operations.
Robustness level: light.
Requirements:
- Execute only the actionable tasks in this batch.
- Treat completed tasks as dependency context, not new work.
- Return structured JSON only.
- Only produce `task_updates` for these tasks: [T1]
- Only produce `sense_check_acknowledgments` for these sense checks: [SC1]
- Do not include updates for tasks or sense checks outside this batch.
- Keep `executor_notes` verification-focused.
- Best-effort progress checkpointing: if `/Users/user_c042661f/Documents/reigh-workspace/.megaplan/plans/add-rollback-for-optimistic-20260413-0218/execution_batch_1.json` is writable, checkpoint task and sense-check updates there (not `finalize.json`). The harness owns `finalize.json`.
- When verifying changes, run the entire test file or module, not individual test functions. Individual tests miss regressions.
- finalize.json includes baseline_test_failures — a list of test IDs that were already failing before your changes. If a test fails and its ID appears in baseline_test_failures, it is pre-existing — do not scope-creep into fixing it. If baseline_test_failures is null, the baseline could not be captured; use your judgment but err on the side of assuming failures are regressions. You MUST still re-run the FULL test suite with your changes applied — pre-existing failures do not excuse skipping verification. Never narrow to individual test functions and stop.
- If this batch includes the final verification task, write a short script that reproduces the exact bug described in the task, run it to confirm the fix resolves it, then delete the script.
{"output":"Implemented batch 1 task T1. Added TimelineUnpatchRegistry in timeline-state-types.ts, added unpatchRegistry to UseTimelineCommitResult, implemented the rollback callback in useTimelineCommit.ts, returned it from the hook, and checkpointed the batch update in .megaplan/plans/add-rollback-for-optimistic-20260413-0218/execution_batch_1.json. Verification: npx tsc --noEmit passed, and git -C reigh-app diff --check -- src/tools/video-editor/hooks/useTimelineCommit.ts src/tools/video-editor/hooks/timeline-state-types.ts passed.","files_changed":["reigh-app/src/tools/video-editor/hooks/useTimelineCommit.ts","reigh-app/src/tools/video-editor/hooks/timeline-state-types.ts",".megaplan/plans/add-rollback-for-optimistic-20260413-0218/execution_batch_1.json"],"commands_run":["sed -n '1,260p' reigh-app/src/tools/video-editor/hooks/timeline-state-types.ts","sed -n '300,430p' reigh-app/src/tools/video-editor/hooks/useTimelineCommit.ts","sed -n '1,220p' reigh-app/src/tools/video-editor/hooks/useTimelineCommit.ts","rg -n "resolvedConfig\.registry|patchRegistry|assembleTimelineData" reigh-app/src/tools/video-editor/hooks/useTimelineCommit.ts reigh-app/src/tools/video-editor -g '!**/.test.'","sed -n '300,420p' reigh-app/src/tools/video-editor/lib/timeline-data.ts","rg -n "type TimelineData|interface TimelineData|resolvedConfig" reigh-app/src/tools/video-editor/lib/timeline-data.ts","sed -n '180,240p' reigh-app/src/tools/video-editor/types/index.ts","git status --short","npx tsc --noEmit","git -C reigh-app diff --check -- src/tools/video-editor/hooks/useTimelineCommit.ts src/tools/video-editor/hooks/timeline-state-types.ts","git -C reigh-app diff -- src/tools/video-editor/hooks/useTimelineCommit.ts src/tools/video-editor/hooks/timeline-state-types.ts","nl -ba reigh-app/src/tools/video-editor/hooks/useTimelineCommit.ts | sed -n '80,430p'","nl -ba reigh-app/src/tools/video-editor/hooks/timeline-state-types.ts | sed -n '20,60p'"],"deviations":[],"task_updates":[{"task_id":"T1","status":"done","executor_notes":"Added TimelineUnpatchRegistry and useTimelineCommit.unpatchRegistry. Verified the rollback path removes assetId from both current.registry.assets and current.resolvedConfig.registry, rebuilds resolved clips from the remaining registry so removed assets lose assetEntry, and calls commitData with save: false. npx tsc --noEmit and git -C reigh-app diff --check -- src/tools/video-editor/hooks/useTimelineCommit.ts src/tools/video-editor/hooks/timeline-state-types.ts both passed.","files_changed":["reigh-app/src/tools/video-editor/hooks/useTimelineCommit.ts","reigh-app/src/tools/video-editor/hooks/timeline-state-types.ts"],"commands_run":["npx tsc --noEmit","git -C reigh-app diff --check -- src/tools/video-editor/hooks/useTimelineCommit.ts src/tools/video-editor/hooks/timeline-state-types.ts"]}],"sense_check_acknowledgments":[{"sense_check_id":"SC1","executor_note":"Confirmed in useTimelineCommit.ts that unpatchRegistry destructures assetId out of both registry.assets and resolvedConfig.registry, rebuilds resolvedConfig.clips against the remaining resolved registry, and calls commitData with save: false."}]}
Add rollback for optimistic asset registry updates. Three sites in useAssetManagement, useStaleVariants, useSwitchToFinalVideo fire-and-forget server persists. On failure, revert local patchRegistry with save:false and show error toast.
code
Batch framing:
- Execute batch 2 of 5.
- Actionable task IDs for this batch: ['T2', 'T3']
- Already completed task IDs available as dependency context: ['T1']
Actionable tasks for this batch:
[
{
"id": "T2",
"description": "Thread unpatchRegistry through the state layer alongside patchRegistry. Follow every site that receives/passes patchRegistry and add unpatchRegistry next to it. Files: (1) useTimelineState.ts \u2014 destructure unpatchRegistry from save (line ~89), pass to useAssetManagement call (line ~206), pass to useTimelineEditorContextValue (line ~284). (2) useTimelineState.types.ts \u2014 add unpatchRegistry: TimelineUnpatchRegistry to TimelineEditorOpsContextValue (after line 142). (3) useTimelineState.contexts.ts \u2014 add unpatchRegistry: TimelineUnpatchRegistry to the UseTimelineEditorContextValueArgs interface (after line 83), include in the return memo (after line 216), add to dependency array (after line 243). (4) useTimelineSave.ts \u2014 add unpatchRegistry: commit.unpatchRegistry (after line 78). (5) VideoEditorProvider.tsx \u2014 add unpatchRegistry: editor.unpatchRegistry (after line 249).",
"depends_on": [
"T1"
],
"status": "pending",
"executor_notes": "",
"files_changed": [
"reigh-app/src/tools/video-editor/hooks/useTimelineState.ts",
"reigh-app/src/tools/video-editor/hooks/useTimelineState.types.ts",
"reigh-app/src/tools/video-editor/hooks/useTimelineState.contexts.ts",
"reigh-app/src/tools/video-editor/hooks/useTimelineSave.ts",
"reigh-app/src/tools/video-editor/contexts/VideoEditorProvider.tsx"
],
"commands_run": [],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T3",
"description": "Add rollback to useStaleVariants.updateAssetToCurrentVariant (useStaleVariants.ts:169-214). Before the patchRegistry call at line 200, capture const previousEntry = entry and const previousFile = entry.file. Replace the .catch at line 203-205 to also call patchRegistry(assetKey, previousEntry, previousFile) and toast.error('Failed to update variant'). Import toast: import { toast } from '@/shared/components/ui/runtime/sonner' (matches useClipEditing.ts in same directory). Keep the existing console.error line.",
"depends_on": [
"T1"
],
"status": "pending",
"executor_notes": "",
"files_changed": [
"reigh-app/src/tools/video-editor/hooks/useStaleVariants.ts"
],
"commands_run": [],
"evidence_files": [],
"reviewer_verdict": ""
}
]
code
Completed task context (already satisfied, do not re-execute unless directly required by current edits):
[
{
"id": "T1",
"description": "Add unpatchRegistry to useTimelineCommit.ts and export the new type in timeline-state-types.ts. Implementation: add a useCallback after patchRegistry (after line 356) that mirrors patchRegistry but destructures the target assetId out of both current.registry.assets and current.resolvedConfig.registry, then reassembles via assembleTimelineData and calls commitData with save: false. Add TimelineUnpatchRegistry = (assetId: string) => void type to timeline-state-types.ts after line 33. Return unpatchRegistry from the hook alongside patchRegistry (add to the return object at line 366).",
"depends_on": [],
"status": "done",
"executor_notes": "Added TimelineUnpatchRegistry and useTimelineCommit.unpatchRegistry. Verified the rollback path removes assetId from both current.registry.assets and current.resolvedConfig.registry, rebuilds resolved clips from the remaining registry so removed assets lose assetEntry, and calls commitData with save: false. npx tsc --noEmit and git -C reigh-app diff --check -- src/tools/video-editor/hooks/useTimelineCommit.ts src/tools/video-editor/hooks/timeline-state-types.ts both passed.",
"files_changed": [
"reigh-app/src/tools/video-editor/hooks/useTimelineCommit.ts",
"reigh-app/src/tools/video-editor/hooks/timeline-state-types.ts"
],
"commands_run": [
"npx tsc --noEmit",
"git -C reigh-app diff --check -- src/tools/video-editor/hooks/useTimelineCommit.ts src/tools/video-editor/hooks/timeline-state-types.ts"
],
"evidence_files": [],
"reviewer_verdict": ""
}
]
code
Prior batch deviations (address if applicable):
[
"Advisory observation mismatch: executor claimed files not observed in git status/content hash delta: .megaplan/plans/add-rollback-for-optimistic-20260413-0218/execution_batch_1.json, reigh-app/src/tools/video-editor/hooks/timeline-state-types.ts, reigh-app/src/tools/video-editor/hooks/useTimelineCommit.ts",
"Advisory audit finding: Executor claimed changed files not present in git status: reigh-app/src/tools/video-editor/components/TimelineEditor/TimelineEditor.tsx, reigh-app/src/tools/video-editor/contexts/VideoEditorProvider.tsx, reigh-app/src/tools/video-editor/hooks/timeline-state-types.ts, reigh-app/src/tools/video-editor/hooks/useAssetManagement.ts, reigh-app/src/tools/video-editor/hooks/useStaleVariants.ts, reigh-app/src/tools/video-editor/hooks/useSwitchToFinalVideo.ts, reigh-app/src/tools/video-editor/hooks/useTimelineCommit.ts, reigh-app/src/tools/video-editor/hooks/useTimelineSave.ts, reigh-app/src/tools/video-editor/hooks/useTimelineState.contexts.ts, reigh-app/src/tools/video-editor/hooks/useTimelineState.ts, reigh-app/src/tools/video-editor/hooks/useTimelineState.types.ts",
"Advisory audit finding: Git status shows changed files not claimed by any task: .claude, art-agents, fix-windows-install.txt, fix-windows-qwen-vl.txt, fix-windows-requests.txt, node_modules, orchestrator.log, outputs, plant_demo.py, scripts",
"Advisory audit finding: Sense check SC2 is missing an executor acknowledgment.",
"Advisory audit finding: Sense check SC3 is missing an executor acknowledgment.",
"Advisory audit finding: Sense check SC4 is missing an executor acknowledgment.",
"Advisory audit finding: Sense check SC5 is missing an executor acknowledgment.",
"Advisory audit finding: Sense check SC6 is missing an executor acknowledgment.",
"Advisory audit finding: Sense check SC7 is missing an executor acknowledgment."
]
code
Batch-scoped sense checks:
[
{
"id": "SC2",
"task_id": "T2",
"question": "Is unpatchRegistry threaded through every site that already passes patchRegistry? Check: useTimelineSave, useTimelineState, useTimelineState.contexts, useTimelineState.types, VideoEditorProvider. Missing any one site will cause a runtime undefined error.",
"executor_note": "",
"verdict": ""
},
{
"id": "SC3",
"task_id": "T3",
"question": "Does the rollback in useStaleVariants correctly capture the ORIGINAL entry (before the updatedEntry mutation) and pass it to patchRegistry on failure? The capture must happen before line 200.",
"executor_note": "",
"verdict": ""
}
]
code
Full execution tracking source of truth (`finalize.json`):
{
"baseline_test_command": "pytest --tb=no -q --no-header",
"baseline_test_failures": [],
"baseline_test_note": "Run all video-editor hook tests before starting. The plan touches useTimelineCommit, useTimelineState, contexts, and three consumer hooks. Existing tests for useSwitchToFinalVideo live in useClipEditing.test.ts. No existing tests for useStaleVariants or useAssetManagement rollback paths.",
"tasks": [
{
"id": "T1",
"description": "Add unpatchRegistry to useTimelineCommit.ts and export the new type in timeline-state-types.ts. Implementation: add a useCallback after patchRegistry (after line 356) that mirrors patchRegistry but destructures the target assetId out of both current.registry.assets and current.resolvedConfig.registry, then reassembles via assembleTimelineData and calls commitData with save: false. Add TimelineUnpatchRegistry = (assetId: string) => void type to timeline-state-types.ts after line 33. Return unpatchRegistry from the hook alongside patchRegistry (add to the return object at line 366).",
"depends_on": [],
"status": "done",
"executor_notes": "Added TimelineUnpatchRegistry and useTimelineCommit.unpatchRegistry. Verified the rollback path removes assetId from both current.registry.assets and current.resolvedConfig.registry, rebuilds resolved clips from the remaining registry so removed assets lose assetEntry, and calls commitData with save: false. npx tsc --noEmit and git -C reigh-app diff --check -- src/tools/video-editor/hooks/useTimelineCommit.ts src/tools/video-editor/hooks/timeline-state-types.ts both passed.",
"files_changed": [
"reigh-app/src/tools/video-editor/hooks/useTimelineCommit.ts",
"reigh-app/src/tools/video-editor/hooks/timeline-state-types.ts"
],
"commands_run": [
"npx tsc --noEmit",
"git -C reigh-app diff --check -- src/tools/video-editor/hooks/useTimelineCommit.ts src/tools/video-editor/hooks/timeline-state-types.ts"
],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T2",
"description": "Thread unpatchRegistry through the state layer alongside patchRegistry. Follow every site that receives/passes patchRegistry and add unpatchRegistry next to it. Files: (1) useTimelineState.ts \u2014 destructure unpatchRegistry from save (line ~89), pass to useAssetManagement call (line ~206), pass to useTimelineEditorContextValue (line ~284). (2) \u2014 add to (after line 142). (3) \u2014 add to the interface (after line 83), include in the return memo (after line 216), add to dependency array (after line 243). (4) \u2014 add (after line 78). (5) \u2014 add (after line 249).",
"depends_on": [
"T1"
],
"status": "pending",
"executor_notes": "",
"files_changed": [
"reigh-app/src/tools/video-editor/hooks/useTimelineState.ts",
"reigh-app/src/tools/video-editor/hooks/useTimelineState.types.ts",
"reigh-app/src/tools/video-editor/hooks/useTimelineState.contexts.ts",
"reigh-app/src/tools/video-editor/hooks/useTimelineSave.ts",
"reigh-app/src/tools/video-editor/contexts/VideoEditorProvider.tsx"
],
"commands_run": [],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T3",
"description": "Add rollback to (useStaleVariants.ts:169-214). Before the call at line 200, capture and . Replace the at line 203-205 to also call and . Import toast: (matches useClipEditing.ts in same directory). Keep the existing line.",
"depends_on": [
"T1"
],
"status": "pending",
"executor_notes": "",
"files_changed": [
"reigh-app/src/tools/video-editor/hooks/useStaleVariants.ts"
],
"commands_run": [],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T4",
"description": "Add rollback to (useAssetManagement.ts:292-295). (1) Add to the interface (after at line 41). (2) Destructure in the hook body (line ~243 area). (3) Replace the at line 293-295 to also call and . (4) Import toast: . (5) Add to the dependency array at line 298. (6) In , update the call (line ~206) to pass .",
"depends_on": [
"T2"
],
"status": "pending",
"executor_notes": "",
"files_changed": [
"reigh-app/src/tools/video-editor/hooks/useAssetManagement.ts",
"reigh-app/src/tools/video-editor/hooks/useTimelineState.ts"
],
"commands_run": [],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T5",
"description": "Add rollback to (useSwitchToFinalVideo.ts). (1) Add to interface (after line 21, import type). (2) Refactor (line 25-42) to return instead of just \u2014 remove the from the helper, return . (3) In (line 51-70): destructure , add on that calls , applies the reverse mutation via , calls , and shows . (4) In (line 72-91): before the forward edit, capture from (find group with matching , , ). On persist failure: call with to restore, the reverse, , toast. (5) Import toast from . (6) Add to both dep arrays. (7) In (line ~499-505), pass to the call.",
"depends_on": [
"T2"
],
"status": "pending",
"executor_notes": "",
"files_changed": [
"reigh-app/src/tools/video-editor/hooks/useSwitchToFinalVideo.ts",
"reigh-app/src/tools/video-editor/components/TimelineEditor/TimelineEditor.tsx"
],
"commands_run": [],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T6",
"description": "Run TypeScript compilation and all existing video-editor hook tests. Fix any type errors or test failures introduced by T1-T5. Commands: (1) (2) (3) . Key areas to watch: useClipEditing.test.ts has existing useSwitchToFinalVideo tests (line 468+) that pass \u2014 they'll need updating if the hook signature changed. Also useExternalDrop.test.tsx mocks but not \u2014 may need a added. VideoEditorProvider.test.tsx mocks at line 152 \u2014 add alongside it.",
"depends_on": [
"T3",
"T4",
"T5"
],
"status": "pending",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T7",
"description": "Run tests relevant to the changed files to verify correctness and check for regressions \u2014 run the full test file/module, not just individual functions. Find and run the project's existing test suite \u2014 do NOT create new test files. If any test fails, read the error, fix the code, and re-run until all tests pass.",
"depends_on": [
"T6"
],
"status": "pending",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"evidence_files": [],
"reviewer_verdict": ""
}
],
"watch_items": [
"TOAST IMPORT: Plan says but the correct import for hooks in this directory is (matches useClipEditing.ts, 88 uses vs 4). Use sonner.",
"TEST CONFIG: Always run vitest with from . Do NOT use bare \u2014 the alias won't resolve without the config.",
"EXISTING TESTS: useSwitchToFinalVideo tests live in , not their own file. They pass as a mock \u2014 will need updating for the new arg and the refactored return type.",
"MOCK UPDATES: , , and all mock hook args including \u2014 each needs added to avoid runtime errors.",
"FLAG-002 (open, minor): tsconfig.app.json excludes test files, so won't typecheck new test files. For test type coverage, rely on vitest compilation instead.",
"unpatchRegistry IMPLEMENTATION: Mirror patchRegistry exactly but destructure the assetId out. Key pattern: . Don't forget to also rebuild with the removed asset (clips referencing the removed asset should get ).",
"updateToLatestVideo ROLLBACK GUARD: has a no-op guard when . The reverse call passes the same but a different . Verify during implementation that the guard checks the asset key's generationId, not the param \u2014 if the guard no-ops, use a raw metaUpdates mutation instead.",
"DEBT: This plan does NOT create new test files for rollback paths (plan Steps 6 test creation was downscoped to avoid scope creep). Existing tests + typecheck + manual verification are the validation strategy.",
"SAVE:FALSE INVARIANT: Both patchRegistry and unpatchRegistry call commitData with save:false. This is critical \u2014 rollback must never trigger a server save of the reverted state."
],
"sense_checks": [
{
"id": "SC1",
"task_id": "T1",
"question": "Does unpatchRegistry correctly destructure the assetId out of BOTH registry.assets AND resolvedConfig.registry, and does commitData get called with save:false?",
"executor_note": "Confirmed in that destructures out of both and , rebuilds against the remaining resolved registry, and calls with .",
"verdict": ""
},
{
"id": "SC2",
"task_id": "T2",
"question": "Is unpatchRegistry threaded through every site that already passes patchRegistry? Check: useTimelineSave, useTimelineState, useTimelineState.contexts, useTimelineState.types, VideoEditorProvider. Missing any one site will cause a runtime undefined error.",
"executor_note": "",
"verdict": ""
},
{
"id": "SC3",
"task_id": "T3",
"question": "Does the rollback in useStaleVariants correctly capture the ORIGINAL entry (before the updatedEntry mutation) and pass it to patchRegistry on failure? The capture must happen before line 200.",
"executor_note": "",
"verdict": ""
},
{
"id": "SC4",
"task_id": "T4",
"question": "Does useAssetManagement.registerGenerationAsset call unpatchRegistry(assetId) \u2014 not patchRegistry \u2014 on failure? And is unpatchRegistry in the useCallback dep array?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC5",
"task_id": "T5",
"question": "In useSwitchToFinalVideo: (1) Does registerFinalVideoAsset now return { assetKey, persistPromise } and NOT fire-and-forget internally? (2) Does switchToFinalVideo reverse with buildSwitchShotGroupToImagesMutation? (3) Does updateToLatestVideo capture oldVideoAssetKey BEFORE the forward edit? (4) Is unpatchRegistry passed from TimelineEditor.tsx?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC6",
"task_id": "T6",
"question": "Do all existing tests pass? Specifically: useClipEditing.test.ts (useSwitchToFinalVideo tests at line 468+), useExternalDrop.test.tsx, VideoEditorProvider.test.tsx \u2014 all need unpatchRegistry mocks added. Does tsc --noEmit pass?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC7",
"task_id": "T7",
"question": "Did the verification tests pass? Were any regressions found and fixed?",
"executor_note": "",
"verdict": ""
}
],
"meta_commentary": "This is a 6-task plan touching ~10 files. The core risk is threading: unpatchRegistry must be plumbed through the same 5-layer chain as patchRegistry, and missing any link causes a runtime undefined. T2 is the most tedious task (pure plumbing) but also where errors are most likely.\n\nToast import gotcha: the plan says but the hooks directory convention (useClipEditing.ts, TimelineEditor.tsx) uses . Use sonner.\n\nThe updateToLatestVideo rollback (T5) has a known uncertainty: the buildUpdateShotGroupToLatestVideoMutation no-op guard may block the reverse mutation if it checks targetGenerationId rather than the asset key's generationId. If the reverse mutation returns null, the executor should read the guard logic in shot-group-commands.ts and either bypass it or construct a raw metaUpdates mutation.\n\nTest files for rollback paths (plan Step 6) were intentionally omitted \u2014 the existing test suite + typecheck + sense checks are sufficient validation for this scope. The existing useSwitchToFinalVideo tests in useClipEditing.test.ts will need mock updates but should not need new test cases.\n\nExecution order: T1 first (foundation), then T2 (threading), then T3/T4/T5 in parallel (each is an independent file), then T6 (validation). T4 has a minor dependency on T2 because useTimelineState.ts needs the unpatchRegistry pass-through to useAssetManagement, but T4 can batch that edit.",
"validation": {
"plan_steps_covered": [
{
"plan_step_summary": "Step 1: Add unpatchRegistry to useTimelineCommit + type to timeline-state-types.ts",
"finalize_task_ids": [
"T1"
]
},
{
"plan_step_summary": "Step 2: Thread unpatchRegistry through state layer (useTimelineState, types, contexts)",
"finalize_task_ids": [
"T2"
]
},
{
"plan_step_summary": "Step 3: Add rollback to useStaleVariants.updateAssetToCurrentVariant",
"finalize_task_ids": [
"T3"
]
},
{
"plan_step_summary": "Step 4: Add rollback to useAssetManagement.registerGenerationAsset",
"finalize_task_ids": [
"T4"
]
},
{
"plan_step_summary": "Step 5: Add rollback to useSwitchToFinalVideo (switchToFinalVideo + updateToLatestVideo)",
"finalize_task_ids": [
"T5"
]
},
{
"plan_step_summary": "Step 6: Add tests for rollback paths",
"finalize_task_ids": [
"T6"
]
},
{
"plan_step_summary": "Step 7: Run existing tests and type check",
"finalize_task_ids": [
"T6"
]
}
],
"orphan_tasks": [
"T7"
],
"completeness_notes": "Steps 6 and 7 are merged into T6 (validation task). Step 6 originally called for creating new test files (useStaleVariants.test.ts, useSwitchToFinalVideo.test.ts) but this was descoped: existing tests in useClipEditing.test.ts already cover useSwitchToFinalVideo, and the validation task covers updating mocks and running the full suite. No new test files are created \u2014 this avoids scope creep while still validating correctness via typecheck + existing test suite.",
"coverage_complete": true
}
}
code
Debt watch items (do not make these worse):
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: for ordinary pairs, the new diagnosis is not well-supported by the repo. the current sync effect in /users/user_c042661f/documents/reigh-workspace/reigh-app/src/tools/travel-between-images/components/shotimageseditor/hooks/usesegmentslotmode.ts already syncs url and primaryvariantid, and the regenerate path reads exactly starturl, endurl, startgenid, endgenid, startvariantid, and endvariantid from segmentslotmode.pairdata in /users/user_c042661f/documents/reigh-workspace/reigh-app/src/domains/media-lightbox/hooks/usevideoregeneratemode.ts. adding thumburl and generationid to the sync does not, by itself, explain why an old image url is still being used for regular pairs. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: the fix is incomplete for extra trailing slots. handlepairclick can populate activepairdata from trailingpairdata when pairindex === pairdatabyindex.size in /users/user_c042661f/documents/reigh-workspace/reigh-app/src/tools/travel-between-images/components/shotimageseditor/hooks/usesegmentslotmode.ts, but the proposed sync effect only reads pairdatabyindex.get(segmentslotlightboxindex). for those trailing-slot cases fresh is undefined, so no image refresh happens. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: the merge pseudocode does not actually sync 'all image fields' as claimed. it omits id and position from change detection, and when fresh.startimage or fresh.endimage becomes null it preserves the stale previous object instead of syncing that null state. as written, it also needs explicit null-guards around spreads of prev.startimage / to be safe in strict typescript. (flagged 1 times across 1 plans)
{"output":"Completed batch 2 tasks T2 and T3, and wrote a checkpoint to .megaplan/plans/add-rollback-for-optimistic-20260413-0218/execution_batch_2.json. unpatchRegistry is now threaded through the required state/context/provider path, and useStaleVariants now rolls back the optimistic registry patch and shows an error toast on persist failure. Verification for this batch was npx tsc --noEmit, repo-aware diff checks, and targeted line audits; Vitest was not run in this batch.","files_changed":["reigh-app/src/tools/video-editor/hooks/useTimelineState.ts","reigh-app/src/tools/video-editor/hooks/useTimelineState.types.ts","reigh-app/src/tools/video-editor/hooks/useTimelineState.contexts.ts","reigh-app/src/tools/video-editor/hooks/useTimelineSave.ts","reigh-app/src/tools/video-editor/contexts/VideoEditorProvider.tsx","reigh-app/src/tools/video-editor/hooks/useStaleVariants.ts",".megaplan/plans/add-rollback-for-optimistic-20260413-0218/execution_batch_2.json"],"commands_run":["git -C reigh-app status --short -- src/tools/video-editor/hooks/useTimelineState.ts src/tools/video-editor/hooks/useTimelineState.types.ts src/tools/video-editor/hooks/useTimelineState.contexts.ts src/tools/video-editor/hooks/useTimelineSave.ts src/tools/video-editor/contexts/VideoEditorProvider.tsx src/tools/video-editor/hooks/useStaleVariants.ts src/tools/video-editor/hooks/useTimelineCommit.ts src/tools/video-editor/hooks/timeline-state-types.ts","git -C reigh-app diff -- src/tools/video-editor/hooks/useTimelineState.types.ts","git -C reigh-app diff -- src/tools/video-editor/contexts/VideoEditorProvider.tsx","rg -n "patchRegistry|unpatchRegistry|TimelineUnpatchRegistry|registerGenerationAsset|useStaleVariants" reigh-app/src/tools/video-editor/hooks reigh-app/src/tools/video-editor/contexts/VideoEditorProvider.tsx","npx tsc --noEmit","git -C reigh-app diff -- src/tools/video-editor/hooks/useTimelineState.ts src/tools/video-editor/hooks/useTimelineState.types.ts src/tools/video-editor/hooks/useTimelineState.contexts.ts src/tools/video-editor/hooks/useTimelineSave.ts src/tools/video-editor/contexts/VideoEditorProvider.tsx src/tools/video-editor/hooks/useStaleVariants.ts","git -C reigh-app diff --check -- src/tools/video-editor/hooks/useTimelineState.ts src/tools/video-editor/hooks/useTimelineState.types.ts src/tools/video-editor/hooks/useTimelineState.contexts.ts src/tools/video-editor/hooks/useTimelineSave.ts src/tools/video-editor/contexts/VideoEditorProvider.tsx src/tools/video-editor/hooks/useStaleVariants.ts","rg -n "unpatchRegistry" reigh-app/src/tools/video-editor/hooks/useTimelineState.ts reigh-app/src/tools/video-editor/hooks/useTimelineState.types.ts reigh-app/src/tools/video-editor/hooks/useTimelineState.contexts.ts reigh-app/src/tools/video-editor/hooks/useTimelineSave.ts reigh-app/src/tools/video-editor/contexts/VideoEditorProvider.tsx","nl -ba reigh-app/src/tools/video-editor/hooks/useTimelineState.ts | sed -n '80,310p'","nl -ba reigh-app/src/tools/video-editor/hooks/useTimelineState.types.ts | sed -n '130,155p'","nl -ba reigh-app/src/tools/video-editor/hooks/useTimelineState.contexts.ts | sed -n '72,260p'","nl -ba reigh-app/src/tools/video-editor/hooks/useTimelineSave.ts | sed -n '68,90p'","nl -ba reigh-app/src/tools/video-editor/contexts/VideoEditorProvider.tsx | sed -n '238,255p'","nl -ba reigh-app/src/tools/video-editor/hooks/useStaleVariants.ts | sed -n '180,215p'"],"deviations":[],"task_updates":[{"task_id":"T2","status":"done","executor_notes":"Threaded unpatchRegistry through the same state-layer path as patchRegistry: useTimelineSave, useTimelineState, useTimelineState.types, useTimelineState.contexts, and VideoEditorProvider. Verified with rg -n \"unpatchRegistry\" ... across those five files, npx tsc --noEmit, and git -C reigh-app diff --check for the touched files.","files_changed":["reigh-app/src/tools/video-editor/hooks/useTimelineState.ts","reigh-app/src/tools/video-editor/hooks/useTimelineState.types.ts","reigh-app/src/tools/video-editor/hooks/useTimelineState.contexts.ts","reigh-app/src/tools/video-editor/hooks/useTimelineSave.ts","reigh-app/src/tools/video-editor/contexts/VideoEditorProvider.tsx"],"commands_run":["npx tsc --noEmit","git -C reigh-app diff --check -- src/tools/video-editor/hooks/useTimelineState.ts src/tools/video-editor/hooks/useTimelineState.types.ts src/tools/video-editor/hooks/useTimelineState.contexts.ts src/tools/video-editor/hooks/useTimelineSave.ts src/tools/video-editor/contexts/VideoEditorProvider.tsx src/tools/video-editor/hooks/useStaleVariants.ts","rg -n "unpatchRegistry" reigh-app/src/tools/video-editor/hooks/useTimelineState.ts reigh-app/src/tools/video-editor/hooks/useTimelineState.types.ts reigh-app/src/tools/video-editor/hooks/useTimelineState.contexts.ts reigh-app/src/tools/video-editor/hooks/useTimelineSave.ts reigh-app/src/tools/video-editor/contexts/VideoEditorProvider.tsx"]},{"task_id":"T3","status":"done","executor_notes":"Added rollback in useStaleVariants.updateAssetToCurrentVariant: captured the original entry and entry.file before building updatedEntry, and on persist failure now restores the old registry entry via patchRegistry(...previousEntry, previousFile) and shows toast.error('Failed to update variant') while preserving the existing console error. Verified with npx tsc --noEmit, git -C reigh-app diff --check, and line audit of useStaleVariants.ts.","files_changed":["reigh-app/src/tools/video-editor/hooks/useStaleVariants.ts"],"commands_run":["npx tsc --noEmit","git -C reigh-app diff --check -- src/tools/video-editor/hooks/useTimelineState.ts src/tools/video-editor/hooks/useTimelineState.types.ts src/tools/video-editor/hooks/useTimelineState.contexts.ts src/tools/video-editor/hooks/useTimelineSave.ts src/tools/video-editor/contexts/VideoEditorProvider.tsx src/tools/video-editor/hooks/useStaleVariants.ts","nl -ba reigh-app/src/tools/video-editor/hooks/useStaleVariants.ts | sed -n '180,215p'"]}],"sense_check_acknowledgments":[{"sense_check_id":"SC2","executor_note":"Confirmed unpatchRegistry is now threaded through all five required sites: useTimelineSave.ts:79, useTimelineState.ts:90/208/287, useTimelineState.types.ts:144, useTimelineState.contexts.ts:85/123/220/248, and VideoEditorProvider.tsx:250."},{"sense_check_id":"SC3","executor_note":"Confirmed useStaleVariants.ts captures const previousEntry = entry and const previousFile = entry.file before patchRegistry(assetKey, updatedEntry, newLocation), and the catch path restores with patchRegistry(assetKey, previousEntry, previousFile) plus an error toast."}]}
Add rollback for optimistic asset registry updates. Three sites in useAssetManagement, useStaleVariants, useSwitchToFinalVideo fire-and-forget server persists. On failure, revert local patchRegistry with save:false and show error toast.
code
Batch framing:
- Execute batch 3 of 5.
- Actionable task IDs for this batch: ['T4', 'T5']
- Already completed task IDs available as dependency context: ['T1', 'T2', 'T3']
Actionable tasks for this batch:
[
{
"id": "T4",
"description": "Add rollback to useAssetManagement.registerGenerationAsset (useAssetManagement.ts:292-295). (1) Add unpatchRegistry to the UseAssetManagementArgs interface (after patchRegistry at line 41). (2) Destructure unpatchRegistry in the hook body (line ~243 area). (3) Replace the .catch at line 293-295 to also call unpatchRegistry(assetId) and toast.error('Failed to save asset'). (4) Import toast: import { toast } from '@/shared/components/ui/runtime/sonner'. (5) Add unpatchRegistry to the useCallback dependency array at line 298. (6) In useTimelineState.ts, update the useAssetManagement call (line ~206) to pass unpatchRegistry.",
"depends_on": [
"T2"
],
"status": "pending",
"executor_notes": "",
"files_changed": [
"reigh-app/src/tools/video-editor/hooks/useAssetManagement.ts",
"reigh-app/src/tools/video-editor/hooks/useTimelineState.ts"
],
"commands_run": [],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T5",
"description": "Add rollback to useSwitchToFinalVideo (useSwitchToFinalVideo.ts). (1) Add unpatchRegistry to UseSwitchToFinalVideoArgs interface (after line 21, import TimelineUnpatchRegistry type). (2) Refactor registerFinalVideoAsset (line 25-42) to return { assetKey, persistPromise } instead of just assetKey \u2014 remove the void ... .catch() from the helper, return persistPromise: registerAsset(assetKey, assetEntry). (3) In switchToFinalVideo (line 51-70): destructure { assetKey, persistPromise }, add .catch on persistPromise that calls buildSwitchShotGroupToImagesMutation({ currentData: dataRef.current, shotId, rowId }), applies the reverse mutation via applyEdit, calls unpatchRegistry(assetKey), and shows toast.error('Failed to save asset'). (4) In updateToLatestVideo (line 72-91): before the forward edit, capture oldVideoAssetKey from dataRef.current?.config.pinnedShotGroups (find group with matching shotId, trackId===rowId, mode==='video'). On persist failure: call buildUpdateShotGroupToLatestVideoMutation with oldVideoAssetKey to restore, applyEdit the reverse, unpatchRegistry(assetKey), toast. (5) Import toast from @/shared/components/ui/runtime/sonner. (6) Add unpatchRegistry to both useCallback dep arrays. (7) In TimelineEditor.tsx (line ~499-505), pass unpatchRegistry to the useSwitchToFinalVideo call.",
"depends_on": [
"T2"
],
"status": "pending",
"executor_notes": "",
"files_changed": [
"reigh-app/src/tools/video-editor/hooks/useSwitchToFinalVideo.ts",
"reigh-app/src/tools/video-editor/components/TimelineEditor/TimelineEditor.tsx"
],
"commands_run": [],
"evidence_files": [],
"reviewer_verdict": ""
}
]
code
Completed task context (already satisfied, do not re-execute unless directly required by current edits):
[
{
"id": "T1",
"description": "Add unpatchRegistry to useTimelineCommit.ts and export the new type in timeline-state-types.ts. Implementation: add a useCallback after patchRegistry (after line 356) that mirrors patchRegistry but destructures the target assetId out of both current.registry.assets and current.resolvedConfig.registry, then reassembles via assembleTimelineData and calls commitData with save: false. Add TimelineUnpatchRegistry = (assetId: string) => void type to timeline-state-types.ts after line 33. Return unpatchRegistry from the hook alongside patchRegistry (add to the return object at line 366).",
"depends_on": [],
"status": "done",
"executor_notes": "Added TimelineUnpatchRegistry and useTimelineCommit.unpatchRegistry. Verified the rollback path removes assetId from both current.registry.assets and current.resolvedConfig.registry, rebuilds resolved clips from the remaining registry so removed assets lose assetEntry, and calls commitData with save: false. npx tsc --noEmit and git -C reigh-app diff --check -- src/tools/video-editor/hooks/useTimelineCommit.ts src/tools/video-editor/hooks/timeline-state-types.ts both passed.",
"files_changed": [
"reigh-app/src/tools/video-editor/hooks/useTimelineCommit.ts",
"reigh-app/src/tools/video-editor/hooks/timeline-state-types.ts"
],
"commands_run": [
"npx tsc --noEmit",
"git -C reigh-app diff --check -- src/tools/video-editor/hooks/useTimelineCommit.ts src/tools/video-editor/hooks/timeline-state-types.ts"
],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T2",
"description": "Thread unpatchRegistry through the state layer alongside patchRegistry. Follow every site that receives/passes patchRegistry and add unpatchRegistry next to it. Files: (1) useTimelineState.ts \u2014 destructure unpatchRegistry from save (line ~89), pass to useAssetManagement call (line ~206), pass to useTimelineEditorContextValue (line ~284). (2) useTimelineState.types.ts \u2014 add unpatchRegistry: TimelineUnpatchRegistry to TimelineEditorOpsContextValue (after line 142). (3) useTimelineState.contexts.ts \u2014 add unpatchRegistry: TimelineUnpatchRegistry to the interface (after line 83), include in the return memo (after line 216), add to dependency array (after line 243). (4) \u2014 add (after line 78). (5) \u2014 add (after line 249).",
"depends_on": [
"T1"
],
"status": "done",
"executor_notes": "Threaded through the same state-layer path as : , , , , and . Verified with across those five files, , and for the touched files.",
"files_changed": [
"reigh-app/src/tools/video-editor/hooks/useTimelineState.ts",
"reigh-app/src/tools/video-editor/hooks/useTimelineState.types.ts",
"reigh-app/src/tools/video-editor/hooks/useTimelineState.contexts.ts",
"reigh-app/src/tools/video-editor/hooks/useTimelineSave.ts",
"reigh-app/src/tools/video-editor/contexts/VideoEditorProvider.tsx"
],
"commands_run": [
"npx tsc --noEmit",
"git -C reigh-app diff --check -- src/tools/video-editor/hooks/useTimelineState.ts src/tools/video-editor/hooks/useTimelineState.types.ts src/tools/video-editor/hooks/useTimelineState.contexts.ts src/tools/video-editor/hooks/useTimelineSave.ts src/tools/video-editor/contexts/VideoEditorProvider.tsx src/tools/video-editor/hooks/useStaleVariants.ts",
"rg -n "unpatchRegistry" reigh-app/src/tools/video-editor/hooks/useTimelineState.ts reigh-app/src/tools/video-editor/hooks/useTimelineState.types.ts reigh-app/src/tools/video-editor/hooks/useTimelineState.contexts.ts reigh-app/src/tools/video-editor/hooks/useTimelineSave.ts reigh-app/src/tools/video-editor/contexts/VideoEditorProvider.tsx"
],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T3",
"description": "Add rollback to (useStaleVariants.ts:169-214). Before the call at line 200, capture and . Replace the at line 203-205 to also call and . Import toast: (matches useClipEditing.ts in same directory). Keep the existing line.",
"depends_on": [
"T1"
],
"status": "done",
"executor_notes": "Added rollback in : captured the original and before building , and on persist failure now restores the old registry entry via and shows while preserving the existing console error. Verified with , , and line audit of .",
"files_changed": [
"reigh-app/src/tools/video-editor/hooks/useStaleVariants.ts"
],
"commands_run": [
"npx tsc --noEmit",
"git -C reigh-app diff --check -- src/tools/video-editor/hooks/useTimelineState.ts src/tools/video-editor/hooks/useTimelineState.types.ts src/tools/video-editor/hooks/useTimelineState.contexts.ts src/tools/video-editor/hooks/useTimelineSave.ts src/tools/video-editor/contexts/VideoEditorProvider.tsx src/tools/video-editor/hooks/useStaleVariants.ts",
"nl -ba reigh-app/src/tools/video-editor/hooks/useStaleVariants.ts | sed -n '180,215p'"
],
"evidence_files": [],
"reviewer_verdict": ""
}
]
code
Prior batch deviations (address if applicable):
[
"Advisory observation mismatch: executor claimed files not observed in git status/content hash delta: .megaplan/plans/add-rollback-for-optimistic-20260413-0218/execution_batch_2.json, reigh-app/src/tools/video-editor/contexts/VideoEditorProvider.tsx, reigh-app/src/tools/video-editor/hooks/useStaleVariants.ts, reigh-app/src/tools/video-editor/hooks/useTimelineSave.ts, reigh-app/src/tools/video-editor/hooks/useTimelineState.contexts.ts, reigh-app/src/tools/video-editor/hooks/useTimelineState.ts, reigh-app/src/tools/video-editor/hooks/useTimelineState.types.ts",
"Advisory audit finding: Executor claimed changed files not present in git status: reigh-app/src/tools/video-editor/components/TimelineEditor/TimelineEditor.tsx, reigh-app/src/tools/video-editor/contexts/VideoEditorProvider.tsx, reigh-app/src/tools/video-editor/hooks/timeline-state-types.ts, reigh-app/src/tools/video-editor/hooks/useAssetManagement.ts, reigh-app/src/tools/video-editor/hooks/useStaleVariants.ts, reigh-app/src/tools/video-editor/hooks/useSwitchToFinalVideo.ts, reigh-app/src/tools/video-editor/hooks/useTimelineCommit.ts, reigh-app/src/tools/video-editor/hooks/useTimelineSave.ts, reigh-app/src/tools/video-editor/hooks/useTimelineState.contexts.ts, reigh-app/src/tools/video-editor/hooks/useTimelineState.ts, reigh-app/src/tools/video-editor/hooks/useTimelineState.types.ts",
"Advisory audit finding: Git status shows changed files not claimed by any task: .claude, art-agents, fix-windows-install.txt, fix-windows-qwen-vl.txt, fix-windows-requests.txt, node_modules, orchestrator.log, outputs, plant_demo.py, scripts",
"Advisory audit finding: Sense check SC4 is missing an executor acknowledgment.",
"Advisory audit finding: Sense check SC5 is missing an executor acknowledgment.",
"Advisory audit finding: Sense check SC6 is missing an executor acknowledgment.",
"Advisory audit finding: Sense check SC7 is missing an executor acknowledgment."
]
code
Batch-scoped sense checks:
[
{
"id": "SC4",
"task_id": "T4",
"question": "Does useAssetManagement.registerGenerationAsset call unpatchRegistry(assetId) \u2014 not patchRegistry \u2014 on failure? And is unpatchRegistry in the useCallback dep array?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC5",
"task_id": "T5",
"question": "In useSwitchToFinalVideo: (1) Does registerFinalVideoAsset now return { assetKey, persistPromise } and NOT fire-and-forget internally? (2) Does switchToFinalVideo reverse with buildSwitchShotGroupToImagesMutation? (3) Does updateToLatestVideo capture oldVideoAssetKey BEFORE the forward edit? (4) Is unpatchRegistry passed from TimelineEditor.tsx?",
"executor_note": "",
"verdict": ""
}
]
code
Full execution tracking source of truth (`finalize.json`):
{
"baseline_test_command": "pytest --tb=no -q --no-header",
"baseline_test_failures": [],
"baseline_test_note": "Run all video-editor hook tests before starting. The plan touches useTimelineCommit, useTimelineState, contexts, and three consumer hooks. Existing tests for useSwitchToFinalVideo live in useClipEditing.test.ts. No existing tests for useStaleVariants or useAssetManagement rollback paths.",
"tasks": [
{
"id": "T1",
"description": "Add unpatchRegistry to useTimelineCommit.ts and export the new type in timeline-state-types.ts. Implementation: add a useCallback after patchRegistry (after line 356) that mirrors patchRegistry but destructures the target assetId out of both current.registry.assets and current.resolvedConfig.registry, then reassembles via assembleTimelineData and calls commitData with save: false. Add TimelineUnpatchRegistry = (assetId: string) => void type to timeline-state-types.ts after line 33. Return unpatchRegistry from the hook alongside patchRegistry (add to the return object at line 366).",
"depends_on": [],
"status": "done",
"executor_notes": "Added TimelineUnpatchRegistry and useTimelineCommit.unpatchRegistry. Verified the rollback path removes assetId from both current.registry.assets and current.resolvedConfig.registry, rebuilds resolved clips from the remaining registry so removed assets lose assetEntry, and calls commitData with save: false. npx tsc --noEmit and git -C reigh-app diff --check -- src/tools/video-editor/hooks/useTimelineCommit.ts src/tools/video-editor/hooks/timeline-state-types.ts both passed.",
"files_changed": [
"reigh-app/src/tools/video-editor/hooks/useTimelineCommit.ts",
"reigh-app/src/tools/video-editor/hooks/timeline-state-types.ts"
],
"commands_run": [
"npx tsc --noEmit",
"git -C reigh-app diff --check -- src/tools/video-editor/hooks/useTimelineCommit.ts src/tools/video-editor/hooks/timeline-state-types.ts"
],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T2",
"description": "Thread unpatchRegistry through the state layer alongside patchRegistry. Follow every site that receives/passes patchRegistry and add unpatchRegistry next to it. Files: (1) useTimelineState.ts \u2014 destructure unpatchRegistry from save (line ~89), pass to useAssetManagement call (line ~206), pass to useTimelineEditorContextValue (line ~284). (2) \u2014 add to (after line 142). (3) \u2014 add to the interface (after line 83), include in the return memo (after line 216), add to dependency array (after line 243). (4) \u2014 add (after line 78). (5) \u2014 add (after line 249).",
"depends_on": [
"T1"
],
"status": "done",
"executor_notes": "Threaded through the same state-layer path as : , , , , and . Verified with across those five files, , and for the touched files.",
"files_changed": [
"reigh-app/src/tools/video-editor/hooks/useTimelineState.ts",
"reigh-app/src/tools/video-editor/hooks/useTimelineState.types.ts",
"reigh-app/src/tools/video-editor/hooks/useTimelineState.contexts.ts",
"reigh-app/src/tools/video-editor/hooks/useTimelineSave.ts",
"reigh-app/src/tools/video-editor/contexts/VideoEditorProvider.tsx"
],
"commands_run": [
"npx tsc --noEmit",
"git -C reigh-app diff --check -- src/tools/video-editor/hooks/useTimelineState.ts src/tools/video-editor/hooks/useTimelineState.types.ts src/tools/video-editor/hooks/useTimelineState.contexts.ts src/tools/video-editor/hooks/useTimelineSave.ts src/tools/video-editor/contexts/VideoEditorProvider.tsx src/tools/video-editor/hooks/useStaleVariants.ts",
"rg -n "unpatchRegistry" reigh-app/src/tools/video-editor/hooks/useTimelineState.ts reigh-app/src/tools/video-editor/hooks/useTimelineState.types.ts reigh-app/src/tools/video-editor/hooks/useTimelineState.contexts.ts reigh-app/src/tools/video-editor/hooks/useTimelineSave.ts reigh-app/src/tools/video-editor/contexts/VideoEditorProvider.tsx"
],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T3",
"description": "Add rollback to (useStaleVariants.ts:169-214). Before the call at line 200, capture and . Replace the at line 203-205 to also call and . Import toast: (matches useClipEditing.ts in same directory). Keep the existing line.",
"depends_on": [
"T1"
],
"status": "done",
"executor_notes": "Added rollback in : captured the original and before building , and on persist failure now restores the old registry entry via and shows while preserving the existing console error. Verified with , , and line audit of .",
"files_changed": [
"reigh-app/src/tools/video-editor/hooks/useStaleVariants.ts"
],
"commands_run": [
"npx tsc --noEmit",
"git -C reigh-app diff --check -- src/tools/video-editor/hooks/useTimelineState.ts src/tools/video-editor/hooks/useTimelineState.types.ts src/tools/video-editor/hooks/useTimelineState.contexts.ts src/tools/video-editor/hooks/useTimelineSave.ts src/tools/video-editor/contexts/VideoEditorProvider.tsx src/tools/video-editor/hooks/useStaleVariants.ts",
"nl -ba reigh-app/src/tools/video-editor/hooks/useStaleVariants.ts | sed -n '180,215p'"
],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T4",
"description": "Add rollback to (useAssetManagement.ts:292-295). (1) Add to the interface (after at line 41). (2) Destructure in the hook body (line ~243 area). (3) Replace the at line 293-295 to also call and . (4) Import toast: . (5) Add to the dependency array at line 298. (6) In , update the call (line ~206) to pass .",
"depends_on": [
"T2"
],
"status": "pending",
"executor_notes": "",
"files_changed": [
"reigh-app/src/tools/video-editor/hooks/useAssetManagement.ts",
"reigh-app/src/tools/video-editor/hooks/useTimelineState.ts"
],
"commands_run": [],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T5",
"description": "Add rollback to (useSwitchToFinalVideo.ts). (1) Add to interface (after line 21, import type). (2) Refactor (line 25-42) to return instead of just \u2014 remove the from the helper, return . (3) In (line 51-70): destructure , add on that calls , applies the reverse mutation via , calls , and shows . (4) In (line 72-91): before the forward edit, capture from (find group with matching , , ). On persist failure: call with to restore, the reverse, , toast. (5) Import toast from . (6) Add to both dep arrays. (7) In (line ~499-505), pass to the call.",
"depends_on": [
"T2"
],
"status": "pending",
"executor_notes": "",
"files_changed": [
"reigh-app/src/tools/video-editor/hooks/useSwitchToFinalVideo.ts",
"reigh-app/src/tools/video-editor/components/TimelineEditor/TimelineEditor.tsx"
],
"commands_run": [],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T6",
"description": "Run TypeScript compilation and all existing video-editor hook tests. Fix any type errors or test failures introduced by T1-T5. Commands: (1) (2) (3) . Key areas to watch: useClipEditing.test.ts has existing useSwitchToFinalVideo tests (line 468+) that pass \u2014 they'll need updating if the hook signature changed. Also useExternalDrop.test.tsx mocks but not \u2014 may need a added. VideoEditorProvider.test.tsx mocks at line 152 \u2014 add alongside it.",
"depends_on": [
"T3",
"T4",
"T5"
],
"status": "pending",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T7",
"description": "Run tests relevant to the changed files to verify correctness and check for regressions \u2014 run the full test file/module, not just individual functions. Find and run the project's existing test suite \u2014 do NOT create new test files. If any test fails, read the error, fix the code, and re-run until all tests pass.",
"depends_on": [
"T6"
],
"status": "pending",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"evidence_files": [],
"reviewer_verdict": ""
}
],
"watch_items": [
"TOAST IMPORT: Plan says but the correct import for hooks in this directory is (matches useClipEditing.ts, 88 uses vs 4). Use sonner.",
"TEST CONFIG: Always run vitest with from . Do NOT use bare \u2014 the alias won't resolve without the config.",
"EXISTING TESTS: useSwitchToFinalVideo tests live in , not their own file. They pass as a mock \u2014 will need updating for the new arg and the refactored return type.",
"MOCK UPDATES: , , and all mock hook args including \u2014 each needs added to avoid runtime errors.",
"FLAG-002 (open, minor): tsconfig.app.json excludes test files, so won't typecheck new test files. For test type coverage, rely on vitest compilation instead.",
"unpatchRegistry IMPLEMENTATION: Mirror patchRegistry exactly but destructure the assetId out. Key pattern: . Don't forget to also rebuild with the removed asset (clips referencing the removed asset should get ).",
"updateToLatestVideo ROLLBACK GUARD: has a no-op guard when . The reverse call passes the same but a different . Verify during implementation that the guard checks the asset key's generationId, not the param \u2014 if the guard no-ops, use a raw metaUpdates mutation instead.",
"DEBT: This plan does NOT create new test files for rollback paths (plan Steps 6 test creation was downscoped to avoid scope creep). Existing tests + typecheck + manual verification are the validation strategy.",
"SAVE:FALSE INVARIANT: Both patchRegistry and unpatchRegistry call commitData with save:false. This is critical \u2014 rollback must never trigger a server save of the reverted state."
],
"sense_checks": [
{
"id": "SC1",
"task_id": "T1",
"question": "Does unpatchRegistry correctly destructure the assetId out of BOTH registry.assets AND resolvedConfig.registry, and does commitData get called with save:false?",
"executor_note": "Confirmed in that destructures out of both and , rebuilds against the remaining resolved registry, and calls with .",
"verdict": ""
},
{
"id": "SC2",
"task_id": "T2",
"question": "Is unpatchRegistry threaded through every site that already passes patchRegistry? Check: useTimelineSave, useTimelineState, useTimelineState.contexts, useTimelineState.types, VideoEditorProvider. Missing any one site will cause a runtime undefined error.",
"executor_note": "Confirmed is now threaded through all five required sites: , , , , and .",
"verdict": ""
},
{
"id": "SC3",
"task_id": "T3",
"question": "Does the rollback in useStaleVariants correctly capture the ORIGINAL entry (before the updatedEntry mutation) and pass it to patchRegistry on failure? The capture must happen before line 200.",
"executor_note": "Confirmed captures and before , and the catch path restores with plus an error toast.",
"verdict": ""
},
{
"id": "SC4",
"task_id": "T4",
"question": "Does useAssetManagement.registerGenerationAsset call unpatchRegistry(assetId) \u2014 not patchRegistry \u2014 on failure? And is unpatchRegistry in the useCallback dep array?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC5",
"task_id": "T5",
"question": "In useSwitchToFinalVideo: (1) Does registerFinalVideoAsset now return { assetKey, persistPromise } and NOT fire-and-forget internally? (2) Does switchToFinalVideo reverse with buildSwitchShotGroupToImagesMutation? (3) Does updateToLatestVideo capture oldVideoAssetKey BEFORE the forward edit? (4) Is unpatchRegistry passed from TimelineEditor.tsx?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC6",
"task_id": "T6",
"question": "Do all existing tests pass? Specifically: useClipEditing.test.ts (useSwitchToFinalVideo tests at line 468+), useExternalDrop.test.tsx, VideoEditorProvider.test.tsx \u2014 all need unpatchRegistry mocks added. Does tsc --noEmit pass?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC7",
"task_id": "T7",
"question": "Did the verification tests pass? Were any regressions found and fixed?",
"executor_note": "",
"verdict": ""
}
],
"meta_commentary": "This is a 6-task plan touching ~10 files. The core risk is threading: unpatchRegistry must be plumbed through the same 5-layer chain as patchRegistry, and missing any link causes a runtime undefined. T2 is the most tedious task (pure plumbing) but also where errors are most likely.\n\nToast import gotcha: the plan says but the hooks directory convention (useClipEditing.ts, TimelineEditor.tsx) uses . Use sonner.\n\nThe updateToLatestVideo rollback (T5) has a known uncertainty: the buildUpdateShotGroupToLatestVideoMutation no-op guard may block the reverse mutation if it checks targetGenerationId rather than the asset key's generationId. If the reverse mutation returns null, the executor should read the guard logic in shot-group-commands.ts and either bypass it or construct a raw metaUpdates mutation.\n\nTest files for rollback paths (plan Step 6) were intentionally omitted \u2014 the existing test suite + typecheck + sense checks are sufficient validation for this scope. The existing useSwitchToFinalVideo tests in useClipEditing.test.ts will need mock updates but should not need new test cases.\n\nExecution order: T1 first (foundation), then T2 (threading), then T3/T4/T5 in parallel (each is an independent file), then T6 (validation). T4 has a minor dependency on T2 because useTimelineState.ts needs the unpatchRegistry pass-through to useAssetManagement, but T4 can batch that edit.",
"validation": {
"plan_steps_covered": [
{
"plan_step_summary": "Step 1: Add unpatchRegistry to useTimelineCommit + type to timeline-state-types.ts",
"finalize_task_ids": [
"T1"
]
},
{
"plan_step_summary": "Step 2: Thread unpatchRegistry through state layer (useTimelineState, types, contexts)",
"finalize_task_ids": [
"T2"
]
},
{
"plan_step_summary": "Step 3: Add rollback to useStaleVariants.updateAssetToCurrentVariant",
"finalize_task_ids": [
"T3"
]
},
{
"plan_step_summary": "Step 4: Add rollback to useAssetManagement.registerGenerationAsset",
"finalize_task_ids": [
"T4"
]
},
{
"plan_step_summary": "Step 5: Add rollback to useSwitchToFinalVideo (switchToFinalVideo + updateToLatestVideo)",
"finalize_task_ids": [
"T5"
]
},
{
"plan_step_summary": "Step 6: Add tests for rollback paths",
"finalize_task_ids": [
"T6"
]
},
{
"plan_step_summary": "Step 7: Run existing tests and type check",
"finalize_task_ids": [
"T6"
]
}
],
"orphan_tasks": [
"T7"
],
"completeness_notes": "Steps 6 and 7 are merged into T6 (validation task). Step 6 originally called for creating new test files (useStaleVariants.test.ts, useSwitchToFinalVideo.test.ts) but this was descoped: existing tests in useClipEditing.test.ts already cover useSwitchToFinalVideo, and the validation task covers updating mocks and running the full suite. No new test files are created \u2014 this avoids scope creep while still validating correctness via typecheck + existing test suite.",
"coverage_complete": true
}
}
code
Debt watch items (do not make these worse):
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: for ordinary pairs, the new diagnosis is not well-supported by the repo. the current sync effect in /users/user_c042661f/documents/reigh-workspace/reigh-app/src/tools/travel-between-images/components/shotimageseditor/hooks/usesegmentslotmode.ts already syncs url and primaryvariantid, and the regenerate path reads exactly starturl, endurl, startgenid, endgenid, startvariantid, and endvariantid from segmentslotmode.pairdata in /users/user_c042661f/documents/reigh-workspace/reigh-app/src/domains/media-lightbox/hooks/usevideoregeneratemode.ts. adding thumburl and generationid to the sync does not, by itself, explain why an old image url is still being used for regular pairs. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: the fix is incomplete for extra trailing slots. handlepairclick can populate activepairdata from trailingpairdata when pairindex === pairdatabyindex.size in /users/user_c042661f/documents/reigh-workspace/reigh-app/src/tools/travel-between-images/components/shotimageseditor/hooks/usesegmentslotmode.ts, but the proposed sync effect only reads pairdatabyindex.get(segmentslotlightboxindex). for those trailing-slot cases fresh is undefined, so no image refresh happens. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: the merge pseudocode does not actually sync 'all image fields' as claimed. it omits id and position from change detection, and when fresh.startimage or fresh.endimage becomes null it preserves the stale previous object instead of syncing that null state. as written, it also needs explicit null-guards around spreads of prev.startimage / to be safe in strict typescript. (flagged 1 times across 1 plans)
{"output":"Completed batch 3 tasks T4 and T5, and wrote a checkpoint to .megaplan/plans/add-rollback-for-optimistic-20260413-0218/execution_batch_3.json. useAssetManagement.registerGenerationAsset now rolls back with unpatchRegistry(assetId) and an error toast on persist failure. useSwitchToFinalVideo now returns { assetKey, persistPromise }, reverses the optimistic edit on persist failure, calls unpatchRegistry(assetKey), and shows an error toast; TimelineEditor.tsx now passes unpatchRegistry into that hook. Verification for this batch: npx tsc --noEmit, git -C reigh-app diff --check, targeted line audits, and npx vitest run --config config/testing/vitest.config.ts src/tools/video-editor/hooks/useClipEditing.test.ts passed.","files_changed":["reigh-app/src/tools/video-editor/hooks/useAssetManagement.ts","reigh-app/src/tools/video-editor/hooks/useSwitchToFinalVideo.ts","reigh-app/src/tools/video-editor/components/TimelineEditor/TimelineEditor.tsx",".megaplan/plans/add-rollback-for-optimistic-20260413-0218/execution_batch_3.json"],"commands_run":["sed -n '1,360p' reigh-app/src/tools/video-editor/hooks/useAssetManagement.ts","sed -n '1,220p' reigh-app/src/tools/video-editor/hooks/useSwitchToFinalVideo.ts","sed -n '460,540p' reigh-app/src/tools/video-editor/components/TimelineEditor/TimelineEditor.tsx","rg -n "buildSwitchShotGroupToImagesMutation|buildUpdateShotGroupToLatestVideoMutation|currentGenerationId === targetGenerationId|oldVideoAssetKey|pinnedShotGroups" reigh-app/src/tools/video-editor -g '!**/.test.'","git -C reigh-app status --short -- src/tools/video-editor/hooks/useAssetManagement.ts src/tools/video-editor/hooks/useSwitchToFinalVideo.ts src/tools/video-editor/components/TimelineEditor/TimelineEditor.tsx src/tools/video-editor/hooks/useTimelineState.ts","git -C reigh-app diff -- src/tools/video-editor/hooks/useSwitchToFinalVideo.ts","git -C reigh-app diff -- src/tools/video-editor/components/TimelineEditor/TimelineEditor.tsx","sed -n '328,420p' reigh-app/src/tools/video-editor/lib/shot-group-commands.ts","npx tsc --noEmit","git -C reigh-app diff -- src/tools/video-editor/hooks/useAssetManagement.ts src/tools/video-editor/hooks/useSwitchToFinalVideo.ts src/tools/video-editor/components/TimelineEditor/TimelineEditor.tsx src/tools/video-editor/hooks/useTimelineState.ts","npx vitest run --config config/testing/vitest.config.ts src/tools/video-editor/hooks/useClipEditing.test.ts","git -C reigh-app diff --check -- src/tools/video-editor/hooks/useAssetManagement.ts src/tools/video-editor/hooks/useSwitchToFinalVideo.ts src/tools/video-editor/components/TimelineEditor/TimelineEditor.tsx","nl -ba reigh-app/src/tools/video-editor/hooks/useAssetManagement.ts | sed -n '34,305p'","nl -ba reigh-app/src/tools/video-editor/hooks/useSwitchToFinalVideo.ts | sed -n '1,220p'","nl -ba reigh-app/src/tools/video-editor/components/TimelineEditor/TimelineEditor.tsx | sed -n '236,510p'"],"deviations":[],"task_updates":[{"task_id":"T4","status":"done","executor_notes":"Added unpatchRegistry to UseAssetManagementArgs, used it in registerGenerationAsset, and on persist failure now calls unpatchRegistry(assetId) plus toast.error('Failed to save asset'). Verified the failure path and dependency array in useAssetManagement.ts, and confirmed the useTimelineState.ts pass-through required by this task was already present from completed task T2, so no additional edit there was needed. Verification: npx tsc --noEmit, git -C reigh-app diff --check, and line audit.","files_changed":["reigh-app/src/tools/video-editor/hooks/useAssetManagement.ts"],"commands_run":["npx tsc --noEmit","git -C reigh-app diff --check -- src/tools/video-editor/hooks/useAssetManagement.ts src/tools/video-editor/hooks/useSwitchToFinalVideo.ts src/tools/video-editor/components/TimelineEditor/TimelineEditor.tsx","nl -ba reigh-app/src/tools/video-editor/hooks/useAssetManagement.ts | sed -n '34,305p'"]},{"task_id":"T5","status":"done","executor_notes":"Refactored registerFinalVideoAsset to return { assetKey, persistPromise }, added unpatchRegistry to useSwitchToFinalVideo, and on persist failure now reverse-applies the relevant shot-group mutation, calls unpatchRegistry(assetKey), and shows toast.error('Failed to save asset'). updateToLatestVideo also captures the old video asset key before the forward edit and uses a guarded restore helper so same-generation asset-key rollbacks still work when the stock helper no-ops. Verified with npx tsc --noEmit, full useClipEditing.test.ts, git -C reigh-app diff --check, and line audit of useSwitchToFinalVideo.ts and the TimelineEditor.tsx wiring.","files_changed":["reigh-app/src/tools/video-editor/hooks/useSwitchToFinalVideo.ts","reigh-app/src/tools/video-editor/components/TimelineEditor/TimelineEditor.tsx"],"commands_run":["npx tsc --noEmit","npx vitest run --config config/testing/vitest.config.ts src/tools/video-editor/hooks/useClipEditing.test.ts","git -C reigh-app diff --check -- src/tools/video-editor/hooks/useAssetManagement.ts src/tools/video-editor/hooks/useSwitchToFinalVideo.ts src/tools/video-editor/components/TimelineEditor/TimelineEditor.tsx","nl -ba reigh-app/src/tools/video-editor/hooks/useSwitchToFinalVideo.ts | sed -n '1,220p'","nl -ba reigh-app/src/tools/video-editor/components/TimelineEditor/TimelineEditor.tsx | sed -n '236,510p'"]}],"sense_check_acknowledgments":[{"sense_check_id":"SC4","executor_note":"Confirmed useAssetManagement.ts now calls unpatchRegistry(assetId) in the registerAsset(...).catch(...) path at lines 297-300, and unpatchRegistry is included in the registerGenerationAsset callback dependency array at line 304."},{"sense_check_id":"SC5","executor_note":"Confirmed useSwitchToFinalVideo.ts now returns { assetKey, persistPromise } from registerFinalVideoAsset (lines 28-44), switchToFinalVideo rolls back with buildSwitchShotGroupToImagesMutation on persist failure (lines 143-155), updateToLatestVideo captures oldVideoAssetKey before the forward edit (lines 164-171) and restores on persist failure (lines 190-205), and TimelineEditor.tsx passes unpatchRegistry into useSwitchToFinalVideo at lines 499-505."}]}
Add rollback for optimistic asset registry updates. Three sites in useAssetManagement, useStaleVariants, useSwitchToFinalVideo fire-and-forget server persists. On failure, revert local patchRegistry with save:false and show error toast.
code
Batch framing:
- Execute batch 4 of 5.
- Actionable task IDs for this batch: ['T6']
- Already completed task IDs available as dependency context: ['T1', 'T2', 'T3', 'T4', 'T5']
Actionable tasks for this batch:
[
{
"id": "T6",
"description": "Run TypeScript compilation and all existing video-editor hook tests. Fix any type errors or test failures introduced by T1-T5. Commands: (1) cd reigh-app && npx tsc --noEmit (2) cd reigh-app && npx vitest run --config config/testing/vitest.config.ts src/tools/video-editor/hooks/ (3) cd reigh-app && npx vitest run --config config/testing/vitest.config.ts src/tools/video-editor/contexts/VideoEditorProvider.test.tsx. Key areas to watch: useClipEditing.test.ts has existing useSwitchToFinalVideo tests (line 468+) that pass registerAsset \u2014 they'll need updating if the hook signature changed. Also useExternalDrop.test.tsx mocks patchRegistry but not unpatchRegistry \u2014 may need a vi.fn() added. VideoEditorProvider.test.tsx mocks patchRegistry at line 152 \u2014 add unpatchRegistry: vi.fn() alongside it.",
"depends_on": [
"T3",
"T4",
"T5"
],
"status": "pending",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"evidence_files": [],
"reviewer_verdict": ""
}
]
code
Completed task context (already satisfied, do not re-execute unless directly required by current edits):
[
{
"id": "T1",
"description": "Add unpatchRegistry to useTimelineCommit.ts and export the new type in timeline-state-types.ts. Implementation: add a useCallback after patchRegistry (after line 356) that mirrors patchRegistry but destructures the target assetId out of both current.registry.assets and current.resolvedConfig.registry, then reassembles via assembleTimelineData and calls commitData with save: false. Add TimelineUnpatchRegistry = (assetId: string) => void type to timeline-state-types.ts after line 33. Return unpatchRegistry from the hook alongside patchRegistry (add to the return object at line 366).",
"depends_on": [],
"status": "done",
"executor_notes": "Added TimelineUnpatchRegistry and useTimelineCommit.unpatchRegistry. Verified the rollback path removes assetId from both current.registry.assets and current.resolvedConfig.registry, rebuilds resolved clips from the remaining registry so removed assets lose assetEntry, and calls commitData with save: false. npx tsc --noEmit and git -C reigh-app diff --check -- src/tools/video-editor/hooks/useTimelineCommit.ts src/tools/video-editor/hooks/timeline-state-types.ts both passed.",
"files_changed": [
"reigh-app/src/tools/video-editor/hooks/useTimelineCommit.ts",
"reigh-app/src/tools/video-editor/hooks/timeline-state-types.ts"
],
"commands_run": [
"npx tsc --noEmit",
"git -C reigh-app diff --check -- src/tools/video-editor/hooks/useTimelineCommit.ts src/tools/video-editor/hooks/timeline-state-types.ts"
],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T2",
"description": "Thread unpatchRegistry through the state layer alongside patchRegistry. Follow every site that receives/passes patchRegistry and add unpatchRegistry next to it. Files: (1) useTimelineState.ts \u2014 destructure unpatchRegistry from save (line ~89), pass to useAssetManagement call (line ~206), pass to useTimelineEditorContextValue (line ~284). (2) useTimelineState.types.ts \u2014 add unpatchRegistry: TimelineUnpatchRegistry to TimelineEditorOpsContextValue (after line 142). (3) useTimelineState.contexts.ts \u2014 add unpatchRegistry: TimelineUnpatchRegistry to the UseTimelineEditorContextValueArgs interface (after line 83), include in the return memo (after line 216), add to dependency array (after line 243). (4) useTimelineSave.ts \u2014 add unpatchRegistry: commit.unpatchRegistry (after line 78). (5) VideoEditorProvider.tsx \u2014 add unpatchRegistry: editor.unpatchRegistry (after line 249).",
"depends_on": [
"T1"
],
"status": "done",
"executor_notes": "Threaded unpatchRegistry through the same state-layer path as patchRegistry: useTimelineSave, useTimelineState, useTimelineState.types, useTimelineState.contexts, and VideoEditorProvider. Verified with rg -n \"unpatchRegistry\" ... across those five files, npx tsc --noEmit, and git -C reigh-app diff --check for the touched files.",
"files_changed": [
"reigh-app/src/tools/video-editor/hooks/useTimelineState.ts",
"reigh-app/src/tools/video-editor/hooks/useTimelineState.types.ts",
"reigh-app/src/tools/video-editor/hooks/useTimelineState.contexts.ts",
"reigh-app/src/tools/video-editor/hooks/useTimelineSave.ts",
"reigh-app/src/tools/video-editor/contexts/VideoEditorProvider.tsx"
],
"commands_run": [
"npx tsc --noEmit",
"git -C reigh-app diff --check -- src/tools/video-editor/hooks/useTimelineState.ts src/tools/video-editor/hooks/useTimelineState.types.ts src/tools/video-editor/hooks/useTimelineState.contexts.ts src/tools/video-editor/hooks/useTimelineSave.ts src/tools/video-editor/contexts/VideoEditorProvider.tsx src/tools/video-editor/hooks/useStaleVariants.ts",
"rg -n "unpatchRegistry" reigh-app/src/tools/video-editor/hooks/useTimelineState.ts reigh-app/src/tools/video-editor/hooks/useTimelineState.types.ts reigh-app/src/tools/video-editor/hooks/useTimelineState.contexts.ts reigh-app/src/tools/video-editor/hooks/useTimelineSave.ts reigh-app/src/tools/video-editor/contexts/VideoEditorProvider.tsx"
],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T3",
"description": "Add rollback to useStaleVariants.updateAssetToCurrentVariant (useStaleVariants.ts:169-214). Before the patchRegistry call at line 200, capture const previousEntry = entry and const previousFile = entry.file. Replace the .catch at line 203-205 to also call patchRegistry(assetKey, previousEntry, previousFile) and toast.error('Failed to update variant'). Import toast: import { toast } from '@/shared/components/ui/runtime/sonner' (matches useClipEditing.ts in same directory). Keep the existing console.error line.",
"depends_on": [
"T1"
],
"status": "done",
"executor_notes": "Added rollback in useStaleVariants.updateAssetToCurrentVariant: captured the original entry and entry.file before building updatedEntry, and on persist failure now restores the old registry entry via patchRegistry(...previousEntry, previousFile) and shows toast.error('Failed to update variant') while preserving the existing console error. Verified with npx tsc --noEmit, git -C reigh-app diff --check, and line audit of useStaleVariants.ts.",
"files_changed": [
"reigh-app/src/tools/video-editor/hooks/useStaleVariants.ts"
],
"commands_run": [
"npx tsc --noEmit",
"git -C reigh-app diff --check -- src/tools/video-editor/hooks/useTimelineState.ts src/tools/video-editor/hooks/useTimelineState.types.ts src/tools/video-editor/hooks/useTimelineState.contexts.ts src/tools/video-editor/hooks/useTimelineSave.ts src/tools/video-editor/contexts/VideoEditorProvider.tsx src/tools/video-editor/hooks/useStaleVariants.ts",
"nl -ba reigh-app/src/tools/video-editor/hooks/useStaleVariants.ts | sed -n '180,215p'"
],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T4",
"description": "Add rollback to useAssetManagement.registerGenerationAsset (useAssetManagement.ts:292-295). (1) Add unpatchRegistry to the UseAssetManagementArgs interface (after patchRegistry at line 41). (2) Destructure unpatchRegistry in the hook body (line ~243 area). (3) Replace the .catch at line 293-295 to also call unpatchRegistry(assetId) and toast.error('Failed to save asset'). (4) Import toast: import { toast } from '@/shared/components/ui/runtime/sonner'. (5) Add unpatchRegistry to the useCallback dependency array at line 298. (6) In useTimelineState.ts, update the useAssetManagement call (line ~206) to pass unpatchRegistry.",
"depends_on": [
"T2"
],
"status": "done",
"executor_notes": "Added unpatchRegistry to UseAssetManagementArgs, used it in registerGenerationAsset, and on persist failure now calls unpatchRegistry(assetId) plus toast.error('Failed to save asset'). Verified the failure path and dependency array in useAssetManagement.ts, and confirmed the useTimelineState.ts pass-through required by this task was already present from completed task T2, so no additional edit there was needed. Verification: npx tsc --noEmit, git -C reigh-app diff --check, and line audit.",
"files_changed": [
"reigh-app/src/tools/video-editor/hooks/useAssetManagement.ts"
],
"commands_run": [
"npx tsc --noEmit",
"git -C reigh-app diff --check -- src/tools/video-editor/hooks/useAssetManagement.ts src/tools/video-editor/hooks/useSwitchToFinalVideo.ts src/tools/video-editor/components/TimelineEditor/TimelineEditor.tsx",
"nl -ba reigh-app/src/tools/video-editor/hooks/useAssetManagement.ts | sed -n '34,305p'"
],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T5",
"description": "Add rollback to useSwitchToFinalVideo (useSwitchToFinalVideo.ts). (1) Add unpatchRegistry to UseSwitchToFinalVideoArgs interface (after line 21, import TimelineUnpatchRegistry type). (2) Refactor registerFinalVideoAsset (line 25-42) to return { assetKey, persistPromise } instead of just assetKey \u2014 remove the void ... .catch() from the helper, return persistPromise: registerAsset(assetKey, assetEntry). (3) In switchToFinalVideo (line 51-70): destructure { assetKey, persistPromise }, add .catch on persistPromise that calls buildSwitchShotGroupToImagesMutation({ currentData: dataRef.current, shotId, rowId }), applies the reverse mutation via applyEdit, calls unpatchRegistry(assetKey), and shows toast.error('Failed to save asset'). (4) In updateToLatestVideo (line 72-91): before the forward edit, capture oldVideoAssetKey from dataRef.current?.config.pinnedShotGroups (find group with matching shotId, trackId===rowId, mode==='video'). On persist failure: call buildUpdateShotGroupToLatestVideoMutation with oldVideoAssetKey to restore, applyEdit the reverse, unpatchRegistry(assetKey), toast. (5) Import toast from @/shared/components/ui/runtime/sonner. (6) Add unpatchRegistry to both useCallback dep arrays. (7) In TimelineEditor.tsx (line ~499-505), pass unpatchRegistry to the useSwitchToFinalVideo call.",
"depends_on": [
"T2"
],
"status": "done",
"executor_notes": "Refactored registerFinalVideoAsset to return { assetKey, persistPromise }, added unpatchRegistry to useSwitchToFinalVideo, and on persist failure now reverse-applies the relevant shot-group mutation, calls unpatchRegistry(assetKey), and shows toast.error('Failed to save asset'). updateToLatestVideo also captures the old video asset key before the forward edit and uses a guarded restore helper so same-generation asset-key rollbacks still work when the stock helper no-ops. Verified with npx tsc --noEmit, full useClipEditing.test.ts, git -C reigh-app diff --check, and line audit of useSwitchToFinalVideo.ts and the TimelineEditor.tsx wiring.",
"files_changed": [
"reigh-app/src/tools/video-editor/hooks/useSwitchToFinalVideo.ts",
"reigh-app/src/tools/video-editor/components/TimelineEditor/TimelineEditor.tsx"
],
"commands_run": [
"npx tsc --noEmit",
"npx vitest run --config config/testing/vitest.config.ts src/tools/video-editor/hooks/useClipEditing.test.ts",
"git -C reigh-app diff --check -- src/tools/video-editor/hooks/useAssetManagement.ts src/tools/video-editor/hooks/useSwitchToFinalVideo.ts src/tools/video-editor/components/TimelineEditor/TimelineEditor.tsx",
"nl -ba reigh-app/src/tools/video-editor/hooks/useSwitchToFinalVideo.ts | sed -n '1,220p'",
"nl -ba reigh-app/src/tools/video-editor/components/TimelineEditor/TimelineEditor.tsx | sed -n '236,510p'"
],
"evidence_files": [],
"reviewer_verdict": ""
}
]
code
Prior batch deviations (address if applicable):
[
"Advisory observation mismatch: executor claimed files not observed in git status/content hash delta: .megaplan/plans/add-rollback-for-optimistic-20260413-0218/execution_batch_3.json, reigh-app/src/tools/video-editor/components/TimelineEditor/TimelineEditor.tsx, reigh-app/src/tools/video-editor/hooks/useAssetManagement.ts, reigh-app/src/tools/video-editor/hooks/useSwitchToFinalVideo.ts",
"Advisory audit finding: Executor claimed changed files not present in git status: reigh-app/src/tools/video-editor/components/TimelineEditor/TimelineEditor.tsx, reigh-app/src/tools/video-editor/contexts/VideoEditorProvider.tsx, reigh-app/src/tools/video-editor/hooks/timeline-state-types.ts, reigh-app/src/tools/video-editor/hooks/useAssetManagement.ts, reigh-app/src/tools/video-editor/hooks/useStaleVariants.ts, reigh-app/src/tools/video-editor/hooks/useSwitchToFinalVideo.ts, reigh-app/src/tools/video-editor/hooks/useTimelineCommit.ts, reigh-app/src/tools/video-editor/hooks/useTimelineSave.ts, reigh-app/src/tools/video-editor/hooks/useTimelineState.contexts.ts, reigh-app/src/tools/video-editor/hooks/useTimelineState.ts, reigh-app/src/tools/video-editor/hooks/useTimelineState.types.ts",
"Advisory audit finding: Git status shows changed files not claimed by any task: .claude, art-agents, fix-windows-install.txt, fix-windows-qwen-vl.txt, fix-windows-requests.txt, node_modules, orchestrator.log, outputs, plant_demo.py, scripts",
"Advisory audit finding: Sense check SC6 is missing an executor acknowledgment.",
"Advisory audit finding: Sense check SC7 is missing an executor acknowledgment."
]
code
Batch-scoped sense checks:
[
{
"id": "SC6",
"task_id": "T6",
"question": "Do all existing tests pass? Specifically: useClipEditing.test.ts (useSwitchToFinalVideo tests at line 468+), useExternalDrop.test.tsx, VideoEditorProvider.test.tsx \u2014 all need unpatchRegistry mocks added. Does tsc --noEmit pass?",
"executor_note": "",
"verdict": ""
}
]
code
Full execution tracking source of truth (`finalize.json`):
{
"baseline_test_command": "pytest --tb=no -q --no-header",
"baseline_test_failures": [],
"baseline_test_note": "Run all video-editor hook tests before starting. The plan touches useTimelineCommit, useTimelineState, contexts, and three consumer hooks. Existing tests for useSwitchToFinalVideo live in useClipEditing.test.ts. No existing tests for useStaleVariants or useAssetManagement rollback paths.",
"tasks": [
{
"id": "T1",
"description": "Add unpatchRegistry to useTimelineCommit.ts and export the new type in timeline-state-types.ts. Implementation: add a useCallback after patchRegistry (after line 356) that mirrors patchRegistry but destructures the target assetId out of both current.registry.assets and current.resolvedConfig.registry, then reassembles via assembleTimelineData and calls commitData with save: false. Add TimelineUnpatchRegistry = (assetId: string) => void type to timeline-state-types.ts after line 33. Return unpatchRegistry from the hook alongside patchRegistry (add to the return object at line 366).",
"depends_on": [],
"status": "done",
"executor_notes": "Added TimelineUnpatchRegistry and useTimelineCommit.unpatchRegistry. Verified the rollback path removes assetId from both current.registry.assets and current.resolvedConfig.registry, rebuilds resolved clips from the remaining registry so removed assets lose assetEntry, and calls commitData with save: false. npx tsc --noEmit and git -C reigh-app diff --check -- src/tools/video-editor/hooks/useTimelineCommit.ts src/tools/video-editor/hooks/timeline-state-types.ts both passed.",
"files_changed": [
"reigh-app/src/tools/video-editor/hooks/useTimelineCommit.ts",
"reigh-app/src/tools/video-editor/hooks/timeline-state-types.ts"
],
"commands_run": [
"npx tsc --noEmit",
"git -C reigh-app diff --check -- src/tools/video-editor/hooks/useTimelineCommit.ts src/tools/video-editor/hooks/timeline-state-types.ts"
],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T2",
"description": "Thread unpatchRegistry through the state layer alongside patchRegistry. Follow every site that receives/passes patchRegistry and add unpatchRegistry next to it. Files: (1) useTimelineState.ts \u2014 destructure unpatchRegistry from save (line ~89), pass to useAssetManagement call (line ~206), pass to useTimelineEditorContextValue (line ~284). (2) \u2014 add to (after line 142). (3) \u2014 add to the interface (after line 83), include in the return memo (after line 216), add to dependency array (after line 243). (4) \u2014 add (after line 78). (5) \u2014 add (after line 249).",
"depends_on": [
"T1"
],
"status": "done",
"executor_notes": "Threaded through the same state-layer path as : , , , , and . Verified with across those five files, , and for the touched files.",
"files_changed": [
"reigh-app/src/tools/video-editor/hooks/useTimelineState.ts",
"reigh-app/src/tools/video-editor/hooks/useTimelineState.types.ts",
"reigh-app/src/tools/video-editor/hooks/useTimelineState.contexts.ts",
"reigh-app/src/tools/video-editor/hooks/useTimelineSave.ts",
"reigh-app/src/tools/video-editor/contexts/VideoEditorProvider.tsx"
],
"commands_run": [
"npx tsc --noEmit",
"git -C reigh-app diff --check -- src/tools/video-editor/hooks/useTimelineState.ts src/tools/video-editor/hooks/useTimelineState.types.ts src/tools/video-editor/hooks/useTimelineState.contexts.ts src/tools/video-editor/hooks/useTimelineSave.ts src/tools/video-editor/contexts/VideoEditorProvider.tsx src/tools/video-editor/hooks/useStaleVariants.ts",
"rg -n "unpatchRegistry" reigh-app/src/tools/video-editor/hooks/useTimelineState.ts reigh-app/src/tools/video-editor/hooks/useTimelineState.types.ts reigh-app/src/tools/video-editor/hooks/useTimelineState.contexts.ts reigh-app/src/tools/video-editor/hooks/useTimelineSave.ts reigh-app/src/tools/video-editor/contexts/VideoEditorProvider.tsx"
],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T3",
"description": "Add rollback to (useStaleVariants.ts:169-214). Before the call at line 200, capture and . Replace the at line 203-205 to also call and . Import toast: (matches useClipEditing.ts in same directory). Keep the existing line.",
"depends_on": [
"T1"
],
"status": "done",
"executor_notes": "Added rollback in : captured the original and before building , and on persist failure now restores the old registry entry via and shows while preserving the existing console error. Verified with , , and line audit of .",
"files_changed": [
"reigh-app/src/tools/video-editor/hooks/useStaleVariants.ts"
],
"commands_run": [
"npx tsc --noEmit",
"git -C reigh-app diff --check -- src/tools/video-editor/hooks/useTimelineState.ts src/tools/video-editor/hooks/useTimelineState.types.ts src/tools/video-editor/hooks/useTimelineState.contexts.ts src/tools/video-editor/hooks/useTimelineSave.ts src/tools/video-editor/contexts/VideoEditorProvider.tsx src/tools/video-editor/hooks/useStaleVariants.ts",
"nl -ba reigh-app/src/tools/video-editor/hooks/useStaleVariants.ts | sed -n '180,215p'"
],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T4",
"description": "Add rollback to (useAssetManagement.ts:292-295). (1) Add to the interface (after at line 41). (2) Destructure in the hook body (line ~243 area). (3) Replace the at line 293-295 to also call and . (4) Import toast: . (5) Add to the dependency array at line 298. (6) In , update the call (line ~206) to pass .",
"depends_on": [
"T2"
],
"status": "done",
"executor_notes": "Added to , used it in , and on persist failure now calls plus . Verified the failure path and dependency array in , and confirmed the pass-through required by this task was already present from completed task , so no additional edit there was needed. Verification: , , and line audit.",
"files_changed": [
"reigh-app/src/tools/video-editor/hooks/useAssetManagement.ts"
],
"commands_run": [
"npx tsc --noEmit",
"git -C reigh-app diff --check -- src/tools/video-editor/hooks/useAssetManagement.ts src/tools/video-editor/hooks/useSwitchToFinalVideo.ts src/tools/video-editor/components/TimelineEditor/TimelineEditor.tsx",
"nl -ba reigh-app/src/tools/video-editor/hooks/useAssetManagement.ts | sed -n '34,305p'"
],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T5",
"description": "Add rollback to (useSwitchToFinalVideo.ts). (1) Add to interface (after line 21, import type). (2) Refactor (line 25-42) to return instead of just \u2014 remove the from the helper, return . (3) In (line 51-70): destructure , add on that calls , applies the reverse mutation via , calls , and shows . (4) In (line 72-91): before the forward edit, capture from (find group with matching , , ). On persist failure: call with to restore, the reverse, , toast. (5) Import toast from . (6) Add to both dep arrays. (7) In (line ~499-505), pass to the call.",
"depends_on": [
"T2"
],
"status": "done",
"executor_notes": "Refactored to return , added to , and on persist failure now reverse-applies the relevant shot-group mutation, calls , and shows . also captures the old video asset key before the forward edit and uses a guarded restore helper so same-generation asset-key rollbacks still work when the stock helper no-ops. Verified with , full , , and line audit of and the wiring.",
"files_changed": [
"reigh-app/src/tools/video-editor/hooks/useSwitchToFinalVideo.ts",
"reigh-app/src/tools/video-editor/components/TimelineEditor/TimelineEditor.tsx"
],
"commands_run": [
"npx tsc --noEmit",
"npx vitest run --config config/testing/vitest.config.ts src/tools/video-editor/hooks/useClipEditing.test.ts",
"git -C reigh-app diff --check -- src/tools/video-editor/hooks/useAssetManagement.ts src/tools/video-editor/hooks/useSwitchToFinalVideo.ts src/tools/video-editor/components/TimelineEditor/TimelineEditor.tsx",
"nl -ba reigh-app/src/tools/video-editor/hooks/useSwitchToFinalVideo.ts | sed -n '1,220p'",
"nl -ba reigh-app/src/tools/video-editor/components/TimelineEditor/TimelineEditor.tsx | sed -n '236,510p'"
],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T6",
"description": "Run TypeScript compilation and all existing video-editor hook tests. Fix any type errors or test failures introduced by T1-T5. Commands: (1) (2) (3) . Key areas to watch: useClipEditing.test.ts has existing useSwitchToFinalVideo tests (line 468+) that pass \u2014 they'll need updating if the hook signature changed. Also useExternalDrop.test.tsx mocks but not \u2014 may need a added. VideoEditorProvider.test.tsx mocks at line 152 \u2014 add alongside it.",
"depends_on": [
"T3",
"T4",
"T5"
],
"status": "pending",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T7",
"description": "Run tests relevant to the changed files to verify correctness and check for regressions \u2014 run the full test file/module, not just individual functions. Find and run the project's existing test suite \u2014 do NOT create new test files. If any test fails, read the error, fix the code, and re-run until all tests pass.",
"depends_on": [
"T6"
],
"status": "pending",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"evidence_files": [],
"reviewer_verdict": ""
}
],
"watch_items": [
"TOAST IMPORT: Plan says but the correct import for hooks in this directory is (matches useClipEditing.ts, 88 uses vs 4). Use sonner.",
"TEST CONFIG: Always run vitest with from . Do NOT use bare \u2014 the alias won't resolve without the config.",
"EXISTING TESTS: useSwitchToFinalVideo tests live in , not their own file. They pass as a mock \u2014 will need updating for the new arg and the refactored return type.",
"MOCK UPDATES: , , and all mock hook args including \u2014 each needs added to avoid runtime errors.",
"FLAG-002 (open, minor): tsconfig.app.json excludes test files, so won't typecheck new test files. For test type coverage, rely on vitest compilation instead.",
"unpatchRegistry IMPLEMENTATION: Mirror patchRegistry exactly but destructure the assetId out. Key pattern: . Don't forget to also rebuild with the removed asset (clips referencing the removed asset should get ).",
"updateToLatestVideo ROLLBACK GUARD: has a no-op guard when . The reverse call passes the same but a different . Verify during implementation that the guard checks the asset key's generationId, not the param \u2014 if the guard no-ops, use a raw metaUpdates mutation instead.",
"DEBT: This plan does NOT create new test files for rollback paths (plan Steps 6 test creation was downscoped to avoid scope creep). Existing tests + typecheck + manual verification are the validation strategy.",
"SAVE:FALSE INVARIANT: Both patchRegistry and unpatchRegistry call commitData with save:false. This is critical \u2014 rollback must never trigger a server save of the reverted state."
],
"sense_checks": [
{
"id": "SC1",
"task_id": "T1",
"question": "Does unpatchRegistry correctly destructure the assetId out of BOTH registry.assets AND resolvedConfig.registry, and does commitData get called with save:false?",
"executor_note": "Confirmed in that destructures out of both and , rebuilds against the remaining resolved registry, and calls with .",
"verdict": ""
},
{
"id": "SC2",
"task_id": "T2",
"question": "Is unpatchRegistry threaded through every site that already passes patchRegistry? Check: useTimelineSave, useTimelineState, useTimelineState.contexts, useTimelineState.types, VideoEditorProvider. Missing any one site will cause a runtime undefined error.",
"executor_note": "Confirmed is now threaded through all five required sites: , , , , and .",
"verdict": ""
},
{
"id": "SC3",
"task_id": "T3",
"question": "Does the rollback in useStaleVariants correctly capture the ORIGINAL entry (before the updatedEntry mutation) and pass it to patchRegistry on failure? The capture must happen before line 200.",
"executor_note": "Confirmed captures and before , and the catch path restores with plus an error toast.",
"verdict": ""
},
{
"id": "SC4",
"task_id": "T4",
"question": "Does useAssetManagement.registerGenerationAsset call unpatchRegistry(assetId) \u2014 not patchRegistry \u2014 on failure? And is unpatchRegistry in the useCallback dep array?",
"executor_note": "Confirmed now calls in the path at lines 297-300, and is included in the callback dependency array at line 304.",
"verdict": ""
},
{
"id": "SC5",
"task_id": "T5",
"question": "In useSwitchToFinalVideo: (1) Does registerFinalVideoAsset now return { assetKey, persistPromise } and NOT fire-and-forget internally? (2) Does switchToFinalVideo reverse with buildSwitchShotGroupToImagesMutation? (3) Does updateToLatestVideo capture oldVideoAssetKey BEFORE the forward edit? (4) Is unpatchRegistry passed from TimelineEditor.tsx?",
"executor_note": "Confirmed now returns from (lines 28-44), rolls back with on persist failure (lines 143-155), captures before the forward edit (lines 164-171) and restores on persist failure (lines 190-205), and passes into at lines 499-505.",
"verdict": ""
},
{
"id": "SC6",
"task_id": "T6",
"question": "Do all existing tests pass? Specifically: useClipEditing.test.ts (useSwitchToFinalVideo tests at line 468+), useExternalDrop.test.tsx, VideoEditorProvider.test.tsx \u2014 all need unpatchRegistry mocks added. Does tsc --noEmit pass?",
"executor_note": "",
"verdict": ""
},
{
"id": "SC7",
"task_id": "T7",
"question": "Did the verification tests pass? Were any regressions found and fixed?",
"executor_note": "",
"verdict": ""
}
],
"meta_commentary": "This is a 6-task plan touching ~10 files. The core risk is threading: unpatchRegistry must be plumbed through the same 5-layer chain as patchRegistry, and missing any link causes a runtime undefined. T2 is the most tedious task (pure plumbing) but also where errors are most likely.\n\nToast import gotcha: the plan says but the hooks directory convention (useClipEditing.ts, TimelineEditor.tsx) uses . Use sonner.\n\nThe updateToLatestVideo rollback (T5) has a known uncertainty: the buildUpdateShotGroupToLatestVideoMutation no-op guard may block the reverse mutation if it checks targetGenerationId rather than the asset key's generationId. If the reverse mutation returns null, the executor should read the guard logic in shot-group-commands.ts and either bypass it or construct a raw metaUpdates mutation.\n\nTest files for rollback paths (plan Step 6) were intentionally omitted \u2014 the existing test suite + typecheck + sense checks are sufficient validation for this scope. The existing useSwitchToFinalVideo tests in useClipEditing.test.ts will need mock updates but should not need new test cases.\n\nExecution order: T1 first (foundation), then T2 (threading), then T3/T4/T5 in parallel (each is an independent file), then T6 (validation). T4 has a minor dependency on T2 because useTimelineState.ts needs the unpatchRegistry pass-through to useAssetManagement, but T4 can batch that edit.",
"validation": {
"plan_steps_covered": [
{
"plan_step_summary": "Step 1: Add unpatchRegistry to useTimelineCommit + type to timeline-state-types.ts",
"finalize_task_ids": [
"T1"
]
},
{
"plan_step_summary": "Step 2: Thread unpatchRegistry through state layer (useTimelineState, types, contexts)",
"finalize_task_ids": [
"T2"
]
},
{
"plan_step_summary": "Step 3: Add rollback to useStaleVariants.updateAssetToCurrentVariant",
"finalize_task_ids": [
"T3"
]
},
{
"plan_step_summary": "Step 4: Add rollback to useAssetManagement.registerGenerationAsset",
"finalize_task_ids": [
"T4"
]
},
{
"plan_step_summary": "Step 5: Add rollback to useSwitchToFinalVideo (switchToFinalVideo + updateToLatestVideo)",
"finalize_task_ids": [
"T5"
]
},
{
"plan_step_summary": "Step 6: Add tests for rollback paths",
"finalize_task_ids": [
"T6"
]
},
{
"plan_step_summary": "Step 7: Run existing tests and type check",
"finalize_task_ids": [
"T6"
]
}
],
"orphan_tasks": [
"T7"
],
"completeness_notes": "Steps 6 and 7 are merged into T6 (validation task). Step 6 originally called for creating new test files (useStaleVariants.test.ts, useSwitchToFinalVideo.test.ts) but this was descoped: existing tests in useClipEditing.test.ts already cover useSwitchToFinalVideo, and the validation task covers updating mocks and running the full suite. No new test files are created \u2014 this avoids scope creep while still validating correctness via typecheck + existing test suite.",
"coverage_complete": true
}
}
code
Debt watch items (do not make these worse):
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: for ordinary pairs, the new diagnosis is not well-supported by the repo. the current sync effect in /users/user_c042661f/documents/reigh-workspace/reigh-app/src/tools/travel-between-images/components/shotimageseditor/hooks/usesegmentslotmode.ts already syncs url and primaryvariantid, and the regenerate path reads exactly starturl, endurl, startgenid, endgenid, startvariantid, and endvariantid from segmentslotmode.pairdata in /users/user_c042661f/documents/reigh-workspace/reigh-app/src/domains/media-lightbox/hooks/usevideoregeneratemode.ts. adding thumburl and generationid to the sync does not, by itself, explain why an old image url is still being used for regular pairs. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: the fix is incomplete for extra trailing slots. handlepairclick can populate activepairdata from trailingpairdata when pairindex === pairdatabyindex.size in /users/user_c042661f/documents/reigh-workspace/reigh-app/src/tools/travel-between-images/components/shotimageseditor/hooks/usesegmentslotmode.ts, but the proposed sync effect only reads pairdatabyindex.get(segmentslotlightboxindex). for those trailing-slot cases fresh is undefined, so no image refresh happens. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: the merge pseudocode does not actually sync 'all image fields' as claimed. it omits id and position from change detection, and when fresh.startimage or fresh.endimage becomes null it preserves the stale previous object instead of syncing that null state. as written, it also needs explicit null-guards around spreads of prev.startimage / to be safe in strict typescript. (flagged 1 times across 1 plans)
npx tsc --noEmit
npx vitest run --config config/testing/vitest.config.ts src/tools/video-editor/hooks/
npx vitest run --config config/testing/vitest.config.ts src/tools/video-editor/contexts/VideoEditorProvider.test.tsx
npx tsc --noEmit
npx vitest run --config config/testing/vitest.config.ts src/tools/video-editor/hooks/
npx vitest run --config config/testing/vitest.config.ts src/tools/video-editor/contexts/VideoEditorProvider.test.tsx
Add rollback for optimistic asset registry updates. Three sites in useAssetManagement, useStaleVariants, useSwitchToFinalVideo fire-and-forget server persists. On failure, revert local patchRegistry with save:false and show error toast.
code
Batch framing:
- Execute batch 5 of 5.
- Actionable task IDs for this batch: ['T7']
- Already completed task IDs available as dependency context: ['T1', 'T2', 'T3', 'T4', 'T5', 'T6']
Actionable tasks for this batch:
[
{
"id": "T7",
"description": "Run tests relevant to the changed files to verify correctness and check for regressions \u2014 run the full test file/module, not just individual functions. Find and run the project's existing test suite \u2014 do NOT create new test files. If any test fails, read the error, fix the code, and re-run until all tests pass.",
"depends_on": [
"T6"
],
"status": "pending",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"evidence_files": [],
"reviewer_verdict": ""
}
]
code
Completed task context (already satisfied, do not re-execute unless directly required by current edits):
[
{
"id": "T1",
"description": "Add unpatchRegistry to useTimelineCommit.ts and export the new type in timeline-state-types.ts. Implementation: add a useCallback after patchRegistry (after line 356) that mirrors patchRegistry but destructures the target assetId out of both current.registry.assets and current.resolvedConfig.registry, then reassembles via assembleTimelineData and calls commitData with save: false. Add TimelineUnpatchRegistry = (assetId: string) => void type to timeline-state-types.ts after line 33. Return unpatchRegistry from the hook alongside patchRegistry (add to the return object at line 366).",
"depends_on": [],
"status": "done",
"executor_notes": "Added TimelineUnpatchRegistry and useTimelineCommit.unpatchRegistry. Verified the rollback path removes assetId from both current.registry.assets and current.resolvedConfig.registry, rebuilds resolved clips from the remaining registry so removed assets lose assetEntry, and calls commitData with save: false. npx tsc --noEmit and git -C reigh-app diff --check -- src/tools/video-editor/hooks/useTimelineCommit.ts src/tools/video-editor/hooks/timeline-state-types.ts both passed.",
"files_changed": [
"reigh-app/src/tools/video-editor/hooks/useTimelineCommit.ts",
"reigh-app/src/tools/video-editor/hooks/timeline-state-types.ts"
],
"commands_run": [
"npx tsc --noEmit",
"git -C reigh-app diff --check -- src/tools/video-editor/hooks/useTimelineCommit.ts src/tools/video-editor/hooks/timeline-state-types.ts"
],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T2",
"description": "Thread unpatchRegistry through the state layer alongside patchRegistry. Follow every site that receives/passes patchRegistry and add unpatchRegistry next to it. Files: (1) useTimelineState.ts \u2014 destructure unpatchRegistry from save (line ~89), pass to useAssetManagement call (line ~206), pass to useTimelineEditorContextValue (line ~284). (2) useTimelineState.types.ts \u2014 add unpatchRegistry: TimelineUnpatchRegistry to TimelineEditorOpsContextValue (after line 142). (3) useTimelineState.contexts.ts \u2014 add unpatchRegistry: TimelineUnpatchRegistry to the UseTimelineEditorContextValueArgs interface (after line 83), include in the return memo (after line 216), add to dependency array (after line 243). (4) useTimelineSave.ts \u2014 add unpatchRegistry: commit.unpatchRegistry (after line 78). (5) VideoEditorProvider.tsx \u2014 add unpatchRegistry: editor.unpatchRegistry (after line 249).",
"depends_on": [
"T1"
],
"status": "done",
"executor_notes": "Threaded unpatchRegistry through the same state-layer path as patchRegistry: useTimelineSave, useTimelineState, useTimelineState.types, useTimelineState.contexts, and VideoEditorProvider. Verified with rg -n \"unpatchRegistry\" ... across those five files, npx tsc --noEmit, and git -C reigh-app diff --check for the touched files.",
"files_changed": [
"reigh-app/src/tools/video-editor/hooks/useTimelineState.ts",
"reigh-app/src/tools/video-editor/hooks/useTimelineState.types.ts",
"reigh-app/src/tools/video-editor/hooks/useTimelineState.contexts.ts",
"reigh-app/src/tools/video-editor/hooks/useTimelineSave.ts",
"reigh-app/src/tools/video-editor/contexts/VideoEditorProvider.tsx"
],
"commands_run": [
"npx tsc --noEmit",
"git -C reigh-app diff --check -- src/tools/video-editor/hooks/useTimelineState.ts src/tools/video-editor/hooks/useTimelineState.types.ts src/tools/video-editor/hooks/useTimelineState.contexts.ts src/tools/video-editor/hooks/useTimelineSave.ts src/tools/video-editor/contexts/VideoEditorProvider.tsx src/tools/video-editor/hooks/useStaleVariants.ts",
"rg -n "unpatchRegistry" reigh-app/src/tools/video-editor/hooks/useTimelineState.ts reigh-app/src/tools/video-editor/hooks/useTimelineState.types.ts reigh-app/src/tools/video-editor/hooks/useTimelineState.contexts.ts reigh-app/src/tools/video-editor/hooks/useTimelineSave.ts reigh-app/src/tools/video-editor/contexts/VideoEditorProvider.tsx"
],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T3",
"description": "Add rollback to useStaleVariants.updateAssetToCurrentVariant (useStaleVariants.ts:169-214). Before the patchRegistry call at line 200, capture const previousEntry = entry and const previousFile = entry.file. Replace the .catch at line 203-205 to also call patchRegistry(assetKey, previousEntry, previousFile) and toast.error('Failed to update variant'). Import toast: import { toast } from '@/shared/components/ui/runtime/sonner' (matches useClipEditing.ts in same directory). Keep the existing console.error line.",
"depends_on": [
"T1"
],
"status": "done",
"executor_notes": "Added rollback in useStaleVariants.updateAssetToCurrentVariant: captured the original entry and entry.file before building updatedEntry, and on persist failure now restores the old registry entry via patchRegistry(...previousEntry, previousFile) and shows toast.error('Failed to update variant') while preserving the existing console error. Verified with npx tsc --noEmit, git -C reigh-app diff --check, and line audit of useStaleVariants.ts.",
"files_changed": [
"reigh-app/src/tools/video-editor/hooks/useStaleVariants.ts"
],
"commands_run": [
"npx tsc --noEmit",
"git -C reigh-app diff --check -- src/tools/video-editor/hooks/useTimelineState.ts src/tools/video-editor/hooks/useTimelineState.types.ts src/tools/video-editor/hooks/useTimelineState.contexts.ts src/tools/video-editor/hooks/useTimelineSave.ts src/tools/video-editor/contexts/VideoEditorProvider.tsx src/tools/video-editor/hooks/useStaleVariants.ts",
"nl -ba reigh-app/src/tools/video-editor/hooks/useStaleVariants.ts | sed -n '180,215p'"
],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T4",
"description": "Add rollback to useAssetManagement.registerGenerationAsset (useAssetManagement.ts:292-295). (1) Add unpatchRegistry to the UseAssetManagementArgs interface (after patchRegistry at line 41). (2) Destructure unpatchRegistry in the hook body (line ~243 area). (3) Replace the .catch at line 293-295 to also call unpatchRegistry(assetId) and toast.error('Failed to save asset'). (4) Import toast: import { toast } from '@/shared/components/ui/runtime/sonner'. (5) Add unpatchRegistry to the useCallback dependency array at line 298. (6) In useTimelineState.ts, update the useAssetManagement call (line ~206) to pass unpatchRegistry.",
"depends_on": [
"T2"
],
"status": "done",
"executor_notes": "Added unpatchRegistry to UseAssetManagementArgs, used it in registerGenerationAsset, and on persist failure now calls unpatchRegistry(assetId) plus toast.error('Failed to save asset'). Verified the failure path and dependency array in useAssetManagement.ts, and confirmed the useTimelineState.ts pass-through required by this task was already present from completed task T2, so no additional edit there was needed. Verification: npx tsc --noEmit, git -C reigh-app diff --check, and line audit.",
"files_changed": [
"reigh-app/src/tools/video-editor/hooks/useAssetManagement.ts"
],
"commands_run": [
"npx tsc --noEmit",
"git -C reigh-app diff --check -- src/tools/video-editor/hooks/useAssetManagement.ts src/tools/video-editor/hooks/useSwitchToFinalVideo.ts src/tools/video-editor/components/TimelineEditor/TimelineEditor.tsx",
"nl -ba reigh-app/src/tools/video-editor/hooks/useAssetManagement.ts | sed -n '34,305p'"
],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T5",
"description": "Add rollback to useSwitchToFinalVideo (useSwitchToFinalVideo.ts). (1) Add unpatchRegistry to UseSwitchToFinalVideoArgs interface (after line 21, import TimelineUnpatchRegistry type). (2) Refactor registerFinalVideoAsset (line 25-42) to return { assetKey, persistPromise } instead of just assetKey \u2014 remove the void ... .catch() from the helper, return persistPromise: registerAsset(assetKey, assetEntry). (3) In switchToFinalVideo (line 51-70): destructure { assetKey, persistPromise }, add .catch on persistPromise that calls buildSwitchShotGroupToImagesMutation({ currentData: dataRef.current, shotId, rowId }), applies the reverse mutation via applyEdit, calls unpatchRegistry(assetKey), and shows toast.error('Failed to save asset'). (4) In updateToLatestVideo (line 72-91): before the forward edit, capture oldVideoAssetKey from dataRef.current?.config.pinnedShotGroups (find group with matching shotId, trackId===rowId, mode==='video'). On persist failure: call buildUpdateShotGroupToLatestVideoMutation with oldVideoAssetKey to restore, applyEdit the reverse, unpatchRegistry(assetKey), toast. (5) Import toast from @/shared/components/ui/runtime/sonner. (6) Add unpatchRegistry to both useCallback dep arrays. (7) In TimelineEditor.tsx (line ~499-505), pass unpatchRegistry to the useSwitchToFinalVideo call.",
"depends_on": [
"T2"
],
"status": "done",
"executor_notes": "Refactored registerFinalVideoAsset to return { assetKey, persistPromise }, added unpatchRegistry to useSwitchToFinalVideo, and on persist failure now reverse-applies the relevant shot-group mutation, calls unpatchRegistry(assetKey), and shows toast.error('Failed to save asset'). updateToLatestVideo also captures the old video asset key before the forward edit and uses a guarded restore helper so same-generation asset-key rollbacks still work when the stock helper no-ops. Verified with npx tsc --noEmit, full useClipEditing.test.ts, git -C reigh-app diff --check, and line audit of useSwitchToFinalVideo.ts and the TimelineEditor.tsx wiring.",
"files_changed": [
"reigh-app/src/tools/video-editor/hooks/useSwitchToFinalVideo.ts",
"reigh-app/src/tools/video-editor/components/TimelineEditor/TimelineEditor.tsx"
],
"commands_run": [
"npx tsc --noEmit",
"npx vitest run --config config/testing/vitest.config.ts src/tools/video-editor/hooks/useClipEditing.test.ts",
"git -C reigh-app diff --check -- src/tools/video-editor/hooks/useAssetManagement.ts src/tools/video-editor/hooks/useSwitchToFinalVideo.ts src/tools/video-editor/components/TimelineEditor/TimelineEditor.tsx",
"nl -ba reigh-app/src/tools/video-editor/hooks/useSwitchToFinalVideo.ts | sed -n '1,220p'",
"nl -ba reigh-app/src/tools/video-editor/components/TimelineEditor/TimelineEditor.tsx | sed -n '236,510p'"
],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T6",
"description": "Run TypeScript compilation and all existing video-editor hook tests. Fix any type errors or test failures introduced by T1-T5. Commands: (1) cd reigh-app && npx tsc --noEmit (2) cd reigh-app && npx vitest run --config config/testing/vitest.config.ts src/tools/video-editor/hooks/ (3) cd reigh-app && npx vitest run --config config/testing/vitest.config.ts src/tools/video-editor/contexts/VideoEditorProvider.test.tsx. Key areas to watch: useClipEditing.test.ts has existing useSwitchToFinalVideo tests (line 468+) that pass registerAsset \u2014 they'll need updating if the hook signature changed. Also useExternalDrop.test.tsx mocks patchRegistry but not unpatchRegistry \u2014 may need a vi.fn() added. VideoEditorProvider.test.tsx mocks patchRegistry at line 152 \u2014 add unpatchRegistry: vi.fn() alongside it.",
"depends_on": [
"T3",
"T4",
"T5"
],
"status": "done",
"executor_notes": "Ran the full validation commands for this plan stage without narrowing scope: npx tsc --noEmit, npx vitest run --config config/testing/vitest.config.ts src/tools/video-editor/hooks/, and npx vitest run --config config/testing/vitest.config.ts src/tools/video-editor/contexts/VideoEditorProvider.test.tsx. All passed (tsc clean, 18 hook test files / 102 tests passed, provider test file / 3 tests passed), so no additional fixes or mock updates were required in this batch.",
"files_changed": [],
"commands_run": [
"npx tsc --noEmit",
"npx vitest run --config config/testing/vitest.config.ts src/tools/video-editor/hooks/",
"npx vitest run --config config/testing/vitest.config.ts src/tools/video-editor/contexts/VideoEditorProvider.test.tsx"
],
"evidence_files": [],
"reviewer_verdict": ""
}
]
code
Prior batch deviations (address if applicable):
[
"Advisory observation mismatch: executor claimed files not observed in git status/content hash delta: .megaplan/plans/add-rollback-for-optimistic-20260413-0218/execution_batch_4.json",
"Advisory: done tasks rely on commands_run without files_changed (FLAG-006 softening): T6",
"Advisory audit finding: Executor claimed changed files not present in git status: reigh-app/src/tools/video-editor/components/TimelineEditor/TimelineEditor.tsx, reigh-app/src/tools/video-editor/contexts/VideoEditorProvider.tsx, reigh-app/src/tools/video-editor/hooks/timeline-state-types.ts, reigh-app/src/tools/video-editor/hooks/useAssetManagement.ts, reigh-app/src/tools/video-editor/hooks/useStaleVariants.ts, reigh-app/src/tools/video-editor/hooks/useSwitchToFinalVideo.ts, reigh-app/src/tools/video-editor/hooks/useTimelineCommit.ts, reigh-app/src/tools/video-editor/hooks/useTimelineSave.ts, reigh-app/src/tools/video-editor/hooks/useTimelineState.contexts.ts, reigh-app/src/tools/video-editor/hooks/useTimelineState.ts, reigh-app/src/tools/video-editor/hooks/useTimelineState.types.ts",
"Advisory audit finding: Git status shows changed files not claimed by any task: .claude, art-agents, fix-windows-install.txt, fix-windows-qwen-vl.txt, fix-windows-requests.txt, node_modules, orchestrator.log, outputs, plant_demo.py, scripts",
"Advisory audit finding: Sense check SC7 is missing an executor acknowledgment."
]
code
Batch-scoped sense checks:
[
{
"id": "SC7",
"task_id": "T7",
"question": "Did the verification tests pass? Were any regressions found and fixed?",
"executor_note": "",
"verdict": ""
}
]
code
Full execution tracking source of truth (`finalize.json`):
{
"baseline_test_command": "pytest --tb=no -q --no-header",
"baseline_test_failures": [],
"baseline_test_note": "Run all video-editor hook tests before starting. The plan touches useTimelineCommit, useTimelineState, contexts, and three consumer hooks. Existing tests for useSwitchToFinalVideo live in useClipEditing.test.ts. No existing tests for useStaleVariants or useAssetManagement rollback paths.",
"tasks": [
{
"id": "T1",
"description": "Add unpatchRegistry to useTimelineCommit.ts and export the new type in timeline-state-types.ts. Implementation: add a useCallback after patchRegistry (after line 356) that mirrors patchRegistry but destructures the target assetId out of both current.registry.assets and current.resolvedConfig.registry, then reassembles via assembleTimelineData and calls commitData with save: false. Add TimelineUnpatchRegistry = (assetId: string) => void type to timeline-state-types.ts after line 33. Return unpatchRegistry from the hook alongside patchRegistry (add to the return object at line 366).",
"depends_on": [],
"status": "done",
"executor_notes": "Added TimelineUnpatchRegistry and useTimelineCommit.unpatchRegistry. Verified the rollback path removes assetId from both current.registry.assets and current.resolvedConfig.registry, rebuilds resolved clips from the remaining registry so removed assets lose assetEntry, and calls commitData with save: false. npx tsc --noEmit and git -C reigh-app diff --check -- src/tools/video-editor/hooks/useTimelineCommit.ts src/tools/video-editor/hooks/timeline-state-types.ts both passed.",
"files_changed": [
"reigh-app/src/tools/video-editor/hooks/useTimelineCommit.ts",
"reigh-app/src/tools/video-editor/hooks/timeline-state-types.ts"
],
"commands_run": [
"npx tsc --noEmit",
"git -C reigh-app diff --check -- src/tools/video-editor/hooks/useTimelineCommit.ts src/tools/video-editor/hooks/timeline-state-types.ts"
],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T2",
"description": "Thread unpatchRegistry through the state layer alongside patchRegistry. Follow every site that receives/passes patchRegistry and add unpatchRegistry next to it. Files: (1) useTimelineState.ts \u2014 destructure unpatchRegistry from save (line ~89), pass to useAssetManagement call (line ~206), pass to useTimelineEditorContextValue (line ~284). (2) \u2014 add to (after line 142). (3) \u2014 add to the interface (after line 83), include in the return memo (after line 216), add to dependency array (after line 243). (4) \u2014 add (after line 78). (5) \u2014 add (after line 249).",
"depends_on": [
"T1"
],
"status": "done",
"executor_notes": "Threaded through the same state-layer path as : , , , , and . Verified with across those five files, , and for the touched files.",
"files_changed": [
"reigh-app/src/tools/video-editor/hooks/useTimelineState.ts",
"reigh-app/src/tools/video-editor/hooks/useTimelineState.types.ts",
"reigh-app/src/tools/video-editor/hooks/useTimelineState.contexts.ts",
"reigh-app/src/tools/video-editor/hooks/useTimelineSave.ts",
"reigh-app/src/tools/video-editor/contexts/VideoEditorProvider.tsx"
],
"commands_run": [
"npx tsc --noEmit",
"git -C reigh-app diff --check -- src/tools/video-editor/hooks/useTimelineState.ts src/tools/video-editor/hooks/useTimelineState.types.ts src/tools/video-editor/hooks/useTimelineState.contexts.ts src/tools/video-editor/hooks/useTimelineSave.ts src/tools/video-editor/contexts/VideoEditorProvider.tsx src/tools/video-editor/hooks/useStaleVariants.ts",
"rg -n "unpatchRegistry" reigh-app/src/tools/video-editor/hooks/useTimelineState.ts reigh-app/src/tools/video-editor/hooks/useTimelineState.types.ts reigh-app/src/tools/video-editor/hooks/useTimelineState.contexts.ts reigh-app/src/tools/video-editor/hooks/useTimelineSave.ts reigh-app/src/tools/video-editor/contexts/VideoEditorProvider.tsx"
],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T3",
"description": "Add rollback to (useStaleVariants.ts:169-214). Before the call at line 200, capture and . Replace the at line 203-205 to also call and . Import toast: (matches useClipEditing.ts in same directory). Keep the existing line.",
"depends_on": [
"T1"
],
"status": "done",
"executor_notes": "Added rollback in : captured the original and before building , and on persist failure now restores the old registry entry via and shows while preserving the existing console error. Verified with , , and line audit of .",
"files_changed": [
"reigh-app/src/tools/video-editor/hooks/useStaleVariants.ts"
],
"commands_run": [
"npx tsc --noEmit",
"git -C reigh-app diff --check -- src/tools/video-editor/hooks/useTimelineState.ts src/tools/video-editor/hooks/useTimelineState.types.ts src/tools/video-editor/hooks/useTimelineState.contexts.ts src/tools/video-editor/hooks/useTimelineSave.ts src/tools/video-editor/contexts/VideoEditorProvider.tsx src/tools/video-editor/hooks/useStaleVariants.ts",
"nl -ba reigh-app/src/tools/video-editor/hooks/useStaleVariants.ts | sed -n '180,215p'"
],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T4",
"description": "Add rollback to (useAssetManagement.ts:292-295). (1) Add to the interface (after at line 41). (2) Destructure in the hook body (line ~243 area). (3) Replace the at line 293-295 to also call and . (4) Import toast: . (5) Add to the dependency array at line 298. (6) In , update the call (line ~206) to pass .",
"depends_on": [
"T2"
],
"status": "done",
"executor_notes": "Added to , used it in , and on persist failure now calls plus . Verified the failure path and dependency array in , and confirmed the pass-through required by this task was already present from completed task , so no additional edit there was needed. Verification: , , and line audit.",
"files_changed": [
"reigh-app/src/tools/video-editor/hooks/useAssetManagement.ts"
],
"commands_run": [
"npx tsc --noEmit",
"git -C reigh-app diff --check -- src/tools/video-editor/hooks/useAssetManagement.ts src/tools/video-editor/hooks/useSwitchToFinalVideo.ts src/tools/video-editor/components/TimelineEditor/TimelineEditor.tsx",
"nl -ba reigh-app/src/tools/video-editor/hooks/useAssetManagement.ts | sed -n '34,305p'"
],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T5",
"description": "Add rollback to (useSwitchToFinalVideo.ts). (1) Add to interface (after line 21, import type). (2) Refactor (line 25-42) to return instead of just \u2014 remove the from the helper, return . (3) In (line 51-70): destructure , add on that calls , applies the reverse mutation via , calls , and shows . (4) In (line 72-91): before the forward edit, capture from (find group with matching , , ). On persist failure: call with to restore, the reverse, , toast. (5) Import toast from . (6) Add to both dep arrays. (7) In (line ~499-505), pass to the call.",
"depends_on": [
"T2"
],
"status": "done",
"executor_notes": "Refactored to return , added to , and on persist failure now reverse-applies the relevant shot-group mutation, calls , and shows . also captures the old video asset key before the forward edit and uses a guarded restore helper so same-generation asset-key rollbacks still work when the stock helper no-ops. Verified with , full , , and line audit of and the wiring.",
"files_changed": [
"reigh-app/src/tools/video-editor/hooks/useSwitchToFinalVideo.ts",
"reigh-app/src/tools/video-editor/components/TimelineEditor/TimelineEditor.tsx"
],
"commands_run": [
"npx tsc --noEmit",
"npx vitest run --config config/testing/vitest.config.ts src/tools/video-editor/hooks/useClipEditing.test.ts",
"git -C reigh-app diff --check -- src/tools/video-editor/hooks/useAssetManagement.ts src/tools/video-editor/hooks/useSwitchToFinalVideo.ts src/tools/video-editor/components/TimelineEditor/TimelineEditor.tsx",
"nl -ba reigh-app/src/tools/video-editor/hooks/useSwitchToFinalVideo.ts | sed -n '1,220p'",
"nl -ba reigh-app/src/tools/video-editor/components/TimelineEditor/TimelineEditor.tsx | sed -n '236,510p'"
],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T6",
"description": "Run TypeScript compilation and all existing video-editor hook tests. Fix any type errors or test failures introduced by T1-T5. Commands: (1) (2) (3) . Key areas to watch: useClipEditing.test.ts has existing useSwitchToFinalVideo tests (line 468+) that pass \u2014 they'll need updating if the hook signature changed. Also useExternalDrop.test.tsx mocks but not \u2014 may need a added. VideoEditorProvider.test.tsx mocks at line 152 \u2014 add alongside it.",
"depends_on": [
"T3",
"T4",
"T5"
],
"status": "done",
"executor_notes": "Ran the full validation commands for this plan stage without narrowing scope: , , and . All passed ( clean, 18 hook test files / 102 tests passed, provider test file / 3 tests passed), so no additional fixes or mock updates were required in this batch.",
"files_changed": [],
"commands_run": [
"npx tsc --noEmit",
"npx vitest run --config config/testing/vitest.config.ts src/tools/video-editor/hooks/",
"npx vitest run --config config/testing/vitest.config.ts src/tools/video-editor/contexts/VideoEditorProvider.test.tsx"
],
"evidence_files": [],
"reviewer_verdict": ""
},
{
"id": "T7",
"description": "Run tests relevant to the changed files to verify correctness and check for regressions \u2014 run the full test file/module, not just individual functions. Find and run the project's existing test suite \u2014 do NOT create new test files. If any test fails, read the error, fix the code, and re-run until all tests pass.",
"depends_on": [
"T6"
],
"status": "pending",
"executor_notes": "",
"files_changed": [],
"commands_run": [],
"evidence_files": [],
"reviewer_verdict": ""
}
],
"watch_items": [
"TOAST IMPORT: Plan says but the correct import for hooks in this directory is (matches useClipEditing.ts, 88 uses vs 4). Use sonner.",
"TEST CONFIG: Always run vitest with from . Do NOT use bare \u2014 the alias won't resolve without the config.",
"EXISTING TESTS: useSwitchToFinalVideo tests live in , not their own file. They pass as a mock \u2014 will need updating for the new arg and the refactored return type.",
"MOCK UPDATES: , , and all mock hook args including \u2014 each needs added to avoid runtime errors.",
"FLAG-002 (open, minor): tsconfig.app.json excludes test files, so won't typecheck new test files. For test type coverage, rely on vitest compilation instead.",
"unpatchRegistry IMPLEMENTATION: Mirror patchRegistry exactly but destructure the assetId out. Key pattern: . Don't forget to also rebuild with the removed asset (clips referencing the removed asset should get ).",
"updateToLatestVideo ROLLBACK GUARD: has a no-op guard when . The reverse call passes the same but a different . Verify during implementation that the guard checks the asset key's generationId, not the param \u2014 if the guard no-ops, use a raw metaUpdates mutation instead.",
"DEBT: This plan does NOT create new test files for rollback paths (plan Steps 6 test creation was downscoped to avoid scope creep). Existing tests + typecheck + manual verification are the validation strategy.",
"SAVE:FALSE INVARIANT: Both patchRegistry and unpatchRegistry call commitData with save:false. This is critical \u2014 rollback must never trigger a server save of the reverted state."
],
"sense_checks": [
{
"id": "SC1",
"task_id": "T1",
"question": "Does unpatchRegistry correctly destructure the assetId out of BOTH registry.assets AND resolvedConfig.registry, and does commitData get called with save:false?",
"executor_note": "Confirmed in that destructures out of both and , rebuilds against the remaining resolved registry, and calls with .",
"verdict": ""
},
{
"id": "SC2",
"task_id": "T2",
"question": "Is unpatchRegistry threaded through every site that already passes patchRegistry? Check: useTimelineSave, useTimelineState, useTimelineState.contexts, useTimelineState.types, VideoEditorProvider. Missing any one site will cause a runtime undefined error.",
"executor_note": "Confirmed is now threaded through all five required sites: , , , , and .",
"verdict": ""
},
{
"id": "SC3",
"task_id": "T3",
"question": "Does the rollback in useStaleVariants correctly capture the ORIGINAL entry (before the updatedEntry mutation) and pass it to patchRegistry on failure? The capture must happen before line 200.",
"executor_note": "Confirmed captures and before , and the catch path restores with plus an error toast.",
"verdict": ""
},
{
"id": "SC4",
"task_id": "T4",
"question": "Does useAssetManagement.registerGenerationAsset call unpatchRegistry(assetId) \u2014 not patchRegistry \u2014 on failure? And is unpatchRegistry in the useCallback dep array?",
"executor_note": "Confirmed now calls in the path at lines 297-300, and is included in the callback dependency array at line 304.",
"verdict": ""
},
{
"id": "SC5",
"task_id": "T5",
"question": "In useSwitchToFinalVideo: (1) Does registerFinalVideoAsset now return { assetKey, persistPromise } and NOT fire-and-forget internally? (2) Does switchToFinalVideo reverse with buildSwitchShotGroupToImagesMutation? (3) Does updateToLatestVideo capture oldVideoAssetKey BEFORE the forward edit? (4) Is unpatchRegistry passed from TimelineEditor.tsx?",
"executor_note": "Confirmed now returns from (lines 28-44), rolls back with on persist failure (lines 143-155), captures before the forward edit (lines 164-171) and restores on persist failure (lines 190-205), and passes into at lines 499-505.",
"verdict": ""
},
{
"id": "SC6",
"task_id": "T6",
"question": "Do all existing tests pass? Specifically: useClipEditing.test.ts (useSwitchToFinalVideo tests at line 468+), useExternalDrop.test.tsx, VideoEditorProvider.test.tsx \u2014 all need unpatchRegistry mocks added. Does tsc --noEmit pass?",
"executor_note": "Confirmed all required validation passed: succeeded, ran clean with 18 test files / 102 tests passing, and passed with 3 tests. The targeted areas called out in the plan (, , ) all passed within those runs.",
"verdict": ""
},
{
"id": "SC7",
"task_id": "T7",
"question": "Did the verification tests pass? Were any regressions found and fixed?",
"executor_note": "",
"verdict": ""
}
],
"meta_commentary": "This is a 6-task plan touching ~10 files. The core risk is threading: unpatchRegistry must be plumbed through the same 5-layer chain as patchRegistry, and missing any link causes a runtime undefined. T2 is the most tedious task (pure plumbing) but also where errors are most likely.\n\nToast import gotcha: the plan says but the hooks directory convention (useClipEditing.ts, TimelineEditor.tsx) uses . Use sonner.\n\nThe updateToLatestVideo rollback (T5) has a known uncertainty: the buildUpdateShotGroupToLatestVideoMutation no-op guard may block the reverse mutation if it checks targetGenerationId rather than the asset key's generationId. If the reverse mutation returns null, the executor should read the guard logic in shot-group-commands.ts and either bypass it or construct a raw metaUpdates mutation.\n\nTest files for rollback paths (plan Step 6) were intentionally omitted \u2014 the existing test suite + typecheck + sense checks are sufficient validation for this scope. The existing useSwitchToFinalVideo tests in useClipEditing.test.ts will need mock updates but should not need new test cases.\n\nExecution order: T1 first (foundation), then T2 (threading), then T3/T4/T5 in parallel (each is an independent file), then T6 (validation). T4 has a minor dependency on T2 because useTimelineState.ts needs the unpatchRegistry pass-through to useAssetManagement, but T4 can batch that edit.",
"validation": {
"plan_steps_covered": [
{
"plan_step_summary": "Step 1: Add unpatchRegistry to useTimelineCommit + type to timeline-state-types.ts",
"finalize_task_ids": [
"T1"
]
},
{
"plan_step_summary": "Step 2: Thread unpatchRegistry through state layer (useTimelineState, types, contexts)",
"finalize_task_ids": [
"T2"
]
},
{
"plan_step_summary": "Step 3: Add rollback to useStaleVariants.updateAssetToCurrentVariant",
"finalize_task_ids": [
"T3"
]
},
{
"plan_step_summary": "Step 4: Add rollback to useAssetManagement.registerGenerationAsset",
"finalize_task_ids": [
"T4"
]
},
{
"plan_step_summary": "Step 5: Add rollback to useSwitchToFinalVideo (switchToFinalVideo + updateToLatestVideo)",
"finalize_task_ids": [
"T5"
]
},
{
"plan_step_summary": "Step 6: Add tests for rollback paths",
"finalize_task_ids": [
"T6"
]
},
{
"plan_step_summary": "Step 7: Run existing tests and type check",
"finalize_task_ids": [
"T6"
]
}
],
"orphan_tasks": [
"T7"
],
"completeness_notes": "Steps 6 and 7 are merged into T6 (validation task). Step 6 originally called for creating new test files (useStaleVariants.test.ts, useSwitchToFinalVideo.test.ts) but this was descoped: existing tests in useClipEditing.test.ts already cover useSwitchToFinalVideo, and the validation task covers updating mocks and running the full suite. No new test files are created \u2014 this avoids scope creep while still validating correctness via typecheck + existing test suite.",
"coverage_complete": true
}
}
code
Debt watch items (do not make these worse):
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: for ordinary pairs, the new diagnosis is not well-supported by the repo. the current sync effect in /users/user_c042661f/documents/reigh-workspace/reigh-app/src/tools/travel-between-images/components/shotimageseditor/hooks/usesegmentslotmode.ts already syncs url and primaryvariantid, and the regenerate path reads exactly starturl, endurl, startgenid, endgenid, startvariantid, and endvariantid from segmentslotmode.pairdata in /users/user_c042661f/documents/reigh-workspace/reigh-app/src/domains/media-lightbox/hooks/usevideoregeneratemode.ts. adding thumburl and generationid to the sync does not, by itself, explain why an old image url is still being used for regular pairs. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: the fix is incomplete for extra trailing slots. handlepairclick can populate activepairdata from trailingpairdata when pairindex === pairdatabyindex.size in /users/user_c042661f/documents/reigh-workspace/reigh-app/src/tools/travel-between-images/components/shotimageseditor/hooks/usesegmentslotmode.ts, but the proposed sync effect only reads pairdatabyindex.get(segmentslotlightboxindex). for those trailing-slot cases fresh is undefined, so no image refresh happens. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: the merge pseudocode does not actually sync 'all image fields' as claimed. it omits id and position from change detection, and when fresh.startimage or fresh.endimage becomes null it preserves the stale previous object instead of syncing that null state. as written, it also needs explicit null-guards around spreads of prev.startimage / to be safe in strict typescript. (flagged 1 times across 1 plans)
{"output":"Completed batch 5 task T7 and wrote a checkpoint to .megaplan/plans/add-rollback-for-optimistic-20260413-0218/execution_batch_5.json. Final verification passed: npx tsc --noEmit succeeded, npx vitest run --config config/testing/vitest.config.ts src/tools/video-editor/hooks/ passed with 18 files / 102 tests, and npx vitest run --config config/testing/vitest.config.ts src/tools/video-editor/contexts/VideoEditorProvider.test.tsx passed with 1 file / 3 tests. A temporary rollback reproduction script for the useSwitchToFinalVideo persist-failure path also passed, confirming the optimistic asset was unpatched, the shot group rolled back to images mode, and the error toast fired; the script was deleted afterward.","files_changed":[".megaplan/plans/add-rollback-for-optimistic-20260413-0218/execution_batch_5.json"],"commands_run":["npx tsc --noEmit","npx vitest run --config config/testing/vitest.config.ts src/tools/video-editor/hooks/","npx vitest run --config config/testing/vitest.config.ts src/tools/video-editor/contexts/VideoEditorProvider.test.tsx","npx tsx .tmp-rollback-check.tsx","node --import tsx .tmp-rollback-check.tsx","test ! -e .tmp-rollback-check.tsx && echo removed","git -C reigh-app diff --check","git -C reigh-app status --short -- ."],"deviations":[],"task_updates":[{"task_id":"T7","status":"done","executor_notes":"Reran the relevant existing verification suite against the final state without narrowing scope: npx tsc --noEmit, npx vitest run --config config/testing/vitest.config.ts src/tools/video-editor/hooks/, and npx vitest run --config config/testing/vitest.config.ts src/tools/video-editor/contexts/VideoEditorProvider.test.tsx. All passed again (tsc clean, 18 hook test files / 102 tests passed, provider test file / 3 tests passed). For the final-batch bug reproduction requirement, created a temporary script that exercised the useSwitchToFinalVideo persist-failure path, confirmed the optimistic asset was unpatched, the shot group rolled back to images mode, and the error toast fired, then deleted the script after the successful run. No regressions were found and no further fixes were needed.","files_changed":[],"commands_run":["npx tsc --noEmit","npx vitest run --config config/testing/vitest.config.ts src/tools/video-editor/hooks/","npx vitest run --config config/testing/vitest.config.ts src/tools/video-editor/contexts/VideoEditorProvider.test.tsx","node --import tsx .tmp-rollback-check.tsx","test ! -e .tmp-rollback-check.tsx && echo removed"]}],"sense_check_acknowledgments":[{"sense_check_id":"SC7","executor_note":"Confirmed the verification reruns all passed with no regressions: npx tsc --noEmit succeeded, the full hook suite passed (18 files / 102 tests), and VideoEditorProvider.test.tsx passed (3 tests). The temporary rollback script for the final-video persist-failure path also passed and was removed afterward."}]}
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: the plan's claim that worker_state.py:200-204 (the 30-minute startup safety net) catches abandoned pods that exited before patching is slightly imprecise. line 200-204 only runs when in_startup_phase is true, which requires startup_phase to be in ('deps_installing', 'deps_verified', 'worker_starting') per line 161. a pod that exits before its first patch has startup_phase = none, so in_startup_phase is false and the code falls through to the normal timeout checks (active_stale / not_claiming) at line 207+, not the 30-minute startup cap. both paths eventually reap the worker, so the end result is the same, but the overview's reasoning (naming 200-204 specifically) is wrong. worth correcting so future readers don't mis-reason about the invariant. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: checked worker_state.py line 161 (in_startup_phase = startup_phase in (...)) against the plan's assumption that subsequent lenient writes are safe. if deps_installing succeeds but deps_verified silently fails, startup_phase stays at 'deps_installing' and the 30-minute cap from line 200-204 applies — even though the pod is actually progressing through uv sync. on a slow runpod image with cold wheel downloads, uv sync --extra cuda124 plus wan2gp deps can take 20+ minutes. there's no concrete benchmark in the plan that says the 30-minute cap is safely above the expected sync time; if uv sync legitimately takes 25 minutes and the deps_verified patch fails on a transient network blip, the orchestrator will terminate a healthy pod. plan should either bump the cap or note that deps_verified swallowing is acceptable because the cap is generously above typical sync time. (flagged 1 times across 1 plans)
[DEBT] are-the-success-criteria-well-prioritized-and-verifiable: are the success criteria well-prioritized and verifiable?: the attached success criteria are stale and do not match the current plan body. they still require 'no usestate for activepairdata', 'setactivepairdata fully removed', 'sync effect deleted', and 'onpairclick simplified to (pairindex: number) => void', which are the opposite of the current targeted-sync plan. as presented, the criteria are not usable for review or execution. (flagged 1 times across 1 plans)
[DEBT] audio-loading: getaudiodata in useeffect removes render-readiness signal (flagged 1 times across 1 plans)
[DEBT] audio-loading: same as correctness-3 — preview/render parity risk (flagged 1 times across 1 plans)
[DEBT] audio-loading: preview/render parity partially satisfied (flagged 1 times across 1 plans)
[DEBT] audio-reactivity: overlapping clips use first-found, volume not scaled (flagged 1 times across 1 plans)
[DEBT] audio-reactivity: same as audio-reactivity-1 — overlapping/volume-adjusted clips diverge from audible mix (flagged 1 times across 1 plans)
[DEBT] audio-reactivity: textclip missing globalframeprovider (flagged 1 times across 1 plans)
[DEBT] audio-reactivity: same as audio-reactivity-2 — textclipsequence missing provider (flagged 1 times across 1 plans)
[DEBT] audio-reactivity: textclip effects surface not covered (flagged 1 times across 1 plans)
[DEBT] audio-reactivity: continuous effects shared by visual and text clips (flagged 1 times across 1 plans)
[DEBT] batch-generation-pipeline: enhancement in usegeneratebatch before generatevideo() could compute prompts against a stale pair snapshot if mutations are still in flight. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-cascade-paths: cascade lookup only reads params->>'orchestrator_task_id_ref', missing shared reference paths and orchestrator-self detection. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-cascade-paths: duplicate of correctness-2 + correctness-3: invalid sql syntax and narrow cascade lookup. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-cascade-paths: shared orchestrator-reference helpers not referenced. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-cascade-paths: orchestrator tasks that crash don't get orchestrator-self cascade. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-cascade-paths: hardcoded params->>'orchestrator_task_id_ref' misses other reference paths. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-retry: crash requeue sql does not increment attempts, risking infinite requeue loop. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-retry: duplicate of correctness-1: attempts never advance on crash requeue. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-retry: missing attempts increment location in heartbeat sql. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-retry: step 6 under-scoped for real retry convergence and orchestrator-self handling. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-sql-syntax: bare select inside plpgsql is invalid — needs perform. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-testing: no multi-crash convergence test exercising attempts 0→1→2→3. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-testing: no validation that plpgsql body executes successfully. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-testing: criteria don't require proof of crash requeue convergence. (flagged 1 times across 1 plans)
[DEBT] criteria-verifiability: 'no unsafe .maybesingle()' criterion requires judgment about column uniqueness. (flagged 1 times across 1 plans)
[DEBT] criteria-verifiability: decision documentation location not specified. (flagged 1 times across 1 plans)
[DEBT] criteria-verifiability: the must criterion requiring 5 task types to exist as active db rows is not verifiable from code diff alone — it requires a live db query. (flagged 1 times across 1 plans)
[DEBT] db-fallback-testing: no new automated test for the db fallback dispatch path or dependant_on preservation for raw worker families. (flagged 1 times across 1 plans)
[DEBT] dependency-resolution: dependency resolution: the plan does not lock down the active python-version matrix even though the repo currently splits between python 3.10 local installs and a python 3.11 runpod image. (flagged 1 times across 1 plans)
[DEBT] did-the-work-fully-address-the-issue-hints-user-notes-and-approved-plan-requirements: did the work fully address the issue hints, user notes, and approved plan requirements?: the package is internally inconsistent. the plan body says to keep activepairdata in usestate and make phase 2 optional, but the attached metadata and success criteria still describe the previous derive-via-usememo / remove-setactivepairdata / simplify-onpairclick plan. that means the approved-plan requirements are only partially coherent as presented. (flagged 1 times across 1 plans)
[DEBT] did-the-work-fully-address-the-issue-hints-user-notes-and-approved-plan-requirements: did the work fully address the issue hints, user notes, and approved plan requirements?: the linux distro note is documentation-only; the generated install command in step 7 still runs apt-get install python3.10-venv python3.10-dev ffmpeg without any pre-check that the package exists. users on ubuntu 24.04+ who ignore the doc and try to copy-paste the command will hit a confusing e: unable to locate package python3.10-venv from apt rather than a targeted error from commandutils.ts. a one-line detection pre-check (e.g., apt-cache show python3.10-venv >/dev/null 2>&1 || { echo 'install deadsnakes ppa first — see readme'; exit 1; }) would convert the silent failure into an actionable error, but the plan does not add this. (flagged 1 times across 1 plans)
[DEBT] does-the-change-touch-all-locations-and-supporting-infrastructure: does the change touch all locations and supporting infrastructure?: phase 1 still misses a real supporting-data location: trailingpairdata lives outside pairdatabyindex in /users/user_c042661f/documents/reigh-workspace/reigh-app/src/tools/travel-between-images/components/shotimageseditor/hooks/usesegmentslotpresentationadapter.ts, but the proposed sync logic only considers pairdatabyindex. if trailing slot regenerate is part of the bug surface, that location is not covered. (flagged 1 times across 1 plans)
[DEBT] does-the-change-touch-all-locations-and-supporting-infrastructure: does the change touch all locations and supporting infrastructure?: the non-swallowing helper update_worker_phase_strict is a new shell function, but phase 1 step 2 introduces it only as pseudo-code. there is no concrete note that the helper must handle supabase http non-2xx responses as failures (curl returns 0 even on http 4xx/5xx by default unless -f or --fail-with-body is used). if the implementer ports update_worker_phase verbatim with only || return 0 removed, a 500 from supabase would still report success because curl's exit code is 0. the plan should specify curl --fail or explicit http status code checking in the strict variant. (flagged 1 times across 1 plans)
[DEBT] edge-test-config: plan's vitest commands use the wrong config entry point. (flagged 1 times across 1 plans)
[DEBT] edge-test-config: same as verification-3: wrong vitest config in validation commands. (flagged 1 times across 1 plans)
[DEBT] edge-test-config: success criterion references wrong test command. (flagged 1 times across 1 plans)
[DEBT] error-handling: db loader error handling convention mismatch (plan says log+null, existing loaders throw) (flagged 1 times across 1 plans)
[DEBT] error-propagation-logging: generation.ts and handler.ts logging endpoints are not directly tested. (flagged 1 times across 1 plans)
[DEBT] error-propagation-testing: no end-to-end regression test for the full symptom chain (db error → tocompletionerror metadata → handler log). (flagged 1 times across 1 plans)
[DEBT] error-propagation-testing: handler.ts metadata surfacing criterion lacks a concrete automated verifier. (flagged 1 times across 1 plans)
[DEBT] error-propagation-testing: main issue only partially validated without an integration test. (flagged 1 times across 1 plans)
[DEBT] find-the-callers-of-the-changed-function-what-arguments-do-they-actually-pass-does-the-fix-handle-all-of-them: find the callers of the changed function. what arguments do they actually pass? does the fix handle all of them?: the step 2 retry loop uses a naked sleep 2 between attempts, which adds up to 6 seconds of latency on the happy path when the first patch eventually succeeds on attempt 2 or 3. for pods where supabase is reachable but slow during the initial moments of a cold runpod start, the retry logic is fine. however, if the first attempt fails with a tls handshake delay and the retry loop sleeps 2s per attempt regardless of whether curl itself has been blocking for tens of seconds, the total startup latency penalty could be substantial. this is a minor tuning concern, not a correctness issue. (flagged 1 times across 1 plans)
[DEBT] gpu-branching-test-matrix: linux cuda128 path under-verified (flagged 1 times across 1 plans)
[DEBT] gpu-branching-ui-surface: nvidia-50 option is exposed on linux in the ui but linux cuda128 smoke test is missing (flagged 1 times across 1 plans)
[DEBT] hook-abstraction: usepairsettingshandler becomes trivial with single caller — keeping it is extra indirection. (flagged 1 times across 1 plans)
[DEBT] is-the-change-in-the-right-place-and-would-it-break-any-callers: is the change in the right place, and would it break any callers?: the optional cleanup steps are not in the right place yet. pairregionslayer does not receive pairdatabyindex today; its props are only images, imagepositionswithpending, pairinfowithpending, and callback/display props in /users/user_c042661f/documents/reigh-workspace/reigh-app/src/tools/travel-between-images/components/timeline/timelinecontainer/components/pairregionslayer.tsx. so step 4's 'pass pairdatabyindex.get(pairindex) directly' would require new prop plumbing or a different seam. (flagged 1 times across 1 plans)
[DEBT] is-the-scope-and-scale-of-the-change-appropriate: is the scope and scale of the change appropriate?: phase 2 is still under-specified for execution. step 4 says pairregionslayer should either pass pairdatabyindex.get(pairindex) directly or 'just pass the index + frame-only data', which are materially different designs. if phase 2 is kept in the plan, it needs a single concrete direction. (flagged 1 times across 1 plans)
[DEBT] is-there-convincing-verification-for-the-change: is there convincing verification for the change?: the plan still lacks an explicit automated regression test for the reported bug. step 2 is manual ('check that usevideoregeneratemode now gets the fresh url'), but there is no concrete test that opens a segment slot, changes the primary variant data, and asserts that the regenerate path sees the fresh url, generationid, and primaryvariantid. (flagged 1 times across 1 plans)
[DEBT] is-there-convincing-verification-for-the-change: is there convincing verification for the change?: the current usesegmentslotmode test remains only a smoke test in /users/user_c042661f/documents/reigh-workspace/reigh-app/src/tools/travel-between-images/components/shotimageseditor/hooks/tests/usesegmentslotmode.test.ts, and the plan does not add behavior coverage for the new sync effect. (flagged 1 times across 1 plans)
[DEBT] is-there-convincing-verification-for-the-change: is there convincing verification for the change?: no verification step covers the trailing-slot branch, even though the proposed phase 1 logic currently misses trailingpairdata refreshes. (flagged 1 times across 1 plans)
[DEBT] legacy-data-backfill: the step 8 diagnostic query only detects cross-shot pair_shot_generation_id misassociations, not same-shot misassociations caused by timeline reordering within a shot. (flagged 1 times across 1 plans)
[DEBT] lookup-consistency: other repo call sites use unordered .limit(1).maybesingle() and will remain inconsistent. (flagged 1 times across 1 plans)
[DEBT] lookup-consistency: other call sites with same unsafe pattern not covered. (flagged 1 times across 1 plans)
[DEBT] lora-management: lora tools simplified vs full ui parity (multi-stage metadata, private loras) (flagged 1 times across 1 plans)
[DEBT] media-lightbox-persistence: variant switches do not clear/restore inpaintprompt, so stale prompt state can leak across variants with no cached prompt. (flagged 1 times across 1 plans)
[DEBT] media-lightbox-persistence: removing prompt/numgenerations from the variant-keyed localstorage cache means all variants within a generation share the same prompt. this broadens existing debt-002 (variant prompt leakage). (flagged 1 times across 1 plans)
[DEBT] media-lightbox-segment-slot: media lightbox / segment slot: the targeted sync rationale does not fully explain the reported stale-url bug for regular pairs, and the proposed effect still misses trailing-slot refreshes because those can come from trailingpairdata rather than pairdatabyindex. (flagged 1 times across 1 plans)
[DEBT] number-input-nullable: plan doesn't explicitly state onchange must also accept null, though step 3 depends on it. (flagged 1 times across 1 plans)
[DEBT] number-input-nullable: disputed v1 flag — original concern about bulkclippanel being unimplementable. (flagged 1 times across 1 plans)
[DEBT] number-input-nullable: onchange null filtering not explicitly addressed in plan. (flagged 1 times across 1 plans)
[DEBT] number-input-testing: no planned tests for numberinput shared component or bulkclippanel nullable draft flow. (flagged 1 times across 1 plans)
[DEBT] orchestrator-completion-rollout: pre-existing individual_travel_segment children won't drive orchestrator completion through segment_type_config after deploy. (flagged 1 times across 1 plans)
[DEBT] orchestrator-completion-rollout: missing compatibility seam in orchestratorcore.ts:123-126 for old individual_travel_segment rows. (flagged 1 times across 1 plans)
[DEBT] orchestrator-completion-rollout: mixed old/new data during rollout can leave old orchestrators without completion counting. (flagged 1 times across 1 plans)
[DEBT] orchestrator-completion-rollout: no test or deployment guard for pre-existing individual_travel_segment children completing after worker change. (flagged 1 times across 1 plans)
[DEBT] orchestrator-completion-rollout: plan overstates backward compatibility for existing data. (flagged 1 times across 1 plans)
[DEBT] orchestrator-completion-rollout: missing rollout compatibility step for in-flight individual_travel_segment tasks. (flagged 1 times across 1 plans)
[DEBT] orchestrator-completion-rollout: pre-deploy individual_travel_segment child completing post-rollout won't be treated as segment task by checkorchestratorcompletion. (flagged 1 times across 1 plans)
[DEBT] orchestrator-completion-rollout: orchestrator.test.ts criterion too narrow to verify old individual_travel_segment compatibility. (flagged 1 times across 1 plans)
[DEBT] pair-settings-plumbing: handleopenpairsettings(pairindex, pairframedata) path in timelinetrackprelude, segmentoutputstrip, and usesegmentoutputstrip not explicitly named. (flagged 1 times across 1 plans)
[DEBT] pair-settings-plumbing: same as flag-002 — segmentoutputstrip and usesegmentoutputstrip still carry pairframedata. (flagged 1 times across 1 plans)
[DEBT] pair-settings-plumbing: timelinetrackprelude and segmentoutputstrip still forward (pairindex, pairframedata). (flagged 1 times across 1 plans)
[DEBT] plan-scope: step 3 is larger than a light megaplan warrants. (flagged 1 times across 1 plans)
[DEBT] planning-metadata: planning metadata: the attached metadata and success criteria still describe a different implementation than the current plan body, which risks sending execution and review down the wrong path. (flagged 1 times across 1 plans)
[DEBT] planning-metadata: success criteria don't cover wave 4 scope (flagged 1 times across 1 plans)
[DEBT] position-key-semantics: plan investigates a unique constraint on (parent_generation_id, child_order) which doesn't match repo semantics for position keys. (flagged 1 times across 1 plans)
[DEBT] position-key-semantics: plan weights toward child_order rather than pair_shot_generation_id as the key that matters. (flagged 1 times across 1 plans)
[DEBT] position-key-semantics: unique constraint on (parent_generation_id, child_order) not supported by repo semantics. (flagged 1 times across 1 plans)
[DEBT] prompt-composition: the plan's step 1 signature includes textbeforeprompts/textafterprompts parameters that would be applied before enhancement, double-wrapping the prompt. (flagged 1 times across 1 plans)
[DEBT] settings-defaults: workerrepopath default can go stale if user switches computertype before editing path (flagged 1 times across 1 plans)
[DEBT] settings-resolution: settings cascade missing — shot-only read diverges from form's defaults→user→project→shot merge (flagged 1 times across 1 plans)
[DEBT] settings-resolution: settings cascade missing — shot-only read (flagged 1 times across 1 plans)
[DEBT] shared-component-compatibility: numberinput changes affect callers outside video-editor (billing, travel-between-images, phaseconfigselectormodal). (flagged 1 times across 1 plans)
[DEBT] shared-component-compatibility: shared ui component blast radius not audited in plan. (flagged 1 times across 1 plans)
[DEBT] shot-linking-testing: no test covers the linkgenerationtoshot error/catch branches. (flagged 1 times across 1 plans)
[DEBT] signature-propagation: plan doesn't explicitly name timeline/index.tsx and segmentslotcontracts.ts for updates. (flagged 1 times across 1 plans)
[DEBT] signature-propagation: same as flag-001 — timeline/index.tsx and segmentslotcontracts.ts not in checklist. (flagged 1 times across 1 plans)
[DEBT] signature-propagation: five supporting contract/plumbing sites not named in the checklist. (flagged 1 times across 1 plans)
[DEBT] task-types-verification: step 3 cites wrong migration file (task_cost_configs instead of task_types) as evidence for db fallback path. (flagged 1 times across 1 plans)
[DEBT] task-types-verification: step 3 should cite task_types source, not task_cost_configs. (flagged 1 times across 1 plans)
[DEBT] task-types-verification: plan doesn't verify travel_segment and travel_stitch exist as active task_types rows using the correct table. (flagged 1 times across 1 plans)
[DEBT] test-coverage: current generation-child.test.ts is only a smoke test. (flagged 1 times across 1 plans)
[DEBT] test-coverage: no plan to verify other lookup paths choose rows consistently. (flagged 1 times across 1 plans)
[DEBT] test-coverage: no new tests for db loader or travel param merge path (flagged 1 times across 1 plans)
[DEBT] test-coverage: must-level criteria depend on manual testing rather than automated assertions (flagged 1 times across 1 plans)
[DEBT] test-coverage: no new unit tests for wave 4 tools (flagged 1 times across 1 plans)
[DEBT] test-coverage: must criteria backed by manual testing only (flagged 1 times across 1 plans)
[DEBT] test-infrastructure: no test fixtures for resources table (flagged 1 times across 1 plans)
[DEBT] timeline-drag-coordination: plan keeps two hooks instead of a single coordinator (flagged 1 times across 1 plans)
[DEBT] timeline-drag-coordination: brief says single coordinator but plan keeps separate hooks (flagged 2 times across 1 plans)
[DEBT] timeline-drag-coordination: pendingopsref retained despite brief suggesting removal (flagged 1 times across 1 plans)
[DEBT] timeline-drag-coordination: wrapper-bound listener mount wiring under-specified (flagged 1 times across 1 plans)
[DEBT] timeline-persistence: read path still assembles config and registry from separate requests (flagged 1 times across 1 plans)
[DEBT] timeline-persistence: poll sync verification not structurally changed (flagged 1 times across 1 plans)
[DEBT] timeline-persistence: backend save helpers not wired to new rpc (flagged 1 times across 1 plans)
[DEBT] timeline-persistence: read infrastructure not updated (flagged 1 times across 1 plans)
[DEBT] timeline-persistence: backend tests not in validation list (flagged 1 times across 1 plans)
[DEBT] timeline-persistence: backend callers not migrated (flagged 1 times across 1 plans)
[DEBT] timeline-persistence: broader persistence-contract problem (flagged 1 times across 1 plans)
[DEBT] timeline-persistence: backend split-save not addressed (flagged 1 times across 1 plans)
[DEBT] timeline-persistence: split polling can combine config and registry from different snapshots (flagged 1 times across 1 plans)
[DEBT] timeline-scaling: the plan only specifies a concrete fix for the default scale(1) case; explicit-scale tracks may still break blend-mode effects. (flagged 1 times across 1 plans)
[DEBT] travel-continuations: smooth continuations not threaded — agent tasks won't have continuation_config even when shot settings enable it (flagged 1 times across 1 plans)
[DEBT] travel-continuations: continuation_config omitted from form parity (flagged 1 times across 1 plans)
[DEBT] travel-payload-cleanup-scope: plan scope narrower than original user request (flagged 1 times across 1 plans)
[DEBT] travel-payload-cleanup-scope: broader create-task contract problem left untouched (flagged 1 times across 1 plans)
[DEBT] travel-payload-readers: phase 4 app-side reader audit incomplete (flagged 1 times across 1 plans)
[DEBT] travel-payload-readers: phase 4 field inventory incomplete for app-side readers (flagged 1 times across 1 plans)
[DEBT] travel-request-contract: image_variant_ids is in frontend request contract (flagged 1 times across 1 plans)
[DEBT] travel-request-contract: image_variant_ids contract change (flagged 1 times across 1 plans)
[DEBT] variant-update-b-fresh-takeover: spawn_worker does not internally call start_worker_process; harness must call both explicitly (flagged 1 times across 1 plans)
[DEBT] variant-update-b-fresh-takeover: worker_id and runpod_id must be generated and threaded distinctly; plan currently uses pod_id as both (flagged 1 times across 1 plans)
[DEBT] variant-update-b-fresh-takeover: duplicate of correctness-1 — spawn_worker two-step misstatement (flagged 2 times across 1 plans)
[DEBT] variant-update-b-fresh-takeover: duplicate of correctness-2 — worker_id/runpod_id propagation across takeover and restore paths (flagged 1 times across 1 plans)
[DEBT] variant-update-b-fresh-takeover: duplicate of correctness-1 + correctness-2 — missing create_worker_record glue and start_worker_process integration (flagged 1 times across 1 plans)
[DEBT] variant-update-b-fresh-takeover: duplicate of correctness-2 — caller contract for spawn_worker requires worker_id, not pod_id (flagged 1 times across 1 plans)
[DEBT] verification: no end-to-end render test for audio analysis timing (flagged 1 times across 1 plans)
[DEBT] verification: no automated coverage for text clips or overlapping clips with audio effects (flagged 1 times across 1 plans)
[DEBT] verification-coverage: no automated test exercises the full segment-slot opening path after cleanup. (flagged 1 times across 1 plans)
[DEBT] verification-coverage: no automated coverage that clicking a pair opens the correct modal after cleanup. (flagged 1 times across 1 plans)
[DEBT] verification-coverage: zero behavioral change criterion is not verifiable from tsc + existing tests alone. (flagged 1 times across 1 plans)
[DEBT] verification-workflow: tsconfig.app.json excludes test files, so tsc won't catch test breakage. (flagged 1 times across 1 plans)
[DEBT] worker-test-staleness: worker test in test_additional_coverage_modules.py:37 may assert stale payload structure (task_type vs family). (flagged 1 times across 1 plans)
code
Note: User chose auto-approve mode. This execution was not manually reviewed at the gate. Exercise extra caution on destructive operations.
Robustness level: light.
Requirements:
- Execute only the actionable tasks in this batch.
- Treat completed tasks as dependency context, not new work.
- Return structured JSON only.
- Only produce `task_updates` for these tasks: [T2, T3]
- Only produce `sense_check_acknowledgments` for these sense checks: [SC2, SC3]
- Do not include updates for tasks or sense checks outside this batch.
- Keep `executor_notes` verification-focused.
- Best-effort progress checkpointing: if `/Users/user_c042661f/Documents/reigh-workspace/.megaplan/plans/add-rollback-for-optimistic-20260413-0218/execution_batch_2.json` is writable, checkpoint task and sense-check updates there (not `finalize.json`). The harness owns `finalize.json`.
- When verifying changes, run the entire test file or module, not individual test functions. Individual tests miss regressions.
- finalize.json includes baseline_test_failures — a list of test IDs that were already failing before your changes. If a test fails and its ID appears in baseline_test_failures, it is pre-existing — do not scope-creep into fixing it. If baseline_test_failures is null, the baseline could not be captured; use your judgment but err on the side of assuming failures are regressions. You MUST still re-run the FULL test suite with your changes applied — pre-existing failures do not excuse skipping verification. Never narrow to individual test functions and stop.
- If this batch includes the final verification task, write a short script that reproduces the exact bug described in the task, run it to confirm the fix resolves it, then delete the script.
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: the plan's claim that worker_state.py:200-204 (the 30-minute startup safety net) catches abandoned pods that exited before patching is slightly imprecise. line 200-204 only runs when in_startup_phase is true, which requires startup_phase to be in ('deps_installing', 'deps_verified', 'worker_starting') per line 161. a pod that exits before its first patch has startup_phase = none, so in_startup_phase is false and the code falls through to the normal timeout checks (active_stale / not_claiming) at line 207+, not the 30-minute startup cap. both paths eventually reap the worker, so the end result is the same, but the overview's reasoning (naming 200-204 specifically) is wrong. worth correcting so future readers don't mis-reason about the invariant. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: checked worker_state.py line 161 (in_startup_phase = startup_phase in (...)) against the plan's assumption that subsequent lenient writes are safe. if deps_installing succeeds but deps_verified silently fails, startup_phase stays at 'deps_installing' and the 30-minute cap from line 200-204 applies — even though the pod is actually progressing through uv sync. on a slow runpod image with cold wheel downloads, uv sync --extra cuda124 plus wan2gp deps can take 20+ minutes. there's no concrete benchmark in the plan that says the 30-minute cap is safely above the expected sync time; if uv sync legitimately takes 25 minutes and the deps_verified patch fails on a transient network blip, the orchestrator will terminate a healthy pod. plan should either bump the cap or note that deps_verified swallowing is acceptable because the cap is generously above typical sync time. (flagged 1 times across 1 plans)
[DEBT] are-the-success-criteria-well-prioritized-and-verifiable: are the success criteria well-prioritized and verifiable?: the attached success criteria are stale and do not match the current plan body. they still require 'no usestate for activepairdata', 'setactivepairdata fully removed', 'sync effect deleted', and 'onpairclick simplified to (pairindex: number) => void', which are the opposite of the current targeted-sync plan. as presented, the criteria are not usable for review or execution. (flagged 1 times across 1 plans)
[DEBT] audio-loading: getaudiodata in useeffect removes render-readiness signal (flagged 1 times across 1 plans)
[DEBT] audio-loading: same as correctness-3 — preview/render parity risk (flagged 1 times across 1 plans)
[DEBT] audio-loading: preview/render parity partially satisfied (flagged 1 times across 1 plans)
[DEBT] audio-reactivity: overlapping clips use first-found, volume not scaled (flagged 1 times across 1 plans)
[DEBT] audio-reactivity: same as audio-reactivity-1 — overlapping/volume-adjusted clips diverge from audible mix (flagged 1 times across 1 plans)
[DEBT] audio-reactivity: textclip missing globalframeprovider (flagged 1 times across 1 plans)
[DEBT] audio-reactivity: same as audio-reactivity-2 — textclipsequence missing provider (flagged 1 times across 1 plans)
[DEBT] audio-reactivity: textclip effects surface not covered (flagged 1 times across 1 plans)
[DEBT] audio-reactivity: continuous effects shared by visual and text clips (flagged 1 times across 1 plans)
[DEBT] batch-generation-pipeline: enhancement in usegeneratebatch before generatevideo() could compute prompts against a stale pair snapshot if mutations are still in flight. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-cascade-paths: cascade lookup only reads params->>'orchestrator_task_id_ref', missing shared reference paths and orchestrator-self detection. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-cascade-paths: duplicate of correctness-2 + correctness-3: invalid sql syntax and narrow cascade lookup. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-cascade-paths: shared orchestrator-reference helpers not referenced. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-cascade-paths: orchestrator tasks that crash don't get orchestrator-self cascade. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-cascade-paths: hardcoded params->>'orchestrator_task_id_ref' misses other reference paths. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-retry: crash requeue sql does not increment attempts, risking infinite requeue loop. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-retry: duplicate of correctness-1: attempts never advance on crash requeue. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-retry: missing attempts increment location in heartbeat sql. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-retry: step 6 under-scoped for real retry convergence and orchestrator-self handling. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-sql-syntax: bare select inside plpgsql is invalid — needs perform. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-testing: no multi-crash convergence test exercising attempts 0→1→2→3. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-testing: no validation that plpgsql body executes successfully. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-testing: criteria don't require proof of crash requeue convergence. (flagged 1 times across 1 plans)
[DEBT] criteria-verifiability: 'no unsafe .maybesingle()' criterion requires judgment about column uniqueness. (flagged 1 times across 1 plans)
[DEBT] criteria-verifiability: decision documentation location not specified. (flagged 1 times across 1 plans)
[DEBT] criteria-verifiability: the must criterion requiring 5 task types to exist as active db rows is not verifiable from code diff alone — it requires a live db query. (flagged 1 times across 1 plans)
[DEBT] db-fallback-testing: no new automated test for the db fallback dispatch path or dependant_on preservation for raw worker families. (flagged 1 times across 1 plans)
[DEBT] dependency-resolution: dependency resolution: the plan does not lock down the active python-version matrix even though the repo currently splits between python 3.10 local installs and a python 3.11 runpod image. (flagged 1 times across 1 plans)
[DEBT] did-the-work-fully-address-the-issue-hints-user-notes-and-approved-plan-requirements: did the work fully address the issue hints, user notes, and approved plan requirements?: the package is internally inconsistent. the plan body says to keep activepairdata in usestate and make phase 2 optional, but the attached metadata and success criteria still describe the previous derive-via-usememo / remove-setactivepairdata / simplify-onpairclick plan. that means the approved-plan requirements are only partially coherent as presented. (flagged 1 times across 1 plans)
[DEBT] did-the-work-fully-address-the-issue-hints-user-notes-and-approved-plan-requirements: did the work fully address the issue hints, user notes, and approved plan requirements?: the linux distro note is documentation-only; the generated install command in step 7 still runs apt-get install python3.10-venv python3.10-dev ffmpeg without any pre-check that the package exists. users on ubuntu 24.04+ who ignore the doc and try to copy-paste the command will hit a confusing e: unable to locate package python3.10-venv from apt rather than a targeted error from commandutils.ts. a one-line detection pre-check (e.g., apt-cache show python3.10-venv >/dev/null 2>&1 || { echo 'install deadsnakes ppa first — see readme'; exit 1; }) would convert the silent failure into an actionable error, but the plan does not add this. (flagged 1 times across 1 plans)
[DEBT] does-the-change-touch-all-locations-and-supporting-infrastructure: does the change touch all locations and supporting infrastructure?: phase 1 still misses a real supporting-data location: trailingpairdata lives outside pairdatabyindex in /users/user_c042661f/documents/reigh-workspace/reigh-app/src/tools/travel-between-images/components/shotimageseditor/hooks/usesegmentslotpresentationadapter.ts, but the proposed sync logic only considers pairdatabyindex. if trailing slot regenerate is part of the bug surface, that location is not covered. (flagged 1 times across 1 plans)
[DEBT] does-the-change-touch-all-locations-and-supporting-infrastructure: does the change touch all locations and supporting infrastructure?: the non-swallowing helper update_worker_phase_strict is a new shell function, but phase 1 step 2 introduces it only as pseudo-code. there is no concrete note that the helper must handle supabase http non-2xx responses as failures (curl returns 0 even on http 4xx/5xx by default unless -f or --fail-with-body is used). if the implementer ports update_worker_phase verbatim with only || return 0 removed, a 500 from supabase would still report success because curl's exit code is 0. the plan should specify curl --fail or explicit http status code checking in the strict variant. (flagged 1 times across 1 plans)
[DEBT] edge-test-config: plan's vitest commands use the wrong config entry point. (flagged 1 times across 1 plans)
[DEBT] edge-test-config: same as verification-3: wrong vitest config in validation commands. (flagged 1 times across 1 plans)
[DEBT] edge-test-config: success criterion references wrong test command. (flagged 1 times across 1 plans)
[DEBT] error-handling: db loader error handling convention mismatch (plan says log+null, existing loaders throw) (flagged 1 times across 1 plans)
[DEBT] error-propagation-logging: generation.ts and handler.ts logging endpoints are not directly tested. (flagged 1 times across 1 plans)
[DEBT] error-propagation-testing: no end-to-end regression test for the full symptom chain (db error → tocompletionerror metadata → handler log). (flagged 1 times across 1 plans)
[DEBT] error-propagation-testing: handler.ts metadata surfacing criterion lacks a concrete automated verifier. (flagged 1 times across 1 plans)
[DEBT] error-propagation-testing: main issue only partially validated without an integration test. (flagged 1 times across 1 plans)
[DEBT] find-the-callers-of-the-changed-function-what-arguments-do-they-actually-pass-does-the-fix-handle-all-of-them: find the callers of the changed function. what arguments do they actually pass? does the fix handle all of them?: the step 2 retry loop uses a naked sleep 2 between attempts, which adds up to 6 seconds of latency on the happy path when the first patch eventually succeeds on attempt 2 or 3. for pods where supabase is reachable but slow during the initial moments of a cold runpod start, the retry logic is fine. however, if the first attempt fails with a tls handshake delay and the retry loop sleeps 2s per attempt regardless of whether curl itself has been blocking for tens of seconds, the total startup latency penalty could be substantial. this is a minor tuning concern, not a correctness issue. (flagged 1 times across 1 plans)
[DEBT] gpu-branching-test-matrix: linux cuda128 path under-verified (flagged 1 times across 1 plans)
[DEBT] gpu-branching-ui-surface: nvidia-50 option is exposed on linux in the ui but linux cuda128 smoke test is missing (flagged 1 times across 1 plans)
[DEBT] hook-abstraction: usepairsettingshandler becomes trivial with single caller — keeping it is extra indirection. (flagged 1 times across 1 plans)
[DEBT] is-the-change-in-the-right-place-and-would-it-break-any-callers: is the change in the right place, and would it break any callers?: the optional cleanup steps are not in the right place yet. pairregionslayer does not receive pairdatabyindex today; its props are only images, imagepositionswithpending, pairinfowithpending, and callback/display props in /users/user_c042661f/documents/reigh-workspace/reigh-app/src/tools/travel-between-images/components/timeline/timelinecontainer/components/pairregionslayer.tsx. so step 4's 'pass pairdatabyindex.get(pairindex) directly' would require new prop plumbing or a different seam. (flagged 1 times across 1 plans)
[DEBT] is-the-scope-and-scale-of-the-change-appropriate: is the scope and scale of the change appropriate?: phase 2 is still under-specified for execution. step 4 says pairregionslayer should either pass pairdatabyindex.get(pairindex) directly or 'just pass the index + frame-only data', which are materially different designs. if phase 2 is kept in the plan, it needs a single concrete direction. (flagged 1 times across 1 plans)
[DEBT] is-there-convincing-verification-for-the-change: is there convincing verification for the change?: the plan still lacks an explicit automated regression test for the reported bug. step 2 is manual ('check that usevideoregeneratemode now gets the fresh url'), but there is no concrete test that opens a segment slot, changes the primary variant data, and asserts that the regenerate path sees the fresh url, generationid, and primaryvariantid. (flagged 1 times across 1 plans)
[DEBT] is-there-convincing-verification-for-the-change: is there convincing verification for the change?: the current usesegmentslotmode test remains only a smoke test in /users/user_c042661f/documents/reigh-workspace/reigh-app/src/tools/travel-between-images/components/shotimageseditor/hooks/tests/usesegmentslotmode.test.ts, and the plan does not add behavior coverage for the new sync effect. (flagged 1 times across 1 plans)
[DEBT] is-there-convincing-verification-for-the-change: is there convincing verification for the change?: no verification step covers the trailing-slot branch, even though the proposed phase 1 logic currently misses trailingpairdata refreshes. (flagged 1 times across 1 plans)
[DEBT] legacy-data-backfill: the step 8 diagnostic query only detects cross-shot pair_shot_generation_id misassociations, not same-shot misassociations caused by timeline reordering within a shot. (flagged 1 times across 1 plans)
[DEBT] lookup-consistency: other repo call sites use unordered .limit(1).maybesingle() and will remain inconsistent. (flagged 1 times across 1 plans)
[DEBT] lookup-consistency: other call sites with same unsafe pattern not covered. (flagged 1 times across 1 plans)
[DEBT] lora-management: lora tools simplified vs full ui parity (multi-stage metadata, private loras) (flagged 1 times across 1 plans)
[DEBT] media-lightbox-persistence: variant switches do not clear/restore inpaintprompt, so stale prompt state can leak across variants with no cached prompt. (flagged 1 times across 1 plans)
[DEBT] media-lightbox-persistence: removing prompt/numgenerations from the variant-keyed localstorage cache means all variants within a generation share the same prompt. this broadens existing debt-002 (variant prompt leakage). (flagged 1 times across 1 plans)
[DEBT] media-lightbox-segment-slot: media lightbox / segment slot: the targeted sync rationale does not fully explain the reported stale-url bug for regular pairs, and the proposed effect still misses trailing-slot refreshes because those can come from trailingpairdata rather than pairdatabyindex. (flagged 1 times across 1 plans)
[DEBT] number-input-nullable: plan doesn't explicitly state onchange must also accept null, though step 3 depends on it. (flagged 1 times across 1 plans)
[DEBT] number-input-nullable: disputed v1 flag — original concern about bulkclippanel being unimplementable. (flagged 1 times across 1 plans)
[DEBT] number-input-nullable: onchange null filtering not explicitly addressed in plan. (flagged 1 times across 1 plans)
[DEBT] number-input-testing: no planned tests for numberinput shared component or bulkclippanel nullable draft flow. (flagged 1 times across 1 plans)
[DEBT] orchestrator-completion-rollout: pre-existing individual_travel_segment children won't drive orchestrator completion through segment_type_config after deploy. (flagged 1 times across 1 plans)
[DEBT] orchestrator-completion-rollout: missing compatibility seam in orchestratorcore.ts:123-126 for old individual_travel_segment rows. (flagged 1 times across 1 plans)
[DEBT] orchestrator-completion-rollout: mixed old/new data during rollout can leave old orchestrators without completion counting. (flagged 1 times across 1 plans)
[DEBT] orchestrator-completion-rollout: no test or deployment guard for pre-existing individual_travel_segment children completing after worker change. (flagged 1 times across 1 plans)
[DEBT] orchestrator-completion-rollout: plan overstates backward compatibility for existing data. (flagged 1 times across 1 plans)
[DEBT] orchestrator-completion-rollout: missing rollout compatibility step for in-flight individual_travel_segment tasks. (flagged 1 times across 1 plans)
[DEBT] orchestrator-completion-rollout: pre-deploy individual_travel_segment child completing post-rollout won't be treated as segment task by checkorchestratorcompletion. (flagged 1 times across 1 plans)
[DEBT] orchestrator-completion-rollout: orchestrator.test.ts criterion too narrow to verify old individual_travel_segment compatibility. (flagged 1 times across 1 plans)
[DEBT] pair-settings-plumbing: handleopenpairsettings(pairindex, pairframedata) path in timelinetrackprelude, segmentoutputstrip, and usesegmentoutputstrip not explicitly named. (flagged 1 times across 1 plans)
[DEBT] pair-settings-plumbing: same as flag-002 — segmentoutputstrip and usesegmentoutputstrip still carry pairframedata. (flagged 1 times across 1 plans)
[DEBT] pair-settings-plumbing: timelinetrackprelude and segmentoutputstrip still forward (pairindex, pairframedata). (flagged 1 times across 1 plans)
[DEBT] plan-scope: step 3 is larger than a light megaplan warrants. (flagged 1 times across 1 plans)
[DEBT] planning-metadata: planning metadata: the attached metadata and success criteria still describe a different implementation than the current plan body, which risks sending execution and review down the wrong path. (flagged 1 times across 1 plans)
[DEBT] planning-metadata: success criteria don't cover wave 4 scope (flagged 1 times across 1 plans)
[DEBT] position-key-semantics: plan investigates a unique constraint on (parent_generation_id, child_order) which doesn't match repo semantics for position keys. (flagged 1 times across 1 plans)
[DEBT] position-key-semantics: plan weights toward child_order rather than pair_shot_generation_id as the key that matters. (flagged 1 times across 1 plans)
[DEBT] position-key-semantics: unique constraint on (parent_generation_id, child_order) not supported by repo semantics. (flagged 1 times across 1 plans)
[DEBT] prompt-composition: the plan's step 1 signature includes textbeforeprompts/textafterprompts parameters that would be applied before enhancement, double-wrapping the prompt. (flagged 1 times across 1 plans)
[DEBT] settings-defaults: workerrepopath default can go stale if user switches computertype before editing path (flagged 1 times across 1 plans)
[DEBT] settings-resolution: settings cascade missing — shot-only read diverges from form's defaults→user→project→shot merge (flagged 1 times across 1 plans)
[DEBT] settings-resolution: settings cascade missing — shot-only read (flagged 1 times across 1 plans)
[DEBT] shared-component-compatibility: numberinput changes affect callers outside video-editor (billing, travel-between-images, phaseconfigselectormodal). (flagged 1 times across 1 plans)
[DEBT] shared-component-compatibility: shared ui component blast radius not audited in plan. (flagged 1 times across 1 plans)
[DEBT] shot-linking-testing: no test covers the linkgenerationtoshot error/catch branches. (flagged 1 times across 1 plans)
[DEBT] signature-propagation: plan doesn't explicitly name timeline/index.tsx and segmentslotcontracts.ts for updates. (flagged 1 times across 1 plans)
[DEBT] signature-propagation: same as flag-001 — timeline/index.tsx and segmentslotcontracts.ts not in checklist. (flagged 1 times across 1 plans)
[DEBT] signature-propagation: five supporting contract/plumbing sites not named in the checklist. (flagged 1 times across 1 plans)
[DEBT] task-types-verification: step 3 cites wrong migration file (task_cost_configs instead of task_types) as evidence for db fallback path. (flagged 1 times across 1 plans)
[DEBT] task-types-verification: step 3 should cite task_types source, not task_cost_configs. (flagged 1 times across 1 plans)
[DEBT] task-types-verification: plan doesn't verify travel_segment and travel_stitch exist as active task_types rows using the correct table. (flagged 1 times across 1 plans)
[DEBT] test-coverage: current generation-child.test.ts is only a smoke test. (flagged 1 times across 1 plans)
[DEBT] test-coverage: no plan to verify other lookup paths choose rows consistently. (flagged 1 times across 1 plans)
[DEBT] test-coverage: no new tests for db loader or travel param merge path (flagged 1 times across 1 plans)
[DEBT] test-coverage: must-level criteria depend on manual testing rather than automated assertions (flagged 1 times across 1 plans)
[DEBT] test-coverage: no new unit tests for wave 4 tools (flagged 1 times across 1 plans)
[DEBT] test-coverage: must criteria backed by manual testing only (flagged 1 times across 1 plans)
[DEBT] test-infrastructure: no test fixtures for resources table (flagged 1 times across 1 plans)
[DEBT] timeline-drag-coordination: plan keeps two hooks instead of a single coordinator (flagged 1 times across 1 plans)
[DEBT] timeline-drag-coordination: brief says single coordinator but plan keeps separate hooks (flagged 2 times across 1 plans)
[DEBT] timeline-drag-coordination: pendingopsref retained despite brief suggesting removal (flagged 1 times across 1 plans)
[DEBT] timeline-drag-coordination: wrapper-bound listener mount wiring under-specified (flagged 1 times across 1 plans)
[DEBT] timeline-persistence: read path still assembles config and registry from separate requests (flagged 1 times across 1 plans)
[DEBT] timeline-persistence: poll sync verification not structurally changed (flagged 1 times across 1 plans)
[DEBT] timeline-persistence: backend save helpers not wired to new rpc (flagged 1 times across 1 plans)
[DEBT] timeline-persistence: read infrastructure not updated (flagged 1 times across 1 plans)
[DEBT] timeline-persistence: backend tests not in validation list (flagged 1 times across 1 plans)
[DEBT] timeline-persistence: backend callers not migrated (flagged 1 times across 1 plans)
[DEBT] timeline-persistence: broader persistence-contract problem (flagged 1 times across 1 plans)
[DEBT] timeline-persistence: backend split-save not addressed (flagged 1 times across 1 plans)
[DEBT] timeline-persistence: split polling can combine config and registry from different snapshots (flagged 1 times across 1 plans)
[DEBT] timeline-scaling: the plan only specifies a concrete fix for the default scale(1) case; explicit-scale tracks may still break blend-mode effects. (flagged 1 times across 1 plans)
[DEBT] travel-continuations: smooth continuations not threaded — agent tasks won't have continuation_config even when shot settings enable it (flagged 1 times across 1 plans)
[DEBT] travel-continuations: continuation_config omitted from form parity (flagged 1 times across 1 plans)
[DEBT] travel-payload-cleanup-scope: plan scope narrower than original user request (flagged 1 times across 1 plans)
[DEBT] travel-payload-cleanup-scope: broader create-task contract problem left untouched (flagged 1 times across 1 plans)
[DEBT] travel-payload-readers: phase 4 app-side reader audit incomplete (flagged 1 times across 1 plans)
[DEBT] travel-payload-readers: phase 4 field inventory incomplete for app-side readers (flagged 1 times across 1 plans)
[DEBT] travel-request-contract: image_variant_ids is in frontend request contract (flagged 1 times across 1 plans)
[DEBT] travel-request-contract: image_variant_ids contract change (flagged 1 times across 1 plans)
[DEBT] variant-update-b-fresh-takeover: spawn_worker does not internally call start_worker_process; harness must call both explicitly (flagged 1 times across 1 plans)
[DEBT] variant-update-b-fresh-takeover: worker_id and runpod_id must be generated and threaded distinctly; plan currently uses pod_id as both (flagged 1 times across 1 plans)
[DEBT] variant-update-b-fresh-takeover: duplicate of correctness-1 — spawn_worker two-step misstatement (flagged 2 times across 1 plans)
[DEBT] variant-update-b-fresh-takeover: duplicate of correctness-2 — worker_id/runpod_id propagation across takeover and restore paths (flagged 1 times across 1 plans)
[DEBT] variant-update-b-fresh-takeover: duplicate of correctness-1 + correctness-2 — missing create_worker_record glue and start_worker_process integration (flagged 1 times across 1 plans)
[DEBT] variant-update-b-fresh-takeover: duplicate of correctness-2 — caller contract for spawn_worker requires worker_id, not pod_id (flagged 1 times across 1 plans)
[DEBT] verification: no end-to-end render test for audio analysis timing (flagged 1 times across 1 plans)
[DEBT] verification: no automated coverage for text clips or overlapping clips with audio effects (flagged 1 times across 1 plans)
[DEBT] verification-coverage: no automated test exercises the full segment-slot opening path after cleanup. (flagged 1 times across 1 plans)
[DEBT] verification-coverage: no automated coverage that clicking a pair opens the correct modal after cleanup. (flagged 1 times across 1 plans)
[DEBT] verification-coverage: zero behavioral change criterion is not verifiable from tsc + existing tests alone. (flagged 1 times across 1 plans)
[DEBT] verification-workflow: tsconfig.app.json excludes test files, so tsc won't catch test breakage. (flagged 1 times across 1 plans)
[DEBT] worker-test-staleness: worker test in test_additional_coverage_modules.py:37 may assert stale payload structure (task_type vs family). (flagged 1 times across 1 plans)
code
Note: User chose auto-approve mode. This execution was not manually reviewed at the gate. Exercise extra caution on destructive operations.
Robustness level: light.
Requirements:
- Execute only the actionable tasks in this batch.
- Treat completed tasks as dependency context, not new work.
- Return structured JSON only.
- Only produce `task_updates` for these tasks: [T4, T5]
- Only produce `sense_check_acknowledgments` for these sense checks: [SC4, SC5]
- Do not include updates for tasks or sense checks outside this batch.
- Keep `executor_notes` verification-focused.
- Best-effort progress checkpointing: if `/Users/user_c042661f/Documents/reigh-workspace/.megaplan/plans/add-rollback-for-optimistic-20260413-0218/execution_batch_3.json` is writable, checkpoint task and sense-check updates there (not `finalize.json`). The harness owns `finalize.json`.
- When verifying changes, run the entire test file or module, not individual test functions. Individual tests miss regressions.
- finalize.json includes baseline_test_failures — a list of test IDs that were already failing before your changes. If a test fails and its ID appears in baseline_test_failures, it is pre-existing — do not scope-creep into fixing it. If baseline_test_failures is null, the baseline could not be captured; use your judgment but err on the side of assuming failures are regressions. You MUST still re-run the FULL test suite with your changes applied — pre-existing failures do not excuse skipping verification. Never narrow to individual test functions and stop.
- If this batch includes the final verification task, write a short script that reproduces the exact bug described in the task, run it to confirm the fix resolves it, then delete the script.
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: the plan's claim that worker_state.py:200-204 (the 30-minute startup safety net) catches abandoned pods that exited before patching is slightly imprecise. line 200-204 only runs when in_startup_phase is true, which requires startup_phase to be in ('deps_installing', 'deps_verified', 'worker_starting') per line 161. a pod that exits before its first patch has startup_phase = none, so in_startup_phase is false and the code falls through to the normal timeout checks (active_stale / not_claiming) at line 207+, not the 30-minute startup cap. both paths eventually reap the worker, so the end result is the same, but the overview's reasoning (naming 200-204 specifically) is wrong. worth correcting so future readers don't mis-reason about the invariant. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: checked worker_state.py line 161 (in_startup_phase = startup_phase in (...)) against the plan's assumption that subsequent lenient writes are safe. if deps_installing succeeds but deps_verified silently fails, startup_phase stays at 'deps_installing' and the 30-minute cap from line 200-204 applies — even though the pod is actually progressing through uv sync. on a slow runpod image with cold wheel downloads, uv sync --extra cuda124 plus wan2gp deps can take 20+ minutes. there's no concrete benchmark in the plan that says the 30-minute cap is safely above the expected sync time; if uv sync legitimately takes 25 minutes and the deps_verified patch fails on a transient network blip, the orchestrator will terminate a healthy pod. plan should either bump the cap or note that deps_verified swallowing is acceptable because the cap is generously above typical sync time. (flagged 1 times across 1 plans)
[DEBT] are-the-success-criteria-well-prioritized-and-verifiable: are the success criteria well-prioritized and verifiable?: the attached success criteria are stale and do not match the current plan body. they still require 'no usestate for activepairdata', 'setactivepairdata fully removed', 'sync effect deleted', and 'onpairclick simplified to (pairindex: number) => void', which are the opposite of the current targeted-sync plan. as presented, the criteria are not usable for review or execution. (flagged 1 times across 1 plans)
[DEBT] audio-loading: getaudiodata in useeffect removes render-readiness signal (flagged 1 times across 1 plans)
[DEBT] audio-loading: same as correctness-3 — preview/render parity risk (flagged 1 times across 1 plans)
[DEBT] audio-loading: preview/render parity partially satisfied (flagged 1 times across 1 plans)
[DEBT] audio-reactivity: overlapping clips use first-found, volume not scaled (flagged 1 times across 1 plans)
[DEBT] audio-reactivity: same as audio-reactivity-1 — overlapping/volume-adjusted clips diverge from audible mix (flagged 1 times across 1 plans)
[DEBT] audio-reactivity: textclip missing globalframeprovider (flagged 1 times across 1 plans)
[DEBT] audio-reactivity: same as audio-reactivity-2 — textclipsequence missing provider (flagged 1 times across 1 plans)
[DEBT] audio-reactivity: textclip effects surface not covered (flagged 1 times across 1 plans)
[DEBT] audio-reactivity: continuous effects shared by visual and text clips (flagged 1 times across 1 plans)
[DEBT] batch-generation-pipeline: enhancement in usegeneratebatch before generatevideo() could compute prompts against a stale pair snapshot if mutations are still in flight. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-cascade-paths: cascade lookup only reads params->>'orchestrator_task_id_ref', missing shared reference paths and orchestrator-self detection. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-cascade-paths: duplicate of correctness-2 + correctness-3: invalid sql syntax and narrow cascade lookup. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-cascade-paths: shared orchestrator-reference helpers not referenced. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-cascade-paths: orchestrator tasks that crash don't get orchestrator-self cascade. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-cascade-paths: hardcoded params->>'orchestrator_task_id_ref' misses other reference paths. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-retry: crash requeue sql does not increment attempts, risking infinite requeue loop. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-retry: duplicate of correctness-1: attempts never advance on crash requeue. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-retry: missing attempts increment location in heartbeat sql. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-retry: step 6 under-scoped for real retry convergence and orchestrator-self handling. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-sql-syntax: bare select inside plpgsql is invalid — needs perform. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-testing: no multi-crash convergence test exercising attempts 0→1→2→3. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-testing: no validation that plpgsql body executes successfully. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-testing: criteria don't require proof of crash requeue convergence. (flagged 1 times across 1 plans)
[DEBT] criteria-verifiability: 'no unsafe .maybesingle()' criterion requires judgment about column uniqueness. (flagged 1 times across 1 plans)
[DEBT] criteria-verifiability: decision documentation location not specified. (flagged 1 times across 1 plans)
[DEBT] criteria-verifiability: the must criterion requiring 5 task types to exist as active db rows is not verifiable from code diff alone — it requires a live db query. (flagged 1 times across 1 plans)
[DEBT] db-fallback-testing: no new automated test for the db fallback dispatch path or dependant_on preservation for raw worker families. (flagged 1 times across 1 plans)
[DEBT] dependency-resolution: dependency resolution: the plan does not lock down the active python-version matrix even though the repo currently splits between python 3.10 local installs and a python 3.11 runpod image. (flagged 1 times across 1 plans)
[DEBT] did-the-work-fully-address-the-issue-hints-user-notes-and-approved-plan-requirements: did the work fully address the issue hints, user notes, and approved plan requirements?: the package is internally inconsistent. the plan body says to keep activepairdata in usestate and make phase 2 optional, but the attached metadata and success criteria still describe the previous derive-via-usememo / remove-setactivepairdata / simplify-onpairclick plan. that means the approved-plan requirements are only partially coherent as presented. (flagged 1 times across 1 plans)
[DEBT] did-the-work-fully-address-the-issue-hints-user-notes-and-approved-plan-requirements: did the work fully address the issue hints, user notes, and approved plan requirements?: the linux distro note is documentation-only; the generated install command in step 7 still runs apt-get install python3.10-venv python3.10-dev ffmpeg without any pre-check that the package exists. users on ubuntu 24.04+ who ignore the doc and try to copy-paste the command will hit a confusing e: unable to locate package python3.10-venv from apt rather than a targeted error from commandutils.ts. a one-line detection pre-check (e.g., apt-cache show python3.10-venv >/dev/null 2>&1 || { echo 'install deadsnakes ppa first — see readme'; exit 1; }) would convert the silent failure into an actionable error, but the plan does not add this. (flagged 1 times across 1 plans)
[DEBT] does-the-change-touch-all-locations-and-supporting-infrastructure: does the change touch all locations and supporting infrastructure?: phase 1 still misses a real supporting-data location: trailingpairdata lives outside pairdatabyindex in /users/user_c042661f/documents/reigh-workspace/reigh-app/src/tools/travel-between-images/components/shotimageseditor/hooks/usesegmentslotpresentationadapter.ts, but the proposed sync logic only considers pairdatabyindex. if trailing slot regenerate is part of the bug surface, that location is not covered. (flagged 1 times across 1 plans)
[DEBT] does-the-change-touch-all-locations-and-supporting-infrastructure: does the change touch all locations and supporting infrastructure?: the non-swallowing helper update_worker_phase_strict is a new shell function, but phase 1 step 2 introduces it only as pseudo-code. there is no concrete note that the helper must handle supabase http non-2xx responses as failures (curl returns 0 even on http 4xx/5xx by default unless -f or --fail-with-body is used). if the implementer ports update_worker_phase verbatim with only || return 0 removed, a 500 from supabase would still report success because curl's exit code is 0. the plan should specify curl --fail or explicit http status code checking in the strict variant. (flagged 1 times across 1 plans)
[DEBT] edge-test-config: plan's vitest commands use the wrong config entry point. (flagged 1 times across 1 plans)
[DEBT] edge-test-config: same as verification-3: wrong vitest config in validation commands. (flagged 1 times across 1 plans)
[DEBT] edge-test-config: success criterion references wrong test command. (flagged 1 times across 1 plans)
[DEBT] error-handling: db loader error handling convention mismatch (plan says log+null, existing loaders throw) (flagged 1 times across 1 plans)
[DEBT] error-propagation-logging: generation.ts and handler.ts logging endpoints are not directly tested. (flagged 1 times across 1 plans)
[DEBT] error-propagation-testing: no end-to-end regression test for the full symptom chain (db error → tocompletionerror metadata → handler log). (flagged 1 times across 1 plans)
[DEBT] error-propagation-testing: handler.ts metadata surfacing criterion lacks a concrete automated verifier. (flagged 1 times across 1 plans)
[DEBT] error-propagation-testing: main issue only partially validated without an integration test. (flagged 1 times across 1 plans)
[DEBT] find-the-callers-of-the-changed-function-what-arguments-do-they-actually-pass-does-the-fix-handle-all-of-them: find the callers of the changed function. what arguments do they actually pass? does the fix handle all of them?: the step 2 retry loop uses a naked sleep 2 between attempts, which adds up to 6 seconds of latency on the happy path when the first patch eventually succeeds on attempt 2 or 3. for pods where supabase is reachable but slow during the initial moments of a cold runpod start, the retry logic is fine. however, if the first attempt fails with a tls handshake delay and the retry loop sleeps 2s per attempt regardless of whether curl itself has been blocking for tens of seconds, the total startup latency penalty could be substantial. this is a minor tuning concern, not a correctness issue. (flagged 1 times across 1 plans)
[DEBT] gpu-branching-test-matrix: linux cuda128 path under-verified (flagged 1 times across 1 plans)
[DEBT] gpu-branching-ui-surface: nvidia-50 option is exposed on linux in the ui but linux cuda128 smoke test is missing (flagged 1 times across 1 plans)
[DEBT] hook-abstraction: usepairsettingshandler becomes trivial with single caller — keeping it is extra indirection. (flagged 1 times across 1 plans)
[DEBT] is-the-change-in-the-right-place-and-would-it-break-any-callers: is the change in the right place, and would it break any callers?: the optional cleanup steps are not in the right place yet. pairregionslayer does not receive pairdatabyindex today; its props are only images, imagepositionswithpending, pairinfowithpending, and callback/display props in /users/user_c042661f/documents/reigh-workspace/reigh-app/src/tools/travel-between-images/components/timeline/timelinecontainer/components/pairregionslayer.tsx. so step 4's 'pass pairdatabyindex.get(pairindex) directly' would require new prop plumbing or a different seam. (flagged 1 times across 1 plans)
[DEBT] is-the-scope-and-scale-of-the-change-appropriate: is the scope and scale of the change appropriate?: phase 2 is still under-specified for execution. step 4 says pairregionslayer should either pass pairdatabyindex.get(pairindex) directly or 'just pass the index + frame-only data', which are materially different designs. if phase 2 is kept in the plan, it needs a single concrete direction. (flagged 1 times across 1 plans)
[DEBT] is-there-convincing-verification-for-the-change: is there convincing verification for the change?: the plan still lacks an explicit automated regression test for the reported bug. step 2 is manual ('check that usevideoregeneratemode now gets the fresh url'), but there is no concrete test that opens a segment slot, changes the primary variant data, and asserts that the regenerate path sees the fresh url, generationid, and primaryvariantid. (flagged 1 times across 1 plans)
[DEBT] is-there-convincing-verification-for-the-change: is there convincing verification for the change?: the current usesegmentslotmode test remains only a smoke test in /users/user_c042661f/documents/reigh-workspace/reigh-app/src/tools/travel-between-images/components/shotimageseditor/hooks/tests/usesegmentslotmode.test.ts, and the plan does not add behavior coverage for the new sync effect. (flagged 1 times across 1 plans)
[DEBT] is-there-convincing-verification-for-the-change: is there convincing verification for the change?: no verification step covers the trailing-slot branch, even though the proposed phase 1 logic currently misses trailingpairdata refreshes. (flagged 1 times across 1 plans)
[DEBT] legacy-data-backfill: the step 8 diagnostic query only detects cross-shot pair_shot_generation_id misassociations, not same-shot misassociations caused by timeline reordering within a shot. (flagged 1 times across 1 plans)
[DEBT] lookup-consistency: other repo call sites use unordered .limit(1).maybesingle() and will remain inconsistent. (flagged 1 times across 1 plans)
[DEBT] lookup-consistency: other call sites with same unsafe pattern not covered. (flagged 1 times across 1 plans)
[DEBT] lora-management: lora tools simplified vs full ui parity (multi-stage metadata, private loras) (flagged 1 times across 1 plans)
[DEBT] media-lightbox-persistence: variant switches do not clear/restore inpaintprompt, so stale prompt state can leak across variants with no cached prompt. (flagged 1 times across 1 plans)
[DEBT] media-lightbox-persistence: removing prompt/numgenerations from the variant-keyed localstorage cache means all variants within a generation share the same prompt. this broadens existing debt-002 (variant prompt leakage). (flagged 1 times across 1 plans)
[DEBT] media-lightbox-segment-slot: media lightbox / segment slot: the targeted sync rationale does not fully explain the reported stale-url bug for regular pairs, and the proposed effect still misses trailing-slot refreshes because those can come from trailingpairdata rather than pairdatabyindex. (flagged 1 times across 1 plans)
[DEBT] number-input-nullable: plan doesn't explicitly state onchange must also accept null, though step 3 depends on it. (flagged 1 times across 1 plans)
[DEBT] number-input-nullable: disputed v1 flag — original concern about bulkclippanel being unimplementable. (flagged 1 times across 1 plans)
[DEBT] number-input-nullable: onchange null filtering not explicitly addressed in plan. (flagged 1 times across 1 plans)
[DEBT] number-input-testing: no planned tests for numberinput shared component or bulkclippanel nullable draft flow. (flagged 1 times across 1 plans)
[DEBT] orchestrator-completion-rollout: pre-existing individual_travel_segment children won't drive orchestrator completion through segment_type_config after deploy. (flagged 1 times across 1 plans)
[DEBT] orchestrator-completion-rollout: missing compatibility seam in orchestratorcore.ts:123-126 for old individual_travel_segment rows. (flagged 1 times across 1 plans)
[DEBT] orchestrator-completion-rollout: mixed old/new data during rollout can leave old orchestrators without completion counting. (flagged 1 times across 1 plans)
[DEBT] orchestrator-completion-rollout: no test or deployment guard for pre-existing individual_travel_segment children completing after worker change. (flagged 1 times across 1 plans)
[DEBT] orchestrator-completion-rollout: plan overstates backward compatibility for existing data. (flagged 1 times across 1 plans)
[DEBT] orchestrator-completion-rollout: missing rollout compatibility step for in-flight individual_travel_segment tasks. (flagged 1 times across 1 plans)
[DEBT] orchestrator-completion-rollout: pre-deploy individual_travel_segment child completing post-rollout won't be treated as segment task by checkorchestratorcompletion. (flagged 1 times across 1 plans)
[DEBT] orchestrator-completion-rollout: orchestrator.test.ts criterion too narrow to verify old individual_travel_segment compatibility. (flagged 1 times across 1 plans)
[DEBT] pair-settings-plumbing: handleopenpairsettings(pairindex, pairframedata) path in timelinetrackprelude, segmentoutputstrip, and usesegmentoutputstrip not explicitly named. (flagged 1 times across 1 plans)
[DEBT] pair-settings-plumbing: same as flag-002 — segmentoutputstrip and usesegmentoutputstrip still carry pairframedata. (flagged 1 times across 1 plans)
[DEBT] pair-settings-plumbing: timelinetrackprelude and segmentoutputstrip still forward (pairindex, pairframedata). (flagged 1 times across 1 plans)
[DEBT] plan-scope: step 3 is larger than a light megaplan warrants. (flagged 1 times across 1 plans)
[DEBT] planning-metadata: planning metadata: the attached metadata and success criteria still describe a different implementation than the current plan body, which risks sending execution and review down the wrong path. (flagged 1 times across 1 plans)
[DEBT] planning-metadata: success criteria don't cover wave 4 scope (flagged 1 times across 1 plans)
[DEBT] position-key-semantics: plan investigates a unique constraint on (parent_generation_id, child_order) which doesn't match repo semantics for position keys. (flagged 1 times across 1 plans)
[DEBT] position-key-semantics: plan weights toward child_order rather than pair_shot_generation_id as the key that matters. (flagged 1 times across 1 plans)
[DEBT] position-key-semantics: unique constraint on (parent_generation_id, child_order) not supported by repo semantics. (flagged 1 times across 1 plans)
[DEBT] prompt-composition: the plan's step 1 signature includes textbeforeprompts/textafterprompts parameters that would be applied before enhancement, double-wrapping the prompt. (flagged 1 times across 1 plans)
[DEBT] settings-defaults: workerrepopath default can go stale if user switches computertype before editing path (flagged 1 times across 1 plans)
[DEBT] settings-resolution: settings cascade missing — shot-only read diverges from form's defaults→user→project→shot merge (flagged 1 times across 1 plans)
[DEBT] settings-resolution: settings cascade missing — shot-only read (flagged 1 times across 1 plans)
[DEBT] shared-component-compatibility: numberinput changes affect callers outside video-editor (billing, travel-between-images, phaseconfigselectormodal). (flagged 1 times across 1 plans)
[DEBT] shared-component-compatibility: shared ui component blast radius not audited in plan. (flagged 1 times across 1 plans)
[DEBT] shot-linking-testing: no test covers the linkgenerationtoshot error/catch branches. (flagged 1 times across 1 plans)
[DEBT] signature-propagation: plan doesn't explicitly name timeline/index.tsx and segmentslotcontracts.ts for updates. (flagged 1 times across 1 plans)
[DEBT] signature-propagation: same as flag-001 — timeline/index.tsx and segmentslotcontracts.ts not in checklist. (flagged 1 times across 1 plans)
[DEBT] signature-propagation: five supporting contract/plumbing sites not named in the checklist. (flagged 1 times across 1 plans)
[DEBT] task-types-verification: step 3 cites wrong migration file (task_cost_configs instead of task_types) as evidence for db fallback path. (flagged 1 times across 1 plans)
[DEBT] task-types-verification: step 3 should cite task_types source, not task_cost_configs. (flagged 1 times across 1 plans)
[DEBT] task-types-verification: plan doesn't verify travel_segment and travel_stitch exist as active task_types rows using the correct table. (flagged 1 times across 1 plans)
[DEBT] test-coverage: current generation-child.test.ts is only a smoke test. (flagged 1 times across 1 plans)
[DEBT] test-coverage: no plan to verify other lookup paths choose rows consistently. (flagged 1 times across 1 plans)
[DEBT] test-coverage: no new tests for db loader or travel param merge path (flagged 1 times across 1 plans)
[DEBT] test-coverage: must-level criteria depend on manual testing rather than automated assertions (flagged 1 times across 1 plans)
[DEBT] test-coverage: no new unit tests for wave 4 tools (flagged 1 times across 1 plans)
[DEBT] test-coverage: must criteria backed by manual testing only (flagged 1 times across 1 plans)
[DEBT] test-infrastructure: no test fixtures for resources table (flagged 1 times across 1 plans)
[DEBT] timeline-drag-coordination: plan keeps two hooks instead of a single coordinator (flagged 1 times across 1 plans)
[DEBT] timeline-drag-coordination: brief says single coordinator but plan keeps separate hooks (flagged 2 times across 1 plans)
[DEBT] timeline-drag-coordination: pendingopsref retained despite brief suggesting removal (flagged 1 times across 1 plans)
[DEBT] timeline-drag-coordination: wrapper-bound listener mount wiring under-specified (flagged 1 times across 1 plans)
[DEBT] timeline-persistence: read path still assembles config and registry from separate requests (flagged 1 times across 1 plans)
[DEBT] timeline-persistence: poll sync verification not structurally changed (flagged 1 times across 1 plans)
[DEBT] timeline-persistence: backend save helpers not wired to new rpc (flagged 1 times across 1 plans)
[DEBT] timeline-persistence: read infrastructure not updated (flagged 1 times across 1 plans)
[DEBT] timeline-persistence: backend tests not in validation list (flagged 1 times across 1 plans)
[DEBT] timeline-persistence: backend callers not migrated (flagged 1 times across 1 plans)
[DEBT] timeline-persistence: broader persistence-contract problem (flagged 1 times across 1 plans)
[DEBT] timeline-persistence: backend split-save not addressed (flagged 1 times across 1 plans)
[DEBT] timeline-persistence: split polling can combine config and registry from different snapshots (flagged 1 times across 1 plans)
[DEBT] timeline-scaling: the plan only specifies a concrete fix for the default scale(1) case; explicit-scale tracks may still break blend-mode effects. (flagged 1 times across 1 plans)
[DEBT] travel-continuations: smooth continuations not threaded — agent tasks won't have continuation_config even when shot settings enable it (flagged 1 times across 1 plans)
[DEBT] travel-continuations: continuation_config omitted from form parity (flagged 1 times across 1 plans)
[DEBT] travel-payload-cleanup-scope: plan scope narrower than original user request (flagged 1 times across 1 plans)
[DEBT] travel-payload-cleanup-scope: broader create-task contract problem left untouched (flagged 1 times across 1 plans)
[DEBT] travel-payload-readers: phase 4 app-side reader audit incomplete (flagged 1 times across 1 plans)
[DEBT] travel-payload-readers: phase 4 field inventory incomplete for app-side readers (flagged 1 times across 1 plans)
[DEBT] travel-request-contract: image_variant_ids is in frontend request contract (flagged 1 times across 1 plans)
[DEBT] travel-request-contract: image_variant_ids contract change (flagged 1 times across 1 plans)
[DEBT] variant-update-b-fresh-takeover: spawn_worker does not internally call start_worker_process; harness must call both explicitly (flagged 1 times across 1 plans)
[DEBT] variant-update-b-fresh-takeover: worker_id and runpod_id must be generated and threaded distinctly; plan currently uses pod_id as both (flagged 1 times across 1 plans)
[DEBT] variant-update-b-fresh-takeover: duplicate of correctness-1 — spawn_worker two-step misstatement (flagged 2 times across 1 plans)
[DEBT] variant-update-b-fresh-takeover: duplicate of correctness-2 — worker_id/runpod_id propagation across takeover and restore paths (flagged 1 times across 1 plans)
[DEBT] variant-update-b-fresh-takeover: duplicate of correctness-1 + correctness-2 — missing create_worker_record glue and start_worker_process integration (flagged 1 times across 1 plans)
[DEBT] variant-update-b-fresh-takeover: duplicate of correctness-2 — caller contract for spawn_worker requires worker_id, not pod_id (flagged 1 times across 1 plans)
[DEBT] verification: no end-to-end render test for audio analysis timing (flagged 1 times across 1 plans)
[DEBT] verification: no automated coverage for text clips or overlapping clips with audio effects (flagged 1 times across 1 plans)
[DEBT] verification-coverage: no automated test exercises the full segment-slot opening path after cleanup. (flagged 1 times across 1 plans)
[DEBT] verification-coverage: no automated coverage that clicking a pair opens the correct modal after cleanup. (flagged 1 times across 1 plans)
[DEBT] verification-coverage: zero behavioral change criterion is not verifiable from tsc + existing tests alone. (flagged 1 times across 1 plans)
[DEBT] verification-workflow: tsconfig.app.json excludes test files, so tsc won't catch test breakage. (flagged 1 times across 1 plans)
[DEBT] worker-test-staleness: worker test in test_additional_coverage_modules.py:37 may assert stale payload structure (task_type vs family). (flagged 1 times across 1 plans)
code
Note: User chose auto-approve mode. This execution was not manually reviewed at the gate. Exercise extra caution on destructive operations.
Robustness level: light.
Requirements:
- Execute only the actionable tasks in this batch.
- Treat completed tasks as dependency context, not new work.
- Return structured JSON only.
- Only produce `task_updates` for these tasks: [T6]
- Only produce `sense_check_acknowledgments` for these sense checks: [SC6]
- Do not include updates for tasks or sense checks outside this batch.
- Keep `executor_notes` verification-focused.
- Best-effort progress checkpointing: if `/Users/user_c042661f/Documents/reigh-workspace/.megaplan/plans/add-rollback-for-optimistic-20260413-0218/execution_batch_4.json` is writable, checkpoint task and sense-check updates there (not `finalize.json`). The harness owns `finalize.json`.
- When verifying changes, run the entire test file or module, not individual test functions. Individual tests miss regressions.
- finalize.json includes baseline_test_failures — a list of test IDs that were already failing before your changes. If a test fails and its ID appears in baseline_test_failures, it is pre-existing — do not scope-creep into fixing it. If baseline_test_failures is null, the baseline could not be captured; use your judgment but err on the side of assuming failures are regressions. You MUST still re-run the FULL test suite with your changes applied — pre-existing failures do not excuse skipping verification. Never narrow to individual test functions and stop.
- If this batch includes the final verification task, write a short script that reproduces the exact bug described in the task, run it to confirm the fix resolves it, then delete the script.
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: the plan's claim that worker_state.py:200-204 (the 30-minute startup safety net) catches abandoned pods that exited before patching is slightly imprecise. line 200-204 only runs when in_startup_phase is true, which requires startup_phase to be in ('deps_installing', 'deps_verified', 'worker_starting') per line 161. a pod that exits before its first patch has startup_phase = none, so in_startup_phase is false and the code falls through to the normal timeout checks (active_stale / not_claiming) at line 207+, not the 30-minute startup cap. both paths eventually reap the worker, so the end result is the same, but the overview's reasoning (naming 200-204 specifically) is wrong. worth correcting so future readers don't mis-reason about the invariant. (flagged 1 times across 1 plans)
[DEBT] are-the-proposed-changes-technically-correct: are the proposed changes technically correct?: checked worker_state.py line 161 (in_startup_phase = startup_phase in (...)) against the plan's assumption that subsequent lenient writes are safe. if deps_installing succeeds but deps_verified silently fails, startup_phase stays at 'deps_installing' and the 30-minute cap from line 200-204 applies — even though the pod is actually progressing through uv sync. on a slow runpod image with cold wheel downloads, uv sync --extra cuda124 plus wan2gp deps can take 20+ minutes. there's no concrete benchmark in the plan that says the 30-minute cap is safely above the expected sync time; if uv sync legitimately takes 25 minutes and the deps_verified patch fails on a transient network blip, the orchestrator will terminate a healthy pod. plan should either bump the cap or note that deps_verified swallowing is acceptable because the cap is generously above typical sync time. (flagged 1 times across 1 plans)
[DEBT] are-the-success-criteria-well-prioritized-and-verifiable: are the success criteria well-prioritized and verifiable?: the attached success criteria are stale and do not match the current plan body. they still require 'no usestate for activepairdata', 'setactivepairdata fully removed', 'sync effect deleted', and 'onpairclick simplified to (pairindex: number) => void', which are the opposite of the current targeted-sync plan. as presented, the criteria are not usable for review or execution. (flagged 1 times across 1 plans)
[DEBT] audio-loading: getaudiodata in useeffect removes render-readiness signal (flagged 1 times across 1 plans)
[DEBT] audio-loading: same as correctness-3 — preview/render parity risk (flagged 1 times across 1 plans)
[DEBT] audio-loading: preview/render parity partially satisfied (flagged 1 times across 1 plans)
[DEBT] audio-reactivity: overlapping clips use first-found, volume not scaled (flagged 1 times across 1 plans)
[DEBT] audio-reactivity: same as audio-reactivity-1 — overlapping/volume-adjusted clips diverge from audible mix (flagged 1 times across 1 plans)
[DEBT] audio-reactivity: textclip missing globalframeprovider (flagged 1 times across 1 plans)
[DEBT] audio-reactivity: same as audio-reactivity-2 — textclipsequence missing provider (flagged 1 times across 1 plans)
[DEBT] audio-reactivity: textclip effects surface not covered (flagged 1 times across 1 plans)
[DEBT] audio-reactivity: continuous effects shared by visual and text clips (flagged 1 times across 1 plans)
[DEBT] batch-generation-pipeline: enhancement in usegeneratebatch before generatevideo() could compute prompts against a stale pair snapshot if mutations are still in flight. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-cascade-paths: cascade lookup only reads params->>'orchestrator_task_id_ref', missing shared reference paths and orchestrator-self detection. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-cascade-paths: duplicate of correctness-2 + correctness-3: invalid sql syntax and narrow cascade lookup. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-cascade-paths: shared orchestrator-reference helpers not referenced. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-cascade-paths: orchestrator tasks that crash don't get orchestrator-self cascade. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-cascade-paths: hardcoded params->>'orchestrator_task_id_ref' misses other reference paths. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-retry: crash requeue sql does not increment attempts, risking infinite requeue loop. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-retry: duplicate of correctness-1: attempts never advance on crash requeue. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-retry: missing attempts increment location in heartbeat sql. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-retry: step 6 under-scoped for real retry convergence and orchestrator-self handling. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-sql-syntax: bare select inside plpgsql is invalid — needs perform. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-testing: no multi-crash convergence test exercising attempts 0→1→2→3. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-testing: no validation that plpgsql body executes successfully. (flagged 1 times across 1 plans)
[DEBT] crash-recovery-testing: criteria don't require proof of crash requeue convergence. (flagged 1 times across 1 plans)
[DEBT] criteria-verifiability: 'no unsafe .maybesingle()' criterion requires judgment about column uniqueness. (flagged 1 times across 1 plans)
[DEBT] criteria-verifiability: decision documentation location not specified. (flagged 1 times across 1 plans)
[DEBT] criteria-verifiability: the must criterion requiring 5 task types to exist as active db rows is not verifiable from code diff alone — it requires a live db query. (flagged 1 times across 1 plans)
[DEBT] db-fallback-testing: no new automated test for the db fallback dispatch path or dependant_on preservation for raw worker families. (flagged 1 times across 1 plans)
[DEBT] dependency-resolution: dependency resolution: the plan does not lock down the active python-version matrix even though the repo currently splits between python 3.10 local installs and a python 3.11 runpod image. (flagged 1 times across 1 plans)
[DEBT] did-the-work-fully-address-the-issue-hints-user-notes-and-approved-plan-requirements: did the work fully address the issue hints, user notes, and approved plan requirements?: the package is internally inconsistent. the plan body says to keep activepairdata in usestate and make phase 2 optional, but the attached metadata and success criteria still describe the previous derive-via-usememo / remove-setactivepairdata / simplify-onpairclick plan. that means the approved-plan requirements are only partially coherent as presented. (flagged 1 times across 1 plans)
[DEBT] did-the-work-fully-address-the-issue-hints-user-notes-and-approved-plan-requirements: did the work fully address the issue hints, user notes, and approved plan requirements?: the linux distro note is documentation-only; the generated install command in step 7 still runs apt-get install python3.10-venv python3.10-dev ffmpeg without any pre-check that the package exists. users on ubuntu 24.04+ who ignore the doc and try to copy-paste the command will hit a confusing e: unable to locate package python3.10-venv from apt rather than a targeted error from commandutils.ts. a one-line detection pre-check (e.g., apt-cache show python3.10-venv >/dev/null 2>&1 || { echo 'install deadsnakes ppa first — see readme'; exit 1; }) would convert the silent failure into an actionable error, but the plan does not add this. (flagged 1 times across 1 plans)
[DEBT] does-the-change-touch-all-locations-and-supporting-infrastructure: does the change touch all locations and supporting infrastructure?: phase 1 still misses a real supporting-data location: trailingpairdata lives outside pairdatabyindex in /users/user_c042661f/documents/reigh-workspace/reigh-app/src/tools/travel-between-images/components/shotimageseditor/hooks/usesegmentslotpresentationadapter.ts, but the proposed sync logic only considers pairdatabyindex. if trailing slot regenerate is part of the bug surface, that location is not covered. (flagged 1 times across 1 plans)
[DEBT] does-the-change-touch-all-locations-and-supporting-infrastructure: does the change touch all locations and supporting infrastructure?: the non-swallowing helper update_worker_phase_strict is a new shell function, but phase 1 step 2 introduces it only as pseudo-code. there is no concrete note that the helper must handle supabase http non-2xx responses as failures (curl returns 0 even on http 4xx/5xx by default unless -f or --fail-with-body is used). if the implementer ports update_worker_phase verbatim with only || return 0 removed, a 500 from supabase would still report success because curl's exit code is 0. the plan should specify curl --fail or explicit http status code checking in the strict variant. (flagged 1 times across 1 plans)
[DEBT] edge-test-config: plan's vitest commands use the wrong config entry point. (flagged 1 times across 1 plans)
[DEBT] edge-test-config: same as verification-3: wrong vitest config in validation commands. (flagged 1 times across 1 plans)
[DEBT] edge-test-config: success criterion references wrong test command. (flagged 1 times across 1 plans)
[DEBT] error-handling: db loader error handling convention mismatch (plan says log+null, existing loaders throw) (flagged 1 times across 1 plans)
[DEBT] error-propagation-logging: generation.ts and handler.ts logging endpoints are not directly tested. (flagged 1 times across 1 plans)
[DEBT] error-propagation-testing: no end-to-end regression test for the full symptom chain (db error → tocompletionerror metadata → handler log). (flagged 1 times across 1 plans)
[DEBT] error-propagation-testing: handler.ts metadata surfacing criterion lacks a concrete automated verifier. (flagged 1 times across 1 plans)
[DEBT] error-propagation-testing: main issue only partially validated without an integration test. (flagged 1 times across 1 plans)
[DEBT] find-the-callers-of-the-changed-function-what-arguments-do-they-actually-pass-does-the-fix-handle-all-of-them: find the callers of the changed function. what arguments do they actually pass? does the fix handle all of them?: the step 2 retry loop uses a naked sleep 2 between attempts, which adds up to 6 seconds of latency on the happy path when the first patch eventually succeeds on attempt 2 or 3. for pods where supabase is reachable but slow during the initial moments of a cold runpod start, the retry logic is fine. however, if the first attempt fails with a tls handshake delay and the retry loop sleeps 2s per attempt regardless of whether curl itself has been blocking for tens of seconds, the total startup latency penalty could be substantial. this is a minor tuning concern, not a correctness issue. (flagged 1 times across 1 plans)
[DEBT] gpu-branching-test-matrix: linux cuda128 path under-verified (flagged 1 times across 1 plans)
[DEBT] gpu-branching-ui-surface: nvidia-50 option is exposed on linux in the ui but linux cuda128 smoke test is missing (flagged 1 times across 1 plans)
[DEBT] hook-abstraction: usepairsettingshandler becomes trivial with single caller — keeping it is extra indirection. (flagged 1 times across 1 plans)
[DEBT] is-the-change-in-the-right-place-and-would-it-break-any-callers: is the change in the right place, and would it break any callers?: the optional cleanup steps are not in the right place yet. pairregionslayer does not receive pairdatabyindex today; its props are only images, imagepositionswithpending, pairinfowithpending, and callback/display props in /users/user_c042661f/documents/reigh-workspace/reigh-app/src/tools/travel-between-images/components/timeline/timelinecontainer/components/pairregionslayer.tsx. so step 4's 'pass pairdatabyindex.get(pairindex) directly' would require new prop plumbing or a different seam. (flagged 1 times across 1 plans)
[DEBT] is-the-scope-and-scale-of-the-change-appropriate: is the scope and scale of the change appropriate?: phase 2 is still under-specified for execution. step 4 says pairregionslayer should either pass pairdatabyindex.get(pairindex) directly or 'just pass the index + frame-only data', which are materially different designs. if phase 2 is kept in the plan, it needs a single concrete direction. (flagged 1 times across 1 plans)
[DEBT] is-there-convincing-verification-for-the-change: is there convincing verification for the change?: the plan still lacks an explicit automated regression test for the reported bug. step 2 is manual ('check that usevideoregeneratemode now gets the fresh url'), but there is no concrete test that opens a segment slot, changes the primary variant data, and asserts that the regenerate path sees the fresh url, generationid, and primaryvariantid. (flagged 1 times across 1 plans)
[DEBT] is-there-convincing-verification-for-the-change: is there convincing verification for the change?: the current usesegmentslotmode test remains only a smoke test in /users/user_c042661f/documents/reigh-workspace/reigh-app/src/tools/travel-between-images/components/shotimageseditor/hooks/tests/usesegmentslotmode.test.ts, and the plan does not add behavior coverage for the new sync effect. (flagged 1 times across 1 plans)
[DEBT] is-there-convincing-verification-for-the-change: is there convincing verification for the change?: no verification step covers the trailing-slot branch, even though the proposed phase 1 logic currently misses trailingpairdata refreshes. (flagged 1 times across 1 plans)
[DEBT] legacy-data-backfill: the step 8 diagnostic query only detects cross-shot pair_shot_generation_id misassociations, not same-shot misassociations caused by timeline reordering within a shot. (flagged 1 times across 1 plans)
[DEBT] lookup-consistency: other repo call sites use unordered .limit(1).maybesingle() and will remain inconsistent. (flagged 1 times across 1 plans)
[DEBT] lookup-consistency: other call sites with same unsafe pattern not covered. (flagged 1 times across 1 plans)
[DEBT] lora-management: lora tools simplified vs full ui parity (multi-stage metadata, private loras) (flagged 1 times across 1 plans)
[DEBT] media-lightbox-persistence: variant switches do not clear/restore inpaintprompt, so stale prompt state can leak across variants with no cached prompt. (flagged 1 times across 1 plans)
[DEBT] media-lightbox-persistence: removing prompt/numgenerations from the variant-keyed localstorage cache means all variants within a generation share the same prompt. this broadens existing debt-002 (variant prompt leakage). (flagged 1 times across 1 plans)
[DEBT] media-lightbox-segment-slot: media lightbox / segment slot: the targeted sync rationale does not fully explain the reported stale-url bug for regular pairs, and the proposed effect still misses trailing-slot refreshes because those can come from trailingpairdata rather than pairdatabyindex. (flagged 1 times across 1 plans)
[DEBT] number-input-nullable: plan doesn't explicitly state onchange must also accept null, though step 3 depends on it. (flagged 1 times across 1 plans)
[DEBT] number-input-nullable: disputed v1 flag — original concern about bulkclippanel being unimplementable. (flagged 1 times across 1 plans)
[DEBT] number-input-nullable: onchange null filtering not explicitly addressed in plan. (flagged 1 times across 1 plans)
[DEBT] number-input-testing: no planned tests for numberinput shared component or bulkclippanel nullable draft flow. (flagged 1 times across 1 plans)
[DEBT] orchestrator-completion-rollout: pre-existing individual_travel_segment children won't drive orchestrator completion through segment_type_config after deploy. (flagged 1 times across 1 plans)
[DEBT] orchestrator-completion-rollout: missing compatibility seam in orchestratorcore.ts:123-126 for old individual_travel_segment rows. (flagged 1 times across 1 plans)
[DEBT] orchestrator-completion-rollout: mixed old/new data during rollout can leave old orchestrators without completion counting. (flagged 1 times across 1 plans)
[DEBT] orchestrator-completion-rollout: no test or deployment guard for pre-existing individual_travel_segment children completing after worker change. (flagged 1 times across 1 plans)
[DEBT] orchestrator-completion-rollout: plan overstates backward compatibility for existing data. (flagged 1 times across 1 plans)
[DEBT] orchestrator-completion-rollout: missing rollout compatibility step for in-flight individual_travel_segment tasks. (flagged 1 times across 1 plans)
[DEBT] orchestrator-completion-rollout: pre-deploy individual_travel_segment child completing post-rollout won't be treated as segment task by checkorchestratorcompletion. (flagged 1 times across 1 plans)
[DEBT] orchestrator-completion-rollout: orchestrator.test.ts criterion too narrow to verify old individual_travel_segment compatibility. (flagged 1 times across 1 plans)
[DEBT] pair-settings-plumbing: handleopenpairsettings(pairindex, pairframedata) path in timelinetrackprelude, segmentoutputstrip, and usesegmentoutputstrip not explicitly named. (flagged 1 times across 1 plans)
[DEBT] pair-settings-plumbing: same as flag-002 — segmentoutputstrip and usesegmentoutputstrip still carry pairframedata. (flagged 1 times across 1 plans)
[DEBT] pair-settings-plumbing: timelinetrackprelude and segmentoutputstrip still forward (pairindex, pairframedata). (flagged 1 times across 1 plans)
[DEBT] plan-scope: step 3 is larger than a light megaplan warrants. (flagged 1 times across 1 plans)
[DEBT] planning-metadata: planning metadata: the attached metadata and success criteria still describe a different implementation than the current plan body, which risks sending execution and review down the wrong path. (flagged 1 times across 1 plans)
[DEBT] planning-metadata: success criteria don't cover wave 4 scope (flagged 1 times across 1 plans)
[DEBT] position-key-semantics: plan investigates a unique constraint on (parent_generation_id, child_order) which doesn't match repo semantics for position keys. (flagged 1 times across 1 plans)
[DEBT] position-key-semantics: plan weights toward child_order rather than pair_shot_generation_id as the key that matters. (flagged 1 times across 1 plans)
[DEBT] position-key-semantics: unique constraint on (parent_generation_id, child_order) not supported by repo semantics. (flagged 1 times across 1 plans)
[DEBT] prompt-composition: the plan's step 1 signature includes textbeforeprompts/textafterprompts parameters that would be applied before enhancement, double-wrapping the prompt. (flagged 1 times across 1 plans)
[DEBT] settings-defaults: workerrepopath default can go stale if user switches computertype before editing path (flagged 1 times across 1 plans)
[DEBT] settings-resolution: settings cascade missing — shot-only read diverges from form's defaults→user→project→shot merge (flagged 1 times across 1 plans)
[DEBT] settings-resolution: settings cascade missing — shot-only read (flagged 1 times across 1 plans)
[DEBT] shared-component-compatibility: numberinput changes affect callers outside video-editor (billing, travel-between-images, phaseconfigselectormodal). (flagged 1 times across 1 plans)
[DEBT] shared-component-compatibility: shared ui component blast radius not audited in plan. (flagged 1 times across 1 plans)
[DEBT] shot-linking-testing: no test covers the linkgenerationtoshot error/catch branches. (flagged 1 times across 1 plans)
[DEBT] signature-propagation: plan doesn't explicitly name timeline/index.tsx and segmentslotcontracts.ts for updates. (flagged 1 times across 1 plans)
[DEBT] signature-propagation: same as flag-001 — timeline/index.tsx and segmentslotcontracts.ts not in checklist. (flagged 1 times across 1 plans)
[DEBT] signature-propagation: five supporting contract/plumbing sites not named in the checklist. (flagged 1 times across 1 plans)
[DEBT] task-types-verification: step 3 cites wrong migration file (task_cost_configs instead of task_types) as evidence for db fallback path. (flagged 1 times across 1 plans)
[DEBT] task-types-verification: step 3 should cite task_types source, not task_cost_configs. (flagged 1 times across 1 plans)
[DEBT] task-types-verification: plan doesn't verify travel_segment and travel_stitch exist as active task_types rows using the correct table. (flagged 1 times across 1 plans)
[DEBT] test-coverage: current generation-child.test.ts is only a smoke test. (flagged 1 times across 1 plans)
[DEBT] test-coverage: no plan to verify other lookup paths choose rows consistently. (flagged 1 times across 1 plans)
[DEBT] test-coverage: no new tests for db loader or travel param merge path (flagged 1 times across 1 plans)
[DEBT] test-coverage: must-level criteria depend on manual testing rather than automated assertions (flagged 1 times across 1 plans)
[DEBT] test-coverage: no new unit tests for wave 4 tools (flagged 1 times across 1 plans)
[DEBT] test-coverage: must criteria backed by manual testing only (flagged 1 times across 1 plans)
[DEBT] test-infrastructure: no test fixtures for resources table (flagged 1 times across 1 plans)
[DEBT] timeline-drag-coordination: plan keeps two hooks instead of a single coordinator (flagged 1 times across 1 plans)
[DEBT] timeline-drag-coordination: brief says single coordinator but plan keeps separate hooks (flagged 2 times across 1 plans)
[DEBT] timeline-drag-coordination: pendingopsref retained despite brief suggesting removal (flagged 1 times across 1 plans)
[DEBT] timeline-drag-coordination: wrapper-bound listener mount wiring under-specified (flagged 1 times across 1 plans)
[DEBT] timeline-persistence: read path still assembles config and registry from separate requests (flagged 1 times across 1 plans)
[DEBT] timeline-persistence: poll sync verification not structurally changed (flagged 1 times across 1 plans)
[DEBT] timeline-persistence: backend save helpers not wired to new rpc (flagged 1 times across 1 plans)
[DEBT] timeline-persistence: read infrastructure not updated (flagged 1 times across 1 plans)
[DEBT] timeline-persistence: backend tests not in validation list (flagged 1 times across 1 plans)
[DEBT] timeline-persistence: backend callers not migrated (flagged 1 times across 1 plans)
[DEBT] timeline-persistence: broader persistence-contract problem (flagged 1 times across 1 plans)
[DEBT] timeline-persistence: backend split-save not addressed (flagged 1 times across 1 plans)
[DEBT] timeline-persistence: split polling can combine config and registry from different snapshots (flagged 1 times across 1 plans)
[DEBT] timeline-scaling: the plan only specifies a concrete fix for the default scale(1) case; explicit-scale tracks may still break blend-mode effects. (flagged 1 times across 1 plans)
[DEBT] travel-continuations: smooth continuations not threaded — agent tasks won't have continuation_config even when shot settings enable it (flagged 1 times across 1 plans)
[DEBT] travel-continuations: continuation_config omitted from form parity (flagged 1 times across 1 plans)
[DEBT] travel-payload-cleanup-scope: plan scope narrower than original user request (flagged 1 times across 1 plans)
[DEBT] travel-payload-cleanup-scope: broader create-task contract problem left untouched (flagged 1 times across 1 plans)
[DEBT] travel-payload-readers: phase 4 app-side reader audit incomplete (flagged 1 times across 1 plans)
[DEBT] travel-payload-readers: phase 4 field inventory incomplete for app-side readers (flagged 1 times across 1 plans)
[DEBT] travel-request-contract: image_variant_ids is in frontend request contract (flagged 1 times across 1 plans)
[DEBT] travel-request-contract: image_variant_ids contract change (flagged 1 times across 1 plans)
[DEBT] variant-update-b-fresh-takeover: spawn_worker does not internally call start_worker_process; harness must call both explicitly (flagged 1 times across 1 plans)
[DEBT] variant-update-b-fresh-takeover: worker_id and runpod_id must be generated and threaded distinctly; plan currently uses pod_id as both (flagged 1 times across 1 plans)
[DEBT] variant-update-b-fresh-takeover: duplicate of correctness-1 — spawn_worker two-step misstatement (flagged 2 times across 1 plans)
[DEBT] variant-update-b-fresh-takeover: duplicate of correctness-2 — worker_id/runpod_id propagation across takeover and restore paths (flagged 1 times across 1 plans)
[DEBT] variant-update-b-fresh-takeover: duplicate of correctness-1 + correctness-2 — missing create_worker_record glue and start_worker_process integration (flagged 1 times across 1 plans)
[DEBT] variant-update-b-fresh-takeover: duplicate of correctness-2 — caller contract for spawn_worker requires worker_id, not pod_id (flagged 1 times across 1 plans)
[DEBT] verification: no end-to-end render test for audio analysis timing (flagged 1 times across 1 plans)
[DEBT] verification: no automated coverage for text clips or overlapping clips with audio effects (flagged 1 times across 1 plans)
[DEBT] verification-coverage: no automated test exercises the full segment-slot opening path after cleanup. (flagged 1 times across 1 plans)
[DEBT] verification-coverage: no automated coverage that clicking a pair opens the correct modal after cleanup. (flagged 1 times across 1 plans)
[DEBT] verification-coverage: zero behavioral change criterion is not verifiable from tsc + existing tests alone. (flagged 1 times across 1 plans)
[DEBT] verification-workflow: tsconfig.app.json excludes test files, so tsc won't catch test breakage. (flagged 1 times across 1 plans)
[DEBT] worker-test-staleness: worker test in test_additional_coverage_modules.py:37 may assert stale payload structure (task_type vs family). (flagged 1 times across 1 plans)
code
Note: User chose auto-approve mode. This execution was not manually reviewed at the gate. Exercise extra caution on destructive operations.
Robustness level: light.
Requirements:
- Execute only the actionable tasks in this batch.
- Treat completed tasks as dependency context, not new work.
- Return structured JSON only.
- Only produce `task_updates` for these tasks: [T7]
- Only produce `sense_check_acknowledgments` for these sense checks: [SC7]
- Do not include updates for tasks or sense checks outside this batch.
- Keep `executor_notes` verification-focused.
- Best-effort progress checkpointing: if `/Users/user_c042661f/Documents/reigh-workspace/.megaplan/plans/add-rollback-for-optimistic-20260413-0218/execution_batch_5.json` is writable, checkpoint task and sense-check updates there (not `finalize.json`). The harness owns `finalize.json`.
- When verifying changes, run the entire test file or module, not individual test functions. Individual tests miss regressions.
- finalize.json includes baseline_test_failures — a list of test IDs that were already failing before your changes. If a test fails and its ID appears in baseline_test_failures, it is pre-existing — do not scope-creep into fixing it. If baseline_test_failures is null, the baseline could not be captured; use your judgment but err on the side of assuming failures are regressions. You MUST still re-run the FULL test suite with your changes applied — pre-existing failures do not excuse skipping verification. Never narrow to individual test functions and stop.
- If this batch includes the final verification task, write a short script that reproduces the exact bug described in the task, run it to confirm the fix resolves it, then delete the script.