Fix watchlist draft hydration and update contracts

This commit is contained in:
master
2026-03-11 10:56:31 +02:00
parent 5c874c8f64
commit 568a1df468
8 changed files with 743 additions and 17 deletions

View File

@@ -0,0 +1,76 @@
# Sprint 20260311-002 - Watchlist Draft State Preservation
## Topic & Scope
- Repair the live `Trust & Signing > Identity Watchlist` create and duplicate flows so route/context hydration can no longer wipe in-progress operator input.
- Prove the fix with focused Angular regression coverage and a real Playwright action sweep that exercises create, edit, pattern test, tuning, duplicate, and delete.
- Keep this iteration scoped to the watchlist shell, its live QA harness, and the supporting docs update.
- Working directory: `src/Web/StellaOps.Web`.
- Allowed coordination edits: `docs/implplan/SPRINT_20260311_002_FE_watchlist_draft_state_preservation.md`, `docs/modules/ui/restoration-topics/watchlist.md`.
- Expected evidence: focused Angular feature spec coverage, rebuilt web bundle synced into the live compose frontdoor, and a live Playwright sweep artifact for the watchlist page actions.
## Dependencies & Concurrency
- Depends on the authenticated live frontdoor harness already in `src/Web/StellaOps.Web/scripts/live-frontdoor-auth.mjs`.
- Safe parallelism: stay inside `src/Web/StellaOps.Web/**` plus the explicitly allowed docs files; do not take ownership of backend watchlist services or unrelated trust pages in parallel.
## Documentation Prerequisites
- `AGENTS.md`
- `docs/qa/feature-checks/FLOW.md`
- `docs/modules/platform/architecture-overview.md`
- `docs/modules/ui/restoration-topics/watchlist.md`
## Delivery Tracker
### FE-WATCHLIST-002-001 - Preserve unsaved drafts through route hydration
Status: DONE
Dependency: none
Owners: Product Manager, Architect, Developer
Task description:
- The live watchlist shell replays route state after entering the create or duplicate draft route. That replay resets the reactive form, silently erasing user input before submit can reach the API.
- Keep route state as the source of truth for which draft is open, but preserve in-progress draft values when hydration replays the same create or duplicate target.
Completion criteria:
- [x] Reapplying the same `entryId=new` route no longer wipes a dirty create draft.
- [x] Reapplying the same duplicate draft route no longer reseeds over operator edits.
- [x] Legitimate transitions between create, duplicate, edit, alerts, and tuning still rehydrate the correct state.
### FE-WATCHLIST-002-002 - Add regression coverage for draft preservation
Status: DONE
Dependency: FE-WATCHLIST-002-001
Owners: Developer, QA
Task description:
- The prior unit coverage only called `saveEntry()` directly and never exercised the route-hydration failure mode.
- Add focused component specs that prove dirty create and duplicate drafts survive repeated route-state application for the same target.
Completion criteria:
- [x] Focused Angular coverage asserts dirty create drafts survive repeated route hydration.
- [x] Focused Angular coverage asserts dirty duplicate drafts survive repeated route hydration.
### FE-WATCHLIST-002-003 - Rebuild and prove live watchlist actions with Playwright
Status: DONE
Dependency: FE-WATCHLIST-002-002
Owners: QA
Task description:
- Rebuild the web bundle, sync it into the live frontdoor static volume, and run a real authenticated Playwright sweep that covers the watchlist action family end to end.
Completion criteria:
- [x] Focused Angular feature coverage passes for `watchlist-page.component.spec.ts`.
- [x] `npm run build` passes and the rebuilt bundle is synced into `compose_console-dist`.
- [x] A live Playwright sweep artifact records passing checks for create, edit, pattern test, tuning, duplicate, alerts tab, and delete flows on `/setup/trust-signing/watchlist`.
## Execution Log
| Date (UTC) | Update | Owner |
| --- | --- | --- |
| 2026-03-11 | Sprint created after live Playwright proved the watchlist create draft route was resetting operator input before submit, leaving the page stuck on `entryId=new` with no API call. | Developer |
| 2026-03-11 | Preserved dirty create/duplicate drafts through repeated route hydration, stopped refreshes from wiping success banners, normalized watchlist test responses in the HTTP client, and merged full watchlist resources for tuning/toggle updates. Focused Angular coverage passed (`14/14` across `watchlist-page.component.spec.ts` and `watchlist.client.spec.ts`), `npm run build` passed, the rebuilt bundle was synced into `compose_console-dist`, and `src/Web/StellaOps.Web/output/playwright/live-watchlist-action-sweep.json` recorded clean live create/edit/test/tuning/duplicate/delete coverage with zero runtime issues. | QA |
## Decisions & Risks
- Decision: route/context hydration is allowed to select the active draft, but it must not erase user-entered values when the route target itself has not changed.
- Decision: this is treated as a user-facing workflow regression, not a QA-harness issue. The fix belongs in the watchlist shell state model, not in Playwright timing workarounds.
- Decision: the watchlist browser client now normalizes the real backend `matchedFields` payload into the array shape the UI renders. That keeps the browser resilient to the existing backend enum-string contract without changing service behavior mid-iteration.
- Decision: watchlist `PUT` remains a full-resource update contract. The web shell now sends merged full payloads for tuning/toggle flows instead of assuming backend partial-update semantics.
- Risk: the watchlist page still relies on frontdoor query hydration, so adjacent trust pages may carry similar draft-reset risks and should be covered in later action sweeps.
## Next Checkpoints
- 2026-03-11: land the watchlist state-model fix and focused frontend coverage.
- 2026-03-11: rebuild and sync the web bundle into the live compose frontdoor.
- 2026-03-11: rerun authenticated Playwright against `/setup/trust-signing/watchlist` and commit the iteration locally.