---
phase: 09-etapes
plan: 04
subsystem: tasks
tags: [go, htmx, templ, etapes, uat]
requires:
  - phase: 09-etapes
    plan: 03
    provides: task create/edit etape selectors and same-tablo assignment validation
provides:
  - reorder preservation regression coverage for etape-assigned tasks
  - filtered reorder behavior that preserves hidden tasks and etape assignment
  - create/delete count refresh fixes for etape chips
  - resolved UAT gap for selected etape winning over active filter
affects: [09-etapes, tasks]
tech-stack:
  added: []
  patterns: [db-backed regressions, oob etape strip refresh, selector-over-filter precedence]
key-files:
  created:
    - .planning/phases/09-etapes/09-UAT.md
  modified:
    - backend/internal/web/handlers_tasks.go
    - backend/internal/web/handlers_tasks_test.go
    - backend/templates/tasks.templ
key-decisions:
  - "Task reorder preserves existing etape_id and keeps ordering status-scoped rather than etape-scoped."
  - "Task create/delete HTMX responses refresh the etape strip out-of-band so chip counts stay current."
  - "Task create assignment comes from the visible selector, not from the active etape filter query param."
patterns-established:
  - "Filtered task reorder has DB-backed coverage for visible and hidden tasks."
  - "UAT gaps are diagnosed in 09-UAT.md and closed with a regression plus retest."
requirements-completed: [ETAPE-01, ETAPE-02, ETAPE-03, ETAPE-04, ETAPE-05, ETAPE-06]
completed: 2026-05-15
---

# Plan 09-04 Summary

**Etape reorder hardening, count refresh fixes, and final UAT closure**

## Accomplishments

- Added DB-backed regression coverage proving task reorder preserves `etape_id`, keeps hidden filtered tasks intact, and remains stable under active etape filters.
- Fixed task reorder behavior so existing etape assignments are preserved through single-task and Sortable-style reorder paths.
- Fixed task create and delete HTMX responses to refresh the etape strip out-of-band, keeping chip counts current after mutations.
- Completed Phase 9 UAT with five user-facing checkpoints: filters, create assignment, etape management, edit assignment, and filtered reorder.
- Diagnosed and fixed the UAT gap where task creation could use the active filter etape instead of the visible selector value.

## Task Commits

1. **Task 1: Add reorder preservation regression tests** - `55263e4`
2. **Task 2: Preserve etape assignment through reorder** - `3a3ecf5`
3. **Task 2 hardening: DB-backed reorder regressions** - `cf07c29`
4. **UAT fix: Refresh counts on task create** - `0c95049`
5. **UAT fix: Refresh counts on task delete** - `ee62ff9`
6. **UAT record: Complete Phase 9 UAT with one diagnosed issue** - `c5513df`
7. **UAT gap fix: Honor selected etape on task create** - `f9fc7a1`

## Verification

- `cd backend && just generate`
- `cd backend && TEST_DATABASE_URL='postgres://xtablo:xtablo@localhost:5432/xtablo?sslmode=disable' go test ./internal/web -run 'TestTaskCreateUsesSelectedEtapeOverActiveFilter|TestTaskCreateRefreshesEtapeCounts|TestTaskCreateAssignsEtape' -count=1`
- `cd backend && TEST_DATABASE_URL='postgres://xtablo:xtablo@localhost:5432/xtablo?sslmode=disable' go test ./... -count=1`
- `git diff --check`
- Browser UAT in `.planning/phases/09-etapes/09-UAT.md` retested successfully after the create-assignment fix.

## Deviations from Plan

Plan 09-04 included final browser verification. Browser UAT found two count-refresh issues and one assignment-precedence issue, so the plan expanded to include focused fixes and regression coverage before closure.

## Issues Encountered

- Task create initially did not refresh etape chip counts after HTMX insert; fixed with an out-of-band `#etape-strip` refresh.
- Task delete initially did not refresh etape chip counts after HTMX removal; fixed with an out-of-band `#etape-strip` refresh.
- Task create could submit duplicate `etape_id` values because the form had both a hidden active-filter value and the visible selector; fixed so the selector value wins and the duplicate hidden field is removed.

## User Setup Required

None.

## Next Phase Readiness

Phase 9 execution is closed. Phase 9 is ready for the normal verification/security gates before moving to Phase 10 events.

## Self-Check: PASSED
