6.8 KiB
Task 8 implementation report — two-step stage confirmation
Status and scope
Implementation is code-frozen after focused tests, type checking and the web/Go build. The controller owns the post-freeze real browser/API materialization and quality-handoff gates, ticket status and aggregate report. No live fixture, proxy, company service, BOS, push or deployment mutation was performed by this implementer.
Implemented behavior and interfaces
- Ctrl/Command+Enter first saves an outstanding current-slice draft through the existing
confirmAnnotation/onConfirmAnnotationspath. Incomplete endpoints/text remain validation failures and cannot fall through to submission. - All parked drafts, including unfinished endpoint selections, prevent stage confirmation. A page dialog lists each affected slice and lets the operator return to its retained editor. No implicit saves or cancellations occur.
- Without drafts, keyboard and existing stage buttons open a native in-page dialog for generating slices or submitting annotation. It shows slice/keep/discard totals, saved description and invalid counts, per-slice semantic blank counts, and the history/stage boundary. No
window.confirmwas added. stageConfirmationShortcut(event, { enterReleased })is a pure keyboard helper. The workbench arms confirmation only after releasing the opening Enter; a separate unmodified Enter confirms, Esc cancels, repeat/IME/modifier events are consumed. A synchronous dispatch guard prevents double submission. Focus returns to the workbench after closing.- Existing
onConfirmSlicesandonSubmitTaskcallbacks remain unchanged. The coordinator independently checks outstanding drafts, phase, ownership and mutation locking before submitting. - Stage request errors and non-processing submission responses are reconciled by the existing task GET API. Only authoritative quality-stage completion returns to the pool. Processing remains locked and polls; transient poll failures continue read-only recovery. If readback also fails, the page keeps content and locks conflicting edits with an explicit
核对阶段结果action. - Rejected readback preserves the editor and its original CAS version instead of silently adopting a newer version with stale local content. The error directs the user to load authoritative content if version/ownership changed.
- Generation processing replaces the conflicting reset action with
核对生成状态; reset is guarded during materialization. History remains bounded by the existing stage boundary and cannot reverse generation or quality handoff. - Shortcut help now exposes stage confirmation in both phases, draft/end validation priority, and annotation Undo/Redo (the minor help omission from the brief).
- Existing backend frame, dictionary, owner, optional-description, invalid/discard and review rules are reused unchanged. No backend production change or new API was required.
TDD evidence
Approved primary seam: controller-owned real browser journey plus existing public APIs. Supplement: existing pure keyboard seam and existing HTTP handler tests.
- RED:
node --test tests/frontend/annotation-shortcuts.test.mjsafter adding the independent Enter test failed becausestageConfirmationShortcutwas not exported. This was expected before the new keyboard gate existed. - GREEN: same command after implementation: 15/15 passed.
- RED: added contextual help expectations; same command: 14 passed, 2 failed. The old help advertised only saving, and slicing had no stage shortcut row.
- GREEN: same command after contextual help update: 16/16 passed.
- Controller supplied browser RED against baseline
6db97457: SECTION focused, no current editor, Ctrl+Return yielded no dialog and no POST on the isolated annotation task. This is controller evidence, not a browser run by this implementer.
Final focused verification
node --test tests/frontend/annotation-shortcuts.test.mjs tests/frontend/annotation-submission-state.test.mjs
20/20 passed, 0 failed, no test warnings. Removed obsolete source-string assertions for the exact old processing-only lock expression; source inspection is not used as new interaction evidence. The unchanged dashboard source assertions in that older test file remain upstream debt.
go test ./internal/api -run 'TestPendingCombinedSubmissionBlocksWorkspaceMutations|TestCombinedSubmissionSupportsImmediateAsynchronousResponse|TestCombinedSubmissionAcceptsOptionalDescriptions|TestBlankSubmissionHandsOffToQualityWithEmptyRevision|TestCombinedSubmissionStillRequiresCompleteSliceCoverage|TestCombinedSubmissionCannotBypassDescriptionOverlapChecks|TestCombinedAnnotationDraftRejectsNonAnnotatorEvenWhenTaskIsVisible|TestCombinedAnnotationDraftRejectsAnnotatorWhoDidNotClaimTheItem|TestCombinedSubmissionFinalCASFailureDoesNotPublishQualityTask' -count=1
Passed (ok droboticflow/internal/api 0.557s). Existing focused tests cover processing mutation refusal, asynchronous acceptance, blank/optional descriptions, overlap/coverage rejection, owner/role denial and final-CAS failure. They use isolated in-memory fixtures and do not contact local live fixtures or company services. No new HTTP test was necessary for a production HTTP change because no backend behavior changed.
npm run lint:web
npm run build
git diff --check
All exit 0. Vite transformed 3203 modules; all three Go binaries compiled. Existing Node module.register() deprecation and >500 kB chunk warnings remain. Per controller instruction, no full test suite was run.
Files
src/components/CaptureAnnotationWorkbench.tsxsrc/lib/annotation-shortcuts.jssrc/pages/AnnotationOperations.tsxtests/frontend/annotation-shortcuts.test.mjstests/frontend/annotation-submission-state.test.mjs
The controller-owned modified ticket was excluded from staging. This report is an untracked/ignored task artifact, following prior task reports.
Self-review and remaining gates
Reviewed modal focus/key ownership, current-versus-parked draft priority, pending/unknown locks, stale mutation identity guards, original CAS retention after rejected readback, and history boundaries. Existing large workbench/coordinator files remain large; changes were kept local rather than introducing a parallel editor or task model.
Root must complete browser GREEN and real API gates after manually reloading the HMR-disabled frontend: current/parked/incomplete drafts; held/repeated Enter and Esc; mouse parity; actual generation processing/completion; actual quality handoff; failure/unknown recovery; blank/invalid/discard distinctions and no cross-stage undo. No browser GREEN or live materialization result is claimed here.
Commit
b6e80de8 — ✨ Add draft-aware two-step stage confirmation. Committed only the five implementation/test files on feature/local-dev-toolkit; no push. Initial sandbox git-index denial was resolved via the authorized elevated local git operation.