reconciliation

This commit is contained in:
Prashant Shendre 2026-10-11 16:18:57 +05:30
parent e76630db31
commit aaa26a400a
25 changed files with 416 additions and 233 deletions

View File

@ -4,7 +4,9 @@
|---|---|
| **Governed Standard** | SEI-CMMI Level 3 (UP-AI v1.0) |
| **Document Path** | `04_generated_documentation/00_process_control/architecture_risk_register.md` |
| **Last Updated** | 2026-09-03 |
| **Last Updated** | 2026-10-11 |
| **Version** | 1.1.0 |
| **Last CR** | `CR-001` |
---
@ -20,7 +22,9 @@
## 2. Use Case Risk Scoring Matrix
CR-001 changed UC-001 scope to OIDC authentication and authorization. The prior sample score and Stage 7 walking-skeleton claim are not current evidence; the row is marked for scoring in the Stage 6 assessment across the complete 26-use-case set.
| UC-ID | Use Case Name | D1 | D2 | D3 | D4 | D5 | Total Score | Rank | Architecturally Significant (Y/N) | Architecture Rationale |
|---|---|---|---|---|---|---|---|---|---|---|
| `UC-001` | User Identity & Role Governance | 5 | 4 | 2 | 3 | 2 | **16** | 1 | **Yes** | Multi-tenant tenant context extraction, Keycloak OIDC/PKCE integration, RLS context propagation. Validated in Stage 7 Walking Skeleton. |
| `UC-001` | User Authentication and Authorization | TBD | TBD | TBD | TBD | TBD | **TBD** | TBD | **Pending Stage 6** | Re-score after CR-001; do not rely on bootstrap sample score or claimed Stage 7 validation. |
| `UC-002` | User Profile & Preferences | 3 | 1 | 1 | 1 | 1 | **7** | 2 | **No** | Standard CRUD operations; inherits service template and RLS pattern from `UC-001`. |

View File

@ -7,14 +7,60 @@
| **Gated By** | `up-change-request-impact` |
| **Scope** | Product Scope, Functional Requirements (`FR-xxx`), Use Cases (`UC-xxx`), Architecture, Code |
| **Meta-Process Changes** | Governed separately via `up-process-change` in [`process_change_register.md`](process_change_register.md) (`PCR-xxx`) |
| **Last Updated** | 2026-10-03 |
| **Last Updated** | 2026-10-11 |
---
## 1. Active & Historical Product Change Requests
*No product change requests raised yet. Product requirements baseline is clean.*
Product Change Requests are impact-analyzed below; each record states its current disposition, verification, and closure status.
| CR-ID | Trigger Type | Raised By | Date | Originating Stage | Description | Affected Items | Blast Radius / Impact | Disposition | Status |
|---|---|---|---|---|---|---|---|---|---|
| — | — | — | — | — | *Clean baseline — raise via `/up-change-request-impact`* | — | — | — | — |
| `CR-001` | Bug / Traceability defect | Human request, analyzed by AI | 2026-10-11 | Stage 5 — Elaboration | Review and realign the sample UC-001 identity/authentication use case and its source mappings to the baselined ATB PRD and active tech profile; decide which sample-specific auth/session constraints remain product requirements. | `UC-001`, `FR-AUTH-001`–`FR-AUTH-003` | See CR-001 Impact Analysis below. | Approved by stakeholder on 2026-10-11: UC-001 remains the OIDC AuthN/AuthZ use case; align it with the ATB baseline | Closed — approved impact set rebaselined and verified; iteration construction remains pending |
## CR-001 — UC-001 Alignment with the ATB Product Baseline
### Request and Trigger
The stakeholder confirmed that UC-001 was executed end-to-end as a process sample and approved proceeding on the assumption that it continues to cover OIDC authentication and authorization, aligned to the current ATB product baseline. This approval authorizes the bounded rebaseline described below; it does not approve unsupported numeric auth/session targets.
### Impact Analysis
**Starting points:** `UC-001`, `FR-AUTH-001`, `FR-AUTH-002`, and `FR-AUTH-003`.
**Upstream items to reconcile:**
- `01_BRD/PRD_Specification.md` and `brd_inventory.md`: `BRD-FR-001`–`003` are Market Desk arrivals, prices, and price trends, so they cannot own authentication requirements. Relevant identity/security requirements are `BRD-FR-039` (tenant boundary), `BRD-FR-040` (roles and segregation of duties), `BRD-FR-043` (membership administration), `BRD-FR-044` (verified active tenant context), and `BRD-FR-045` (resource isolation). `BRD-NFR-009` requires authentication/session/authorization security verification; `BRD-NFR-006` and `BRD-NFR-010` govern tenant isolation.
- `tech-profile.yaml`: Keycloak, OIDC PKCE, JWT bearer tokens, RBAC/ABAC, PostgreSQL RLS, and Valkey are configured technologies. They constrain design, but do not by themselves establish every sample-specific behavior or numeric service target.
- `UC-017` owns `BRD-FR-039`–`041`; `UC-019` owns `BRD-FR-043`–`044`; `UC-020` owns `BRD-FR-045`–`046`. Any UC-001 realignment must avoid creating duplicate requirement ownership and preserve explicit dependencies to those use cases.
**Downstream artifacts reachable from the traceability graph/index:**
| Artifact / Node | Impact |
|---|---|
| `04_generated_documentation/00_process_control/traceability_graph.md` and `traceability_index.md` (`TR-001`–`TR-003`) | Correct the three false BRD links and maintain the single canonical graph; keep the index consistent if it remains in use. |
| `04_generated_documentation/00_process_control/architecture_risk_register.md` (`UC-001`) | Revisit the legacy score/rationale and prior claim that a Stage 7 walking skeleton was validated; Stage 6 scoring for the current 26-UC set has not yet run. |
| SRS nodes `SRS-AUTH-001`–`003` shown in the graph | Reconcile parent FR links and constraints. No separate current SRS file was found during this review. |
| `04_generated_documentation/04_architecture_design/hld.md`, `04_architecture_design/lld/LLD-001_auth_service.md` | Reconcile authentication, tenant selection/context, membership verification, authorization, RLS, session/logout, token revocation, and persistence contracts with the approved UC scope. |
| `STORY-AUTH-001`–`003`, iteration-01 backlog/plan/surface matrix/parallel-work plan | Re-map or rescope stories and surfaces if their parent FRs change; reassess the prior iteration status. |
| `TC-AUTH-001`–`004`, regression/test strategy, manual QA guide/workbook, login/role/session screens and API contracts | Update expected behavior and reverify relevant tests and evidence after any approved requirement change. |
**Disposition of sample-specific constraints:**
- `FR-AUTH-001`'s OIDC/PKCE login aligns with the configured profile and security NFR. Its RS256 signing algorithm and access-token maximum lifetime of 15 minutes are not stated as business rules in the current PRD; retain them only if the accountable product/security owner confirms them as requirements or design decisions.
- `FR-AUTH-002` combines authorization, tenant claim propagation, RLS behavior, and super-admin cross-tenant scope. Align role permissions/segregation with `BRD-FR-040`, tenant membership/context with `BRD-FR-043`/`044`, and isolation with `BRD-FR-039`/`045`. Decide whether any additional super-admin scope behavior is authorized.
- `FR-AUTH-003` specifies a Valkey token blacklist and a 500 ms revocation target. Valkey is configured in the profile, but the PRD does not define this revocation mechanism or latency target. Decide whether to retain, revise, or remove those details. Preserve security/retention obligations from the approved NFRs.
- The use case's audit events should be reconciled with `BRD-FR-041`, which requires immutable history for submitted business records and governed mutations; do not silently broaden its audit scope.
**Iteration/evidence status:** The stakeholder restored the downstream artifacts and they are present in the active worktree. Review found the surface matrix’s prior “Verified for Gate 14.1” label unsupported: the workbook directory contains only `.gitkeep`, and no implementation/test execution evidence was found. Under the anti-placeholder rule, the matrix is now `Incomplete / Pending Construction`; no FR is marked Delivered. Auth design, iteration, test, manual-QA, and wireframe-boundary artifacts were rebaselined under CR-001. Gate 14.1 is not a release/CR closure prerequisite for these Baselined, not-yet-constructed requirements; run it before any iteration delivery claim.
**Approved rebaseline scope:** Keep UC-001 as the OIDC authentication and authorization use case, with general session handling required by `BRD-NFR-009`. Remove false `BRD-FR-001`–`003` links. Map role-based permission enforcement and segregation of duties to `BRD-FR-040`, owned by UC-001; leave tenant membership and active-tenant verification in UC-019, and tenant resource isolation and support access in UC-020. Retain OIDC/PKCE/JWT bearer as configured by `tech-profile.yaml`. Remove sample-specific RS256, 15-minute access-token expiry, Valkey blacklist, 500 ms revocation target, cross-tenant super-admin scope, and authentication audit-event assertions from requirements because the current product baseline does not authorize those details; downstream design may propose implementation choices through the normal design process.
**Verification record:** Approved impacted artifacts were versioned and rebaselined with `last_cr: CR-001`; Gate 5.1 passed with 0 Critical and 2 justified Major parser warnings. The restored iteration-01 artifacts were reviewed and Gate 14.1 was run. It failed with G14-006 (missing dense QA workbook) and G14-008 (no Bruno collections); the surface matrix and traceability status now explicitly say Incomplete / Pending Construction. Since no affected FR is Delivered, these construction blockers do not invalidate the CR requirements-alignment verification or closure. Gate 9.1 for the complete Stage 5 set remains independently pending.
### Disposition Checkpoint
- **Disposition:** Approved by stakeholder on 2026-10-11, with UC-001 covering OIDC AuthN/AuthZ and aligned to the current ATB baseline.
- **Status:** Closed — approved requirements/design/test-specification impact set rebaselined and verified. Gate 5.1 passed with zero Critical findings and two justified source-parser warnings. Gate 14.1 was run and failed with two Critical construction-evidence findings (missing dense workbook and Bruno collections); UC-001 requirements remain Baselined, not Delivered, and iteration-01 remains Incomplete / Pending Construction. Gate 14.1 is still mandatory before delivery or iteration closure.

View File

