- Pin 409 conflict detail string matching to backend commit d9c86e27 in workshop roster spec - Add absolute path anchoring and non-test database guardrails to QA seed script - Formalize three-stage owner approval sequence in pre-experiment baseline
14 KiB
type, role, status, project, feature, milestone, date, tags
| type | role | status | project | feature | milestone | date | tags | |||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| plan | specification-contract | draft | armonia-dashboard | workshop-roster-checkin | M4 | 2026-10-25 |
|
Specification Contract: Group Workshop Roster Quick Check-in
Contract Authority: Binding implementation contract for
armonia-dashboard.
Engineering Boundary: This specification defines what the operator must accomplish and how states behave. The component breakdown, DOM composition, and styling implementation belong to Anne Droid's engineering judgment. Implementation must be strictly additive and isolated; existing features (Follow-up Queue, Daily Agenda, Client Directory, Nueva Cita) must remain undisturbed and 100% passing.
1. Domain Context & User Goals
In Armonía del Ser, group services (e.g., Círculo de Cacao Presencial, Meditación con Cuencos) take place with multiple attendees (up to 12–25 capacity).
The Operator's Goal: On the day of the workshop, Jasmin or her assistant stands at reception. As participants arrive, the operator needs a mobile-first, high-density view to:
- Confirm which group workshop session is active today and review capacity metrics.
- Rapidly record digital attendance (1-tap check-in marking attendance and completing the booking).
- Identify payment state at a glance: identify who is pre-paid (
PAGADOvia SPEI) versus who must pay on arrival (PENDIENTE). - Collect cash on-site and acknowledge payment in the same 1-tap check-in action.
- Register and check in unexpected walk-in attendees without disrupting the session flow.
2. Precise Semantic Definitions & Status Mapping
2.1 The Two Workshop Counters
┌────────────────────────────────────────────────────────────────────────┐
│ Workshop Counter Semantics │
├─────────────────────┬──────────────────────────────────────────────────┤
│ Metric │ Business Meaning & Mutation Rules │
├─────────────────────┼──────────────────────────────────────────────────┤
│ occupied_count │ Total participants holding an active spot │
│ │ (status: RESERVED, COMPLETED, NO_SHOW). │
│ │ • Advance booking created: count increments. │
│ │ • Existing attendee checks in: count UNCHANGED. │
│ │ • Walk-in attendee registers: count increments. │
├─────────────────────┼──────────────────────────────────────────────────┤
│ attended_count │ Participants physically present & verified │
│ │ (booking_status: COMPLETED, attended: true). │
│ │ • Existing attendee checks in: count increments. │
│ │ • Walk-in attendee registers: count increments. │
└─────────────────────┴──────────────────────────────────────────────────┘
- Capacity Display: Formatted as
Ocupación: {occupied_count} / {max_capacity} ({attended_count} presentes). - 409 Conflict Disambiguation & Reconciliation Contract:
The backend issues
HTTP 409 Conflictin two distinct business scenarios, verified against pinned backend commitd9c86e27d926inarmonia-api/app/routers/rosters.py. The client must inspectresponse.detail(or error payload):- Already Checked-In Conflict (
detail: "This attendee has already checked in.") (app/routers/rosters.py#L196): Indicates an idempotent duplicate submission. The client must reconcile by updating the attendee row toASISTIÓ, disabling the check-in button, and showing an informative status toast ("El asistente ya contaba con asistencia registrada"). The client must never crash or treat this as a failed/unregistered state. - Capacity Exceeded Conflict (
detail: "El taller ha alcanzado su cupo máximo ({max_cap}) para esta sesión.") (app/routers/rosters.py#L332): Occurs during walk-in registration whenoccupied_count >= max_capacity. The client must detect the capacity message (e.g. matchingcupo máximo), display an explicit capacity error alert ("El taller ha alcanzado su cupo máximo (15) para esta sesión"), keep the modal form state intact for operator decision, and never optimistically increment attendance or report success.
- Already Checked-In Conflict (
- Ordinary Network / 500 Failure: Preserve the current UI state, do not change attendee status, and allow the operator to retry.
- Technical Debt & Future Contract Note: String matching on
response.detailis a pilot accommodation to preserve backend immutability onarmonia-api. A future M5 ADR will introduce structured machine-readable error codes (e.g.{"error_code": "ATTENDEE_ALREADY_CHECKED_IN"}).
2.2 Status Terminology Mapping Table
To prevent ambiguity between UI labels and backend persistence, all badge renderings must adhere to this mapping:
| UI Badge / Label | Visual Styling | Backend Entity | Persisted Status Field & Value |
|---|---|---|---|
REGISTRADO |
Slate/Neutral Pill | Booking |
booking_status: "RESERVED", attended: false |
ASISTIÓ |
Emerald/Green Pill | Booking |
booking_status: "COMPLETED", attended: true |
PAGADO |
Emerald/Green Pill | Booking & Payment |
payment_status: "ACKNOWLEDGED" |
PENDIENTE |
Amber/Orange Pill | Booking |
payment_status: "AWAITING_ACKNOWLEDGMENT" |
3. Resilient Error-Recovery Contract (The 5 States)
Every interactive view in this feature must explicitly handle the 5 states:
stateDiagram
[*] --> Loading: Switch to #rosters tab
Loading --> Empty: GET /rosters returns []
Loading --> Error_Roster: GET /rosters fails (Network/500)
Loading --> Roster_Ready: GET /rosters returns sessions
Error_Roster --> Loading: Tap "Reintentar"
Empty --> Loading: Change date picker
Roster_Ready --> Action_In_Flight: Tap Check-in or Submit Walk-in
Action_In_Flight --> Action_Error: POST fails (Timeout/Network)
Action_In_Flight --> Roster_Ready: POST succeeds (HTTP 200) -> Toast
Action_Error --> Roster_Ready: Toast error; row stays uncommitted
- Loading State: Render skeleton placeholder cards for workshop sessions and attendee rows. Layout shift (CLS) must remain
\le 0.05. - Empty State: If no group sessions exist for the selected date, display:
"No hay talleres grupales programados para esta fecha."
The date selector remains interactive so the operator can navigate to adjacent days. - Failed Roster Retrieval (Error with Retry): If
GET /rostersfails (network down or server error), display an inline error banner:"No se pudieron cargar los talleres. Verifica tu conexión."
Accompanied by an explicit<button class="btn btn-secondary">Reintentar</button>that re-triggers the fetch without a full page reload. - Action Failure & Conflict Recovery:
- Already-Checked-In Conflict (409): If the server reports the attendee is already checked in, the client reconciles state by updating the row to
ASISTIÓ, disabling check-in, and displaying an informative notice ("El asistente ya contaba con asistencia registrada"). - Capacity Reached Conflict (409): If a walk-in is rejected because the session is full, the client reports the capacity limit ("El taller ha alcanzado su cupo máximo"), leaves the form open for operator decision, and does not record attendance.
- Network / Server Error (5xx / Timeout): The client displays an accessible error toast, preserves the uncommitted attendee row state (no optimistic toggle), and keeps the action button enabled for immediate retry.
- Already-Checked-In Conflict (409): If the server reports the attendee is already checked in, the client reconciles state by updating the row to
- Success Feedback State: Upon successful check-in or walk-in:
- Immediate visual feedback on the row (
ASISTIÓbadge). - Display an accessible toast container equipped with
role="status"andaria-live="polite"announcing: "Asistencia registrada con éxito."
- Immediate visual feedback on the row (
4. Explicit Acceptance Criteria (AC)
AC-1: Workshop Session Selection & Capacity Overview
- Given the operator navigates to the "Talleres" tab (URL hash
#rosters), - When the view loads for the selected date (default: today),
- Then it queries
GET /rosters?date_from=YYYY-MM-DD&date_to=YYYY-MM-DD. - And it displays the group session title, scheduled time, and a capacity counter formatted as
Ocupación: {occupied_count} / {max_capacity} ({attended_count} presentes).
AC-2: Attendee Roster Display & Status Indicators
- Given an active workshop session with registered attendees,
- When the session roster renders,
- Then each attendee row displays: Client Name, Phone, Booking Code (
ADS-XXXX), Attendance Status (REGISTRADOvs.ASISTIÓ), and Payment Status (PAGADOvs.PENDIENTE). - And includes a 1-tap
wa.melink pre-populated with the attendee's phone.
AC-3: Existing Booking Check-in (Pre-paid)
- Given an attendee with
booking_status: "RESERVED"andpayment_status: "ACKNOWLEDGED", - When the operator taps the "Registrar Asistencia" button,
- Then the client sends
POST /rosters/quick-checkinwith payload{"booking_id": "<id>", "paid_cash": false}. - And upon HTTP 200, the row immediately updates to
ASISTIÓ, the check-in button disables, andattended_countincrements by 1.
AC-4: Existing Booking Check-in with Cash Payment Acknowledgment
- Given an attendee with
payment_status: "AWAITING_ACKNOWLEDGMENT", - When the operator taps check-in with "Cobro en efectivo recibido" checked,
- Then the client sends
POST /rosters/quick-checkinwith payload{"booking_id": "<id>", "paid_cash": true, "notes": "Cobro en puerta"}. - And upon HTTP 200, the row reflects both
ASISTIÓandPAGADO(ACKNOWLEDGED), andattended_countincrements by 1 without full page reload.
AC-5: Walk-in Attendee Quick Registration & Check-in
- Given an unregistered participant arrives at the workshop,
- When the operator taps "+ Registrar Asistente Sin Cita",
- Then a modal opens requesting: Full Name, Phone (WhatsApp), and Cash Payment toggle (defaults to
true/ checked, because walk-in reception is predominantly cash). - When submitted, the client sends
POST /rosters/quick-checkinwith Mode 2 payload:{"service_id": "<id>", "scheduled_at": "<iso>", "client_name": "...", "client_phone": "...", "paid_cash": true}. - And upon HTTP 200, the modal closes, the attendee appears in the list as
ASISTIÓandPAGADO, and bothoccupied_countandattended_countincrement by 1. - And the modal submit button disables while in flight to prevent accidental double-click duplicate registrations.
AC-6: Resilient Error Handling & Retry
- Given an error state (failed roster fetch or interrupted check-in),
- Then the UI exposes an actionable retry path without clearing existing form data or falsely marking attendees present.
AC-7: Mobile Ergonomics & Keyboard Accessibility
- All interactive controls (Check-in buttons, Cash toggles, Walk-in trigger, Modal inputs) must have touch targets of at least 44x44px.
- Roster rows must render cleanly at 375px viewport width without horizontal scroll overflow.
- All interactive controls must support sequential keyboard focus (
Tab/Shift+Tab) with visible:focus-visibleoutlines. - Toast feedback must announce to assistive technology via
role="status"andaria-live="polite".
5. Navigation & Architectural Conventions
- Tab Identifier:
rosters - URL Hash:
#rosters - Navigation Label: "Talleres"
- Header Integration: Integrated into
OperatorDashboardApp.renderShell()insrc/main.tsalongside#queue,#agenda,#clients, and#all. - Cash Toggle Default: In the walk-in modal, the "Cobro en efectivo recibido" toggle defaults to checked (
true). Rationale: In-person workshop walk-ins overwhelmingly settle entrance fees in cash at reception. Operators may uncheck if the client provides immediate SPEI transfer verification.
6. API Contract Reference
The view interacts strictly with existing endpoints defined in armonia-api:
- Endpoint 1:
GET /rosters?date_from={YYYY-MM-DD}&date_to={YYYY-MM-DD}&service_id={optional}- Response Shape:
list[RosterSessionRead](seeapp/schemas/roster.py).
- Response Shape:
- Endpoint 2:
POST /rosters/quick-checkin- Mode 1 (Existing Booking):
{ "booking_id": "uuid-str", "paid_cash": true, "notes": "Opcional" } - Mode 2 (Walk-In):
{ "service_id": "uuid-str", "scheduled_at": "2026-10-25T18:00:00Z", "client_name": "Nombre Cliente", "client_phone": "525512345678", "paid_cash": true } - Response:
QuickCheckinResponse(walk_in: bool,attendee: RosterAttendeeRead). - Conflict Behavior: HTTP 409 Conflict if attendee already completed or session at max capacity.
- Mode 1 (Existing Booking):