Schedule Channel Context + Auto-Watch Implementation Plan
For agentic workers: REQUIRED SUB-SKILL: Use
superpowers:subagent-driven-development (recommended) or
superpowers:executing-plans to implement this plan task-by-task. Steps use
checkbox (- [ ]) syntax for tracking.
Goal: Enrich the Schedule channel dropdown with availability + ratings, and
auto-watch requested_by when a scheduled plan links to a started measurement.
Architecture: Frontend-only Autocomplete enrichment from existing lab
status. Backend injects UserWatchedMeasurementService into measurement create
(link path) and planned-measurement PATCH (in_progress path); watch failures
are logged and never fail the primary operation.
Tech Stack: React/MUI Autocomplete, RTK Query lab status, FastAPI services,
pytest, vitest.
Spec:
docs/superpowers/specs/2026-07-23-schedule-channel-context-auto-watch-design.md
File map
Task 1: Frontend channel option helpers + dialog
Files:-
Create:
frontend/src/sections/lab/schedule-channel-options.ts -
Create:
frontend/src/sections/lab/schedule-channel-options.test.ts -
Modify:
frontend/src/sections/lab/schedule-planned-measurement-dialog.tsx - Step 1: Write failing vitest for flatten + ratings label
ScheduleChannelOption, channelRatingsLabel,
flattenLabChannelsForSchedule. Test: free channel with max_amps=40,
min_volts=0, max_volts=5 → ratings "40 A · 0–5 V" and state: 'free'.
- Step 2: Implement helpers
formatRatingRange from wall-scope.ts. Flatten site→cycler→channel
with id, label, outOfCommission, state, amp/volt fields.
- Step 3: Wire dialog Autocomplete
renderOption shows label, ratings secondary line, trailing
CHANNEL_STATE_STYLES[state].label (Lab-wall title case). Keep
out-of-commission disabled. Preserve next-available helper.
- Step 4: Run
just test-frontend-unitfiltered to the new test file (or project vitest command for that path). Expect PASS.
Task 2: Auto-watch on measurement link (primary path)
Files:-
Modify:
backend/src/services/cell_measurements.py -
Modify:
backend/tests/fixtures/cell_fixtures.py(addwatch_servicemock) -
Modify:
backend/tests/test_services/test_cell_measurements.py - Step 1: Write failing tests
link_started_measurement return with requested_by, assert
watch_service.watch(requested_by, measurement_id) awaited once.
When link returns None, watch not called.
When watch raises, measurement create still succeeds.
- Step 2: Implement
UserWatchedMeasurementService into CellMeasurementService +
get_cell_measurement_service. After successful link, call watch inside
try/except (log, continue). Prefer nested try so link success is not rolled
back by watch failure (watch after link, separate except).
- Step 3: Run
just test-backend tests/test_services/test_cell_measurements.py -k "planned"Expect PASS. Fix fixture constructors that construct the service.
Task 3: Auto-watch on planned PATCH to in_progress
Files:-
Modify:
backend/src/services/planned_measurements.py -
Modify:
backend/tests/test_services/test_planned_measurements.py - Step 1: Write failing tests
scheduled → in_progress + started_measurement_id: watch called with
requested_by and that measurement id.
Already in_progress update (e.g. to completed): watch not called for
auto-start.
Watch failure does not fail update.
- Step 2: Implement
existing.status is not in_progress and updated status is in_progress and
started_measurement_id is set, auto-watch with try/except.
- Step 3: Run
just test-backend tests/test_services/test_planned_measurements.py -k "in_progress or watch"Expect PASS.
Task 4: Docs
Files:-
Modify:
dev-docs/planned-measurements.md -
Step 1: Document that successful link / in_progress transition
auto-watches
requested_by(best-effort, non-blocking).