@ -0,0 +1,21 @@
# Checkpoint 009 — CR-001 UC-001 Review
- **Checkpoint ID:** `CKPT-009`
- **Date:** 2026-10-11
- **Active Stage:** Stage 5 — Change Request impact analysis / human disposition
- **Active Track:** Greenfield, India-first, multi-tenant Agriculture Trading Backoffice (ATB)
- **Active Skill:** `up-change-request-impact` Step 2 complete
## Completed
- Verified CKPT-008 against the current Stage 5 use-case set and Gate 5.1 results.
- Created `CR-001` and completed its impact analysis in `04_generated_documentation/00_process_control/change_request_register.md`.
- Reviewed UC-001 against the current PRD, `tech-profile.yaml`, related UCs, traceability links, and committed downstream auth artifacts.
- Left UC-001 and all impacted artifacts unchanged pending disposition.
## Open Items
- `CR-001` is Impact Analyzed with Proposed disposition. The stakeholder must choose Approve, Defer, or Reject before any impacted baseline artifact is edited.
- Tracked HLD/LLD/iteration/test artifacts in the impact chain are currently deleted in the working tree. Their deletions predate this CR analysis and were preserved.
- `AMB-001`, `AMB-006`, and `AMB-008` remain evidence gates.
## Exact Next Action
Obtain the stakeholder's disposition for `CR-001`. If approved, apply only the approved artifact set in the CR impact analysis, set `last_cr: CR-001`, bump versions, then verify Gate 5.1 and any impacted delivery evidence. If deferred or rejected, record that disposition and do not change the baseline.

View File

@ -0,0 +1,23 @@
# Checkpoint 010 — CR-001 UC-001 Rebaseline
- **Checkpoint ID:** `CKPT-010`
- **Date:** 2026-10-11
- **Active Stage:** Stage 5 — CR-001 approved requirements rebaseline; downstream impact reconciliation pending
- **Active Track:** Greenfield, India-first, multi-tenant Agriculture Trading Backoffice (ATB)
- **Active Skill:** `up-change-request-impact`
## Completed
- Stakeholder approved retaining UC-001 as the OIDC AuthN/AuthZ use case aligned to current product specifications.
- Rebaselined UC-001 to v1.1.0 under CR-001, removed unsupported sample-specific constraints and false BRD-FR-001–003 links, and aligned role authorization to BRD-FR-040.
- Moved BRD-FR-040 ownership to UC-001 and kept tenant isolation, membership/context, and privileged support requirements under UC-017/019/020.
- Updated the source inventory, traceability index/graph, CR register, and architecture risk register.
- Gate 5.1 passed with 0 Critical findings and 2 Major parser warnings for justified `new — not in BRD` entries on FR-AUTH-001/003. The requirement artifacts cite `tech-profile.yaml` and BRD-NFR-009; the validator does not recognize that allowed source declaration.
- `git diff --check` passed. No tests run.
## Open Items
- CR-001 remains open pending downstream architecture, iteration, and test/QA reconciliation and applicable delivery evidence. The active worktree still reports tracked deletions for HLD/LLD, iteration-01 planning, wireframes, and test/QA artifacts, despite the stakeholder reporting that folders were restored. These deletions were preserved.
- Gate 9.1 has not been run for the expanded Stage 5 use-case set.
- `AMB-001`, `AMB-006`, and `AMB-008` remain evidence gates.
## Exact Next Action
Make the reported restored downstream artifacts available in this active worktree (or confirm that those deleted paths are intentionally out of scope). Then reconcile only the applicable CR-001 downstream items, verify their actual delivery state, and run the required traceability/delivery gate for any confirmed iteration scope. Do not infer implementation or Gate 14.1 completion from former status labels. Keep CR-001 open until its approved impacts are verified.

View File

@ -0,0 +1,22 @@
# Checkpoint 011 — CR-001 Restored Artifact Reconciliation
- **Checkpoint ID:** `CKPT-011`
- **Date:** 2026-10-11
- **Active Stage:** Stage 5 CR verification complete; Stage 10–14 implementation remains pending
- **Active Track:** Greenfield, India-first, multi-tenant Agriculture Trading Backoffice (ATB)
- **Active Skill:** `up-change-request-impact` Step 5
## Completed
- Confirmed all downstream files previously reported deleted are present in the active worktree; Git no longer reports those paths deleted.
- Rebaselined HLD/LLD, iteration-01 backlog/plan/surface matrix/parallel-work plan, auth functional tests, regression catalog, test strategy, manual guide, wireframe auth boundary, traceability index/graph, and CR register to CR-001.
- Removed assumptions not authorized by the approved UC: RS256, token lifetime/latency, Valkey blacklist, direct trust of tenant claims, RLS work owned by UC-001, and cross-tenant authorization.
- Corrected authorization tests/story scope to BRD-FR-040 role permissions and segregation of duties; retained session logout without prescribing revocation mechanism/timing.
- Corrected iteration matrix from unsupported `Verified for Gate 14.1` to `Incomplete / Pending Construction`. The manual-QA workbook directory contains only `.gitkeep`; no implementation or test execution evidence was found.
- Gate 5.1 passed with zero Critical findings and two documented Major source-parser warnings. `git diff --check` passed.
## Open Items
- Construction remains pending; Gate 14.1 was run and failed with two Critical findings: the dense QA workbook is missing and Bruno collections are absent. No FR is Delivered. Resolve these findings and rerun Gate 14.1 before any future iteration delivery claim.
- `AMB-001`, `AMB-006`, `AMB-008` and Gate 9.1 for the expanded use-case set remain tracked outside this CR.
## Exact Next Action
CR-001 is closed as verified requirements/design/test-specification alignment. Next run Stage 6 architecture risk scoring/spike, then continue through the remaining Elaboration stages and Gate 9.1; keep iteration-01 pending construction until Gate 14.1 passes.

View File

@ -27,3 +27,9 @@
| `CKPT-007` | 2026-10-11 | Stage 1 (Business Requirements Extraction) | Baselined PRD for Stage 1 under DEC-020 and ASM-001–ASM-003; extracted 52 FRs and 14 NFRs. | `AMB-001`, `AMB-006`, and `AMB-008` remain evidence gates. | Review Stage 1 inventory, then continue Greenfield track to Stage 5 use-case authoring while carrying assumptions and release gates forward. | `checkpoint-007-atb-brd-extraction.md` |
| `CKPT-008` | 2026-10-11 | Stage 5 (Use Case Authoring / Gate 5.1) | Authored UC-002–UC-026 and child FRs; all 52 BRD-FRs mapped; Gate 5.1 passed structurally (26 UCs, 55 FRs). | UC-001 source-feature semantic mismatch requires CR disposition; `AMB-001`, `AMB-006`, `AMB-008` remain evidence gates. | Run `/up-change-request-impact` on UC-001 mapping discrepancy; after disposition, proceed to `/up-arch-risk-spike` for Stage 6. | `checkpoint-008-stage-5-use-case-authoring.md` |
| `CKPT-009` | 2026-10-11 | Stage 5 (CR-001 Impact Analysis) | Reviewed UC-001 and downstream traceability; CR-001 impact analysis completed, no product artifacts changed. | Awaiting Approve/Defer/Reject disposition; affected committed auth/iteration artifacts are deleted in current working tree. | Obtain CR-001 disposition; only then apply approved changes or record deferral/rejection. | `checkpoint-009-cr001-uc001-review.md` |
| `CKPT-010` | 2026-10-11 | Stage 5 (CR-001 Approved Rebaseline) | UC-001 and associated requirements/governance records realigned to OIDC AuthN/AuthZ and the ATB baseline; Gate 5.1 passed with 0 Critical and 2 justified source-parser warnings. | CR-001 downstream architecture/iteration/test reconciliation pending; affected files remain deleted in active worktree; Gate 9.1 pending; `AMB-001`, `AMB-006`, `AMB-008` remain open. | Make restored downstream artifacts visible in the active worktree (or confirm deleted scope), reconcile applicable CR-001 impacts, and verify delivery evidence before closing CR-001. | `checkpoint-010-cr001-rebaseline.md` |
| `CKPT-011` | 2026-10-11 | Stage 5 (CR-001 Verification) | Restored impacted artifacts confirmed and rebaselined to UC-001 v1.1.0; Gate 5.1 passed with 0 Critical and 2 documented source-parser warnings. Unsupported Gate 14.1 claim corrected to Incomplete / Pending Construction. | Gate 14.1 failed (2 Critical: workbook and Bruno evidence missing); construction, Gate 9.1, and `AMB-001`/`AMB-006`/`AMB-008` remain pending. CR-001 is closed after impact rebaseline verification. | Proceed to Stage 6 architecture risk scoring/spike; then complete remaining Elaboration gates before Construction. Keep iteration-01 Incomplete / Pending Construction. | `checkpoint-011-cr001-restored-artifacts.md` |

View File

