95 lines
4.5 KiB
Markdown
95 lines
4.5 KiB
Markdown
---
|
|
phase: 01-draft-state-ownership
|
|
plan: 01
|
|
subsystem: ui
|
|
tags: [react, typescript, tauri, vitest, runtime-settings]
|
|
requires: []
|
|
provides:
|
|
- runtime draft ownership contracts for live, baseline, and editable runtime state
|
|
- manager-owned polling reconciliation that preserves dirty drafts
|
|
- regression coverage for poll-safe draft edits, close or reopen preservation, and save promotion
|
|
affects: [phase-1-drawer-refactor, runtime-settings-drawer, lifecycle-semantics]
|
|
tech-stack:
|
|
added: []
|
|
patterns: [manager-owned live-baseline-draft state, operational-only polling reconciliation while dirty, hook-level draft regression harness]
|
|
key-files:
|
|
created: []
|
|
modified:
|
|
- tauri-app/src/features/runtime/types.ts
|
|
- tauri-app/src/features/runtime/useRuntimeManager.ts
|
|
- tauri-app/src/features/runtime/runtime-settings-form.test.ts
|
|
- tauri-app/src/features/runtime/components/RuntimeSurface.test.tsx
|
|
key-decisions:
|
|
- "Keep existing snapshot/saveConfig outputs while adding explicit draft APIs so brownfield consumers keep compiling during the Phase 1 transition."
|
|
- "When the draft is dirty, polling updates only operational live fields and leaves baseline plus draft config untouched."
|
|
patterns-established:
|
|
- "Runtime manager owns liveSnapshot, savedBaseline, and draftConfig separately instead of deriving editable state from polling output."
|
|
- "Draft behavior is verified with hook-level regression tests that exercise open, close, update, poll, and save flows independently from the drawer UI."
|
|
requirements-completed: [WORK-02, CONF-01]
|
|
duration: 10min
|
|
completed: 2026-03-29
|
|
---
|
|
|
|
# Phase 1 Plan 1: Draft State Ownership Summary
|
|
|
|
**Manager-owned runtime draft contracts with polling-safe reconciliation and save-promotion regressions for the Tauri runtime workspace**
|
|
|
|
## Performance
|
|
|
|
- **Duration:** 10 min
|
|
- **Started:** 2026-03-29T02:43:00Z
|
|
- **Completed:** 2026-03-29T02:52:44Z
|
|
- **Tasks:** 2
|
|
- **Files modified:** 4
|
|
|
|
## Accomplishments
|
|
- Added explicit draft-state contracts for live snapshot, saved baseline, editable draft config, and field metadata in `tauri-app/src/features/runtime/types.ts`
|
|
- Refactored `useRuntimeManager` to own `liveSnapshot`, `savedBaseline`, and `draftConfig` separately while preserving legacy `snapshot` and `saveConfig` compatibility
|
|
- Added regression coverage proving dirty drafts survive polling, hidden drafts survive close or reopen in-session, and save promotes the returned config into the new clean baseline
|
|
|
|
## Task Commits
|
|
|
|
Each task was committed atomically:
|
|
|
|
1. **Task 1: Define runtime draft ownership contracts** - `929a516` (feat)
|
|
2. **Task 2: Move draft, baseline, and polling reconciliation into the runtime manager** - `18501e9` (feat)
|
|
|
|
**Plan metadata:** pending
|
|
|
|
## Files Created/Modified
|
|
- `tauri-app/src/features/runtime/types.ts` - Defines reusable draft-state contracts and default field metadata for manager-owned runtime editing
|
|
- `tauri-app/src/features/runtime/runtime-settings-form.test.ts` - Verifies the new draft contract surface with runtime-backed and type-level assertions
|
|
- `tauri-app/src/features/runtime/useRuntimeManager.ts` - Separates live polling state from saved baseline and editable draft state while keeping legacy consumers working
|
|
- `tauri-app/src/features/runtime/components/RuntimeSurface.test.tsx` - Covers dirty polling reconciliation, close or reopen draft persistence, and save promotion behavior through the runtime manager harness
|
|
|
|
## Decisions Made
|
|
- Kept `snapshot` and `saveConfig` on the manager return value so the current drawer keeps working while Phase 1 transitions draft ownership into the manager
|
|
- Treated dirty polling as an operational refresh only, updating status and process health without replacing draft or baseline config values
|
|
|
|
## Deviations from Plan
|
|
|
|
None - plan executed exactly as written.
|
|
|
|
## Issues Encountered
|
|
- The first RED attempt used type-only assertions, which Vitest transpiled without failing on missing exports; the contract test was adjusted to use runtime-backed draft helpers so the TDD red phase became real before implementation
|
|
|
|
## User Setup Required
|
|
|
|
None - no external service configuration required.
|
|
|
|
## Next Phase Readiness
|
|
- Phase 1 now has a typed draft-state foundation and manager behaviors the drawer refactor can consume directly
|
|
- The next plan can move the drawer UI onto the manager-owned draft API without re-solving polling or save-baseline ownership rules
|
|
|
|
## Self-Check
|
|
|
|
PASSED
|
|
|
|
- FOUND: `.planning/phases/01-hf-model-discovery/01-01-SUMMARY.md`
|
|
- FOUND: `929a516`
|
|
- FOUND: `18501e9`
|
|
|
|
---
|
|
*Phase: 01-draft-state-ownership*
|
|
*Completed: 2026-03-29*
|