6.4 KiB
Raw Permalink Blame History

Task 2 implementation report

Status

Implementation, focused automated verification, controller-owned browser acceptance, and read-only review are complete. The reviewer approved the task with no Critical, Important, or Minor findings.

Changes

  • The parent slicing entry point now creates fresh IDs for both children and returns the left child ID. The workbench keeps that just-completed slice selected after C instead of falling back to the first slice.
  • C explicitly pauses transport before applying the split, then seeks to the exact frame boundary without resuming playback.
  • Playback bounds are phase-aware: slicing uses the whole Capture range, so Space crosses slice boundaries; annotation and materialization use the selected slice range.
  • Time updates, end restart, ordinary frame stepping, and the range-clamp effect use the same phase-aware bounds. Slicing frame steps traverse the whole Capture; annotation frame steps remain selected-slice bounded and independent of playback speed.
  • A later C resolves the slice containing the continuously advanced playhead instead of assuming the retained review selection still owns that time.
  • Slicing displays Capture-relative progress once playback leaves the selected slice. Invalid boundary cuts preserve the partition and show a visible alert.
  • Production split children retain the existing dictionary name and source lineage. The synchronized left/right hardware-frame mapping is unchanged.

TDD evidence

RED:

node --test tests/frontend/annotation-workbench.test.mjs
12 passed, 2 failed

splitting a selected slice returns two fresh children and keeps the completed child selected:
expected split result, received undefined

playback spans the Capture while slicing and the selected slice while annotating:
expected phase bounds, received undefined

GREEN:

node --test tests/frontend/annotation-workbench.test.mjs
14 passed, 0 failed

Browser-gate regression RED and GREEN cycles:

node --test tests/frontend/annotation-workbench.test.mjs
14 passed, 1 failed: sliceIndexAtPlayhead was undefined

node --test tests/frontend/annotation-workbench.test.mjs
15 passed, 0 failed

node --test tests/frontend/annotation-workbench.test.mjs
15 passed, 1 failed: boundary rejection returned no message

node --test tests/frontend/annotation-workbench.test.mjs
16 passed, 0 failed

The tests call executable production helpers and assert returned slice topology, fresh child IDs, selected child, input immutability, phase playback ranges, playhead ownership after continuous playback, and invalid-cut feedback. They do not inspect source strings or private React state.

Verification evidence

Fresh post-commit verification:

node --test tests/frontend/annotation-workbench.test.mjs tests/frontend/capture-annotation-workbench.test.mjs tests/frontend/unified-annotation-boundaries.test.mjs tests/frontend/annotation-shortcuts.test.mjs tests/frontend/annotation-playhead-draft.test.mjs
40 passed, 0 failed

npm run lint:web
tsc --noEmit; exit 0

git show --format= --check HEAD
exit 0

No full suite was run, per ticket instructions.

Browser evidence

All browser checks used the real page with local frontend/API/Mongo only (5173 / 3001 / 27018) and the isolated slice-primary / annotate-delayed fixtures.

Initial RED: splitting the middle slice at frame 120.166667 selected the first slice and moved the playhead to 120.1. The detailed initial capture is in acceptance-evidence.md.

The first implementation kept the new left child selected and paused both cameras at the exact cut (left 120.166668, right 120.133335); Space crossed the new boundary. That gate exposed two further selection couplings: a later C did nothing because it still targeted the retained left child, and at 4× ordinary Right jumped backward from 134.166667 to the selected child's end 120.166667.

After the follow-up, continuous playback reached 127.566667; a second C created the next split, selected its new left child, and paused at left 127.566668 / right 127.533335. At 4×, Right advanced to 127.6 and Left returned to 127.566667, one original hardware-frame step with dual-camera correspondence preserved. In annotation, Space near the selected end stopped at 120.1 with both cameras paused instead of crossing slices.

Boundary RED: C at Capture start preserved all three slices but the component only rendered its error inside annotation UI, so no prompt was visible. Final GREEN: the slicing role=alert displayed 当前帧位于切片边界,请移动到片段内部帧后再拆分。; slice count stayed 3 and full 0–412 coverage remained unchanged.

Files

  • src/lib/annotation-workbench.js
  • src/pages/AnnotationOperations.tsx
  • src/components/CaptureAnnotationWorkbench.tsx
  • src/dev/CaptureAnnotationWorkbenchPreview.tsx
  • tests/frontend/annotation-workbench.test.mjs

Self-review

  • The left child is selected intentionally: it is the segment just completed by the cut and is the meaningful target for later review, while slicing playback is independent of selection and continues forward from the cut.
  • Both child IDs are produced by the owning parent before state replacement, so the workbench never depends on a deleted source ID.
  • The cut path pauses before both the parent update and exact seek, avoiding the transport queue's retained play intent.
  • Annotation playback, time updates, ordinary frame stepping, and selection changes remain clamped to the selected slice. Slicing playback and ordinary stepping use the Capture bounds. The unified frame-boundary conversion and right-camera mapping were not changed.
  • The production split copies the valid project-dictionary name to both children. Blank/invalid/discard meanings, ownership, review, persistence, and delivery behavior are untouched.
  • Controller-owned changes in .scratch/annotation-keyboard-workflow/issues/02-continuous-slice-playback.md and scripts/local/prepare-annotation-keyboard-fixtures.sh were excluded from the commit.

Commit

  • 015c86de — 🐛 Keep slice playback continuous after cuts
  • 4a6affea — 🐛 Keep continuous slicing on the playhead
  • d16e41b9 — 🐛 Show rejected slice cut feedback

Review

The read-only reviewer marked the task spec compliant and approved. The review found no Critical, Important, or Minor issues. Review: task-2-review.md.

Concerns

  • The full frontend suite was intentionally not run by this task agent.