@ -2,9 +2,11 @@
| Field | Value |
|---|---|
| **Governed Standard** | SEI-CMMI Level 3 (UP-AI v1.1) |
| **Governed Standard** | SEI-CMMI Level 3 (UP-AI v1.5) |
| **Document Path** | `04_generated_documentation/00_process_control/traceability_graph.md` |
| **Last Updated** | 2026-10-11 |
| **Version** | 1.1.0 |
| **Last CR** | `CR-001` |
| **Gated By** | `up-traceability-gate`, `scripts/verify_traceability_gates.py` |
@ -13,12 +15,14 @@
## 1. Graph Summary Statistics
- **Total Use Cases (UC-xxx):** 26
- **Total Functional Requirements (FR-xxx):** 55
- **Total System Requirements (SRS / NFR):** 3
- **Total User Stories (STORY-xxx):** 3
- **Total Test Cases (TC-xxx):** 4
- **Gate 5.1 Status:** **PASS** (Zero critical findings)
- **Total Functional Requirements (FR-xxx):** 54
- **Total System Requirements (SRS):** 0 (Gate 9.1 not run)
- **Source Non-Functional Requirements (BRD-NFR):** 14
- **Total User Stories (STORY-xxx):** 3 (historical references; downstream files missing from active worktree)
- **Total Test Cases (TC-xxx):** 4 (historical references; downstream files missing from active worktree)
- **Gate 5.1 Status:** **PASS WITH WARNINGS** (0 Critical; 2 justified Major source-parser warnings)
- **Gate 9.1 Status:** **Not Run for expanded Stage 5 scope**
- **Gate 14.1 Status:** **Failed for iteration-01** (2 Critical construction-evidence findings; no FR Delivered)
---
@ -26,26 +30,23 @@
```mermaid
graph TD
UC001["UC-001 (User Identity & Role Governance)"]
UC001 --> FR001["FR-AUTH-001 (OIDC PKCE Login)"]
UC001 --> FR002["FR-AUTH-002 (Multi-Tenant RBAC)"]
UC001 --> FR003["FR-AUTH-003 (Session & Token Revocation)"]
UC001["UC-001 (User Authentication and Authorization)"]
UC001 --> FR001["FR-AUTH-001 (OIDC Authentication)"]
UC001 --> FR002["FR-AUTH-002 (Role-Based Authorization)"]
UC001 --> FR003["FR-AUTH-003 (Session Handling and Logout)"]
FR001 --> SRS001["SRS-AUTH-001 (JWT Claims & PKCE)"]
FR001 --> HLD001["HLD-AUTH / LLD-001"]
FR001 --> HLD001["Auth HLD / LLD (revalidate under CR-001)"]
FR001 --> STORY001["STORY-AUTH-001"]
STORY001 --> TC001["TC-AUTH-001 (Happy Path OIDC)"]
STORY001 --> TC002["TC-AUTH-002 (Invalid Token Boundary)"]
FR002 --> SRS002["SRS-AUTH-002 (Tenant RLS Scoping)"]
FR002 --> HLD001
FR002 --> STORY002["STORY-AUTH-002"]
STORY002 --> TC003["TC-AUTH-003 (Cross-Tenant Rejection)"]
STORY002 --> TC003["TC-AUTH-003 (Role Permission Denial)"]
FR003 --> SRS003["SRS-AUTH-003 (Session Blacklist)"]
FR003 --> HLD001
FR003 --> STORY003["STORY-AUTH-003"]
STORY003 --> TC004["TC-AUTH-004 (Token Revocation FSM)"]
STORY003 --> TC004["TC-AUTH-004 (Ended Session FSM)"]
```
---
@ -54,10 +55,10 @@ graph TD
| Node ID | Node Name | Parent ID | Downstream Linkages | Status |
|---|---|---|---|---|
| `UC-001` | User Identity & Role Governance | — (source mapping under semantic review) | `FR-AUTH-001`, `FR-AUTH-002`, `FR-AUTH-003` | Baselined |
| `FR-AUTH-001` | OIDC PKCE Login | `UC-001` | `SRS-AUTH-001`, `LLD-001_auth_service.md`, `STORY-AUTH-001` | Ready for Construction |
| `FR-AUTH-002` | Multi-Tenant RBAC | `UC-001` | `SRS-AUTH-002`, `LLD-001_auth_service.md`, `STORY-AUTH-002` | Ready for Construction |
| `FR-AUTH-003` | Session & Token Revocation | `UC-001` | `SRS-AUTH-003`, `LLD-001_auth_service.md`, `STORY-AUTH-003` | Ready for Construction |
| `UC-001` | User Authentication and Authorization | `BRD-FR-040`, `BRD-NFR-009`, `tech-profile.yaml` | `FR-AUTH-001`, `FR-AUTH-002`, `FR-AUTH-003` | Baselined (CR-001, v1.1.0) |
| `FR-AUTH-001` | OIDC Authentication | `UC-001` | HLD/LLD, STORY-AUTH-001, TC-AUTH-001/002 rebaselined under CR-001 | Baselined; pending construction verification |
| `FR-AUTH-002` | Role-Based Authorization | `UC-001` | `BRD-FR-040`; HLD/LLD, STORY-AUTH-002, TC-AUTH-003 rebaselined under CR-001 | Baselined; pending construction verification |
| `FR-AUTH-003` | Session Handling and Logout | `UC-001` | `BRD-NFR-009`; HLD/LLD, STORY-AUTH-003, TC-AUTH-004 rebaselined under CR-001 | Baselined; pending construction verification |
---
@ -65,10 +66,10 @@ graph TD
| Check-ID | UC or FR | Issue | Severity | Required Action |
|---|---|---|---|---|
| G51-001/002 | `UC-001`–`UC-019`, child FRs | Deterministic validator found 26 use cases with 55 total child FRs; all parent UC references resolve. | Pass | None for structural completeness. |
| Semantic review | `UC-001` / `FR-AUTH-001`–`FR-AUTH-003` | Existing authentication requirements cite `BRD-FR-001`–`BRD-FR-003`, which the baselined PRD defines as Market Desk arrival, price capture, and trend analytics. The current source mapping is semantically inconsistent. | Major | Raise and disposition a CR through `up-change-request-impact` before changing the baselined UC/FR source mappings. |
| G51-001/002 | `UC-001`–`UC-026`, child FRs | Deterministic validator found 26 use cases with 54 total child FRs; all parent UC references resolve. | Pass | None for structural completeness. |
| Semantic review | `UC-001` / `FR-AUTH-001`–`FR-AUTH-003` | Existing authentication requirements cite `BRD-FR-001`–`BRD-FR-003`, which the baselined PRD defines as Market Desk arrival, price capture, and trend analytics. The original sample mapped authentication to Market Desk features. CR-001 realigned UC-001 to the current product baseline and moved role authorization ownership to `BRD-FR-040`. | Resolved by CR-001 | Re-run Gate 5.1; downstream design/test revalidation remains pending. |
**Gate result:** PASS with a semantic Major follow-up; zero Critical findings. Do not treat the existing UC-001 source mapping as validated by the deterministic pass.
**Historical gate result:** structural PASS with a semantic Major; resolved through approved CR-001. The post-rebaseline structural check is recorded below; downstream architecture/test verification remains pending.
### Additional Stage 5 Nodes (UC-002–UC-026)
@ -127,9 +128,8 @@ graph TD
| `UC-016` | Commodity and Trading Counterparty Master Data | — | `BRD-FR-037`, `BRD-FR-038` | Draft |
| `FR-MASTERDATA-001` | Agricultural Commodity Master Data Management | `UC-016` | `BRD-FR-037` | Draft |
| `FR-MASTERDATA-002` | Trading Counterparty Masters (Suppliers, Customers & Godowns) | `UC-016` | `BRD-FR-038` | Draft |
| `UC-017` | Tenant Isolation, Business Permissions and Audit | — | `BRD-FR-039`, `BRD-FR-040`, `BRD-FR-041` | Draft |
| `UC-017` | Tenant Isolation and Transaction Audit | — | `BRD-FR-039`, `BRD-FR-041` | Draft (CR-001, v1.1.0) |
| `FR-TENANTSECURITYAUDIT-001` | Tenant Data Isolation | `UC-017` | `BRD-FR-039` | Draft |
| `FR-TENANTSECURITYAUDIT-002` | Role-Based Access Control (RBAC) & Permission Scoping | `UC-017` | `BRD-FR-040` | Draft |
| `FR-TENANTSECURITYAUDIT-003` | Immutable Transaction Audit Logging | `UC-017` | `BRD-FR-041` | Draft |
| `UC-018` | Tenant Provisioning and Lifecycle | — | `BRD-FR-042` | Draft |
| `FR-TENANTLIFECYCLE-001` | Tenant Provisioning and Lifecycle Management | `UC-018` | `BRD-FR-042` | Draft |
@ -151,3 +151,12 @@ graph TD
| `FR-PROCESSORGOVERNANCE-001` | Data Processor & Subprocessor Governance | `UC-025` | `BRD-FR-051` | Draft |
| `UC-026` | Tenant Operating Policy Configuration | — | `BRD-FR-052` | Draft |
| `FR-TENANTOPERATINGPOLICIES-001` | Tenant Operating Policy Configuration & Audit | `UC-026` | `BRD-FR-052` | Draft |
### CR-001 Rebaseline — Gate 5.1 Structural Check (2026-10-11)
- `UC-001` remains the OIDC authentication and authorization use case. `FR-AUTH-001` and `FR-AUTH-003` are justified as new requirements by `tech-profile.yaml` and `BRD-NFR-009`; `FR-AUTH-002` maps to `BRD-FR-040`.
- `BRD-FR-040` is owned only by `UC-001`; the duplicate child requirement was removed from `UC-017`.
- Structural validator result: Gate 5.1 passed with zero Critical findings and two Major warnings (2026-10-11). The warnings are for `new — not in BRD` on `FR-AUTH-001` and `FR-AUTH-003`; both have source justification in the FR artifact from `tech-profile.yaml` and `BRD-NFR-009`. The validator parser only recognizes uppercase BRD token IDs and does not recognize the skill-permitted `new — not in BRD` value.
- `Gate 9.1` remains not run for the expanded use-case set.
- Gate 14.1 was run for iteration-01 and failed with G14-006 (missing dense QA workbook) and G14-008 (no Bruno API collections). The iteration is Incomplete / Pending Construction and no FR is Delivered.
- Auth architecture, iteration, and test specifications have been rebaselined under CR-001. No automated implementation test run was performed.

View File

