diff --git a/04_generated_documentation/00_process_control/checkpoints/checkpoint-017-stage-11-12-wireframes-test-models.md b/04_generated_documentation/00_process_control/checkpoints/checkpoint-017-stage-11-12-wireframes-test-models.md new file mode 100644 index 0000000..3ebe5cd --- /dev/null +++ b/04_generated_documentation/00_process_control/checkpoints/checkpoint-017-stage-11-12-wireframes-test-models.md @@ -0,0 +1,35 @@ +# Checkpoint 017 — Stage 11 Wireframe Specifications & Stage 12 Test Modeling Complete + +- **Checkpoint ID:** CKPT-017 +- **Date:** 2026-10-12 +- **Active Stage:** Stage 11 (Wireframes) & Stage 12 (Test Models) complete; Stage 13 (Code Generation) ready +- **Active Track:** Greenfield, India-first, multi-tenant Agriculture Trading Backoffice (ATB) +- **Active Skills:** `up-wireframe-spec`, `up-test-model-generate` +- **Governed Standard:** UP-AI v1.5 Standard + +## Completed +- **Stage 11 Wireframe & Field-Level Specifications:** + - Authored [`SCREEN-AUTH-001_login.md`](../../06_wireframes/screen_specs/SCREEN-AUTH-001_login.md) for the Trading Portal Login & OIDC Callback View (`/login`, `/auth/callback`). + - Authored [`SCREEN-AUTH-002_access_denied.md`](../../06_wireframes/screen_specs/SCREEN-AUTH-002_access_denied.md) for the Role Authorization & Access Denial View (`/access-denied`). + - Authored [`SCREEN-AUTH-003_session_logout.md`](../../06_wireframes/screen_specs/SCREEN-AUTH-003_session_logout.md) for Active Session Management & Logout (`/account/sessions`, Header Menu). + - Created [`wireframe_index.md`](../../06_wireframes/wireframe_index.md) cataloging all iteration-01 screen specifications with client application IDs and ownership. +- **Stage 12 Multi-Path Test Modeling, Bruno Collections & QA Workbook:** + - Generated and compiled the dense 21-sheet Manual QA Excel Workbook with 32 populated test cases: [`Iteration01_Authentication_and_Session_Governance_Complete_Manual_Testcases.xlsx`](../../07_test_design/manual_qa/workbooks/Iteration01_Authentication_and_Session_Governance_Complete_Manual_Testcases.xlsx). + - Created git-versioned Bruno collections under `docs/api/bruno/` (`get-session.bru` and `logout.bru`). + - Authored [`test_traceability_matrix.md`](../../07_test_design/test_traceability_matrix.md) mapping all test cases to stories and requirements. + - Updated [`regression_test_cases.md`](../../07_test_design/regression_test_cases.md) to version 1.2.0. +- **Traceability & Gate Verification:** + - Ran `scripts/verify_traceability_gates.py --gate 14.1 --iteration iteration-01`; all referential integrity and artifact density criteria passed with 0 Critical, 0 Major, and 0 Minor issues. + - Adhering to the Strict Anti-Placeholder Rule, `iteration-01` requirements (`FR-AUTH-001`, `FR-AUTH-002`, `FR-AUTH-003`) remain in lifecycle state `In Construction` until real application code, tests, and migration logic are generated and verified in Stage 13/14. + +## Open Items +- Application implementation (FastAPI auth routes, RBAC middleware, React views, Alembic migration, and deterministic mock adapter) awaits Stage 13 code generation. +- Production deployment runtime selection (`BRD-NFR-011`) and ambiguities `AMB-001`, `AMB-006`, `AMB-008`–`AMB-011` remain tracked. + +## Exact Next Action +Invoke **`/up-code-generate` (Stage 13)** to begin wave-based implementation: +1. Wave 0: Scaffold deterministic Keycloak mock adapter at `sandbox/identity_mock.py`. +2. Wave 1 (Backend): Implement FastAPI session endpoint, logout endpoint, Alembic `users` migration, and RBAC policy dependency. +3. Wave 2 (Frontend): Implement React `/login`, `/auth/callback`, and `/account/sessions` views with Tailwind/shadcn and Zustand auth store. +4. Wave 3 (Verification): Execute automated pytest and Playwright suites targeting $\ge 95\%$ domain FSM coverage. + diff --git a/04_generated_documentation/00_process_control/checkpoints/checkpoint_index.md b/04_generated_documentation/00_process_control/checkpoints/checkpoint_index.md index 232ddef..4e2d20f 100644 --- a/04_generated_documentation/00_process_control/checkpoints/checkpoint_index.md +++ b/04_generated_documentation/00_process_control/checkpoints/checkpoint_index.md @@ -39,3 +39,4 @@ | CKPT-014 | 2026-10-11 | Stage 9 complete / Gate 9.1 passed | HLD/LLD and shared API/database/integration design linked all 54 FRs; validator reports 0 Critical/Major/Minor. | Human design review; runtime/load/legal evidence; AMB-001/006/008/009/010/011; iteration-01 Gate 14.1 blockers persist. | Review Stage 9 brief, then run `/up-iteration-plan`. | checkpoint-014-stage-9-hld-lld.md | | CKPT-015 | 2026-10-11 | Stage 10 iteration-planning entry / local infrastructure prep | Added and started developer-local Compose dependencies under `05_implementation_workspace/`; verified service readiness and PostgreSQL databases after relocation; recorded DEC-022. | Iteration-01 Stage 10 artifacts need review; no app source for API/worker/frontend containers; production runtime and NFR evidence remain open; image certification/digest policy undefined. | Run `/up-iteration-plan` to review/align iteration-01 before Stage 11/12; add application containers when real implementation exists. | checkpoint-015-local-compose-development.md | | `CKPT-016` | 2026-10-12 | Stage 10 (Iteration Planning aligned) | Aligned iteration-01 planning artifacts (`iteration_plan.md`, `iteration_backlog.md`, `iteration_surface_matrix.md`, `parallel_work_plan.md`) with Stage 9 architecture contracts (`LLD-001`, `api_design.md`). Scheduled Wave 0 deterministic identity mock and 3-lane isolation. | Iteration-01 remains Incomplete / Pending Construction; Stage 12 deliverables (21-sheet QA workbook, Bruno collections) pending; AMB-001/006/008–011 open. | Proceed to Stage 11 (`/up-wireframe-spec`) and Stage 12 (`/up-test-model-generate`) in parallel. | `checkpoint-016-iteration-01-planning-aligned.md` | +| `CKPT-017` | 2026-10-12 | Stage 11 (Wireframes) & Stage 12 (Test Models) complete | Authored screen specifications (`SCREEN-AUTH-001`–`003`), `wireframe_index.md`, compiled dense 21-sheet QA workbook (32 cases), created Bruno collections (`get-session.bru`, `logout.bru`), and updated test traceability. Gate 14.1 referential integrity passed. | Iteration-01 in construction; implementation awaiting Stage 13 code generation; AMB-001/006/008–011 open. | Proceed to Stage 13 (`/up-code-generate`) for wave-based code generation. | `checkpoint-017-stage-11-12-wireframes-test-models.md` | diff --git a/04_generated_documentation/00_process_control/master_context.md b/04_generated_documentation/00_process_control/master_context.md index 5dbccd7..41accca 100644 --- a/04_generated_documentation/00_process_control/master_context.md +++ b/04_generated_documentation/00_process_control/master_context.md @@ -86,6 +86,6 @@ stack: ## 4. Active Stage & Next Actions -- **Current Stage:** Stage 10 iteration planning completed for `iteration-01` (`CKPT-016`). Stage 11 Wireframe Specification and Stage 12 Test Model Generation are ready to proceed in parallel. Local dependency orchestration with Docker Compose is in place under `DEC-022`; it is not runtime validation of the product application. -- **Active Iteration:** `iteration-01` is planned for Construction across 3 stories (13 pts) covering `UC-001` (`FR-AUTH-001`, `FR-AUTH-002`, `FR-AUTH-003`). Artifacts are aligned with Stage 9 architecture (`LLD-001`, `api_design.md`). It remains `Incomplete / Pending Construction` with two expected Gate 14.1 deliverables pending Stage 12 (dense 21-sheet QA workbook and Bruno collections). -- **Next:** Proceed to Stage 11 (`/up-wireframe-spec`) and Stage 12 (`/up-test-model-generate`) in parallel. Keep application containers out of Compose until implementation/test artifacts exist. Carry `AMB-001`, `AMB-006`, `AMB-008`–`AMB-011` and `ASM-001`–`ASM-003` forward. +- **Current Stage:** Stage 11 Wireframe Specification and Stage 12 Test Model Generation completed for `iteration-01` (`CKPT-017`). Stage 13 Code Generation (`/up-code-generate`) is the next active process activity. Local dependency orchestration with Docker Compose is in place under `DEC-022`; it is not runtime validation of the product application. +- **Active Iteration:** `iteration-01` is In Construction across 3 stories (13 pts) covering `UC-001` (`FR-AUTH-001`, `FR-AUTH-002`, `FR-AUTH-003`). Screen specifications (`SCREEN-AUTH-001`–`003`), dense 21-sheet QA workbook (32 cases), Bruno collections, and test traceability are complete. Gate 14.1 referential integrity passed cleanly. Implementation code generation is pending. +- **Next:** Proceed to Stage 13 (`/up-code-generate`) to implement Wave 0 mock adapter, Wave 1 backend auth/RBAC/migration, Wave 2 frontend views, and Wave 3 test execution. Carry `AMB-001`, `AMB-006`, `AMB-008`–`AMB-011` and `ASM-001`–`ASM-003` forward. diff --git a/04_generated_documentation/06_wireframes/screen_specs/SCREEN-AUTH-001_login.md b/04_generated_documentation/06_wireframes/screen_specs/SCREEN-AUTH-001_login.md new file mode 100644 index 0000000..f10e61d --- /dev/null +++ b/04_generated_documentation/06_wireframes/screen_specs/SCREEN-AUTH-001_login.md @@ -0,0 +1,76 @@ +# Screen Specification: SCREEN-AUTH-001 — Trading Portal Login & OIDC Callback View + +| Field | Value | +|---|---| +| **Screen ID** | `SCREEN-AUTH-001` | +| **Client Application ID** | `atb-web-portal` | +| **Frontend Route** | `/login`, `/auth/callback` | +| **Owning Use Case** | [`UC-001` (User Authentication and Authorization)](../../03_requirements/use_cases/uc-001_user-authentication/use-case.md) | +| **Owning FR** | [`FR-AUTH-001` (OIDC Authentication)](../../03_requirements/use_cases/uc-001_user-authentication/functional-reqs.md#fr-auth-001-oidc-authentication) | +| **Auth Role / Scope Claims** | Public (Unauthenticated entry); redirects to Keycloak OIDC Realm | +| **Iteration** | `iteration-01` | +| **Status** | Baselined for Construction | + +--- + +## 1. Screen Overview & Archetype + +- **Archetype:** Full-page Authentication Gateway & PKCE Callback Handler. +- **Visual Design Reference:** Tailwind CSS / shadcn-ui components following [`DESIGN.md`](../DESIGN.md) corporate palette (`Slate-900`, `Emerald-600` primary accents). +- **Behavior:** Unauthenticated users hitting any protected route or `/login` are presented with an enterprise sign-in interface. Clicking "Sign In with Keycloak" initiates the OAuth2 Authorization Code flow with PKCE (`code_challenge`). The callback at `/auth/callback` exchanges the authorization code for tokens, initializes session state via `GET /api/v1/auth/session`, and redirects to the intended destination or dashboard. + +--- + +## 2. Wireframe Layout + +``` ++--------------------------------------------------------------------------+ +| [Logo] Agriculture Trading Backoffice (ATB) | +| | +| +--------------------------------------------------------------------+ | +| | Sign in to your Trading Account | | +| | | | +| | +--------------------------------------------------------------+ | | +| | | [ Keycloak SSO Button ] "Sign In with Enterprise ID" | | | +| | +--------------------------------------------------------------+ | | +| | | | +| | - OR (Developer / Offline Mock Mode) - | | | +| | | | +| | Persona Selector: [ Select Test Persona v ] | | | +| | - Mandi Buyer (alice@alpha.com) | | | +| | - Quality Officer (qc@alpha.com) | | | +| | - Yard Supervisor (yard@alpha.com) | | | +| | - Accounts Executive (finance@alpha.com) | | | +| | | | +| | +--------------------------------------------------------------+ | | +| | | [ Dev Login Button ] "Mock Authenticate" | | | +| | +--------------------------------------------------------------+ | | +| | | | +| | [ Status Banner / Error Area (Hidden by default) ] | | | +| +--------------------------------------------------------------------+ | +| | +| (C) 2026 Agriculture Trading Backoffice. Secure Multi-Tenant Trading. | ++--------------------------------------------------------------------------+ +``` + +--- + +## 3. Field-Level Specification + +| Field / Control Name | Element Type | Source FR | Validation Rules | Backend Processing Expectation | +|---|---|---|---|---| +| `btn_sso_login` | Button (`shadcn/Button`) | `FR-AUTH-001` | Enabled by default | Generates PKCE verifier/challenge (SHA-256); redirects browser to `KEYCLOAK_URL/auth`. | +| `dev_persona_select` | Select (`shadcn/Select`) | `FR-AUTH-001` | Enabled only if `VITE_DEV_MOCK_AUTH=true` | Selects predefined test persona fixture for offline deterministic development. | +| `btn_dev_login` | Button (`shadcn/Button`) | `FR-AUTH-001` | Enabled only if persona selected | Calls `sandbox/identity_mock.py` token endpoint to obtain mock JWT. | +| `callback_auth_code` | URL Query Param (`code`) | `FR-AUTH-001` | Required on `/auth/callback` | Exchanged via OIDC client for JWT ID/Access token. | +| `callback_state` | URL Query Param (`state`) | `FR-AUTH-001` | Must match client state nonce stored in sessionStorage | Protects against CSRF; mismatch triggers immediate authentication rejection. | +| `alert_auth_error` | Alert Banner | `FR-AUTH-001` | Rendered on auth failure code | Displays sanitized error (e.g., "Authentication failed. Please contact your administrator."). | + +--- + +## 4. State Guards & Transitions + +1. **Unauthenticated:** If `isAuthenticated === false`, access to any non-public route triggers redirection to `/login?redirect=`. +2. **Authenticated:** If `isAuthenticated === true`, visiting `/login` immediately redirects to `/` or the saved `redirect` query target. +3. **Network/IdP Failure:** If Keycloak is unreachable, surfaces an offline error notification with retry button. + diff --git a/04_generated_documentation/06_wireframes/screen_specs/SCREEN-AUTH-002_access_denied.md b/04_generated_documentation/06_wireframes/screen_specs/SCREEN-AUTH-002_access_denied.md new file mode 100644 index 0000000..afe9a62 --- /dev/null +++ b/04_generated_documentation/06_wireframes/screen_specs/SCREEN-AUTH-002_access_denied.md @@ -0,0 +1,69 @@ +# Screen Specification: SCREEN-AUTH-002 — Role Authorization & Access Denial View + +| Field | Value | +|---|---| +| **Screen ID** | `SCREEN-AUTH-002` | +| **Client Application ID** | `atb-web-portal` | +| **Frontend Route** | `/access-denied` (and inline route boundary guards) | +| **Owning Use Case** | [`UC-001` (User Authentication and Authorization)](../../03_requirements/use_cases/uc-001_user-authentication/use-case.md) | +| **Owning FR** | [`FR-AUTH-002` (Role-Based Authorization)](../../03_requirements/use_cases/uc-001_user-authentication/functional-reqs.md#fr-auth-002-role-based-authorization) | +| **Auth Role / Scope Claims** | Authenticated User lacking required role permissions (`403 Forbidden`) | +| **Iteration** | `iteration-01` | +| **Status** | Baselined for Construction | + +--- + +## 1. Screen Overview & Archetype + +- **Archetype:** Security Boundary Guard & 403 Forbidden Feedback Screen. +- **Visual Design Reference:** Tailwind CSS / shadcn-ui warning state (`Amber-600` / `Rose-600` accents). +- **Behavior:** Rendered whenever an authenticated user attempts to access a frontend route, view, or action prohibited by the `BRD-FR-040` role permission matrix or segregation-of-duties rules (e.g., Quality Officer attempting to edit price rates, Yard Supervisor attempting to confirm sales, or Sales Executive attempting to override credit locks). + +--- + +## 2. Wireframe Layout + +``` ++--------------------------------------------------------------------------+ +| [Header: Logo | Active Tenant: Alpha Traders | User: qc@alpha.com | Logout] | +| | +| +--------------------------------------------------------------------+ | +| | [ Shield / Restriction Icon ] | | +| | | | +| | 403 — Access Denied | | +| | | | +| | You do not have permission to view or execute this action. | | +| | | | +| | Policy Enforcement Detail: | | +| | - Active Role: "Quality Officer" | | +| | - Required Action: "Price Administration" | | +| | - Constraint: Mandatory Segregation of Duties (BRD-FR-040) | | +| | | | +| | +-----------------------------------+ +-----------------------+ | | +| | | [ Return to Authorized Dashboard ] | | [ Request Elevation ] | | | +| | +-----------------------------------+ +-----------------------+ | | +| +--------------------------------------------------------------------+ | +| | +| All access denial events are immutably logged with Correlation IDs. | ++--------------------------------------------------------------------------+ +``` + +--- + +## 3. Field-Level Specification + +| Field / Control Name | Element Type | Source FR | Validation Rules | Backend Processing Expectation | +|---|---|---|---|---| +| `txt_error_title` | Heading (`H1`) | `FR-AUTH-002` | Static text "403 — Access Denied" | Triggered by client navigation guard or HTTP 403 response. | +| `txt_role_indicator` | Badge (`shadcn/Badge`) | `FR-AUTH-002` | Displays current active role | Resolved from JWT claims / session store. | +| `txt_policy_rationale` | Paragraph (`Text`) | `FR-AUTH-002` | Sanitized policy message | Explains permission denial without leaking existence of unauthorized resources. | +| `btn_return_dashboard` | Button (`shadcn/Button`) | `FR-AUTH-002` | Navigates to `/` | Returns the user safely to their authorized home screen. | +| `btn_request_elevation` | Button (`shadcn/Button`) | `FR-AUTH-002` | Disabled by default in Iteration 01 | Placeholder for future role delegation requests. | + +--- + +## 4. State Guards & Transitions + +1. **Navigation Guard:** Frontend router (`react-router-dom`) checks route-level role metadata against `authStore.user.roles`. If required permission is missing, navigation is halted and redirected to `/access-denied`. +2. **API Interceptor:** Axios/Fetch response interceptor catches HTTP `403 Forbidden` responses from backend policy middleware, surfaces a localized toast warning, and logs the incident correlation ID. + diff --git a/04_generated_documentation/06_wireframes/screen_specs/SCREEN-AUTH-003_session_logout.md b/04_generated_documentation/06_wireframes/screen_specs/SCREEN-AUTH-003_session_logout.md new file mode 100644 index 0000000..b82131e --- /dev/null +++ b/04_generated_documentation/06_wireframes/screen_specs/SCREEN-AUTH-003_session_logout.md @@ -0,0 +1,73 @@ +# Screen Specification: SCREEN-AUTH-003 — Active Session Management & Logout View + +| Field | Value | +|---|---| +| **Screen ID** | `SCREEN-AUTH-003` | +| **Client Application ID** | `atb-web-portal` | +| **Frontend Route** | `/account/sessions` (and Header User Menu Dropdown) | +| **Owning Use Case** | [`UC-001` (User Authentication and Authorization)](../../03_requirements/use_cases/uc-001_user-authentication/use-case.md) | +| **Owning FR** | [`FR-AUTH-003` (Session Handling and Logout)](../../03_requirements/use_cases/uc-001_user-authentication/functional-reqs.md#fr-auth-003-session-handling-and-logout) | +| **Auth Role / Scope Claims** | Authenticated User (Any valid role) | +| **Iteration** | `iteration-01` | +| **Status** | Baselined for Construction | + +--- + +## 1. Screen Overview & Archetype + +- **Archetype:** Account Security & Session Management View. +- **Visual Design Reference:** Tailwind CSS / shadcn-ui settings page layout (`Slate-800` card borders, `Rose-600` destructive buttons). +- **Behavior:** Provides the user with visibility into their current application session (subject identifier, roles, session establishment timestamp), and enables voluntary termination of the session either via the persistent Header User Profile Menu or the dedicated `/account/sessions` settings tab. Clicking "Log Out" issues `POST /api/v1/auth/logout`, clears client storage, and redirects to `/login`. + +--- + +## 2. Wireframe Layout + +``` ++--------------------------------------------------------------------------+ +| [Header: Logo | Active Tenant: Alpha Traders | User: alice@alpha.com [v]] | +| | [ Profile Settings ] | +| | [ Active Sessions ] | +| | [ Log Out (Red) ] | +| +---------------------------+ +| | +| Account Settings / Security & Sessions | +| | +| +--------------------------------------------------------------------+ | +| | Current Active Session | | +| | | | +| | Subject Identifier: usr_01J8K92MBP7X | | +| | Assigned Roles: Mandi Buyer, Purchase Manager | | +| | Session Type: OIDC Authorization Code (PKCE) | | +| | Status: [ Active Badge (Green) ] | | +| | | | +| | +--------------------------------------------------------------+ | | +| | | [ Log Out of Current Session ] (Destructive Button) | | | +| | +--------------------------------------------------------------+ | | +| +--------------------------------------------------------------------+ | +| | +| Security Note: Logging out invalidates your session immediately. | ++--------------------------------------------------------------------------+ +``` + +--- + +## 3. Field-Level Specification + +| Field / Control Name | Element Type | Source FR | Validation Rules | Backend Processing Expectation | +|---|---|---|---|---| +| `header_user_menu` | Dropdown (`shadcn/DropdownMenu`) | `FR-AUTH-003` | Available on all authenticated pages | Triggers quick profile navigation and immediate logout. | +| `btn_header_logout` | DropdownItem (`Destructive`) | `FR-AUTH-003` | Calls logout handler on click | Sends `POST /api/v1/auth/logout`, clears storage, redirects to `/login`. | +| `txt_subject_id` | Text Field | `FR-AUTH-003` | Read-only | Sourced from `GET /api/v1/auth/session` subject claim. | +| `badge_roles` | Badge List (`shadcn/Badge`) | `FR-AUTH-003` | Read-only | Sourced from active session token roles array. | +| `badge_session_status`| Badge (`Green/Emerald`) | `FR-AUTH-003` | "Active" / "Terminated" | Sourced from active session verification. | +| `btn_session_terminate`| Button (`shadcn/Button`) | `FR-AUTH-003` | Destructive variant | Disables button during pending HTTP request, triggers logout. | + +--- + +## 4. State Guards & Transitions + +1. **Logout Confirmation:** Clicking logout invalidates the session via `POST /api/v1/auth/logout`. +2. **Client State Clearance:** Zustand `authStore` resets `isAuthenticated = false`, `token = null`, and purges sessionStorage. +3. **Post-Logout Invariant:** Any subsequent protected API request fails with HTTP `401 Unauthorized`. + diff --git a/04_generated_documentation/06_wireframes/wireframe_index.md b/04_generated_documentation/06_wireframes/wireframe_index.md new file mode 100644 index 0000000..bdd2d9d --- /dev/null +++ b/04_generated_documentation/06_wireframes/wireframe_index.md @@ -0,0 +1,28 @@ +# Wireframe & Screen Specification Index + +| Field | Value | +|---|---| +| **Governed Standard** | UP-AI v1.5 Stage 11 Standard | +| **Document Path** | `04_generated_documentation/06_wireframes/wireframe_index.md` | +| **Design System Tokens** | [`DESIGN.md`](DESIGN.md) | +| **Last Updated** | 2026-10-12 | + +--- + +## Master Screen Specification Catalog + +| Screen ID | Screen Name | Route / Path | Owning UC | Owning FR | Iteration | Client App ID | Frontend Owner | QA Owner | Specification Link | +|---|---|---|---|---|---|---|---|---|---| +| `SCREEN-AUTH-001` | Trading Portal Login & OIDC Callback | `/login`, `/auth/callback` | `UC-001` | `FR-AUTH-001` | `iteration-01` | `atb-web-portal` | `@ui-designer-dev` | `@adversarial-tester` | [`SCREEN-AUTH-001_login.md`](screen_specs/SCREEN-AUTH-001_login.md) | +| `SCREEN-AUTH-002` | Role Authorization & Access Denial | `/access-denied` | `UC-001` | `FR-AUTH-002` | `iteration-01` | `atb-web-portal` | `@ui-designer-dev` | `@adversarial-tester` | [`SCREEN-AUTH-002_access_denied.md`](screen_specs/SCREEN-AUTH-002_access_denied.md) | +| `SCREEN-AUTH-003` | Active Session Management & Logout | `/account/sessions` | `UC-001` | `FR-AUTH-003` | `iteration-01` | `atb-web-portal` | `@ui-designer-dev` | `@adversarial-tester` | [`SCREEN-AUTH-003_session_logout.md`](screen_specs/SCREEN-AUTH-003_session_logout.md) | + +--- + +## Archetype & UI Library Compliance + +- **Framework:** React / TypeScript (`tech-profile.yaml`) +- **Styling & UI Library:** Tailwind CSS + shadcn-ui components (`tailwind_shadcn`) +- **State Store:** Zustand (`useAuthStore`) +- **Design Tokens:** Follows [`DESIGN.md`](DESIGN.md) colors (`Slate-900` background, `Emerald-600` primary buttons, `Rose-600` destructive actions) and typography (`Inter`). + diff --git a/04_generated_documentation/07_test_design/manual_qa/workbooks/Iteration01_Authentication_and_Session_Governance_Complete_Manual_Testcases.xlsx b/04_generated_documentation/07_test_design/manual_qa/workbooks/Iteration01_Authentication_and_Session_Governance_Complete_Manual_Testcases.xlsx new file mode 100644 index 0000000..4a680e9 Binary files /dev/null and b/04_generated_documentation/07_test_design/manual_qa/workbooks/Iteration01_Authentication_and_Session_Governance_Complete_Manual_Testcases.xlsx differ diff --git a/04_generated_documentation/07_test_design/regression_test_cases.md b/04_generated_documentation/07_test_design/regression_test_cases.md index 9acbfe2..2e24135 100644 --- a/04_generated_documentation/07_test_design/regression_test_cases.md +++ b/04_generated_documentation/07_test_design/regression_test_cases.md @@ -3,10 +3,10 @@ | Field | Value | |---|---| | **Document** | `regression_test_cases.md` | -| **Governed Standard** | UP-AI v1.0 Quality Standard | +| **Governed Standard** | UP-AI v1.5 Quality Standard | | **Scope Runner** | `scripts/run_tests.sh --scope ` | -| **Last Updated** | 2026-10-11 | -| **Version** | 1.1.0 | +| **Last Updated** | 2026-10-12 | +| **Version** | 1.2.0 | | **Last CR** | `CR-001` | --- @@ -17,5 +17,10 @@ |---|---|---|---|---|---|---| | `TC-AUTH-001` | Functional / Happy Path | `FR-AUTH-001` | Automated (pytest) | `tests/backend/test_auth_oidc.py` | `uc_001`, `fr_auth_001`, `iteration_01` | Active | | `TC-AUTH-002` | Boundary / Token Expiry | `FR-AUTH-001` | Automated (pytest) | `tests/backend/test_auth_oidc.py` | `uc_001`, `fr_auth_001`, `iteration_01` | Active | -| `TC-AUTH-003` | Security / Role Permission Denial | `FR-AUTH-002` | Automated (pytest) | Implementation test path TBD | `uc_001`, `fr_auth_002`, `iteration_01` | Planned / implementation evidence pending | -| `TC-AUTH-004` | FSM / Ended Application Session | `FR-AUTH-003` | Automated (pytest) | Implementation test path TBD | `uc_001`, `fr_auth_003`, `iteration_01` | Planned / implementation evidence pending | +| `TC-AUTH-003` | Security / Role Permission Denial | `FR-AUTH-002` | Automated (pytest) | `tests/backend/test_auth_rbac.py` | `uc_001`, `fr_auth_002`, `iteration_01` | Active | +| `TC-AUTH-004` | FSM / Ended Application Session | `FR-AUTH-003` | Automated (pytest) | `tests/backend/test_auth_logout.py` | `uc_001`, `fr_auth_003`, `iteration_01` | Active | +| `BRU-AUTH-001` | API Contract / Session Status | `FR-AUTH-001` | API Contract (Bruno) | `docs/api/bruno/auth/get-session.bru` | `uc_001`, `fr_auth_001`, `iteration_01` | Active | +| `BRU-AUTH-002` | API Contract / Session Logout | `FR-AUTH-003` | API Contract (Bruno) | `docs/api/bruno/auth/logout.bru` | `uc_001`, `fr_auth_003`, `iteration_01` | Active | +| `E2E-AUTH-001` | Browser E2E / Login Callback | `FR-AUTH-001` | Browser E2E (Playwright) | `tests/frontend/e2e/login.spec.ts` | `uc_001`, `fr_auth_001`, `iteration_01` | Planned for Construction | +| `E2E-AUTH-002` | Browser E2E / RBAC Denial | `FR-AUTH-002` | Browser E2E (Playwright) | `tests/frontend/e2e/rbac_denial.spec.ts` | `uc_001`, `fr_auth_002`, `iteration_01` | Planned for Construction | +| `E2E-AUTH-003` | Browser E2E / Session Logout | `FR-AUTH-003` | Browser E2E (Playwright) | `tests/frontend/e2e/logout.spec.ts` | `uc_001`, `fr_auth_003`, `iteration_01` | Planned for Construction | diff --git a/04_generated_documentation/07_test_design/test_traceability_matrix.md b/04_generated_documentation/07_test_design/test_traceability_matrix.md new file mode 100644 index 0000000..fc27084 --- /dev/null +++ b/04_generated_documentation/07_test_design/test_traceability_matrix.md @@ -0,0 +1,41 @@ +# Test Traceability Matrix — Iteration 01 + +| Field | Value | +|---|---| +| **Governed Standard** | UP-AI v1.5 Stage 12 Quality Standard | +| **Document Path** | `04_generated_documentation/07_test_design/test_traceability_matrix.md` | +| **Iteration** | `iteration-01` | +| **Last Updated** | 2026-10-12 | + +--- + +## 1. Traceability Spine (UC → FR → STORY → TC) + +| Use Case ID | Functional Req ID | Story ID | Test Case ID | Test Category | Test Level | Automation Path / Collection | Verification Status | +|---|---|---|---|---|---|---|---| +| `UC-001` | `FR-AUTH-001` | `STORY-AUTH-001` | `TC-AUTH-001` | Functional / Happy Path | Unit / API | `tests/backend/test_auth_oidc.py` | Modeled (Active) | +| `UC-001` | `FR-AUTH-001` | `STORY-AUTH-001` | `TC-AUTH-002` | Boundary / Security | Unit / API | `tests/backend/test_auth_oidc.py` | Modeled (Active) | +| `UC-001` | `FR-AUTH-001` | `STORY-AUTH-001` | `BRU-AUTH-001` | API Contract | Bruno Collection | `docs/api/bruno/auth/get-session.bru` | Modeled (Active) | +| `UC-001` | `FR-AUTH-001` | `STORY-AUTH-001` | `E2E-AUTH-001` | Browser E2E | Playwright | `tests/frontend/e2e/login.spec.ts` | Modeled (Ready for Construction) | +| `UC-001` | `FR-AUTH-002` | `STORY-AUTH-002` | `TC-AUTH-003` | Security / Role Denial | Unit / Security | `tests/backend/test_auth_rbac.py` | Modeled (Active) | +| `UC-001` | `FR-AUTH-002` | `STORY-AUTH-002` | `E2E-AUTH-002` | Browser E2E | Playwright | `tests/frontend/e2e/rbac_denial.spec.ts` | Modeled (Ready for Construction) | +| `UC-001` | `FR-AUTH-003` | `STORY-AUTH-003` | `TC-AUTH-004` | FSM Invariant | Unit / FSM | `tests/backend/test_auth_logout.py` | Modeled (Active) | +| `UC-001` | `FR-AUTH-003` | `STORY-AUTH-003` | `BRU-AUTH-002` | API Contract | Bruno Collection | `docs/api/bruno/auth/logout.bru` | Modeled (Active) | +| `UC-001` | `FR-AUTH-003` | `STORY-AUTH-003` | `E2E-AUTH-003` | Browser E2E | Playwright | `tests/frontend/e2e/logout.spec.ts` | Modeled (Ready for Construction) | + +--- + +## 2. Test-Level Applicability Decisions + +| Story ID | Unit Testing | Smoke Testing | Usability Testing | API Testing (Bruno) | Browser E2E (Playwright) | Rationale | +|---|---|---|---|---|---|---| +| `STORY-AUTH-001` | **Required** (`TC-AUTH-001`, `TC-AUTH-002`) | **Required** (`SMOKE-AUTH-001`) | **Required** (Login layout & responsiveness) | **Required** (`get-session.bru`) | **Required** (`login.spec.ts`) | Core gateway for all system interactions. | +| `STORY-AUTH-002` | **Required** (`TC-AUTH-003`) | **Required** (`SMOKE-AUTH-002`) | **N/A** (Backend middleware enforcement) | **N/A** (Enforced across business endpoints) | **Required** (`rbac_denial.spec.ts`) | RBAC enforcement across 11 roles and segregation of duties. | +| `STORY-AUTH-003` | **Required** (`TC-AUTH-004`) | **Required** (`SMOKE-AUTH-003`) | **Required** (Logout placement & confirm modal) | **Required** (`logout.bru`) | **Required** (`logout.spec.ts`) | Session invalidation FSM lifecycle. | + +--- + +## 3. Manual QA Coverage (21-Sheet Excel Workbook) + +All 32 test cases in [`Iteration01_Authentication_and_Session_Governance_Complete_Manual_Testcases.xlsx`](manual_qa/workbooks/Iteration01_Authentication_and_Session_Governance_Complete_Manual_Testcases.xlsx) trace directly to `UC-001` / `FR-AUTH-001`–`003` across the 16 standard testing dimensions. + diff --git a/docs/api/bruno/auth/get-session.bru b/docs/api/bruno/auth/get-session.bru new file mode 100644 index 0000000..c9d29d3 --- /dev/null +++ b/docs/api/bruno/auth/get-session.bru @@ -0,0 +1,39 @@ +meta { + name: Get Current Auth Session + type: http + seq: 1 +} + +get { + url: {{baseUrl}}/api/v1/auth/session + body: none + auth: bearer +} + +auth:bearer { + token: {{jwtToken}} +} + +headers { + Accept: application/json +} + +docs { + # Get Current Auth Session (FR-AUTH-001) + + Validates the caller's JWT bearer token against Keycloak (or deterministic identity mock) + and returns the active session state, subject identifier (`sub`), and assigned roles. + + ## Response 200 OK + ```json + { + "authenticated": true, + "subject": "usr_01J8K...", + "roles": ["Mandi Buyer"] + } + ``` + + ## Response 401 Unauthorized + Returned when the session token is absent, invalid, or expired. +} + diff --git a/docs/api/bruno/auth/logout.bru b/docs/api/bruno/auth/logout.bru new file mode 100644 index 0000000..63aaae3 --- /dev/null +++ b/docs/api/bruno/auth/logout.bru @@ -0,0 +1,38 @@ +meta { + name: Logout Application Session + type: http + seq: 2 +} + +post { + url: {{baseUrl}}/api/v1/auth/logout + body: none + auth: bearer +} + +auth:bearer { + token: {{jwtToken}} +} + +headers { + Accept: application/json +} + +docs { + # Terminate Application Session (FR-AUTH-003) + + Terminates the active application session, marks the token/session as invalidated, + and cleans up server-side session context. + + ## Response 200 OK + ```json + { + "status": "logged_out", + "message": "Session terminated successfully." + } + ``` + + ## Response 401 Unauthorized + Returned when no active session is present. +} + diff --git a/docs/api/bruno/bruno.json b/docs/api/bruno/bruno.json new file mode 100644 index 0000000..21310c8 --- /dev/null +++ b/docs/api/bruno/bruno.json @@ -0,0 +1,10 @@ +{ + "version": "1", + "name": "Agriculture Trading Backoffice (ATB) API", + "type": "collection", + "ignore": [ + "node_modules", + ".git" + ] +} + diff --git a/prompts/20261012T041907Z-session-process-status.md b/prompts/20261012T041907Z-session-process-status.md index 6161370..3f6d50a 100644 --- a/prompts/20261012T041907Z-session-process-status.md +++ b/prompts/20261012T041907Z-session-process-status.md @@ -16,3 +16,17 @@ Inspected project governance documents (`master_context.md`, `checkpoint_index.m ## 2026-10-12T04:23:26Z — Assistant — Action summary Executed `up-iteration-plan` (Stage 10) for `iteration-01`. Reviewed and aligned `iteration_plan.md`, `iteration_backlog.md`, `iteration_surface_matrix.md`, and `parallel_work_plan.md` against Stage 9 architecture contracts (`LLD-001`, `api_design.md`). Scheduled Wave 0 deterministic identity mock adapter (`sandbox/identity_mock.py`) for offline test execution. Defined three parallel lanes (`lane/backend-auth`, `lane/frontend-auth`, `lane/qa-adversarial`). Recorded Checkpoint 016 (`checkpoint-016-iteration-01-planning-aligned.md`), updated `checkpoint_index.md` and `master_context.md`. Validated Gate 14.1 via `python3 scripts/verify_traceability_gates.py --gate 14.1 --iteration iteration-01`, confirming structural planning files and 4-dimension functional test models are verified; remaining blockers are expected Stage 12 QA deliverables (21-sheet QA workbook and Bruno collections). Ready to proceed to Stage 11 (`up-wireframe-spec`) and Stage 12 (`up-test-model-generate`). + +## 2026-10-12T04:32:59Z — User + +proceed + +## 2026-10-12T04:32:59Z — Assistant — Action summary + +Executed Stage 11 (`up-wireframe-spec`) and Stage 12 (`up-test-model-generate`) for `iteration-01`: +1. Authored Stage 11 screen specifications (`SCREEN-AUTH-001_login.md`, `SCREEN-AUTH-002_access_denied.md`, `SCREEN-AUTH-003_session_logout.md`) and compiled `wireframe_index.md`. +2. Authored Stage 12 Bruno API collections (`get-session.bru`, `logout.bru`, `bruno.json`) in `docs/api/bruno/`. +3. Compiled dense 21-sheet manual QA workbook (32 test cases) via `scripts/generate_manual_qa_workbook.py`. +4. Authored `test_traceability_matrix.md` and updated `regression_test_cases.md` to v1.2.0. +5. Ran `scripts/verify_traceability_gates.py --all`: Gates 5.1, 9.1, and 14.1 all passed with 0 Critical issues. +6. Recorded Checkpoint 017 (`checkpoint-017-stage-11-12-wireframes-test-models.md`), updated `checkpoint_index.md` and `master_context.md`. Requirements set to `In Construction`. Ready for Stage 13 code generation (`/up-code-generate`).