15 KiB
Tasks: User Profile Dashboard Filter
Input: Design documents from /specs/024-user-dashboard-filter/
Prerequisites: plan.md, spec.md, ux_reference.md, research.md, data-model.md, contracts/, quickstart.md
Tests: Include backend contract/integration tests and frontend integration tests because the specification and quickstart define independently testable scenarios and recovery behavior.
Organization: Tasks are grouped by user story to enable independent implementation and testing.
Format: [ID] [P?] [Story] Description
- [P]: Can run in parallel (different files, no dependencies)
- [Story]: User story label (
[US1],[US2],[US3]) for story-phase tasks only - Every task includes exact file path(s)
Phase 1: Setup (Shared Infrastructure)
Purpose: Initialize scaffolding and shared assets for profile preferences and dashboards filter UX.
- T001 Create feature scaffolding files in
backend/src/models/profile.py,backend/src/schemas/profile.py,backend/src/services/profile_service.py,backend/src/api/routes/profile.py, andfrontend/src/routes/profile/+page.svelte - T002 [P] Add shared fixture placeholders for profile/filter flows in
backend/tests/fixtures/profile/fixtures_profile_filter.jsonandfrontend/src/routes/profile/__tests__/fixtures/profile.fixtures.js - T003 [P] Add i18n placeholder keys for profile lookup/filter states in
frontend/src/lib/i18n/locales/en.jsonandfrontend/src/lib/i18n/locales/ru.json - T004 [P] Add profile navigation placeholder entry in
frontend/src/lib/components/layout/Sidebar.svelte
Phase 2: Foundational (Blocking Prerequisites)
Purpose: Implement core persistence, contracts, and API/client foundations required by all user stories.
⚠️ CRITICAL: No user story work starts before this phase is complete.
- T005 Implement persistent
UserDashboardPreferenceentity and repository access inbackend/src/models/profile.pyandbackend/src/core/auth/repository.py - T006 [P] Implement profile preference and Superset lookup schemas in
backend/src/schemas/profile.py - T007 [P] Implement Superset account lookup adapter for selected environment (paging/sort passthrough and normalization) in
backend/src/core/superset_client.py - T008 Implement profile domain orchestration in
backend/src/services/profile_service.py(CRITICAL: PRE authenticated user + payload/environment; POST self-scoped normalized preference save and deterministic actor matching helper; UX_STATE backend service, no direct UI states; TEST_FIXTUREvalid_profile_update; TEST_EDGEenable_without_username,cross_user_mutation,lookup_env_not_found) - T009 Implement profile API endpoints in
backend/src/api/routes/profile.py(CRITICAL: PRE valid auth token, self context,environment_idfor lookup; POST returns self-only preference payload or degraded lookup warning payload; UX_STATE supports profile page save/lookup state mapping through stable response shape; TEST_FIXTUREget_my_preference_ok; TEST_EDGEunauthorized_request,invalid_username_payload,superset_lookup_upstream_error) - T010 Wire profile router registration in
backend/src/api/routes/__init__.pyandbackend/src/app.py - T011 [P] Extend frontend API methods for profile preferences, Superset account lookup, and dashboards profile filter params in
frontend/src/lib/api.js - T012 [P] Create backend test skeletons for profile and dashboards filter contracts in
backend/src/api/routes/__tests__/test_profile_api.pyandbackend/src/api/routes/__tests__/test_dashboards.py
Checkpoint: Foundation ready; user stories can now be implemented and validated independently.
Phase 3: User Story 1 - Configure Dashboard Filter Preference (Priority: P1) 🎯 MVP
Goal: Let user bind Superset account (with environment-based lookup), save global username + default toggle, and see filtered dashboards by default.
Independent Test: On profile page select environment, load/select account (or manual fallback), save enabled preference, then open /dashboards and verify only matching dashboards (owners OR modified_by) are shown.
Tests for User Story 1
- T013 [P] [US1] Add contract tests for
GET/PATCH /api/profile/preferencesvalidation and persistence rules inbackend/src/api/routes/__tests__/test_profile_api.py - T014 [P] [US1] Add dashboards filter contract tests for
owners OR modified_bywith trim + case-insensitive matching inbackend/src/api/routes/__tests__/test_dashboards.py - T015 [P] [US1] Add frontend integration test for profile binding happy path (lookup success and manual fallback save) in
frontend/src/routes/profile/__tests__/profile-preferences.integration.test.js
Implementation for User Story 1
- T016 [US1] Implement lookup + save rules (global username, normalization, non-blocking degraded lookup) in
backend/src/services/profile_service.py(CRITICAL: PRE authenticated user and selected environment for lookup; POST persisted normalized global username and lookup fallback remains save-capable; UX_STATE supportsLookupLoading/LookupError/Saving/SaveSuccess/SaveErrorvia service outcomes; TEST_FIXTUREvalid_profile_update; TEST_EDGEenable_without_username,lookup_env_not_found) - T017 [US1] Implement profile route request/response mapping for preference save/get + account lookup in
backend/src/api/routes/profile.py(CRITICAL: PRE self-scoped authenticated request; POST stableProfilePreferenceResponseandSupersetAccountLookupResponse; UX_STATE provides explicit degraded warning for profile UI recovery; TEST_FIXTUREget_my_preference_ok; TEST_EDGEinvalid_username_payload,superset_lookup_upstream_error) - T018 [US1] Implement default profile filtering on dashboards main list in
backend/src/api/routes/dashboards.py(CRITICAL: PRE parsedpage_context/apply_profile_default/override_show_allquery context; POST response totals and pagination remain deterministic withowners OR modified_bymatching; UX_STATE supports filtered list and empty-filtered state metadata; TEST_FIXTUREprofile_filter_applied; TEST_EDGEno_match_results) - T019 [P] [US1] Implement profile page form with environment selector, account suggestions, manual username field, toggle, and save/cancel actions in
frontend/src/routes/profile/+page.svelte(CRITICAL: PRE authenticated user and initial preference load; POST persisted values reflected in form state; UX_STATEDefault,LookupLoading,LookupError,Saving,SaveSuccess,SaveError; TEST_FIXTUREbind_account_happy_path; TEST_EDGElookup_failed_manual_fallback,invalid_username,cancel_changes) - T020 [P] [US1] Implement dashboards active-filter indicator and filtered empty-state rendering in
frontend/src/routes/dashboards/+page.svelte(CRITICAL: PRE effective filter metadata returned by dashboards API; POST filtered context is visible and understandable; UX_STATEFilterActive,EmptyFiltered; TEST_FIXTUREdefault_profile_filter_applied; TEST_EDGEno_matching_dashboards) - T021 [US1] Finalize localized copy for profile binding, lookup warning, and filter-active texts in
frontend/src/lib/i18n/locales/en.jsonandfrontend/src/lib/i18n/locales/ru.json - T022 [US1] Verify implementation matches
specs/024-user-dashboard-filter/ux_reference.md(Happy Path & Errors)
Checkpoint: US1 is independently functional and demo-ready as MVP.
Phase 4: User Story 2 - Manage Profile Settings (Priority: P2)
Goal: Ensure profile settings are easy to access/manage over time, with self-only edit enforcement and predictable cancel/reload behavior.
Independent Test: Open profile page, confirm existing values preload, change then cancel to keep original values, save valid changes, and verify cross-user edits are rejected.
Tests for User Story 2
- T023 [P] [US2] Add backend authorization tests for self-only preference mutation and cross-user rejection in
backend/src/api/routes/__tests__/test_profile_api.py - T024 [P] [US2] Add frontend tests for preload, cancel without persistence, and saved-state reload in
frontend/src/routes/profile/__tests__/profile-settings-state.integration.test.js
Implementation for User Story 2
- T025 [US2] Implement preload and cancel-to-last-saved behavior in
frontend/src/routes/profile/+page.svelte(CRITICAL: PRE current preference loaded before editing; POST cancel does not mutate persisted data; UX_STATEDefault,Saving,SaveErrorretain user context; TEST_EDGEcancel_changes) - T026 [US2] Enforce self-scope mutation guard across service and route in
backend/src/services/profile_service.pyandbackend/src/api/routes/profile.py(CRITICAL: PRE authenticated actor identity; POST attempts to mutate another user are denied; UX_STATE maps denial into actionable error feedback; TEST_EDGEcross_user_mutation) - T027 [US2] Implement consistent save success/error/validation feedback mapping in
frontend/src/routes/profile/+page.svelteandfrontend/src/lib/api.js(CRITICAL: PRE response includes validation or error details; POST user gets clear recovery guidance without data loss; UX_STATESaveSuccess,SaveError; TEST_EDGEinvalid_username) - T028 [US2] Verify implementation matches
specs/024-user-dashboard-filter/ux_reference.md(Happy Path & Errors)
Checkpoint: US2 independently functional with robust state management and ownership guardrails.
Phase 5: User Story 3 - Override Dashboard Filter (Priority: P3)
Goal: Allow temporary "show all dashboards" override on dashboards page without changing saved default preference.
Independent Test: With default filter enabled, clear filter on /dashboards to see all dashboards, then leave and return to /dashboards and verify default filter is restored automatically.
Tests for User Story 3
- T029 [P] [US3] Add backend tests for
override_show_all,page_context, and effective filter metadata semantics inbackend/src/api/routes/__tests__/test_dashboards.py - T030 [P] [US3] Add frontend integration test for temporary clear and restore-on-return flow in
frontend/src/routes/dashboards/__tests__/dashboard-profile-override.integration.test.js
Implementation for User Story 3
- T031 [US3] Implement override semantics and effective filter metadata in dashboards API response in
backend/src/api/routes/dashboards.py(CRITICAL: PRE main-list context with override flag; POSTeffective_profile_filter.applied=falsewhen override is active and persisted preference remains unchanged; UX_STATE enables clear distinction between active-filter and override states; TEST_FIXTUREprofile_filter_applied; TEST_EDGEoverride_show_all,no_match_results) - T032 [US3] Implement temporary show-all control and restore-on-return behavior in
frontend/src/routes/dashboards/+page.svelte(CRITICAL: PRE active filtered state available from response metadata; POST override is page-scoped and non-persistent; UX_STATEFilterActive,OverrideActive,EmptyFiltered; TEST_FIXTUREdefault_profile_filter_applied; TEST_EDGEtemporary_show_all,return_to_page) - T033 [US3] Verify implementation matches
specs/024-user-dashboard-filter/ux_reference.md(Happy Path & Errors)
Checkpoint: US3 independently functional with non-persistent override behavior.
Phase 6: Polish & Cross-Cutting Concerns
Purpose: Align final contracts/docs and record verification evidence across all delivered stories.
- T034 [P] Reconcile OpenAPI contract with implemented payloads and query semantics in
specs/024-user-dashboard-filter/contracts/api.yaml - T035 [P] Reconcile CRITICAL module contract annotations and edge-case traces in
specs/024-user-dashboard-filter/contracts/modules.md - T036 [P] Execute quickstart validation and record outcomes in
specs/024-user-dashboard-filter/quickstart.mdandspecs/024-user-dashboard-filter/tests/coverage.md - T037 Document final implementation notes and operational constraints in
specs/024-user-dashboard-filter/plan.md
Dependencies & Execution Order
Phase Dependencies
- Phase 1 (Setup): no dependencies
- Phase 2 (Foundational): depends on Phase 1; blocks all user stories
- Phase 3 (US1): depends on Phase 2 and delivers MVP
- Phase 4 (US2): depends on Phase 2 and integrates with US1 profile baseline
- Phase 5 (US3): depends on Phase 2 and builds on US1 filtered dashboards baseline
- Phase 6 (Polish): depends on completion of selected user stories
User Story Dependency Graph
- US1 (P1): first deliverable and base for profile + default filtering
- US2 (P2): extends profile management behavior and ownership guarantees
- US3 (P3): extends dashboards behavior with temporary override
Graph: US1 -> {US2, US3}
Parallel Opportunities
- Setup: T002, T003, T004
- Foundational: T006, T007, T011, T012 after T005 baseline
- US1: T013, T014, T015 in parallel; T019 and T020 can proceed in parallel after backend contracts stabilize
- US2: T023 and T024 in parallel
- US3: T029 and T030 in parallel
- Polish: T034, T035, T036 in parallel
Parallel Example: User Story 1
Task: "T013 [US1] Contract tests for profile preferences in backend/src/api/routes/__tests__/test_profile_api.py"
Task: "T014 [US1] Dashboards matching tests in backend/src/api/routes/__tests__/test_dashboards.py"
Task: "T015 [US1] Frontend profile binding integration test in frontend/src/routes/profile/__tests__/profile-preferences.integration.test.js"
Task: "T019 [US1] Profile page UI implementation in frontend/src/routes/profile/+page.svelte"
Task: "T020 [US1] Dashboards filter indicator implementation in frontend/src/routes/dashboards/+page.svelte"
Parallel Example: User Story 2
Task: "T023 [US2] Backend self-scope auth tests in backend/src/api/routes/__tests__/test_profile_api.py"
Task: "T024 [US2] Frontend preload/cancel tests in frontend/src/routes/profile/__tests__/profile-settings-state.integration.test.js"
Parallel Example: User Story 3
Task: "T029 [US3] Backend override semantics tests in backend/src/api/routes/__tests__/test_dashboards.py"
Task: "T030 [US3] Frontend override restore integration test in frontend/src/routes/dashboards/__tests__/dashboard-profile-override.integration.test.js"
Implementation Strategy
MVP First (Recommended)
- Complete Phase 1 + Phase 2.
- Complete Phase 3 (US1).
- Validate US1 independent test criteria.
- Demo/deploy MVP.
Incremental Delivery
- Deliver US1 (profile binding + default filtering).
- Deliver US2 (profile management reliability + self-scope hardening).
- Deliver US3 (temporary override behavior).
- Run Phase 6 cross-cutting validation and contract/documentation alignment.
UX Preservation Rule
No task in this plan intentionally degrades UX defined in specs/024-user-dashboard-filter/ux_reference.md.
Mandatory UX verification tasks are included at the end of each user story phase: T022, T028, T033.