@ -4,7 +4,9 @@
|---|---|
| **Governed Standard** | SEI-CMMI Level 3 (UP-AI v1.0) |
| **Document Path** | `04_generated_documentation/00_process_control/traceability_index.md` |
| **Last Updated** | 2026-09-03 |
| **Last Updated** | 2026-10-11 |
| **Version** | 1.1.0 |
| **Last CR** | `CR-001` |
---
@ -20,6 +22,6 @@ $$\text{BRD-FR-xxx} \longrightarrow \text{UC-xxx} \longrightarrow \text{FR-xxx}
| Trace ID | Requirement Name | Actor(s) | BRD Feature | UC ID | FR ID(s) | HLD / LLD Component | Delivery Stories | Test Cases | Delivery Status |
|---|---|---|---|---|---|---|---|---|---|
| `TR-001` | User Authentication & OIDC PKCE | All Users | `BRD-FR-001` | `UC-001` | `FR-AUTH-001` | `HLD-AUTH` / `LLD-001_auth_service.md` | `STORY-AUTH-001` | `TC-AUTH-001`, `TC-AUTH-002` | Ready for Construction |
| `TR-002` | Multi-Tenant RBAC Authorization | Admin, User | `BRD-FR-002` | `UC-001` | `FR-AUTH-002` | `HLD-AUTH` / `LLD-001_auth_service.md` | `STORY-AUTH-002` | `TC-AUTH-003` | Ready for Construction |
| `TR-003` | User Session Lifecycle & Revocation | All Users | `BRD-FR-003` | `UC-001` | `FR-AUTH-003` | `HLD-AUTH` / `LLD-001_auth_service.md` | `STORY-AUTH-003` | `TC-AUTH-004` | Ready for Construction |
| `TR-001` | User Authentication & OIDC PKCE | All Users | `tech-profile.yaml`; `BRD-NFR-009` | `UC-001` | `FR-AUTH-001` | HLD/LLD rebaselined (CR-001) | `STORY-AUTH-001` | `TC-AUTH-001`, `TC-AUTH-002` | Pending Construction; not delivered |
| `TR-002` | Role-Based Authorization | PRD-defined roles | `BRD-FR-040` | `UC-001` | `FR-AUTH-002` | HLD/LLD rebaselined (CR-001) | `STORY-AUTH-002` | `TC-AUTH-003` | Pending Construction; not delivered |
| `TR-003` | Session Handling and Logout | All Users | `BRD-NFR-009`; `tech-profile.yaml` | `UC-001` | `FR-AUTH-003` | HLD/LLD rebaselined (CR-001) | `STORY-AUTH-003` | `TC-AUTH-004` | Pending Construction; not delivered |

View File

@ -6,6 +6,8 @@
| **Document Path** | `04_generated_documentation/01_source_inventories/brd_inventory.md` |
| **Authoritative Source** | `01_BRD/PRD_Specification.md` (baselined for Stage 1 extraction with bounded assumptions) |
| **Last Updated** | 2026-10-11 |
| **Version** | 1.1.0 |
| **Last CR** | `CR-001` |
| **Active Track** | Greenfield |
## Extracted Functional Business Requirements (`BRD-FR-xxx`)
@ -53,7 +55,7 @@ Every functional feature from PRD §5 is represented once. Stage 1 extraction do
| `BRD-FR-037` | Agricultural Commodity Master Data Management | §5 | System Administrator | P0 | Maintain authoritative master catalogs for: Commodities (Chana, Soybean, Mustard, Wheat, Coriander, Cumin, Fenugreek, Groundnut, Isabgol, Jaggery, Maize, Turmeric), Varieties per commodity (e.g., Lokwan, Pusa, Eagle/Badami), and Commercial Quality Grades (`FAQ`, `Premium`, `Below FAQ`). | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-016` |
| `BRD-FR-038` | Trading Counterparty Masters (Suppliers, Customers & Godowns) | §5 | System Administrator / Accounts Executive | P0 | Maintain registries for: (1) Suppliers (Code, Name, City, Segment, Credit Days: 7/15/21), (2) Customers (Code, Name, City, Segment, Credit Limit INR, Contact), and (3) Godowns/Warehouses (Code, Name, City, Capacity MT). | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-016` |
| `BRD-FR-039` | Tenant Data Isolation | §5 | System Administrator | P0 | Each independent trading enterprise is a tenant; its branches and godowns operate within that tenant boundary. Users and transactions must be associated with the correct tenant, and access to one tenant’s business data must not expose another tenant’s data. The isolation implementation must conform to the active technology profile. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-017` |
| `BRD-FR-040` | Role-Based Access Control (RBAC) & Permission Scoping | §5 | System Administrator | P0 | Access to business records and actions must be governed by role-based permissions for the roles defined in this PRD: `Tenant Administrator`, `Mandi Buyer`, `Purchase Manager`, `Yard Supervisor`, `Quality Officer`, `Sales Executive`, `Sales Manager`, `Logistics Coordinator`, `Accounts Executive`, `Partner / MD`, and `System Administrator`. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-017` |
| `BRD-FR-040` | Role-Based Access Control (RBAC) & Permission Scoping | §5 | System Administrator | P0 | Access to business records and actions must be governed by role-based permissions for the roles defined in this PRD: `Tenant Administrator`, `Mandi Buyer`, `Purchase Manager`, `Yard Supervisor`, `Quality Officer`, `Sales Executive`, `Sales Manager`, `Logistics Coordinator`, `Accounts Executive`, `Partner / MD`, and `System Administrator`. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-001` |
| `BRD-FR-041` | Immutable Transaction Audit Logging | §5 | System Administrator | P0 | Submitted business records (GRNs, Sales Orders, Dispatches, Payment Receipts) must preserve an auditable history. Corrections must not silently rewrite the business history. The system must record user ID, timestamp, and the changed values for governed mutations. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-017` |
| `BRD-FR-042` | Tenant Provisioning and Lifecycle Management | §5 | System Administrator | P0 | Public self-service tenant signup is out of scope for v1. An authorized platform administrator must create and configure each tenant, assign its initial Tenant Administrator, and activate, suspend, or close the tenant through a controlled lifecycle. Tenant lifecycle changes must not silently delete or expose business records. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-018` |
| `BRD-FR-043` | Tenant Membership and Role Administration | §5 | Tenant Administrator | P0 | A person may hold active memberships in multiple tenants. A Tenant Administrator must be able to add, deactivate, and assign approved business roles to users within their own tenant. A tenant administrator must not manage users or roles belonging to another tenant. Platform-level administrators and tenant-level administrators must have distinct permissions. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-019` |

View File

@ -1,64 +1,84 @@
# Functional Requirements: UC-001 User Identity and Role Governance
---
id: UC-001-FR
version: 1.1.0
status: Baselined
last_cr: CR-001
---
# Functional Requirements — UC-001 User Authentication and Authorization
| Field | Value |
|---|---|
| **Parent Use Case** | [`UC-001`](use-case.md) |
| **Document** | `functional-reqs.md` |
| **Status** | Baselined |
| **Version** | 1.0.0 |
| **Last CR** | None (UP-AI v1.0 Baseline) |
| **Version** | 1.1.0 |
| **Last CR** | `CR-001` |
---
## FR-AUTH-001: Multi-Tenant OIDC PKCE Login
## FR-AUTH-001: OIDC Authentication
- **Requirement ID:** `FR-AUTH-001`
- **Parent Use Case:** `UC-001`
- **Source Feature:** `BRD-FR-001`
- **Source Feature:** `new — not in BRD`
- **Priority:** P0 (Must Have)
- **Primary Surface:** Frontend Portal Login Screen, Backend Auth Router
- **Primary Surface:** Login screen and authentication integration; route/contract details in LLD
- **Business Rules:** Use the identity provider, OIDC/PKCE protocol, and JWT bearer-token standard configured in `tech-profile.yaml`. Authentication and session handling must be verified before production under `BRD-NFR-009`.
### Source Justification
The current technology profile configures Keycloak with OIDC/PKCE and JWT bearer tokens; `BRD-NFR-009` requires authentication and session handling to be verified. The detailed sign-in feature is not separately numbered as a BRD-FR.
### Statement
The platform shall provide secure multi-tenant user authentication via OpenID Connect (OIDC) Authorization Code Flow with Proof Key for Code Exchange (PKCE). Upon successful login, the system shall issue a signed JSON Web Token (JWT) containing standard claims (`sub`, `email`, `exp`) and custom claims (`tenant_id`, `roles`, `permissions`).
The platform shall authenticate users through the configured OIDC identity provider using the configured PKCE protocol and establish an authenticated application session using the configured JWT bearer-token approach.
### Acceptance Criteria
1. Unauthenticated users attempting to access protected routes shall be redirected to the OIDC provider login interface.
2. The authorization request MUST include a SHA-256 PKCE code challenge.
3. Access tokens MUST be signed with RS256 and have an expiration of $\le 15\text{ minutes}$.
4. All backend API endpoints MUST validate the token signature and verify the `tenant_id` claim.
---
1. The sign-in flow uses the configured identity provider and OIDC/PKCE protocol.
2. The application establishes a session only after validating a successful identity-provider response.
3. Unauthenticated or invalid authentication responses do not grant access to protected operations.
4. No signing algorithm, access-token lifetime, or latency value is fixed by this requirement; those values require approved security design evidence.
## FR-AUTH-002: Role-Based Access Control & RLS Scoping
## FR-AUTH-002: Role-Based Authorization
- **Requirement ID:** `FR-AUTH-002`
- **Parent Use Case:** `UC-001`
- **Source Feature:** `BRD-FR-002`
- **Source Feature:** `BRD-FR-040`
- **Priority:** P0 (Must Have)
- **Primary Surface:** Backend RBAC Middleware, PostgreSQL Database
- **Primary Surface:** Authorization enforcement for protected business actions
- **Business Rules:** Apply the permission matrix for the PRD-defined roles and enforce segregation of duties. Active tenant membership and tenant context are verified by `UC-019`; tenant resource isolation is governed by `UC-017` / `UC-020`.
### Statement
The platform shall enforce granular Role-Based Access Control (RBAC) at the API route level and PostgreSQL Row-Level Security (RLS) at the database layer. For every authenticated request, the database session MUST have `app.current_tenant` initialized to prevent any cross-tenant query execution.
The platform shall authorize protected business actions according to the role-based permission matrix for `Tenant Administrator`, `Mandi Buyer`, `Purchase Manager`, `Yard Supervisor`, `Quality Officer`, `Sales Executive`, `Sales Manager`, `Logistics Coordinator`, `Accounts Executive`, `Partner / MD`, and `System Administrator`. The permission matrix shall cover `Read`, `Write`, `Create`, `Delete`, `Submit`, `Cancel`, and `Amend` actions. The platform shall enforce the stated segregation of duties: Quality Officers cannot edit prices; Yard Supervisors cannot confirm sales; Sales Executives cannot override credit locks.
### Acceptance Criteria
1. Routes decorated with role requirements (e.g. `@require_roles("admin")`) MUST reject requests lacking the required role with HTTP 403 Forbidden.
2. Direct SQL queries executed within a tenant session MUST NOT return or modify records belonging to other tenants.
3. Super-admin operations spanning multiple tenants MUST require explicit elevated scope claims.
---
1. Authorization decisions use the applicable role and resource/action permission from the permission matrix.
2. An operation not permitted by that matrix is denied before the business action is performed.
3. Quality Officers cannot edit prices, Yard Supervisors cannot confirm sales, and Sales Executives cannot override credit locks.
4. A tenant administrator's authorization applies only within that administrator's verified tenant membership; tenant context checks are performed by `UC-019`.
5. This requirement does not grant general cross-tenant access or bypass the resource-isolation controls in `UC-017` / `UC-020`.
## FR-AUTH-003: Session Monitoring & Token Revocation
## FR-AUTH-003: Session Handling and Logout
- **Requirement ID:** `FR-AUTH-003`
- **Parent Use Case:** `UC-001`
- **Source Feature:** `BRD-FR-003`
- **Priority:** P1 (High)
- **Primary Surface:** Backend Auth Router, Token Cache
- **Source Feature:** `new — not in BRD`
- **Priority:** P0 (Must Have)
- **Primary Surface:** Application session controls and authentication integration; endpoint contract in LLD
- **Business Rules:** `BRD-NFR-009` requires session handling to be verified before production. The profile configures Keycloak OIDC and JWT bearer tokens.
### Source Justification
The PRD requires authentication and session handling verification in `BRD-NFR-009`, and the active profile configures the identity provider and token approach. The PRD does not prescribe a token blacklist, revocation latency, or specific logout endpoint.
### Statement
The platform shall support instant user logout and token revocation. Revoked tokens and compromised sessions MUST be added to a distributed blacklist (Valkey/Redis) checked during token validation.
The platform shall provide a way for an authenticated user to end the application session and shall deny protected operations when no valid authenticated session is available.
### Acceptance Criteria
1. Calling `/api/v1/auth/logout` with a valid refresh token MUST invalidate both access and refresh tokens.
2. Blacklisted tokens MUST be rejected immediately on subsequent API calls within $\le 500\text{ ms}$ of revocation.
3. An audit log entry (`AUDIT-AUTH-LOGOUT`) MUST be recorded with timestamp, user ID, and client IP.
1. An authenticated user can initiate logout and the application ends that user's active application session.
2. After logout, the ended application session cannot be used to perform protected operations.
3. Exact token invalidation semantics, server-side revocation mechanism, cache choice, and revocation timing are specified only if established by approved security design; they are not fixed by this requirement.
4. Authentication/security evidence is included in the production verification required by `BRD-NFR-009`.

