From 4a38b7a8fd688a7151c478870f0bf575a26ec4b7 Mon Sep 17 00:00:00 2001 From: Prashant Shendre Date: Mon, 12 Oct 2026 10:01:31 +0530 Subject: [PATCH] plan iteration --- .gitignore | 4 + ...point-016-iteration-01-planning-aligned.md | 29 +++++++ .../checkpoints/checkpoint_index.md | 1 + .../00_process_control/master_context.md | 6 +- .../iteration-01/iteration_backlog.md | 60 +++++++++++++-- .../iterations/iteration-01/iteration_plan.md | 49 +++++++++--- .../iteration-01/iteration_surface_matrix.md | 33 ++++++-- .../iteration-01/parallel_work_plan.md | 77 +++++++++++++++---- ...20261012T041907Z-session-process-status.md | 18 +++++ 9 files changed, 238 insertions(+), 39 deletions(-) create mode 100644 04_generated_documentation/00_process_control/checkpoints/checkpoint-016-iteration-01-planning-aligned.md create mode 100644 prompts/20261012T041907Z-session-process-status.md diff --git a/.gitignore b/.gitignore index c88e422..f893be1 100644 --- a/.gitignore +++ b/.gitignore @@ -50,3 +50,7 @@ out/ .DS_Store Thumbs.db +# Implementation workspace assets are version-controlled. Keep local Compose +# credentials out of Git. +05_implementation_workspace/.env + diff --git a/04_generated_documentation/00_process_control/checkpoints/checkpoint-016-iteration-01-planning-aligned.md b/04_generated_documentation/00_process_control/checkpoints/checkpoint-016-iteration-01-planning-aligned.md new file mode 100644 index 0000000..9c7ad67 --- /dev/null +++ b/04_generated_documentation/00_process_control/checkpoints/checkpoint-016-iteration-01-planning-aligned.md @@ -0,0 +1,29 @@ +# Checkpoint 016 — Iteration 01 Planning Aligned with Stage 9 Architecture + +- **Checkpoint ID:** CKPT-016 +- **Date:** 2026-10-12 +- **Active Stage:** Stage 10 Iteration Planning complete; Stage 11/12 ready +- **Active Track:** Greenfield, India-first, multi-tenant Agriculture Trading Backoffice (ATB) +- **Active Skill:** up-iteration-plan +- **Governed Standard:** UP-AI v1.5 Standard + +## Completed +- Reviewed and updated `iteration_plan.md`, `iteration_backlog.md`, `iteration_surface_matrix.md`, and `parallel_work_plan.md` for `iteration-01` (`UC-001`, `FR-AUTH-001`, `FR-AUTH-002`, `FR-AUTH-003`). +- Aligned delivery surface matrix directly with Stage 9 architecture contracts (`LLD-001`, `api_design.md`, `database_design.md`, `integration_design.md`): + - `FR-AUTH-001`: IdP Keycloak OIDC/PKCE flow; `GET /api/v1/auth/session`; UI login view at `/login` and `/auth/callback`. + - `FR-AUTH-002`: Cross-cutting role authorization middleware enforcing `BRD-FR-040` 11 PRD roles, 7 discrete actions, and segregation-of-duties rules on protected operations. + - `FR-AUTH-003`: `POST /api/v1/auth/logout`; UI session termination at `/account/sessions`. +- Scheduled Wave 0 deterministic identity mock adapter (`sandbox/identity_mock.py`) matching `tech-profile.yaml` to ensure offline automated test execution without external Keycloak dependency. +- Defined three isolated parallel work lanes (`lane/backend-auth`, `lane/frontend-auth`, `lane/qa-adversarial`) with strict boundaries, shared artifact ownership, contract dependencies, and merge order. +- Validated Gate 14.1 structural criteria via `python3 scripts/verify_traceability_gates.py --gate 14.1 --iteration iteration-01`. All structural files and 4-dimension functional test models are verified; the remaining two critical findings (21-sheet QA workbook and Bruno API collections) are the planned deliverables of Stage 12. + +## Open Items +- Iteration-01 remains `Incomplete / Pending Construction` until Stage 11 (Wireframes), Stage 12 (Test Models/Bruno/Workbook), Stage 13 (Code Generation $\ge 95\%$ coverage), and Stage 14 (Review/Gate 14.1 closure) execute. +- Ambiguities `AMB-001`, `AMB-006`, `AMB-008`–`AMB-011` remain tracked for pilot KPI measurement, legal/accounting certification, and production load-test telemetry. +- Production deployment runtime selection (`BRD-NFR-011`) remains open. + +## Exact Next Action +Proceed to **Stage 11 (`up-wireframe-spec`)** and **Stage 12 (`up-test-model-generate`)** in parallel: +1. Reconcile screen specifications for `/login`, `/auth/callback`, and `/account/sessions` against `06_wireframes/DESIGN.md`. +2. Compile the 21-sheet Excel QA Workbook with $\ge 20$ test cases via `scripts/generate_manual_qa_workbook.py` and author Bruno collections under `docs/api/bruno/auth/` to resolve Gate 14.1 construction blockers. + 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 365a605..232ddef 100644 --- a/04_generated_documentation/00_process_control/checkpoints/checkpoint_index.md +++ b/04_generated_documentation/00_process_control/checkpoints/checkpoint_index.md @@ -38,3 +38,4 @@ | CKPT-013 | 2026-10-11 | Stage 7 approved / Stage 8 derived | Human lead approved Stage 7 patterns (`DEC-021`); 54 FR-specific SRS records + 4 explicit cross-cutting NFRs authored and mapped. | Stage 9 HLD/LLD fan-out; Gate 9.1 follows Stage 9; runtime/load proof and AMB-001/006/008/009 evidence remain pending; Gate 14.1 blockers unchanged. | Run `/up-hld-lld-generate`, then `/up-traceability-gate 9.1`. | checkpoint-013-stage-7-approval-stage-8-srs.md | | 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` | diff --git a/04_generated_documentation/00_process_control/master_context.md b/04_generated_documentation/00_process_control/master_context.md index c3644f4..5dbccd7 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 7 architecture design baseline approved by human lead (`DEC-021`). Stage 8 SRS derivation is complete for 54 FRs and Stage 9 HLD/LLD design is complete for all 54 FRs; Gate 9.1 passed with zero findings. Stage 10 iteration planning is the next 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 planned but remains Incomplete / Pending Construction. Its existing Stage 10 artifacts need process review before Stage 11/12. Gate 14.1 has two Critical findings (dense QA workbook and Bruno API collections missing). -- **Next:** Run `/up-iteration-plan` to review/align iteration-01 against current traceability, architecture and QG-E, then proceed to Stage 11/12. Local Compose currently starts PostgreSQL, Keycloak and Valkey only; app, worker, frontend, migration and test-runner services await real implementation/test artifacts. Production runtime remains unselected; carrying the user's acknowledged single-host risk does not change BRD-NFR-011 or claim its targets are met. Carry `AMB-001`, `AMB-006`, `AMB-008`–`AMB-011` and `ASM-001`–`ASM-003` forward. +- **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. diff --git a/04_generated_documentation/05_iteration_planning/iterations/iteration-01/iteration_backlog.md b/04_generated_documentation/05_iteration_planning/iterations/iteration-01/iteration_backlog.md index 6e596d7..dad59b7 100644 --- a/04_generated_documentation/05_iteration_planning/iterations/iteration-01/iteration_backlog.md +++ b/04_generated_documentation/05_iteration_planning/iterations/iteration-01/iteration_backlog.md @@ -4,8 +4,9 @@ |---|---| | **Iteration** | `iteration-01` | | **Parent Use Case** | [`UC-001`](../../../03_requirements/use_cases/uc-001_user-authentication/use-case.md) | -| **Status** | Rebaselined under CR-001; Ready for Construction | -| **Version** | 1.1.0 | +| **Governed Standard** | UP-AI v1.5 Stage 10 Standard | +| **Status** | Aligned with Stage 9 Architecture (Gate 9.1 Passed); Ready for Stage 11/12 | +| **Version** | 1.2.0 | | **Last CR** | `CR-001` | --- @@ -14,6 +15,55 @@ | Story ID | Parent FR | Story Title | Points | Priority | Primary Delivery Surface | Assigned Roles | Status | |---|---|---|---|---|---|---|---| -| `STORY-AUTH-001` | `FR-AUTH-001` | OIDC PKCE Authorization Code Exchange | 5 | P0 | Backend API (`/api/v1/auth/token`), Frontend `/login` | `@backend-dev`, `@ui-designer-dev` | Ready | -| `STORY-AUTH-002` | `FR-AUTH-002` | Role Permission Matrix Enforcement & Segregation of Duties | 5 | P0 | Authorization for protected business actions | `@backend-dev` | Ready | -| `STORY-AUTH-003` | `FR-AUTH-003` | End Application Session and Logout | 3 | P1 | Application session controls and authentication integration | `@backend-dev`, `@adversarial-tester` | Ready | +| `STORY-AUTH-001` | `FR-AUTH-001` | OIDC PKCE Authorization Code Exchange & Application Session | 5 | P0 | Backend API (`GET /api/v1/auth/session`), Frontend `/login`, `/auth/callback` | `@backend-dev`, `@ui-designer-dev` | Ready for Construction | +| `STORY-AUTH-002` | `FR-AUTH-002` | Role Permission Matrix Enforcement & Segregation of Duties | 5 | P0 | Cross-cutting API Authorization Dependency / Middleware | `@backend-dev` | Ready for Construction | +| `STORY-AUTH-003` | `FR-AUTH-003` | End Application Session and Logout | 3 | P1 | Backend API (`POST /api/v1/auth/logout`), Frontend `/account/sessions` & Header | `@backend-dev`, `@adversarial-tester` | Ready for Construction | + +--- + +## Detailed Story Specifications + +### STORY-AUTH-001: OIDC PKCE Authorization Code Exchange & Application Session +- **Parent Requirement:** [`FR-AUTH-001`](../../../03_requirements/use_cases/uc-001_user-authentication/functional-reqs.md#fr-auth-001-oidc-authentication) +- **SRS Linkage:** `SRS-AUTH-001` +- **Architecture Contract:** `HLD-IAM`, [`LLD-001`](../../../04_architecture_design/lld/LLD-001_auth_service.md), [`api_design.md`](../../../04_architecture_design/api_design.md) +- **Story Points:** 5 (P0) +- **Description:** Implement OIDC Authorization Code flow with Proof Key for Code Exchange (PKCE) against the Keycloak identity provider, validating tokens on callback and providing an authenticated application session endpoint (`GET /api/v1/auth/session`). +- **Acceptance Criteria:** + 1. The React client initiates authorization-code flow with PKCE (`code_challenge` generated via SHA-256 and `code_verifier`). + 2. The backend validates the callback exchange and verifies JWT signatures against provider JWKS, issuer (`iss`), audience (`aud`), state, and time validity claims (`exp`, `nbf`). + 3. `GET /api/v1/auth/session` returns the session status (`authenticated: true`), the authenticated subject identifier (`sub`), and token validity without exposing secret tokens. + 4. Unauthenticated, expired, or tampered tokens return HTTP `401 Unauthorized`. + 5. The entire flow runs deterministically offline using `sandbox/identity_mock.py` when Keycloak is unavailable. + +--- + +### STORY-AUTH-002: Role Permission Matrix Enforcement & Segregation of Duties +- **Parent Requirement:** [`FR-AUTH-002`](../../../03_requirements/use_cases/uc-001_user-authentication/functional-reqs.md#fr-auth-002-role-based-authorization) +- **SRS Linkage:** `SRS-AUTH-002` +- **Architecture Contract:** `HLD-IAM`, [`LLD-001`](../../../04_architecture_design/lld/LLD-001_auth_service.md) +- **Story Points:** 5 (P0) +- **Description:** Implement a cross-cutting authorization policy evaluator that validates the BRD-FR-040 role-based permission matrix across all 11 PRD roles and strictly enforces segregation of duties on protected operations. +- **Acceptance Criteria:** + 1. Evaluates permissions across all 11 PRD roles: `Tenant Administrator`, `Mandi Buyer`, `Purchase Manager`, `Yard Supervisor`, `Quality Officer`, `Sales Executive`, `Sales Manager`, `Logistics Coordinator`, `Accounts Executive`, `Partner / MD`, and `System Administrator`. + 2. Enforces discrete actions: `Read`, `Write`, `Create`, `Delete`, `Submit`, `Cancel`, and `Amend`. + 3. Denies any operation not permitted by the matrix before invoking business logic, returning HTTP `403 Forbidden`. + 4. Strictly enforces segregation of duties: + - Quality Officers cannot edit prices. + - Yard Supervisors cannot confirm sales. + - Sales Executives cannot override credit locks. + 5. Does not grant cross-tenant authorization; tenant administrative permissions are valid only within the verified tenant membership context. + +--- + +### STORY-AUTH-003: End Application Session and Logout +- **Parent Requirement:** [`FR-AUTH-003`](../../../03_requirements/use_cases/uc-001_user-authentication/functional-reqs.md#fr-auth-003-session-handling-and-logout) +- **SRS Linkage:** `SRS-AUTH-003` +- **Architecture Contract:** `HLD-IAM`, [`LLD-001`](../../../04_architecture_design/lld/LLD-001_auth_service.md), [`api_design.md`](../../../04_architecture_design/api_design.md) +- **Story Points:** 3 (P1) +- **Description:** Implement the session termination and logout workflow, enabling authenticated users to end their active session and preventing any reuse of ended sessions. +- **Acceptance Criteria:** + 1. Authenticated user can initiate logout via UI controls or via `POST /api/v1/auth/logout`. + 2. The application terminates the active application session and clears client credentials/cookies. + 3. Any subsequent protected operation using the ended session credentials returns HTTP `401 Unauthorized`. + 4. Fails closed on malformed or replayed logout requests. diff --git a/04_generated_documentation/05_iteration_planning/iterations/iteration-01/iteration_plan.md b/04_generated_documentation/05_iteration_planning/iterations/iteration-01/iteration_plan.md index acb35c6..a348ebe 100644 --- a/04_generated_documentation/05_iteration_planning/iterations/iteration-01/iteration_plan.md +++ b/04_generated_documentation/05_iteration_planning/iterations/iteration-01/iteration_plan.md @@ -3,20 +3,47 @@ | Field | Value | |---|---| | **Iteration** | `iteration-01` | -| **Slice Goal** | Deliver OIDC authentication, BRD-FR-040 role authorization, and application session/logout behavior (`UC-001`). | -| **Governed Standard** | UP-AI v1.0 Stage 10 Standard | +| **Slice Goal** | Deliver OIDC authentication, BRD-FR-040 role authorization, and application session/logout behavior (`UC-001`) with deterministic offline sandbox integration. | +| **Governed Standard** | UP-AI v1.5 Stage 10 Standard | +| **Parent Use Case** | [`UC-001`](../../../03_requirements/use_cases/uc-001_user-authentication/use-case.md) | | **Capacity** | 3 Stories (13 Story Points) | -| **Status** | Rebaselined under CR-001; planned for Construction | -| **Version** | 1.1.0 | +| **Status** | Aligned with Stage 9 Architecture (Gate 9.1 Passed); Ready for Stage 11/12 | +| **Version** | 1.2.0 | | **Last CR** | `CR-001` | --- -## 1. Demo & Acceptance Criteria +## 1. Iteration Goal & Scope Summary -Planned acceptance evidence for Iteration 01 (not yet delivered): -1. An unauthenticated user accessing `/` is redirected to Keycloak OIDC login and returns with valid session tokens. -2. Protected business actions are allowed or denied according to the BRD-FR-040 role permission matrix and segregation-of-duties restrictions; tenant membership/context and data isolation remain governed by their separately planned owning use cases. -3. The user can end the application session; a protected operation using that ended application session is denied. The revocation mechanism and timing remain subject to approved security design. -4. Required automated and manual checks pass at applicable project quality thresholds before delivery is claimed. -5. The required dense Manual QA workbook and other Gate 14.1 evidence are populated and verified before the iteration can close. +Deliver the foundational authentication, session management, and authorization boundaries for the Agriculture Trading Backoffice (ATB) application. This vertical slice implements Keycloak OIDC Authorization Code flow with PKCE, JWT bearer validation, server-side session querying and termination, and the PRD-defined role permission matrix with segregation of duties (`UC-001`: `FR-AUTH-001`, `FR-AUTH-002`, `FR-AUTH-003`). + +Tenant membership verification and PostgreSQL Row-Level Security isolation remain distinct architectural components owned by their respective downstream use cases and are resolved in their own iterations. + +--- + +## 2. Demo & Acceptance Criteria + +Planned acceptance evidence for Iteration 01: +1. **OIDC Authentication Flow (`FR-AUTH-001`):** An unauthenticated user accessing `/` or protected routes is redirected to the Keycloak OIDC login interface using PKCE. Upon successful callback, the client receives session credentials, and `GET /api/v1/auth/session` returns authenticated state, current subject ID, and assigned roles. +2. **Role-Based Authorization & Segregation of Duties (`FR-AUTH-002`):** Protected business API actions enforce the `BRD-FR-040` role permission matrix covering `Read`, `Write`, `Create`, `Delete`, `Submit`, `Cancel`, and `Amend` across all 11 PRD roles. Enforces mandatory segregation of duties: + - Quality Officers cannot edit prices. + - Yard Supervisors cannot confirm sales. + - Sales Executives cannot override credit locks. + Unpermitted actions are denied before business command execution with HTTP `403 Forbidden`. +3. **Application Session Termination (`FR-AUTH-003`):** The user can terminate their active application session via `POST /api/v1/auth/logout`. Any subsequent protected requests using the terminated session are rejected with HTTP `401 Unauthorized`. +4. **Deterministic Offline Sandbox:** All authentication and authorization automated tests can execute deterministically without external network connectivity using the mock adapter at `sandbox/identity_mock.py` (matching `tech-profile.yaml`). +5. **Quality & Coverage Compliance:** Automated test execution satisfies the tiered coverage threshold: + - Backend domain/FSM coverage: $\ge 95.0\%$ + - Integration adapter coverage: $\ge 90.0\%$ + - Frontend components coverage: $\ge 80.0\%$ +6. **Gate 14.1 Artifact Density:** + - 21-sheet Excel QA Workbook with $\ge 20$ dense test cases across categories (`scripts/generate_manual_qa_workbook.py`). + - Git-versioned Bruno API collections (`.bru`) under `docs/api/bruno/auth/` covering all declared endpoints (`GET /api/v1/auth/session`, `POST /api/v1/auth/logout`). + - Multi-path 4-dimension functional test models in `07_test_design/functional_test_cases/`. + +--- + +## 3. Carried-Over Scope & Regression Debt + +- **Carried-over stories from previous iteration:** None (Iteration 01 is the initial Construction loop). +- **Regression debt from `regression_test_cases.md`:** None. Initial suite setup includes active pytest specs `TC-AUTH-001` through `TC-AUTH-004`. diff --git a/04_generated_documentation/05_iteration_planning/iterations/iteration-01/iteration_surface_matrix.md b/04_generated_documentation/05_iteration_planning/iterations/iteration-01/iteration_surface_matrix.md index 95e6bfe..a7141ee 100644 --- a/04_generated_documentation/05_iteration_planning/iterations/iteration-01/iteration_surface_matrix.md +++ b/04_generated_documentation/05_iteration_planning/iterations/iteration-01/iteration_surface_matrix.md @@ -3,9 +3,9 @@ | Field | Value | |---|---| | **Iteration** | `iteration-01` | -| **Governed Standard** | UP-AI v1.0 Standard | -| **Status** | Incomplete / Pending Construction | -| **Version** | 1.1.0 | +| **Governed Standard** | UP-AI v1.5 Stage 10 Standard | +| **Status** | In Construction (Stage 10 Planned) | +| **Version** | 1.2.0 | | **Last CR** | `CR-001` | --- @@ -14,6 +14,27 @@ | Story ID | Parent FR | Portal / Screen | Route | API Endpoint | DB Migration | Sandbox / Mock | Config / Secret | Test Scopes | Dev Owner | QA Owner | Surface Status | |---|---|---|---|---|---|---|---|---|---|---|---| -| `STORY-AUTH-001` | `FR-AUTH-001` | Login screen (wireframe pending) | `/login` | `POST /api/v1/auth/token` | Auth persistence design TBD | Identity provider integration | `KEYCLOAK_URL` | Unit, Bruno, Playwright | `@backend-dev` | `@adversarial-tester` | Pending wireframe / construction | -| `STORY-AUTH-002` | `FR-AUTH-002` | Protected business action authorization | Routes defined by owning business use cases | Permission decision contract TBD in LLD | Permission matrix persistence TBD | N/A | Authorization policy config TBD | Unit, API, browser authorization checks | `@backend-dev` | `@adversarial-tester` | Pending design / construction | -| `STORY-AUTH-003` | `FR-AUTH-003` | Application session controls | `/account/sessions` (route to confirm in LLD) | Logout contract to confirm in LLD | None specified | N/A | Session design config TBD | Unit, API, FSM invariant | `@backend-dev` | `@adversarial-tester` | Pending design / construction | +| `STORY-AUTH-001` | `FR-AUTH-001` | Login Screen & Callback View | `/login`, `/auth/callback` | `GET /api/v1/auth/session` | Schema baseline: `users` table via Alembic | `sandbox/identity_mock.py` | `KEYCLOAK_URL`, `KEYCLOAK_REALM`, `KEYCLOAK_CLIENT_ID` | Unit (pytest), API (Bruno), Browser E2E (Playwright) | `@backend-dev`, `@ui-designer-dev` | `@adversarial-tester` | Planned for Construction | +| `STORY-AUTH-002` | `FR-AUTH-002` | Protected Portal Navigation Guards | Protected routes (`/`, `/market`, `/procurement`, `/finance`) | Policy Middleware (`Depends(verify_role_permission)`) | Role permission matrix seed data | Test user personas (`Trader`, `AccountsOfficer`, `QualityInspector`) | Role policy definition | Unit (pytest matrix), Security API checks, FSM invariant | `@backend-dev` | `@adversarial-tester` | Planned for Construction | +| `STORY-AUTH-003` | `FR-AUTH-003` | User Profile Menu & Session Controls | `/account/sessions` | `POST /api/v1/auth/logout` | Session revocation store (in-memory / Valkey) | `sandbox/identity_mock.py` | IdP logout redirect URI | Unit (pytest), API (Bruno), Browser E2E (Playwright), FSM invariant | `@backend-dev` | `@adversarial-tester` | Planned for Construction | + +--- + +## Surface Breakdown & Responsibilities + +1. **Frontend Portal / Screen Surfaces:** + - **Login & Callback View (`STORY-AUTH-001`):** React component with Tailwind/shadcn UI handling redirection to Keycloak OIDC login with PKCE and token exchange on callback route `/auth/callback`. + - **Protected Navigation Guards (`STORY-AUTH-002`):** Zustand-backed auth store guarding routes and rendering UI elements based on active role permissions. + - **Session Controls (`STORY-AUTH-003`):** Header user profile dropdown and `/account/sessions` view offering user-initiated session termination. +2. **Backend API Endpoints:** + - `GET /api/v1/auth/session`: Validates current application session token and returns subject ID and token claims without leaking secrets. + - `Policy Middleware`: Cross-cutting FastAPI dependency applied to all protected routes enforcing the BRD-FR-040 role matrix and segregation of duties. + - `POST /api/v1/auth/logout`: Invalidates the active application session and cleans up server-side state. +3. **Database & Migrations:** + - Initial Alembic migration defining the `users` table for internal subject mapping, ensuring foreign-key referential integrity for downstream tenant memberships. +4. **Integration Sandboxes (Wave 0):** + - Deterministic Keycloak mock adapter at `sandbox/identity_mock.py` providing reproducible JWKS endpoints, PKCE code exchange, and token signing for isolated offline execution. +5. **Quality Assurance Deliverables:** + - **Bruno Collections:** Git-versioned collections in `docs/api/bruno/auth/` for `GET /api/v1/auth/session` and `POST /api/v1/auth/logout`. + - **Excel QA Workbook:** 21-sheet manual QA workbook compiled with $\ge 20$ test cases across categories. + - **Multi-Path Automated Tests:** Happy Path, Boundary/Edge, Negative/Security, and FSM Invariant tests in `tests/backend/` and `tests/frontend/e2e/`. diff --git a/04_generated_documentation/05_iteration_planning/iterations/iteration-01/parallel_work_plan.md b/04_generated_documentation/05_iteration_planning/iterations/iteration-01/parallel_work_plan.md index 298685e..e8792d5 100644 --- a/04_generated_documentation/05_iteration_planning/iterations/iteration-01/parallel_work_plan.md +++ b/04_generated_documentation/05_iteration_planning/iterations/iteration-01/parallel_work_plan.md @@ -3,29 +3,78 @@ | Field | Value | |---|---| | **Iteration** | `iteration-01` | -| **Governed Standard** | UP-AI v1.0 Standard | +| **Governed Standard** | UP-AI v1.5 Standard | | **Integration Skill** | `up-parallel-work-integrate` | -| **Status** | Rebaselined under CR-001; planned | -| **Version** | 1.1.0 | +| **Status** | Approved for Construction | +| **Version** | 1.2.0 | | **Last CR** | `CR-001` | --- -## Lane Allocations +## 1. Wave 0 — Sandbox & Integration Scaffolding + +Before parallel application lanes commence development, Wave 0 establishes deterministic offline mocks for external third-party boundaries: + +| Adapter Component | Physical Path | Target External Dependency | Mode | Owner | +|---|---|---|---|---| +| **Identity Mock Adapter** | `sandbox/identity_mock.py` | Keycloak OIDC / JWKS Provider | Deterministic Mock (Local PKCE & JWT Generator) | `@backend-dev` | + +- **Wave 0 Completion Criteria:** `sandbox/identity_mock.py` runs without network dependencies, generates valid test tokens, validates PKCE challenge/verifier pairs, and serves deterministic JWKS metadata for unit/integration test runners. + +--- + +## 2. Lane Allocations & Isolation ### Lane 1: Backend Authentication, Authorization & Session (`lane/backend-auth`) - **Assigned Stories:** `STORY-AUTH-001`, `STORY-AUTH-002`, `STORY-AUTH-003` - **Owner:** `@backend-dev` -- **Allowed Scope:** OIDC integration, role permission enforcement and segregation-of-duties checks, application session handling, and related tests. Tenant membership/context and RLS are owned by their linked use cases. -- **Wave 0 Sandboxes:** `sandbox/identity_mock.py` - -### Lane 2: Frontend Auth Views & Token Interceptor (`lane/frontend-auth`) -- **Assigned Stories:** `STORY-AUTH-001` (UI surface) -- **Owner:** `@ui-designer-dev` -- **Allowed Scope:** React portal views (`/login`, `/account/sessions`), OIDC PKCE client interceptor, Playwright E2E specs. +- **Allowed Scope / Paths:** + - `backend/app/auth/` (OIDC client adapter, JWT validator, session manager) + - `backend/app/middleware/auth.py` (FastAPI authentication & RBAC dependencies) + - `backend/app/models/user.py` (Internal user/subject entity) + - `backend/alembic/versions/` (Initial user migration) + - `backend/tests/test_auth_*.py` (Pytest test suite) +- **Shared Artifacts & Ownership:** OpenAPI schema for `/api/v1/auth/*` (Single Owner: `@backend-dev`). +- **Required Contracts:** [`LLD-001`](../../../04_architecture_design/lld/LLD-001_auth_service.md), [`api_design.md`](../../../04_architecture_design/api_design.md). +- **Branch / Worktree:** `lane/backend-auth` (branched from `main`). +- **Dependencies:** Wave 0 `sandbox/identity_mock.py`. +- **Completion Evidence:** `pytest tests/backend/test_auth_*.py` passes with $\ge 95\%$ domain FSM coverage. --- -## Safe Convergence & Merge Order -1. **Merge Order:** `lane/backend-auth` $\longrightarrow$ `lane/frontend-auth` $\longrightarrow$ `master-lane`. -2. **Integration Gate:** Run `/up-parallel-work-integrate lane/backend-auth lane/frontend-auth` prior to Gate 14.1. +### Lane 2: Frontend Auth Views & Token Interceptor (`lane/frontend-auth`) +- **Assigned Stories:** `STORY-AUTH-001` (UI surface), `STORY-AUTH-003` (UI session/logout) +- **Owner:** `@ui-designer-dev` +- **Allowed Scope / Paths:** + - `frontend/src/features/auth/` (Login view, callback handler, logout actions) + - `frontend/src/components/auth/` (Auth guards, user profile menu) + - `frontend/src/stores/auth_store.ts` (Zustand session state) + - `frontend/tests/e2e/auth.spec.ts` (Playwright E2E tests) +- **Shared Artifacts:** Consumes OpenAPI schema published by Lane 1. +- **Required Contracts:** `06_wireframes/DESIGN.md`, Stage 11 Screen Specs. +- **Branch / Worktree:** `lane/frontend-auth` (branched from `main`). +- **Dependencies:** Lane 1 API contract freeze. +- **Completion Evidence:** Vitest component tests pass ($\ge 80\%$ coverage); Playwright login/logout tests pass against identity sandbox. + +--- + +### Lane 3: QA Deliverables & Adversarial Test Models (`lane/qa-adversarial`) +- **Assigned Stories:** Cross-cutting validation across all stories +- **Owner:** `@adversarial-tester` +- **Allowed Scope / Paths:** + - `07_test_design/functional_test_cases/TC-001_auth_service.md` + - `07_test_design/manual_qa/iteration-01/MANUAL_TESTING_GUIDE.md` + - `07_test_design/manual_qa/workbooks/` (21-sheet Excel QA Workbook) + - `docs/api/bruno/auth/` (Bruno `.bru` collections) +- **Shared Artifacts:** Surface matrix endpoint alignment. +- **Branch / Worktree:** `lane/qa-adversarial` (branched from `main`). +- **Completion Evidence:** Gate 14.1 density checks pass (Excel workbook $\ge 20$ rows; Bruno collections present). + +--- + +## 3. Safe Convergence & Merge Order + +1. **Wave 0 Baseline:** Scaffold `sandbox/identity_mock.py` on `main`. +2. **Merge Sequence:** + $$\text{Wave 0} \longrightarrow \text{Lane 1 (Backend)} \longrightarrow \text{Lane 2 (Frontend)} \longrightarrow \text{Lane 3 (QA)} \longrightarrow \text{main}$$ +3. **Integration Gate:** Run `scripts/verify_traceability_gates.py --gate 14.1 --iteration iteration-01` before closing Construction. diff --git a/prompts/20261012T041907Z-session-process-status.md b/prompts/20261012T041907Z-session-process-status.md new file mode 100644 index 0000000..6161370 --- /dev/null +++ b/prompts/20261012T041907Z-session-process-status.md @@ -0,0 +1,18 @@ +# Session Transcript — Process Status Assessment + +## 2026-10-12T04:19:07Z — User + +where are we in the current process? + +## 2026-10-12T04:19:07Z — Assistant — Action summary + +Inspected project governance documents (`master_context.md`, `checkpoint_index.md`, `checkpoint-015-local-compose-development.md`), verified gate validation statuses via `scripts/verify_traceability_gates.py --all`, and checked docker runtime status. Gate 5.1 passed with minor/major source mappings justified; Gate 9.1 passed with zero findings across 54 FRs; Gate 14.1 for iteration-01 is currently failing (Incomplete / Pending Construction) due to uncompiled Excel QA workbook and pending Bruno API collections. Next process step is running `/up-iteration-plan` to review and align iteration-01 before entering Stage 11/12. + + +## 2026-10-12T04:23:26Z — User + +/up-iteration-plan + +## 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`).