Flow A now drives the real screens - detail page, Send-to modal, dept-response
page, Accept button - so the run is watchable in headed mode. Each visible step
falls back to a direct POST if the UI doesn't persist, so the flow still
completes reliably. Flows B/C unchanged.
ensureAuth() probes an auth-required endpoint after each login() and re-logs-in
if the session hasn't settled (occasionally needed under slowMo after rapid
role swaps). Also observes the HTTP status of every second-pass POST so any
auth bounce is visible. App logic unchanged (verified via the test client).
Adds headed Playwright coverage for the full send-to-department lifecycle
(PX send -> champion investigates -> manager approves/rejects -> PX accepts ->
resolve), including the token investigation sub-flow and both reject loops.
Bugs fixed (found by the new test):
- champion_start_investigation: NameError - InvestigationAnswer not imported
(complaints/views.py) -> the "create questions" POST was 500ing
- champion_start_investigation: staff_member.phone_number -> Staff.phone
(would have AttributeError'd once the import was fixed)
Harness:
- create_e2e_isolated_env: bind dept-manager as department.manager + create
e2e-staff Staff profile in the champion's department
- seed_e2e_complaint, get_e2e_workflow_state CLI helpers for setup/assertions
- champion-manager-workflow.spec.ts (flows A/B/C1/C2)
Report: appended "Champion/Manager Workflow Audit" section.
Pre-production security fixes to prevent cross-hospital data leaks:
- Standards API: add get_queryset() filtering by department__hospital
- Reports service: add user param with hospital filtering to all querysets
- RCA views: replace is_superuser with tenant_hospital pattern, add access
checks to all 11 mutation views
- Notifications views: replace is_superuser patterns with _get_notification_hospital
helper across all 5 settings functions
- Appreciation API: add tenant_hospital fallback to AppreciationViewSet,
AppreciationStatsViewSet, and LeaderboardView
- AI Analytics: add tenant_hospital fallback in ExecutiveSummaryGenerator and
ActionRecommendationEngine
- SourceUserRestrictionMiddleware: remove None from ALLOWED_URL_NAMES
- Complaint export: fix nullable patient/due_at/description crashes in CSV
and Excel export, fix invalid get_category_display/get_source_display calls
E2E test updates:
- Update isolation gap tests to actively assert hospital filtering
- Fix CSV export test to use API context for download handling
- Switch clinical-staff tests to serial mode to prevent race conditions