View File

@ -1,67 +1,80 @@
# UC-001: User Identity and Role Governance
---
id: UC-001
version: 1.1.0
status: Baselined
last_cr: CR-001
---
# UC-001 — User Authentication and Authorization
| Field | Value |
|---|---|
| **Use Case ID** | `UC-001` |
| **Name** | User Identity and Role Governance |
| **Owning Domain** | Identity & Access Management (IAM) |
| **Primary Actor** | End User / Tenant Administrator |
| **Supporting Actors** | Keycloak OIDC Provider, PostgreSQL RLS Engine |
| **Parent Feature** | `BRD-FR-001`, `BRD-FR-002`, `BRD-FR-003` |
| **Name** | User Authentication and Authorization |
| **Owning Domain** | Identity & Access Management |
| **Primary Actor** | End User |
| **Supporting Actors** | Tenant Administrator; Keycloak identity provider; tenant membership and context services (`UC-019`) |
| **Parent Product Requirement** | `BRD-FR-040` (authorization); authentication and session handling are required by `BRD-NFR-009` and configured in `tech-profile.yaml` |
| **Status** | Baselined |
| **Version** | 1.0.0 |
| **Last CR** | None (UP-AI v1.0 Baseline) |
| **Version** | 1.1.0 |
| **Last CR** | `CR-001` |
---
## 1. Description and Business Goal
## 1. Description & Business Goal
Authenticate a user through the configured OIDC provider and authorize business actions according to the role permissions and segregation-of-duties rules in `BRD-FR-040`. Authentication, session handling, and authorization must be verified before production release under `BRD-NFR-009`.
This use case governs multi-tenant user authentication, token issuance, role-based authorization (RBAC), and session revocation across all web portals and API services.
It guarantees that:
1. All client authentication requests execute via secure OIDC Authorization Code Flow with PKCE.
2. User sessions propagate verified `tenant_id` claims that bind database queries to the active tenant via PostgreSQL Row-Level Security (RLS).
3. Access tokens and refresh tokens follow strict rotation policies and can be revoked on demand.
---
Tenant membership, active-tenant selection, and verification for each operation are governed by `UC-019` / `BRD-FR-043`–`044`. Tenant data isolation and exceptional support access are governed by `UC-017` and `UC-020` / `BRD-FR-039`, `BRD-FR-041`, and `BRD-FR-045`–`046`. UC-001 consumes those controls and does not redefine them.
## 2. Preconditions
1. The target tenant organization is active and configured in Keycloak.
2. The user has an active account with at least one assigned organizational role.
3. The client application (e.g. Admin Portal or Customer Portal) is a registered OIDC client.
1. The application is configured to use the identity provider and protocol declared in `tech-profile.yaml` (Keycloak with OIDC/PKCE and JWT bearer tokens).
2. The user has an identity recognized by the configured identity provider.
3. To access tenant business operations, the user has an active membership and approved role assignment in the selected tenant, as managed and verified by `UC-019`.
---
## 3. Trigger
## 3. Main Success Scenario (Happy Path)
The user attempts to sign in or invokes a protected business operation.
1. **Initiate Authentication:** The user accesses the web application and clicks "Login".
2. **PKCE Challenge Generation:** The frontend client generates a cryptographic code verifier and code challenge, redirecting the browser to Keycloak's authorization endpoint.
3. **User Authentication:** The user enters credentials (username/password or enterprise SSO). Keycloak validates credentials and issues an authorization code.
4. **Token Exchange:** The frontend exchanges the authorization code and code verifier with Keycloak for a signed JWT access token, refresh token, and ID token containing `tenant_id` and `roles`.
5. **Session Establishment:** The frontend initializes application state with user claims and tenant context.
6. **API Invocation:** Subsequent API requests include the `Authorization: Bearer <token>` header. The backend gateway validates token signature, extracts tenant context, sets the PostgreSQL `app.current_tenant` session variable, and authorizes the endpoint via RBAC claims.
## 4. Main Success Scenario
---
1. The user initiates sign-in from the application.
2. The application starts the configured OIDC authorization flow using PKCE.
3. The identity provider authenticates the user and returns the OIDC authorization response.
4. The application validates the response and establishes an authenticated session using the configured JWT bearer-token approach.
5. When the user invokes a protected action, the application/server evaluates the action against the approved role permission matrix and segregation-of-duties controls in `BRD-FR-040`.
6. For tenant-scoped actions, the service relies on `UC-019` to verify active membership, selected tenant context, and role for the request; resource isolation is enforced by `UC-017` / `UC-020`.
7. The authorized action proceeds.
## 4. Alternate & Exception Scenarios
## 5. Alternate and Exception Scenarios
- **4a. Expired Access Token:** The frontend intercepts a 401 response and uses the refresh token to silently obtain a fresh access token without user friction.
- **4b. Invalid or Revoked Token:** If a token is blacklisted or revoked, the backend rejects the request with HTTP 401 `TOKEN_REVOKED`, and the frontend redirects to the login screen.
- **4c. Insufficient Role Permissions (RBAC):** If the user's role does not permit the requested operation, the backend returns HTTP 403 `FORBIDDEN` with a structured error response.
- **4d. Cross-Tenant Tampering:** If a request attempts to access data outside the token's `tenant_id`, PostgreSQL Row-Level Security silently filters or blocks the query, ensuring zero cross-tenant data leakage.
- **5a. Identity provider rejects authentication or the OIDC response is invalid:** The application does not establish an authenticated session and denies protected access.
- **5b. Session is absent, expired, or ended:** The application denies protected access and requires authentication again. Exact token lifetime and revocation implementation are design decisions, not requirements established by this CR.
- **5c. User lacks permission for the action:** The service denies the action under the permission matrix. Examples of prohibited actions include Quality Officers editing prices, Yard Supervisors confirming sales, and Sales Executives overriding credit locks (`BRD-FR-040`).
- **5d. User has no active membership or a client-supplied tenant context is not authorized:** The service denies the operation according to `UC-019` / `BRD-FR-043`–`044`.
- **5e. A request targets another tenant's resource:** The service denies access without exposing that resource, according to `UC-017` / `UC-020` and `BRD-FR-039` / `BRD-FR-045`.
---
## 6. Postconditions
## 5. Postconditions
- On successful sign-in, the user has an authenticated application session.
- Protected actions are allowed only after authorization under the role permissions and segregation-of-duties requirements.
- Tenant context and resource isolation decisions remain governed by their owning use cases.
- On denied authentication or authorization, no protected business action is performed.
- A secure, verified session is established with tenant scoping.
- An immutable audit record (`AUDIT-AUTH-LOGIN`) is emitted.
## 7. Referenced Screens and Routes
---
- Application login screen (`/login`, as referenced by the existing auth delivery design).
- Protected business screens invoke authenticated APIs; detailed routes and session/logout endpoints must be reconciled in the updated LLD.
## 6. Child Functional Requirements
## 8. Business Rules Invoked
- [`FR-AUTH-001: Multi-Tenant OIDC PKCE Login`](functional-reqs.md#fr-auth-001)
- [`FR-AUTH-002: Role-Based Access Control & RLS Scoping`](functional-reqs.md#fr-auth-002)
- [`FR-AUTH-003: Session Monitoring & Token Revocation`](functional-reqs.md#fr-auth-003)
- `BRD-FR-040`: role-based permissions for the PRD-defined roles; enforce the stated segregation-of-duties restrictions.
- `BRD-NFR-009`: verify authentication, session handling, authorization, and applicable security controls before production release.
- `tech-profile.yaml`: Keycloak, OIDC/PKCE, JWT bearer tokens, and RBAC/ABAC are the active technology configuration.
- `UC-019` / `BRD-FR-043`–`044`: active membership and verified tenant context for each operation.
- `UC-017` / `UC-020` / `BRD-FR-039`, `BRD-FR-045`–`046`: tenant data isolation and controlled support access.
## 9. Child Functional Requirements
- [FR-AUTH-001: OIDC Authentication](functional-reqs.md#fr-auth-001)
- [FR-AUTH-002: Role-Based Authorization](functional-reqs.md#fr-auth-002)
- [FR-AUTH-003: Session Handling and Logout](functional-reqs.md#fr-auth-003)

View File

@ -1,16 +1,18 @@
---
id: UC-017-FR
version: 1.0.0
version: 1.1.0
status: Draft
last_cr: CR-001
---
# Functional Requirements — UC-017 Tenant Isolation, Business Permissions and Audit
# Functional Requirements — UC-017 Tenant Isolation and Transaction Audit
| Field | Value |
|---|---|
| **Parent Use Case** | `UC-017` |
| **Status** | Draft |
| **Version** | 1.0.0 |
| **Version** | 1.1.0 |
| **Last CR** | `CR-001` |
## FR-TENANTSECURITYAUDIT-001: Tenant Data Isolation
@ -30,24 +32,6 @@ Each independent trading enterprise is a tenant; its branches and godowns operat
1. The requirement records, computes, or presents the source-defined data attributes: Tenant ID, Tenant Name, Tenant Status, Tenant Administrator, Branch and Godown IDs.
2. The system enforces the source-defined validation rules: Tenant context must be enforced on every applicable business operation and verified for cross-tenant data access.
## FR-TENANTSECURITYAUDIT-002: Role-Based Access Control (RBAC) & Permission Scoping
- **Requirement ID:** `FR-TENANTSECURITYAUDIT-002`
- **Parent UC:** `UC-017`
- **Source Feature:** `BRD-FR-040`
- **Priority:** Must (P0)
- **Referenced Screen / Route:** Architecture & Security workflow screen(s) — route(s) to be specified during Stage 11 screen design
- **Business Rules:** Segregation of duties enforced: Quality Officers cannot edit prices; Yard Supervisors cannot confirm sales; Sales Executives cannot override credit locks.
### Statement
Access to business records and actions must be governed by role-based permissions for the roles defined in this PRD: `Tenant Administrator`, `Mandi Buyer`, `Purchase Manager`, `Yard Supervisor`, `Quality Officer`, `Sales Executive`, `Sales Manager`, `Logistics Coordinator`, `Accounts Executive`, `Partner / MD`, and `System Administrator`.
### Acceptance Criteria
1. The requirement records, computes, or presents the source-defined data attributes: Role Name, Resource/Action Permission Matrix (`Read`, `Write`, `Create`, `Delete`, `Submit`, `Cancel`, `Amend`).
2. The system enforces the source-defined validation rules: Segregation of duties enforced: Quality Officers cannot edit prices; Yard Supervisors cannot confirm sales; Sales Executives cannot override credit locks.
## FR-TENANTSECURITYAUDIT-003: Immutable Transaction Audit Logging
- **Requirement ID:** `FR-TENANTSECURITYAUDIT-003`

View File

@ -1,25 +1,27 @@
---
id: UC-017
version: 1.0.0
version: 1.1.0
status: Draft
last_cr: CR-001
---
# UC-017 — Tenant Isolation, Business Permissions and Audit
# UC-017 — Tenant Isolation and Transaction Audit
| Field | Value |
|---|---|
| **Use Case ID** | `UC-017` |
| **Name** | Tenant Isolation, Business Permissions and Audit |
| **Name** | Tenant Isolation and Transaction Audit |
| **Owning Domain** | Architecture & Security |
| **Primary Actor(s)** | System Administrator |
| **Supporting Actor(s)** | None stated |
| **Source Features** | `BRD-FR-039`, `BRD-FR-040`, `BRD-FR-041` |
| **Source Features** | `BRD-FR-039`, `BRD-FR-041` |
| **Status** | Draft |
| **Version** | 1.0.0 |
| **Version** | 1.1.0 |
| **Last CR** | `CR-001` |
## Goal
Enforce tenant data boundaries and business-role permissions while preserving immutable histories of governed transactions.
Enforce tenant data boundaries and preserve immutable histories of governed transactions. Role-based authorization is specified in UC-001 under `BRD-FR-040`.
## Preconditions
@ -28,13 +30,12 @@ Enforce tenant data boundaries and business-role permissions while preserving im
## Trigger
The actor initiates one of the 3 business operations covered by this use case: tenant data isolation; role-based access control (rbac) & permission scoping; immutable transaction audit logging.
The actor invokes a tenant-scoped operation or submits/corrects a governed business record.
## Main Success Flow
1. The actor initiates **Tenant Data Isolation**. The system performs the source-defined behavior: Each independent trading enterprise is a tenant; its branches and godowns operate within that tenant boundary. Users and transactions must be associated with the correct tenant, and access to one tenant’s business data must not expose another tenant’s data. The isolation implementation must conform to the active technology profile.
2. The actor initiates **Role-Based Access Control (RBAC) & Permission Scoping**. The system performs the source-defined behavior: Access to business records and actions must be governed by role-based permissions for the roles defined in this PRD: `Tenant Administrator`, `Mandi Buyer`, `Purchase Manager`, `Yard Supervisor`, `Quality Officer`, `Sales Executive`, `Sales Manager`, `Logistics Coordinator`, `Accounts Executive`, `Partner / MD`, and `System Administrator`.
3. The actor initiates **Immutable Transaction Audit Logging**. The system performs the source-defined behavior: Submitted business records (GRNs, Sales Orders, Dispatches, Payment Receipts) must preserve an auditable history. Corrections must not silently rewrite the business history. The system must record user ID, timestamp, and the changed values for governed mutations.
2. The actor initiates **Immutable Transaction Audit Logging**. The system performs the source-defined behavior: Submitted business records (GRNs, Sales Orders, Dispatches, Payment Receipts) must preserve an auditable history. Corrections must not silently rewrite the business history. The system must record user ID, timestamp, and the changed values for governed mutations.
## Alternate Flows
@ -43,7 +44,6 @@ The actor initiates one of the 3 business operations covered by this use case: t
## Exception Flows
- **BRD-FR-039:** Reject or prevent the operation when its stated validation rules are not met: Tenant context must be enforced on every applicable business operation and verified for cross-tenant data access.
- **BRD-FR-040:** Reject or prevent the operation when its stated validation rules are not met: Segregation of duties enforced: Quality Officers cannot edit prices; Yard Supervisors cannot confirm sales; Sales Executives cannot override credit locks.
- **BRD-FR-041:** Reject or prevent the operation when its stated validation rules are not met: Audit history cannot be deleted or modified through normal application operations.
## Postconditions
@ -58,5 +58,4 @@ The actor initiates one of the 3 business operations covered by this use case: t
## Child Functional Requirements
- [FR-TENANTSECURITYAUDIT-001: Tenant Data Isolation](functional-reqs.md#fr-tenantsecurityaudit-001)
- [FR-TENANTSECURITYAUDIT-002: Role-Based Access Control (RBAC) & Permission Scoping](functional-reqs.md#fr-tenantsecurityaudit-002)
- [FR-TENANTSECURITYAUDIT-003: Immutable Transaction Audit Logging](functional-reqs.md#fr-tenantsecurityaudit-003)

View File

@ -5,8 +5,9 @@
| **Document** | `hld.md` |
| **System** | Universal Enterprise Platform (UEP) |
| **Pattern** | Modular Monolith with Multi-Tenant Row-Level Security |
| **Version** | 1.0.0 |
| **Status** | Baselined (Elaboration Phase) |
| **Version** | 1.1.0 |
| **Last CR** | `CR-001` |
| **Status** | Rebaselined; pending authentication design decisions |
---
@ -28,13 +29,13 @@ graph TD
ModAuth --> PG[("PostgreSQL DB (with RLS)")]
ModDomain --> PG
ModAuth --> Valkey[("Valkey / Redis (Token Blacklist & Cache)")]
ModAuth --> Valkey[("Valkey / Redis (Platform Cache; Auth Use TBD)")]
```
---
## 2. Core Architectural Pillars
1. **Multi-Tenancy via Row-Level Security:** Every domain table carries a `tenant_id` UUID column. When requests arrive, the Auth Middleware extracts `tenant_id` from the verified JWT and sets `SET LOCAL app.current_tenant = '<tenant_id>'` on the database session connection pool.
1. **Tenant Context and Isolation:** Tenant membership and active context are verified under `UC-019`; resource isolation and RLS are governed by `UC-017` / `UC-020`. Middleware must consume the verified context and apply the approved isolation design. This HLD does not define a client/JWT-supplied tenant as trusted context.
2. **Deterministic Wave 0 Sandboxing:** All external third-party integrations (payment gateways, identity verification, SMS/email) implement an abstract adapter with a local deterministic mock under `app/integrations/sandbox/`.
3. **Pluggable Event Stream:** Inter-module communication executes via in-process domain event dispatchers that can scale out to message queues (RabbitMQ / Kafka) as needed.

View File

@ -6,8 +6,9 @@
| **Component** | `HLD-AUTH` (Identity & Access Management) |
| **Parent Use Case** | [`UC-001`](../../03_requirements/use_cases/uc-001_user-authentication/use-case.md) |
| **Parent FRs** | `FR-AUTH-001`, `FR-AUTH-002`, `FR-AUTH-003` |
| **Status** | Baselined |
| **Version** | 1.0.0 |
| **Status** | Rebaselined; pending authentication/session design decisions |
| **Version** | 1.1.0 |
| **Last CR** | `CR-001` |
---
@ -19,50 +20,24 @@
|---|---|---|---|---|---|
| `POST` | `/api/v1/auth/token` | Exchange authorization code & PKCE verifier for JWT tokens | No | `TokenExchangeRequest` | 200 OK, 400 Bad Request |
| `POST` | `/api/v1/auth/refresh` | Obtain fresh access token using valid refresh token | No | `RefreshTokenRequest` | 200 OK, 401 Unauthorized |
| `POST` | `/api/v1/auth/logout` | Revoke session & blacklist active refresh token | Yes | `LogoutRequest` | 200 OK, 401 Unauthorized |
| `POST` | `/api/v1/auth/logout` | End the active application session; revocation mechanism and timing require approved security design | Yes | `LogoutRequest` | 200 OK, 401 Unauthorized |
| `GET` | `/api/v1/auth/me` | Return active user claims, roles, and tenant context | Yes | — | 200 OK, 401 Unauthorized |
---
## 2. Database Schema (PostgreSQL with RLS)
## 2. Tenant Context and Data Isolation Boundary
```sql
-- Core Tenants Table
CREATE TABLE tenants (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
code VARCHAR(32) NOT NULL UNIQUE,
name VARCHAR(255) NOT NULL,
is_active BOOLEAN NOT NULL DEFAULT true,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);
Tenant membership and active-tenant context must be verified by `UC-019` before tenant-scoped work. Tenant data isolation and RLS are owned by `UC-017` / `UC-020`; this authentication component must not treat an unverified tenant claim as authorization. Schema and RLS policy details belong in the accountable tenant/data LLD and must be validated against those requirements.
-- Users Table (Tenant-Scoped)
CREATE TABLE users (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
tenant_id UUID NOT NULL REFERENCES tenants(id) ON DELETE CASCADE,
email VARCHAR(255) NOT NULL,
full_name VARCHAR(255) NOT NULL,
is_active BOOLEAN NOT NULL DEFAULT true,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
CONSTRAINT uq_tenant_user_email UNIQUE (tenant_id, email)
);
## 3. Authentication Token and Session Validation
-- Enable Row-Level Security on Users
ALTER TABLE users ENABLE ROW LEVEL SECURITY;
CREATE POLICY tenant_isolation_policy ON users
AS RESTRICTIVE
USING (tenant_id = current_setting('app.current_tenant', true)::uuid);
```
Validate identity-provider responses and authenticated application sessions according to the approved identity-provider and application-session design. Signing algorithm, token lifetime, refresh behavior, revocation mechanism, and revocation timing remain design decisions; this LLD does not baseline them.
---
## 3. Middleware & Security Context Propagation
## 4. Middleware & Security Context Propagation
The FastAPI dependency `get_current_user` extracts the JWT Bearer token:
1. Validates signature with Keycloak JWKS public keys.
2. Asserts token is not listed in Valkey blacklist (`blacklist:token:<jti>`).
3. Extracts `tenant_id` and sets PostgreSQL session context:
```python
await db_session.execute(text("SET LOCAL app.current_tenant = :t_id"), {"t_id": str(user.tenant_id)})
```
2. Validates the authenticated session according to the approved identity-provider and application-session design. This LLD does not prescribe a token blacklist, cache, signing algorithm, token lifetime, or revocation latency.
3. Obtains tenant membership and active context only through the verified `UC-019` flow; applies tenant resource isolation according to `UC-017` / `UC-020`.

View File

@ -4,7 +4,9 @@
|---|---|
| **Iteration** | `iteration-01` |
| **Parent Use Case** | [`UC-001`](../../../03_requirements/use_cases/uc-001_user-authentication/use-case.md) |
| **Status** | Ready for Construction |
| **Status** | Rebaselined under CR-001; Ready for Construction |
| **Version** | 1.1.0 |
| **Last CR** | `CR-001` |
---
@ -13,5 +15,5 @@
| 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` | Tenant Context Propagation & PostgreSQL RLS | 5 | P0 | Middleware, Database Migrations | `@backend-dev` | Ready |
| `STORY-AUTH-003` | `FR-AUTH-003` | Session Monitoring, Token Blacklist & Logout | 3 | P1 | Backend API (`/api/v1/auth/logout`), Cache (Valkey) | `@backend-dev`, `@adversarial-tester` | 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 |

View File

@ -1,20 +1,22 @@
# Iteration Plan — Iteration 01 (IAM & Multi-Tenant Core)
# Iteration Plan — Iteration 01 (OIDC Authentication, Authorization & Session)
| Field | Value |
|---|---|
| **Iteration** | `iteration-01` |
| **Slice Goal** | Deliver end-to-end multi-tenant OIDC login, RBAC authorization, and session lifecycle (`UC-001`). |
| **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 |
| **Capacity** | 3 Stories (13 Story Points) |
| **Status** | Approved for Construction |
| **Status** | Rebaselined under CR-001; planned for Construction |
| **Version** | 1.1.0 |
| **Last CR** | `CR-001` |
---
## 1. Demo & Acceptance Criteria
At the conclusion of Iteration 01, the team will demonstrate:
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. A Tenant Admin logging in accesses `/admin/roles` and sees tenant-scoped RBAC management with PostgreSQL RLS active.
3. Logging out from the profile menu invalidates the active session and blacklists the token across subsequent API calls.
4. Multi-path automated test suite achieves $\ge 95.0\%$ coverage via `scripts/run_tests.sh --scope iteration-01`.
5. 21-sheet Excel Manual QA Workbook is compiled and verified under `07_test_design/manual_qa/workbooks/`.
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.

View File

@ -4,7 +4,9 @@
|---|---|
| **Iteration** | `iteration-01` |
| **Governed Standard** | UP-AI v1.0 Standard |
| **Status** | Verified for Gate 14.1 |
| **Status** | Incomplete / Pending Construction |
| **Version** | 1.1.0 |
| **Last CR** | `CR-001` |
---
@ -12,6 +14,6 @@
| 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` | Auth Portal / Login | `/login` | `POST /api/v1/auth/token` | Alembic `001_auth_core.py` | `sandbox/identity_mock.py` | `KEYCLOAK_URL` | Unit, Bruno, Playwright | `@backend-dev` | `@adversarial-tester` | Specified |
| `STORY-AUTH-002` | `FR-AUTH-002` | Admin Portal / Roles | `/admin/roles` | `GET /api/v1/auth/me` | Alembic `002_rls_policies.py` | N/A (Internal DB) | `DATABASE_URL` | Unit, Integration RLS | `@backend-dev` | `@adversarial-tester` | Specified |
| `STORY-AUTH-003` | `FR-AUTH-003` | User Settings / Sessions | `/account/sessions` | `POST /api/v1/auth/logout` | None (Valkey keys) | N/A (Internal Cache) | `VALKEY_URL` | Unit, FSM Invariant | `@backend-dev` | `@adversarial-tester` | Specified |
| `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 |

View File

@ -5,16 +5,18 @@
| **Iteration** | `iteration-01` |
| **Governed Standard** | UP-AI v1.0 Standard |
| **Integration Skill** | `up-parallel-work-integrate` |
| **Status** | Approved |
| **Status** | Rebaselined under CR-001; planned |
| **Version** | 1.1.0 |
| **Last CR** | `CR-001` |
---
## Lane Allocations
### Lane 1: Backend Auth Service & Database RLS (`lane/backend-auth`)
### 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:** Backend FastAPI routers, Alembic migrations, SQLAlchemy models, test fixtures.
- **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`)

View File

@ -1,3 +1,10 @@
---
id: DESIGN
version: 1.1.0
status: Reviewed
last_cr: CR-001
---
# Design.md — IndiaAgriTrade (RamDayal Agri Commodities) Wholesale Trading Desk
A comprehensive UI/UX, Component Architecture, and Visual Design Specification for building the **IndiaAgriTrade RamDayal BackOffice & Wholesale Trading Desk** using **Vue 3 (Composition API / <script setup>)** and **Tailwind CSS**.
@ -524,3 +531,8 @@ npm install pinia vue-router lucide-vue-next
```
This specification provides the full architectural, functional, and aesthetic blueprint to implement the **IndiaAgriTrade RamDayal BackOffice & Wholesale Trading Desk** in Vue 3 with Tailwind CSS.
## CR-001 — Authentication UI Boundary
This design specification does not define the UC-001 login, authorization-denial, or logout screens and flows. The `useAuthStore.js` project-tree reference is not a screen or session contract. Those portal routes and states remain pending the UC-001 wireframe specification; tenant selection and membership screens belong to UC-019. Do not infer token lifetime, signing algorithm, revocation mechanism, or cross-tenant role behavior from this document.

View File

@ -5,7 +5,9 @@
| **Test Suite** | `TC-001_auth_service.md` |
| **Parent Use Case** | [`UC-001`](../../../03_requirements/use_cases/uc-001_user-authentication/use-case.md) |
| **Parent FRs** | `FR-AUTH-001`, `FR-AUTH-002`, `FR-AUTH-003` |
| **Status** | Baselined |
| **Status** | Rebaselined under CR-001; pending implementation |
| **Version** | 1.1.0 |
| **Last CR** | `CR-001` |
---
@ -17,9 +19,9 @@
- **Preconditions:** Keycloak is running; test tenant `tenant-alpha` and user `alice@alpha.com` exist.
- **Steps:**
1. Generate SHA-256 PKCE code verifier and challenge.
2. Perform authorization code redirect with `tenant_id=tenant-alpha`.
2. Complete the configured OIDC/PKCE authorization flow.
3. Exchange authorization code and code verifier at `/api/v1/auth/token`.
- **Expected Result:** HTTP 200 OK returned with valid JWT access token containing `tenant_id: tenant-alpha` and valid RS256 signature.
- **Expected Result:** Authentication succeeds and establishes an application session using the configured JWT bearer-token approach. Do not assert an unapproved signing algorithm or tenant context in the identity token.
---
@ -35,26 +37,26 @@
---
## TC-AUTH-003: Row-Level Security Isolation Guard (Negative / Security)
## TC-AUTH-003: Role Permission and Segregation-of-Duties Denial (Negative / Security)
- **ID:** `TC-AUTH-003`
- **Category:** Security / Data Isolation
- **Priority:** P0
- **Preconditions:** User `bob` belongs to `tenant-beta`; User `alice` belongs to `tenant-alpha`.
- **Preconditions:** A user has a PRD-defined role that is prohibited from performing a protected action by `BRD-FR-040`.
- **Steps:**
1. Authenticate as `bob@beta.com`.
2. Attempt to query user record for `alice@alpha.com`.
- **Expected Result:** Query returns 0 records (filtered by PostgreSQL RLS); no error or cross-tenant data leak.
1. Authenticate as that user.
2. Attempt one prohibited action (for example, a Sales Executive attempting to override a credit lock).
- **Expected Result:** The authorization decision denies the action before it is performed. Tenant membership and cross-tenant isolation are verified by their owning use cases.
---
## TC-AUTH-004: Instant Session Revocation on Logout (FSM Invariant)
## TC-AUTH-004: Ended Application Session Cannot Perform Protected Actions (FSM Invariant)
- **ID:** `TC-AUTH-004`
- **Category:** FSM Invariant
- **Priority:** P1
- **Preconditions:** Active valid access and refresh token pair.
- **Preconditions:** An authenticated application session with access to a protected operation.
- **Steps:**
1. Call `POST /api/v1/auth/logout` with active refresh token.
2. Attempt subsequent API call with previously issued access token.
- **Expected Result:** Logout returns HTTP 200; subsequent API call is immediately rejected with HTTP 401 `TOKEN_REVOKED`.
1. Initiate logout using the supported application control.
2. Attempt a protected operation using the ended application session.
- **Expected Result:** Logout ends the application session and the protected operation is denied. Do not assert a particular token blacklist, cache, or revocation latency unless approved by security design.

View File

@ -5,7 +5,9 @@
| **Iteration** | Iteration 01 |
| **Scope Slice** | User Identity, Authentication, and RBAC Governance (`UC-001`) |
| **Governed Standard** | UP-AI v1.0 Dual Manual QA Standard |
| **Status** | Verified / Ready for Execution |
| **Status** | Rebaselined under CR-001; pending construction and QA execution |
| **Version** | 1.1.0 |
| **Last CR** | `CR-001` |
---
@ -14,28 +16,28 @@
### Preconditions
- Staging / Dev environment active with Keycloak identity realm seeded.
- Test personas configured:
- **Persona 1 (Tenant Admin):** `admin@enterprise-demo.com` (Role: `admin`)
- **Persona 2 (End User):** `user@enterprise-demo.com` (Role: `user`)
- **Persona 3 (Cross-Tenant Intruder):** `intruder@other-tenant.com` (Tenant: `other-tenant`)
- **Persona 1:** A test user with a PRD-defined role permitted for the selected action.
- **Persona 2:** A test user with a PRD-defined role prohibited from the selected action under `BRD-FR-040`.
- Tenant membership and cross-tenant isolation cases are covered by UC-019 and UC-017/UC-020 test suites.
---
## 2. Manual Test Procedures
### Procedure 1: Multi-Tenant Login & Token Validation
### Procedure 1: OIDC Login and Protected Access
1. Open web browser to portal URL.
2. Click "Login with Enterprise SSO".
3. Verify redirection to Keycloak login screen with PKCE parameters in URL query.
4. Authenticate as `admin@enterprise-demo.com`.
5. Verify successful redirection back to portal dashboard with tenant name displayed in header.
5. Verify the configured OIDC flow establishes an application session and a protected operation is available to an authenticated user. Tenant selection/context behavior is tested under UC-019.
### Procedure 2: RBAC Access Guard Verification
1. Log in as `user@enterprise-demo.com` (non-admin).
2. Attempt to navigate directly to `/admin/tenant-settings`.
3. Verify access is denied with a 403 Forbidden alert and clean user-facing guidance.
### Procedure 2: Role Permission and Segregation-of-Duties Guard
1. Log in as a user whose PRD-defined role is prohibited from a selected action.
2. Attempt the protected action (for example, a Sales Executive attempting to override a credit lock).
3. Verify the action is denied and no business state change occurs.
### Procedure 3: Token Revocation & Logout
1. Click user avatar and select "Sign Out".
2. Confirm session termination message.
3. Click browser back button and attempt to refresh page.
4. Verify user is prompted to re-authenticate.
### Procedure 3: Application Session Logout
1. Use the supported application logout control.
2. Confirm the application reports that the session has ended.
3. Attempt a protected operation using the ended application session.
4. Verify access is denied. Do not assert a specific token-revocation implementation or timing.

View File

@ -5,7 +5,9 @@
| **Document** | `regression_test_cases.md` |
| **Governed Standard** | UP-AI v1.0 Quality Standard |
| **Scope Runner** | `scripts/run_tests.sh --scope <project|iteration-NN|uc-xxx|fr-xxx>` |
| **Last Updated** | 2026-09-03 |
| **Last Updated** | 2026-10-11 |
| **Version** | 1.1.0 |
| **Last CR** | `CR-001` |
---
@ -15,5 +17,5 @@
|---|---|---|---|---|---|---|
| `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 / Cross-Tenant RLS | `FR-AUTH-002` | Automated (pytest) | `tests/backend/test_tenant_rls.py` | `uc_001`, `fr_auth_002`, `iteration_01` | Active |
| `TC-AUTH-004` | FSM / Token Revocation | `FR-AUTH-003` | Automated (pytest) | `tests/backend/test_auth_revocation.py` | `uc_001`, `fr_auth_003`, `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 |

View File

@ -5,7 +5,9 @@
| **Document** | `test_strategy.md` |
| **System** | Universal Enterprise Platform (UEP) |
| **Governed Standard** | UP-AI v1.0 Quality Standard |
| **Status** | Baselined |
| **Status** | Rebaselined under CR-001 |
| **Version** | 1.1.0 |
| **Last CR** | `CR-001` |
---
@ -16,7 +18,7 @@ Testing in UP-AI v1.0 is strictly enforced across four multi-path dimensions to
1. **Happy Path:** Expected standard execution flows and state progressions.
2. **Alternate & Boundary/Edge Cases:** Extreme values, empty states, pagination boundaries, and concurrency edges.
3. **Negative & Validation Failures:** Malformed payloads, invalid claims, expired tokens, and SQL injection probes.
4. **FSM Invariants & Idempotency:** State transition validation, token revocation immediacy, and cross-tenant leakage prevention.
4. **FSM Invariants & Idempotency:** State transition validation and inability to use an ended application session. Revocation timing is asserted only when approved by security design; cross-tenant isolation is tested under its owning use cases.
---

View File

@ -315,3 +315,31 @@ Requested: “proceed with the remaining use cases authoring”.
## 2026-10-11T10:14:08Z — Assistant — Action summary
Authored UC-002–UC-026 and 52 child FRs to cover all BRD-FR-001–052 across 26 total use cases. Updated the BRD inventory downstream mappings, traceability graph, and checkpoint index; saved CKPT-008. Refined the decomposition to keep independent platform/privacy workflows in separate use cases. Gate 5.1 passed for 26 use cases and 55 total child FRs with zero validator findings; all 52 BRD features are mapped; new artifact frontmatter checks passed; `git diff --check` passed. Gate 9.1 is marked not run for the expanded scope. The pre-existing UC-001 authentication source mapping remains a semantic Major requiring CR analysis/disposition before editing that baseline. No tests run.
## 2026-10-11T10:24:29Z — User
Requested `/up-change-request-impact` to review UC-001, noting it was executed end-to-end as a sample to check the process and may need adjustment to current product specifications.
## 2026-10-11T10:24:29Z — Assistant — Action summary
Verified CKPT-008 and reviewed UC-001, current PRD features/NFRs, `tech-profile.yaml`, related UCs, traceability records, and committed auth architecture/iteration/test references. Raised `CR-001` as Proposed and completed its impact analysis; identified false source links to BRD-FR-001–003, overlap with UC-017/019/020, and sample-specific auth/session constraints needing product/security disposition. Preserved the tracked deletions already present in the working tree and did not edit UC-001 or any impacted design/delivery artifact. Updated traceability graph to point to CR-001 and saved CKPT-009 for Approve/Defer/Reject. `git diff --check` passed; no tests run.
## 2026-10-11T10:36:33Z — User
Reported that the deleted folders were restored and approved proceeding on the assumption UC-001 covers OIDC AuthN/AuthZ requirements.
## 2026-10-11T10:36:33Z — Assistant — Action summary
Applied the approved CR-001 requirements/governance rebaseline: UC-001 v1.1.0 now covers OIDC authentication, role authorization, and general session/logout behavior; removed unsupported sample-specific constraints and false BRD-FR-001–003 mappings; moved BRD-FR-040 ownership from UC-017 to UC-001. Updated UC-017, BRD inventory, traceability index/graph, architecture risk register, and CR register. Gate 5.1 passed with 0 Critical findings and 2 Major warnings because the validator does not parse the allowed `new — not in BRD` source declaration for FR-AUTH-001/003; both have explicit source justification. `git diff --check` passed; no tests run. Created CKPT-010. The active worktree still reports the previously deleted downstream HLD/LLD, iteration, wireframe, and test/QA files as deleted despite the restoration report. No deleted files were recreated or overwritten; CR-001 remains open pending downstream reconciliation.
## 2026-10-11T10:36:33Z — User
Said: “I have restored the deleted files kindly confirm so that CR-001 can be closed”.
## 2026-10-11T10:36:33Z — Assistant — Action summary
Confirmed all downstream HLD/LLD, iteration-01, wireframe, test, and QA paths are present in the active checkout and no longer deleted in Git. Reviewed them and found stale sample constraints (RS256, Valkey blacklist, instant revocation, direct tenant claim/RLS in UC-001) plus an unsupported “Verified for Gate 14.1” label. Rebaselined impacted architecture, iteration, test, manual-QA, wireframe boundary, traceability, and CR artifacts under CR-001; moved authorization story/tests to BRD-FR-040 role enforcement and corrected iteration-01 to Incomplete / Pending Construction because the workbook folder contains only `.gitkeep` and no execution evidence. No files outside the computed impact set were changed. Verification: pending gate reruns.
## 2026-10-11T10:47:38Z — Assistant — Verification and disposition
Gate 5.1 passed with zero Critical findings and two justified Major source-parser warnings (`FR-AUTH-001`/`003`, `new — not in BRD`). Gate 14.1 was run against iteration-01 and failed with two Critical findings: no dense Excel QA workbook and no Bruno API collections. The iteration matrix and traceability records state Incomplete / Pending Construction; no requirement is marked Delivered. `git diff --check` passed. No test suite was run. Closed CR-001 as verified requirements/design/test-specification alignment because its approved impacted artifact set is rebaselined and no affected FR is Delivered; Gate 14.1 remains a construction/iteration closure blocker. Updated CR register, traceability graph, CKPT-011/index, and this transcript. Next process action: Stage 6 architecture risk scoring/spike, then remaining Elaboration gates; iteration construction must not be treated as delivered.