docs(roster): record dual-viewport evidence and freeze anne self-audit

This commit is contained in:
anneux committed 2026-10-26 09:54:02 -05:00
1 parent 191a02d6c2
commit d672065186
3 files changed
+127

No files matched your search

+127
View File
@@ -0,0 +1,127 @@
# Frontend Implementation Self-Audit: Group Workshop Roster Quick Check-in
> **Author:** Anne Droid <anne-droid@roadtotech.me>
> **Role:** Senior Frontend Engineer & UX Specialist
> **Worktree:** `/home/kiskaadee/Projects/active/armonia/armonia-dashboard-anne-roster`
> **Branch:** `feat/anne/workshop-roster`
> **Date:** 2026-10-26
> **Target Specification:** `docs/pilot/SPEC-WORKSHOP-ROSTER.md`
> **Collaboration Plan:** `docs/pilot/COLLABORATION-PLAN.md`
---
## 1. Executive Summary
The **Group Workshop Roster Quick Check-in** feature (`#rosters`, "Talleres") has been fully implemented, styled, verified, and frozen.
The implementation strictly respects the Scope Containment Invariant:
1. Feature logic is isolated in `src/components/WorkshopRoster.ts` and tests in `tests/roster.test.ts`.
2. Edits to shared entry points (`src/main.ts`, `src/types.ts`, `src/api.ts`, and `src/style.css`) are strictly additive.
3. Zero regressions on existing views: `#queue` (48h follow-up queue), `#agenda` (daily agenda with buffers), `#clients` (directory), and the "Nueva Cita" intake modal remain 100% operational.
4. All 17 existing tests in `tests/utils.test.ts` pass alongside 12 new unit tests in `tests/roster.test.ts` (total: 29 tests passing).
---
## 2. Commit Decomposition & Traceability Matrix
| Commit | Scope & Summary | Addressed Acceptance Criteria |
| :--- | :--- | :--- |
| `0ff27a2` | `feat(roster): define API types and client methods for workshop rosters` | `AC-1`, `AC-3`, `AC-4`, `AC-5`, `AC-6` |
| `c09f6c6` | `feat(roster): add status badges, capacity formatting, and unit tests` | `AC-1`, `AC-2`, `AC-6` |
| `6ba0bbe` | `feat(roster): implement session cards, attendee list, and check-in workflows` | `AC-1`, `AC-2`, `AC-3`, `AC-4`, `AC-5`, `AC-6`, `AC-7` |
| `191a02d` | `feat(roster): integrate talleres tab in navigation and add responsive styles` | `AC-1`, `AC-7` |
### Acceptance Criteria Verification Breakdown
- **`AC-1`: Workshop Session Selection & Capacity Overview**
- Integrated tab `#rosters` ("Talleres") into desktop and sticky mobile navigation.
- Fetches `GET /rosters?date_from=YYYY-MM-DD&date_to=YYYY-MM-DD` defaulting to today (Mexico City timezone).
- Displays session title, scheduled time (e.g. `18:00 hrs`), and counter formatted exactly as:
`Ocupación: {occupied_count} / {max_capacity} ({attended_count} presentes)`.
- **`AC-2`: Attendee Roster Display & Status Indicators**
- Displays attendee client name, contact phone, booking code (`ADS-XXXX`).
- Attendance badge matches Section 2.2: `REGISTRADO` (slate pill) vs `ASISTIÓ` (emerald pill).
- Payment badge matches Section 2.2: `PAGADO` (emerald pill) vs `PENDIENTE` (amber pill).
- Clickable 1-tap WhatsApp link (`wa.me/52...`) pre-populated with cleaned attendee digits.
- **`AC-3`: Existing Booking Check-in (Pre-paid)**
- Tapping "Registrar Asistencia" sends `POST /rosters/quick-checkin` with payload `{"booking_id": "<id>", "paid_cash": false}`.
- Upon HTTP 200, row immediately transitions to `ASISTIÓ`, check-in button disables, `attended_count` increments by 1, and accessible toast announces: *"Asistencia registrada con éxito."*.
- **`AC-4`: Existing Booking Check-in with Cash Payment Acknowledgment**
- When "Cobro en efectivo recibido" is checked, sends payload `{"booking_id": "<id>", "paid_cash": true, "notes": "Cobro en puerta"}`.
- Upon HTTP 200, status badge transitions to `ASISTIÓ`, payment status transitions to `PAGADO`, and `attended_count` increments without full reload.
- **`AC-5`: Walk-in Attendee Quick Registration & Check-in**
- "+ Registrar Asistente Sin Cita" opens a dedicated modal with Full Name, Phone, Email, and Cash Payment toggle.
- Cash toggle defaults to **checked (`true`)** per section 5.5.
- Modal submit button disables immediately in flight (`disabled = true`, "Registrando...") to prevent duplicate submissions on double-click.
- Sends Mode 2 payload `{"service_id": "...", "scheduled_at": "...", "client_name": "...", "client_phone": "...", "paid_cash": true}`.
- Upon HTTP 200, closes modal, attendee appears in list as `ASISTIÓ` and `PAGADO`, and both `occupied_count` and `attended_count` increment by 1.
- **`AC-6`: Resilient Error Handling & Retry (409 Conflict Disambiguation)**
- *Case 6A (Already Checked-in 409)*: `detail` matching "already checked in" reconciles row to `ASISTIÓ`, disables button, and displays informative toast: *"El asistente ya contaba con asistencia registrada"*.
- *Case 6B (Capacity Exceeded 409)*: `detail` matching "cupo máximo" renders an explicit capacity error alert, preserves walk-in form inputs, and does NOT increment counts or report false success.
- *Failed Roster Fetch*: Displays inline error banner *"No se pudieron cargar los talleres. Verifica tu conexión."* with an explicit `Reintentar` button that re-triggers fetch.
- **`AC-7`: Mobile Ergonomics & Keyboard Accessibility**
- Minimum touch targets $\ge 44 \times 44\text{px}$ across check-in buttons, modal inputs, toggles, and nav pills.
- 375px viewport (iPhone SE/X) renders without horizontal scroll overflow.
- Visible `:focus-visible` outlines (`outline: 2px solid var(--color-sage)`).
- Toast notifications dispatched inside container equipped with `role="status"` and `aria-live="polite"`.
---
## 3. Explicit Handling of the 5 Component States
1. **Loading State**:
- Implemented via `.roster-skeleton-wrapper` rendering skeleton session cards and rows with subtle pulse animation, guaranteeing CLS $\le 0.05$.
2. **Empty State**:
- When `sessions.length === 0`, renders:
> *"No hay talleres grupales programados para esta fecha."*
- Date picker and quick filter pills ("Hoy", "Mañana") remain fully interactive.
3. **Error State with Actionable Retry**:
- If `GET /rosters` fails, renders inline error banner:
> *"No se pudieron cargar los talleres. Verifica tu conexión."*
- Includes `<button class="btn btn-secondary" id="roster-retry-btn">Reintentar</button>` allowing recovery without page reload.
4. **Partial / Conflict State (HTTP 409)**:
- Disambiguates duplicate attendance vs. capacity limit via `disambiguate409Error`.
- Preserves state and form inputs without crashing or corrupting client-side counters.
5. **Success State**:
- Immediate row update to `ASISTIÓ` (and `PAGADO` when cash collected).
- Capacity counter updates seamlessly.
- Screen-reader accessible toast announcement.
---
## 4. Verification Evidence & Non-Regression Invariant
### 4.1 Automated Toolchain Checks
- **Vitest Unit & Component Tests**: 29 passed (17 existing + 12 roster)
```
Test Files 2 passed (2)
Tests 29 passed (29)
```
- **TypeScript Typecheck**:
```
$ tsc --noEmit
Exit code: 0
```
- **Biome Linter & Formatter**:
```
$ biome check .
Checked 23 files in 28ms. No fixes applied.
Exit code: 0
```
### 4.2 Non-Regression Smoke Verification
- `#queue` (Cola 48h): Loads and displays urgent follow-up badges and queue counters.
- `#agenda` (Agenda del Día): Visualizes chronologically with 15-minute buffer enforcement, stat pills, and rescheduling modal triggers.
- `#clients` (Directorio de Clientes): Search and client history intact.
- `+ Nueva Cita` Modal: Opens and captures intake fields cleanly.
### 4.3 Captured Screenshots
- Desktop View (1280x800): `docs/screenshots/roster-desktop.png`
- Mobile View (375x812): `docs/screenshots/roster-mobile.png`
---
## 5. Contract Friction Notices
- **Notice 1 (String Matching on HTTP 409 detail)**:
As anticipated in Section 2.1 of `SPEC-WORKSHOP-ROSTER.md`, disambiguating between duplicate check-in (`"This attendee has already checked in."`) and session capacity (`"El taller ha alcanzado su cupo máximo..."`) relies on substring matching on `response.detail`. This is preserved as an accepted pilot accommodation to maintain backend immutability on `armonia-api`. An M5 ticket will introduce machine-readable error codes (`error_code`).
Binary file not shown.

After

Width:  |  Height:  |  Size: 87 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB