From d83226ce6e68c12f1287c0b9b0d9e4dbd7919f18 Mon Sep 17 00:00:00 2001 From: Prashant Shendre Date: Sun, 11 Oct 2026 15:21:20 +0530 Subject: [PATCH 01/13] couple of ambiguities left open and proceeding with baselining requirements --- 01_BRD/PRD_Specification.md | 14 ++- .../00_process_control/ambiguity_register.md | 2 +- .../assumptions_register.md | 5 +- .../checkpoint-007-atb-brd-extraction.md | 23 ++++ .../checkpoints/checkpoint_index.md | 2 + .../00_process_control/decision_log.md | 1 + .../00_process_control/master_context.md | 6 +- .../01_source_inventories/brd_inventory.md | 100 ++++++++++++++++-- ...11T074829Z-session-greenfield-bootstrap.md | 9 ++ 9 files changed, 144 insertions(+), 18 deletions(-) create mode 100644 04_generated_documentation/00_process_control/checkpoints/checkpoint-007-atb-brd-extraction.md diff --git a/01_BRD/PRD_Specification.md b/01_BRD/PRD_Specification.md index 8c69dcd..16b60ae 100644 --- a/01_BRD/PRD_Specification.md +++ b/01_BRD/PRD_Specification.md @@ -7,7 +7,7 @@ | **Version** | 1.0.0 | | **Author** | Stakeholder elicitation with `up-requirements-elicit` | | **Process** | UP-AI v1.5 | -| **Status** | Draft — business direction accepted; candidate policies pending domain review and baseline approval | +| **Status** | Baselined for Stage 1 extraction with explicit evidence-gated assumptions; open evidence items remain production/release gates | | **Last Updated** | 2026-10-11 | --- @@ -691,7 +691,17 @@ The stakeholder accepted the reference values below as configurable seed candida Coverage budgets, test dimensions, and test levels are governed by the active technology profile and UP-AI process rather than the backup PRD. -### 6.3 Multi-Tenant Platform Security and Operations References +### 6.3 Bounded Assumptions for Stage 1 and Evidence Gates + +The following assumptions allow business requirements to be inventoried without fabricating unresolved numeric or legal outcomes. They are valid for Stage 1 extraction and early elaboration only; they do not close the linked ambiguities or waive production/release evidence gates. + +- **ASM-001 — Efficiency targets remain evidence-based:** Until the accepted 30-operating-day pre-rollout and post-rollout pilot measurements exist, no numeric efficiency-improvement target is assumed. Requirements extraction and early design may proceed; the system must preserve the ability to measure the agreed metrics. Resolve `AMB-001` before final production acceptance. +- **ASM-002 — Retention durations remain unassigned:** No category/purpose retention duration or additional legal obligation is inferred. The system must support configurable schedules and holds under `BRD-FR-050` and `BRD-NFR-014`; responsible qualified reviewers must approve actual schedules and legal mappings before production. Resolve `AMB-006` before release. +- **ASM-003 — Numeric fair-share budgets remain TBD:** The accepted capacity envelope and load-test scenario are planning inputs, not contractual quotas. No numeric per-tenant budget or alert threshold is assumed until architecture/load-test evidence exists; observability and configurable budget controls remain required. Resolve `AMB-008` before production capacity acceptance. + +These assumptions do not assert legal compliance, determine a tenant's operating policy, or permit production release without the stated evidence. + +### 6.4 Multi-Tenant Platform Security and Operations References - [OWASP Application Security Verification Standard (ASVS)](https://github.com/OWASP/ASVS) — candidate source for selecting testable application-security controls and verification rigor. - [PostgreSQL Row Security Policies](https://www.postgresql.org/docs/current/ddl-rowsecurity.html) — behavior and privileged-role considerations for the configured row-level security model. diff --git a/04_generated_documentation/00_process_control/ambiguity_register.md b/04_generated_documentation/00_process_control/ambiguity_register.md index 26eb874..8f6897d 100644 --- a/04_generated_documentation/00_process_control/ambiguity_register.md +++ b/04_generated_documentation/00_process_control/ambiguity_register.md @@ -15,6 +15,6 @@ Open requirements questions are tracked here (`AMB-xxx`). Unresolved business ru | AMB-003 | 2026-10-11 | Stage 0B | How should the proposed numeric operating values from the reference be applied when their appropriateness varies by tenant, commodity, or contract? | Stakeholder accepted the business scope and all 11 mockup areas, and accepted the reference values as configurable tenant-scoped seed candidates. | Resolved: the values are not universal defaults. Each tenant’s Partner/Managing Director or delegated authorized business owner must confirm or edit applicable thresholds before affected risk-sensitive workflows are enabled; only those affected workflows remain blocked for missing/unreviewed values. Policies are effective-dated and changes audited per `BRD-FR-052`. | Resolved | Stakeholder, 2026-10-11 | | AMB-004 | 2026-10-11 | Stage 0B | How are tenants onboarded and suspended, and may one user hold memberships in multiple tenant firms? | Tenant lifecycle and membership management affect identity and administration design. | Resolved: v1 has no public self-service signup; an authorized platform administrator provisions and activates tenants. A person may belong to multiple tenants and explicitly selects the active tenant after sign-in; server-side membership and role checks apply on every request. Captured in `BRD-FR-042`–`BRD-FR-044`. | Resolved | Stakeholder, 2026-10-11 | | AMB-005 | 2026-10-11 | Stage 0B | Who may approve exceptional cross-tenant support access, and what tenant notification/review is required? | Support access to tenant business data must be exceptional, attributable, and reviewable. | Resolved: no standing support access; ordinary case-specific access requires Tenant Administrator approval and is time-limited. A designated platform security administrator may grant break-glass access for at most one hour during an urgent incident, recording the reason, generating an immediate audit alert, and notifying the tenant administrator within one business day. Captured in `BRD-FR-046`. | Resolved | Stakeholder, 2026-10-11 | -| AMB-006 | 2026-10-11 | Stage 0B | What actual retention durations and additional India-specific sectoral/contractual obligations apply to v1? | The stakeholder accepted the SaaS privacy roles, India-first scope, all-natural-person coverage, four internal sensitivity labels with separate personal-data/purpose tags, category/purpose retention governance, OWASP ASVS v5.0.0 Level 2, and the review path: tenant legal/accounting reviewers approve trading-data purposes/retention; the ATB operator’s qualified privacy/legal reviewer approves platform processing, retention, and processor obligations. Exact durations and other legal/contractual duties remain unconfirmed. The Act/Rules have phased commencement. | PRD captures accepted policy in `BRD-FR-047`–`BRD-FR-051` and `BRD-NFR-009`/`BRD-NFR-014`. Record qualified review evidence for actual durations and other obligations before baseline; revalidate current requirements before production. | Open | — | +| AMB-006 | 2026-10-11 | Stage 0B | What actual retention durations and additional India-specific sectoral/contractual obligations apply to v1? | The stakeholder accepted the SaaS privacy roles, India-first scope, all-natural-person coverage, four internal sensitivity labels with separate personal-data/purpose tags, category/purpose retention governance, OWASP ASVS v5.0.0 Level 2, and the review path: tenant legal/accounting reviewers approve trading-data purposes/retention; the ATB operator’s qualified privacy/legal reviewer approves platform processing, retention, and processor obligations. Exact durations and other legal/contractual duties remain unconfirmed. The Act/Rules have phased commencement. | PRD captures accepted policy in `BRD-FR-047`–`BRD-FR-051` and `BRD-NFR-009`/`BRD-NFR-014`. Under `ASM-002`, extraction and early design proceed without assuming durations or obligations; record qualified review evidence and revalidate current requirements before production release. | Open | — | | AMB-007 | 2026-10-11 | Stage 0B | What production availability, backup retention, RTO, and RPO targets are acceptable? | These targets determine hosting, data protection, recovery design, and support commitments. | Resolved: 99.9% monthly availability measured 24/7; RTO ≤4 hours; RPO ≤15 minutes; encrypted daily backups with point-in-time recovery and 35-day retention; quarterly restore exercises. Captured in `BRD-NFR-011`. | Resolved | Stakeholder, 2026-10-11 | | AMB-008 | 2026-10-11 | Stage 0B | What tenant count, active-user count, transaction volume, peak concurrency, and per-tenant limits must the platform support? | Stakeholder approved an initial envelope of 50 tenant firms, 25 named users per tenant, and 250 concurrent active users service-wide. The approved provisional planning scenario is 200 core business documents per tenant per operating day with a 5× peak-hour burst. Stakeholder accepted no fixed business-document quota; observe per-tenant use, provide configurable early warnings near the tested fair-share budget, and protect core transactions while using backpressure/temporary throttling for expensive reports or bulk exports under contention. Numeric fair-share budgets and alert thresholds still require architecture/load-test evidence and later pilot refinement. | Partially resolved: approved 50 tenant firms, up to 25 named users per tenant, 250 concurrent active users service-wide, and 50,000 ledger rows per tenant for report validation. The 200 documents/tenant/operating day and 5× peak-hour burst scenario has been accepted for load testing; set numeric fair-share budgets and alert thresholds from architecture/load-test evidence and refine them with pilot telemetry; see `BRD-NFR-004` and `BRD-NFR-012`. | Open | — | diff --git a/04_generated_documentation/00_process_control/assumptions_register.md b/04_generated_documentation/00_process_control/assumptions_register.md index 8ae6a97..b613189 100644 --- a/04_generated_documentation/00_process_control/assumptions_register.md +++ b/04_generated_documentation/00_process_control/assumptions_register.md @@ -8,7 +8,10 @@ ## Active Assumptions -No unapproved business assumptions are being used to complete the PRD draft. Candidate numeric policies are listed in the ambiguity register and marked provisional. Technical choices in `tech-profile.yaml` are known configuration facts, not assumptions. +Three bounded working assumptions are accepted for Stage 1 extraction and early elaboration only. They preserve unknown values as TBD and retain the corresponding ambiguity and production/release evidence gates. Technical choices in `tech-profile.yaml` are configuration facts, not assumptions. | ID | Date | Stage | Assumption | Basis | Risk Level | Status | Superseded By | |---|---|---|---|---|---|---|---| +| ASM-001 | 2026-10-11 | Stage 1 | Efficiency improvement targets remain unset until the agreed representative-tenant pre/post pilot measurements are collected; requirements extraction and early design may proceed, and the product must support measurement of the agreed metrics. | Stakeholder authorized proceeding under explicit assumptions; no pilot evidence currently supports numeric targets. | Medium | Accepted for Stage 1 and early elaboration; resolve `AMB-001` before production acceptance. | — | +| ASM-002 | 2026-10-11 | Stage 1 | Do not infer retention durations or additional legal obligations. Support configurable category/purpose schedules; require qualified review and evidence before production release. | Exact durations and applicable obligations are unresolved under `AMB-006`; a configurable design can proceed without inventing legal rules. | High | Accepted for Stage 1 and early elaboration; resolve `AMB-006` before production release. | — | +| ASM-003 | 2026-10-11 | Stage 1 | Treat the accepted capacity envelope and load profile as planning inputs only; numeric fair-share budgets and alert thresholds remain TBD pending architecture/load tests and pilot telemetry. | No performance evidence currently establishes safe per-tenant budgets; observability and configurable fairness controls remain in scope. | Medium | Accepted for Stage 1 and early elaboration; resolve `AMB-008` before production capacity acceptance. | — | diff --git a/04_generated_documentation/00_process_control/checkpoints/checkpoint-007-atb-brd-extraction.md b/04_generated_documentation/00_process_control/checkpoints/checkpoint-007-atb-brd-extraction.md new file mode 100644 index 0000000..72eeb5b --- /dev/null +++ b/04_generated_documentation/00_process_control/checkpoints/checkpoint-007-atb-brd-extraction.md @@ -0,0 +1,23 @@ +# Checkpoint 007 — ATB BRD Extraction + +- **Checkpoint ID:** `CKPT-007` +- **Date:** 2026-10-11 +- **Active Stage:** Stage 1 — Business Requirements Extraction +- **Active Track:** Greenfield, India-first, multi-tenant Agriculture Trading Backoffice (ATB) +- **Active Skill:** `up-brd-extract` +- **PRD Status:** Baselined for Stage 1 extraction with bounded, evidence-gated assumptions + +## Completed +- Recorded stakeholder direction `DEC-020` authorizing Stage 1 under explicit bounded assumptions. +- Added `ASM-001`–`ASM-003`; kept `AMB-001`, `AMB-006`, and `AMB-008` open as evidence gates. +- Baselined `01_BRD/PRD_Specification.md` for Stage 1 extraction and documented assumption boundaries. +- Extracted all 52 functional requirements and 14 NFRs into `04_generated_documentation/01_source_inventories/brd_inventory.md`. +- Confirmed unique FR/NFR ID counts and scoped whitespace validation; no tests or traceability gates are applicable to this extraction step. + +## Open Items +- `AMB-001`: pilot measurements and efficiency targets. +- `AMB-006`: qualified legal/accounting review and retention/legal evidence. +- `AMB-008`: architecture/load-test evidence and pilot telemetry for fair-share budgets. + +## Exact Next Action +Review the Stage 1 inventory for completeness and consistency, then continue the Greenfield track to Stage 5 use-case authoring. Carry `ASM-001`–`ASM-003` and their release gates forward; do not mark the open ambiguities resolved or treat the assumptions as production evidence. 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 0b01a5f..b638627 100644 --- a/04_generated_documentation/00_process_control/checkpoints/checkpoint_index.md +++ b/04_generated_documentation/00_process_control/checkpoints/checkpoint_index.md @@ -23,3 +23,5 @@ | `CKPT-006` | 2026-10-11 | Stage 0B (Requirements elicitation / Inception) | ATB draft PRD expanded to 52 FRs and 14 NFRs; decisions recorded through DEC-019, including the accepted pre/post pilot KPI measurement protocol. | `AMB-001`, `AMB-006`, and `AMB-008` remain open for pilot results, qualified legal/accounting evidence, and load-test/pilot telemetry; PRD baseline approval pending. | Prepare Stage 0B Human Review Brief and review the Draft PRD; collect evidence for the remaining ambiguities, then obtain explicit baseline approval before Stage 1. | `checkpoint-006-atb-requirements-elicitation.md` | + +| `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` | diff --git a/04_generated_documentation/00_process_control/decision_log.md b/04_generated_documentation/00_process_control/decision_log.md index 3dc3c9a..63f0fb7 100644 --- a/04_generated_documentation/00_process_control/decision_log.md +++ b/04_generated_documentation/00_process_control/decision_log.md @@ -33,3 +33,4 @@ Project decisions made during requirements elicitation and bootstrap are recorde | DEC-017 | 2026-10-11 | Stage 0B | Require tenant legal/accounting reviewers to approve trading-data purposes and retention schedules; require the ATB operator’s qualified privacy/legal reviewer to approve platform processing, retention, and processor/subprocessor obligations. Record evidence; leave durations unfilled until approved. | Assigns privacy/legal decisions to the party responsible for each processing context and avoids inventing legal retention periods. | One global schedule; agent-selected periods without qualified review. | Adds a review-evidence gate to `AMB-006`, `BRD-FR-050`, `BRD-FR-051`, and `BRD-NFR-014`; exact durations and other duties remain open. | Stakeholder | | DEC-018 | 2026-10-11 | Stage 0B | Require each tenant’s Partner/Managing Director or delegated authorized business owner to review and confirm or edit applicable reference thresholds before affected workflows go live. Keep only the affected risk-sensitive workflow disabled when a threshold is missing or unreviewed; record effective-dated policy versions and audit changes. | Converts reference values into safe tenant-specific setup candidates without asserting universal domain correctness or blocking unrelated operations. | Silently activate workflows on candidate values; block all tenant operations for any missing threshold. | Updates `BRD-FR-042` and `BRD-FR-052`; resolves the application approach for `AMB-003`. | Stakeholder | | DEC-019 | 2026-10-11 | Stage 0B | For a representative tenant, measure manual effort per transaction, gate-in-to-stock-posting time, and stock-reconciliation variance by godown/commodity for 30 operating days before rollout, then repeat for 30 operating days after rollout; set numeric improvement targets from the observed results. Keep lot traceability, QC dispatch prevention, and credit controls as hard product invariants. | Establishes an evidence-based pre/post comparison without inventing improvement percentages before pilot data exists. | Choose numeric efficiency targets before collecting baseline evidence; assess only post-rollout values. | Updates PRD §1.3; the protocol is resolved while measured baselines and numeric targets remain open under `AMB-001`. | Stakeholder | +| DEC-020 | 2026-10-11 | Stage 0B / Stage 1 | Proceed to Stage 1 extraction using the PRD as its requirements baseline under bounded working assumptions: pilot improvement targets, legal retention values/obligations, and numeric fair-share budgets remain unresolved and evidence-gated. | Allows complete feature extraction while preserving unknowns as TBD and preventing assumptions from being misrepresented as verified outcomes. | Defer all Stage 1 extraction until pilot, legal, and load-test evidence is available; invent interim numeric/legal values. | Baselines the PRD for Stage 1 extraction only; records `ASM-001`–`ASM-003`; `AMB-001`, `AMB-006`, and `AMB-008` remain open and production/release gates. | Stakeholder direction | diff --git a/04_generated_documentation/00_process_control/master_context.md b/04_generated_documentation/00_process_control/master_context.md index 7172e8a..aecdef5 100644 --- a/04_generated_documentation/00_process_control/master_context.md +++ b/04_generated_documentation/00_process_control/master_context.md @@ -14,7 +14,7 @@ ## 1. Project Goal & Overview -Agriculture Trading Backoffice (ATB) is a greenfield, India-first multi-tenant backoffice platform for agricultural trading firms. The stakeholder-reviewed business direction is captured in the Draft PRD at [`01_BRD/PRD_Specification.md`](../../../01_BRD/PRD_Specification.md); requirements are not yet baselined. +Agriculture Trading Backoffice (ATB) is a greenfield, India-first multi-tenant backoffice platform for agricultural trading firms. The stakeholder-reviewed PRD at [`01_BRD/PRD_Specification.md`](../../../01_BRD/PRD_Specification.md) is baselined for Stage 1 extraction under bounded assumptions; pilot, legal/accounting, and load-test evidence gates remain open for production readiness. --- @@ -85,6 +85,6 @@ stack: ## 4. Active Stage & Next Actions -- **Current Stage:** Stage 0B — Requirements elicitation; PRD draft prepared from stakeholder-accepted business direction. +- **Current Stage:** Stage 1 — Business requirements extraction; PRD baselined for extraction under bounded, evidence-gated assumptions. - **Active Iteration:** None; no iteration has been planned for this project baseline. -- **Next:** Prepare the Stage 0B Human Review Brief and review `01_BRD/PRD_Specification.md`. The pilot measurement protocol for `AMB-001` is accepted; collect 30-operating-day pre- and post-rollout results to set numeric targets. Obtain qualified review evidence for DPDP retention durations and other applicable obligations (`AMB-006`), and derive fair-share budgets from load testing and pilot telemetry (`AMB-008`). Keep the PRD in Draft until required evidence is available and the stakeholder explicitly approves the baseline; then proceed to Stage 1 extraction. +- **Next:** Review `04_generated_documentation/01_source_inventories/brd_inventory.md` for completeness, then continue the Greenfield track to Stage 5 use-case authoring. Carry `ASM-001`–`ASM-003` forward. Pilot results (`AMB-001`), qualified legal/accounting evidence (`AMB-006`), and load-test/pilot evidence (`AMB-008`) remain production/release gates; the assumptions do not resolve them. diff --git a/04_generated_documentation/01_source_inventories/brd_inventory.md b/04_generated_documentation/01_source_inventories/brd_inventory.md index c1b4651..a09e2dd 100644 --- a/04_generated_documentation/01_source_inventories/brd_inventory.md +++ b/04_generated_documentation/01_source_inventories/brd_inventory.md @@ -2,18 +2,96 @@ | Field | Value | |---|---| -| **Governed Standard** | SEI-CMMI Level 3 (UP-AI v1.0) | +| **Governed Standard** | UP-AI v1.5 | | **Document Path** | `04_generated_documentation/01_source_inventories/brd_inventory.md` | -| **Source** | `01_BRD/PRD_Specification.template.md` | -| **Last Updated** | 2026-09-03 | +| **Authoritative Source** | `01_BRD/PRD_Specification.md` (baselined for Stage 1 extraction with bounded assumptions) | +| **Last Updated** | 2026-10-11 | +| **Active Track** | Greenfield | ---- +## Extracted Functional Business Requirements (`BRD-FR-xxx`) -## Extracted Business Features & Requirements (`BRD-FR-xxx`) +Every functional feature from PRD §5 is represented once. Stage 1 extraction does not compare against the illustrative mockup or infer legacy behavior. Candidate values retain the provisional status and controls stated in the PRD. -| Feature ID | Feature Name | PRD Reference | Primary Actor | Description | Downstream Use Case | Status | -|---|---|---|---|---|---|---| -| `BRD-FR-001` | Multi-Tenant User Authentication | PRD §3 | All Users | Secure OIDC/PKCE login with tenant context propagation and JWT bearer token issuance. | `UC-001` | Extracted / Baselined | -| `BRD-FR-002` | Role-Based Access Control (RBAC) | PRD §3 | Tenant Admin | Tenant-scoped roles, permissions, and hierarchical privilege enforcement. | `UC-001` | Extracted / Baselined | -| `BRD-FR-003` | User Session & Token Revocation | PRD §3 | All Users | Session state monitoring, refresh token rotation, and instant revocation capability. | `UC-001` | Extracted / Baselined | -| `BRD-FR-004` | Audit & Compliance Event Stream | PRD §3 | System Admin | Immutable audit logging of authentication, state mutations, and administrative events. | `UC-001` | Extracted / Baselined | +| Feature ID | Feature Name | PRD Reference | Primary Actor(s) | Priority | Extracted Business Requirement | Legacy Overlap / Conflict | Downstream Use Case | +|---|---|---|---|---|---|---|---| +| `BRD-FR-001` | Daily APMC Mandi Arrival Ingestion & Tracking | §5 | Procurement Executive / Mandi Buyer | P0 | The system must record daily physical arrival volumes at APMC mandi yards across target commodities (Chana, Coriander, Cumin, Fenugreek, Groundnut, Isabgol, Jaggery, Maize, Mustard, Soybean, Turmeric, Wheat) across monitored markets (Neemuch, Mandsaur, Ratlam, Kota, Indore, Jaora, Ujjain, Chittorgarh). | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | +| `BRD-FR-002` | Daily Modal & Range Pricing Tracking (₹/Qtl) | §5 | Procurement Executive / Purchase Manager | P0 | For each daily mandi arrival record, the system must capture the quoted price range (Min Rate ₹/Qtl, Max Rate ₹/Qtl) and the official modal clearing price (Modal Rate ₹/Qtl). | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | +| `BRD-FR-003` | Intraday Price Trend Analysis & 20-Day Benchmark Analytics | §5 | Purchase Manager / Partner | P0 | The system must provide interactive visual charts and trend tables comparing the 20-day historical modal rate trend per commodity across markets, computing 20-day moving averages, 20-day highs/lows, and price velocity. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | +| `BRD-FR-004` | Procurement Price Variance Alert vs. Modal Rate | §5 | Purchase Manager | P1 | When booking a purchase sauda, the system must compare the offered trade rate against the latest modal clearing rate for that commodity/mandi. If the offered rate exceeds the modal rate by $>5\%$, the system must display an inline warning and require confirmation. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | +| `BRD-FR-005` | Mandi Auction & Direct Purchase Sauda Booking | §5 | Procurement Executive / Purchase Manager | P0 | The system must record purchase contracts (*saudas*) negotiated in mandi auctions or directly with suppliers. Each sauda must capture supplier code, sourcing market, commodity, variety, trade rate (₹/Qtl), estimated bag count, and booked quantity in MT. The system must support multi-truck partial delivery: a sauda may be fulfilled across multiple trucks/GRNs over consecutive delivery days, tracking cumulative received MT and remaining balance MT until fully fulfilled. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | +| `BRD-FR-006` | Supplier Credit Terms & Due Date Computation | §5 | Purchase Manager / Accounts Executive | P0 | The system must automatically compute the supplier payment due date by adding the supplier's contractual credit days (e.g., 7, 15, or 21 days) to the sauda or GRN receipt date. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | +| `BRD-FR-007` | Mandi Cess & Statutory Levies Apportioning | §5 | Accounts Executive | P1 | The system must calculate statutory mandi cess (e.g., 1.5% APMC market fee + 0.2% Nirashrit fee) based on the gross sauda value and append it to the total procurement cost. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | +| `BRD-FR-008` | Inward Vehicle Gate Entry & Verification | §5 | Yard Supervisor | P0 | Upon vehicle arrival at the godown, the Yard Supervisor must log gate entry linking the vehicle registration number and driver details to an active booked sauda. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | +| `BRD-FR-009` | Weighbridge Gross & Tare Weighment Logging | §5 | Yard Supervisor | P0 | The system must record dual-phase weighbridge measurements for incoming trucks: (1) Gross Weighment (truck + commodity) upon arrival, and (2) Tare Weighment (empty truck) after unloading. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | +| `BRD-FR-010` | Bag Tare Deduction (*Bardana Katai*) & Final Net MT | §5 | Yard Supervisor | P0 | The system must deduct the weight of packaging bags from the gross commodity weight using the defined tare deduction factor (default 1.0 kg/gunny bag) to calculate true Net Payable MT. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | +| `BRD-FR-011` | Weighment Tolerance & Transit Shortage Verification | §5 | Yard Supervisor / Purchase Manager | P0 | The system must compare the Final Net Weighbridge MT against the Booked Sauda MT. If shortage exceeds $0.5\%$, the system must flag a `Transit Shortage Warning` and adjust the final payable amount to the actual net received weight. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | +| `BRD-FR-012` | Goods Receipt Note (GRN) Posting & Warehouse Stack Placement | §5 | Yard Supervisor | P0 | Upon weighment completion, the system must generate a formal GRN document, allocate the physical goods to a specific warehouse/godown and stack location, credit the warehouse stock book, and mint an inward Commodity Lot. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | +| `BRD-FR-013` | Mandatory Lot & Batch Identity Generation | §5 | Yard Supervisor / Quality Officer | P0 | The system must automatically generate a globally unique, immutable Lot ID (`LOT-YYYYMM-xxx`) for every inward consignment processed through a GRN. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | +| `BRD-FR-014` | Inward Quality Inspection Parameter Recording | §5 | Quality Officer | P0 | The Quality Officer must log laboratory/physical test parameters for the lot: Moisture %, Foreign Matter / Dust %, Admixture (other grains) %, Damaged / Discolored %, and Weevil count. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | +| `BRD-FR-015` | Quality Deduction / Rebate Calculation | §5 | Quality Officer / Accounts Executive | P1 | If moisture or foreign matter exceeds standard contract baselines (e.g., standard moisture baseline 10.0%), the system must automatically compute a quality price deduction (e.g., ₹10 deduction per quintal for each 0.5% moisture above baseline). | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | +| `BRD-FR-016` | Finite State Machine Enforcement for `QC Hold` vs. `Released` | §5 | Quality Officer | P0 | The system must enforce strict FSM transitions on the Lot record. If moisture $>12\%$ or foreign matter $>2\%$, the lot must be transitioned to `QC Hold`. A lot on `QC Hold` is programmatically blocked from sales order allocation and dispatch loading. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | +| `BRD-FR-017` | Lot Splitting & Blending Traceability | §5 | Yard Supervisor / Quality Officer | P1 | The system must support splitting a parent lot into sub-lots (e.g., when dividing a consignment across two warehouses) or blending multiple lots, maintaining parent-child lineage in the traceability graph. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | +| `BRD-FR-018` | Multi-Godown Dual-Unit Stock Ledger | §5 | Yard Supervisor / Management | P0 | The system must maintain a real-time, double-entry stock ledger tracking commodity positions across warehouses (WH-01 Neemuch Main Yard, WH-02 Neemuch North Godown, WH-03 Mandsaur Transit Godown, WH-04 Indore Buffer Depot). For each commodity, variety, and grade, it must maintain Opening Stock MT, Received MT, Dispatched MT, Closing Stock MT, and physical Bag counts. The system must support Periodic Physical Stock Audits: recording physical tally counts against book balances and generating supervisor-authorized Stock Adjustment Vouchers capturing natural storage loss/gain (*ghat / nami* due to moisture evaporation or seasonal humidity) or handling spillage with mandatory reason codes. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | +| `BRD-FR-019` | Godown Capacity & Volume Utilization Tracking | §5 | Yard Supervisor / Partner | P0 | The system must track the physical storage capacity of each warehouse in Metric Tonnes and calculate real-time percentage utilization: | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | +| `BRD-FR-020` | Godown-to-Godown Internal Stock Transfer | §5 | Yard Supervisor / Logistics Coordinator | P0 | The system must support recording stock transfers between godowns (e.g., from Mandsaur Transit Godown to Neemuch Main Yard), logging origin outward deduction, in-transit state, destination weighment, and destination inward credit. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | +| `BRD-FR-021` | Customer Sales Contract Booking | §5 | Sales Manager / Sales Executive | P0 | The system must record customer sales orders/contracts specifying customer code, destination city, customer segment (`Wholesale`, `Processor`, `Institutional`, `Distributor`), commodity, variety, grade, contracted quantity in MT, contract rate in ₹/Qtl, and delivery timeline. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | +| `BRD-FR-022` | Customer Credit Limit & Pre-Order Exposure Verification | §5 | Sales Manager / Accounts Executive | P0 | Prior to confirming a sales order, the system must evaluate the customer's current outstanding receivables plus the value of the new order against their sanctioned credit limit. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | +| `BRD-FR-023` | Sales Order Inventory Allocation | §5 | Sales Manager / Yard Supervisor | P0 | The Sales Manager must allocate specific available inventory lot(s) from a warehouse to a confirmed sales order. The system must verify that selected lots are in `Released` state and have sufficient unreserved balance. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | +| `BRD-FR-024` | Outbound Dispatch Board Console | §5 | Logistics Coordinator | P0 | The system must provide a visual dispatch management board displaying scheduled, loading, and in-transit consignments, matching confirmed sales orders to allocated warehouse lots and transport vehicles. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | +| `BRD-FR-025` | Outbound Weighbridge & Dispatch Bilty/Manifest | §5 | Yard Supervisor / Logistics Coordinator | P0 | The system must capture outward weighbridge weights for loaded dispatch trucks (Tare truck before loading, Gross truck after loading), verify loaded weight against order MT, and generate a printable transport manifest / Bilty. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | +| `BRD-FR-026` | In-Transit Tracking & Proof of Delivery (POD) | §5 | Logistics Coordinator | P0 | The system must track dispatch states from `In Transit` to `Delivered`. Upon consignee receipt, the Logistics Coordinator logs confirmation date, destination weighment, and uploads POD document reference. If destination weighment or quality parameters reveal a transit shortage or damage acknowledged by the buyer, the system must allow recording a Consignee Shortage Note and automatically generating a compensating Sales Credit Note against the customer ledger without altering the immutable outbound dispatch manifest. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | +| `BRD-FR-027` | Transport Fleet Registry | §5 | Logistics Coordinator | P1 | The system must maintain a registry of transport trucks (owned and contract carriers) including registration number, vehicle model, gross payload capacity in MT, ownership type (`Own` vs `Contract`), insurance/fitness expiry dates, and operational status (`Available`, `On Route`, `Maintenance`). | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | +| `BRD-FR-028` | Customer Ledger & Aging Statement | §5 | Accounts Executive / Sales Manager | P0 | The system must maintain an immutable party sub-ledger for each customer, debiting finalized sales invoices, crediting payment receipts, and presenting a real-time outstanding balance and aging schedule (0–7 days, 8–15 days, 16–30 days, >30 days). | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | +| `BRD-FR-029` | Automated Customer Credit Exposure Watch & Threshold Alert | §5 | Accounts Executive / Partner | P0 | The system must continuously recompute the customer exposure ratio ($\text{Outstanding} / \text{Credit Limit}$). If exposure $>80\%$, the account must be automatically tagged with a visual `Watch` badge, and an operational warning alert generated on the Executive Dashboard. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | +| `BRD-FR-030` | Credit Breach Dispatch Lock & Partner Override | §5 | Partner / Managing Director | P0 | If a customer's outstanding receivables exceed 100% of their sanctioned credit limit, all pending dispatches for that customer must be locked. Only a Partner user can record an explicit electronic approval override with mandatory justification notes to release the lock. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | +| `BRD-FR-031` | Customer Payment Receipt Posting | §5 | Accounts Executive | P0 | The system must record customer payments capturing payment date, customer code, received amount in INR, payment instrument mode (`NEFT`, `RTGS`, `Cheque`, `Cash`, `UPI`), bank reference/UTR number, and payment status (`Pending Clearance`, `Cleared`, `Bounced`). The system must enforce automatic reversal upon Cheque/Instrument Bounce: if an instrument status transitions to `Bounced`, the system must immediately reverse the credit entry on the customer sub-ledger, restore the previous outstanding debt, recompute exposure ratio %, reinstate credit locks if exposure $>100\%$, and trigger an urgent financial alert. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | +| `BRD-FR-032` | Supplier Payables Aging & Balance Snapshots | §5 | Accounts Executive / Partner | P0 | The system must track supplier payables arising from accepted GRNs, applying supplier credit days, generating aging schedules, and providing daily aggregate payables snapshots. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | +| `BRD-FR-033` | Mandi Operating Expense Classification & Recording | §5 | Accounts Executive | P1 | The system must record operational expenses incurred in mandi and godown operations categorizing entries under: Labor / Hamali (loading/unloading), Freight / Cartage, Weighbridge Fees, Godown Rent, Mandi Cess, Pest Control/Fumigation, and Office Expenses. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | +| `BRD-FR-034` | Real-Time Operational Alerts Engine | §5 | Partner / Operations Supervisor | P0 | The system must evaluate active business data and publish automated proactive alerts across four critical categories: | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | +| `BRD-FR-035` | Executive Control Centre Dashboard | §5 | Partner / Managing Director | P0 | The system must provide a unified operational dashboard displaying real-time metrics: Total Stock on Hand (MT), Total Active Stock Lines, Intraday Purchase Value INR, Intraday Sales Revenue INR, Total Customer Receivables INR, Top 10 Stock Lines by Volume, Top Recent Sales, and Warehouse Utilization Barometers. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | +| `BRD-FR-036` | 20-Day Consolidated Trading Trend Reporting | §5 | Partner / Managing Director | P0 | The system must compile daily management snapshots across a rolling 20-day trading window, tabulating: Date, Purchases MT, Sales MT, Closing Stock MT, Total Receivables INR, and Total Payables INR. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | +| `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) | Not yet mapped (Stage 5) | +| `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) | Not yet mapped (Stage 5) | +| `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) | Not yet mapped (Stage 5) | +| `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) | Not yet mapped (Stage 5) | +| `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) | Not yet mapped (Stage 5) | +| `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) | Not yet mapped (Stage 5) | +| `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) | Not yet mapped (Stage 5) | +| `BRD-FR-044` | Verified Tenant Context for Every Operation | §5 | All authenticated users | P0 | The service must derive the effective tenant context from the authenticated user’s verified tenant membership. A client-supplied tenant identifier alone must never grant or switch tenant access. A user associated with multiple tenants must explicitly select the active tenant after sign-in; the service verifies that membership and its role for every request before permitting action in that tenant. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | +| `BRD-FR-045` | End-to-End Tenant Resource Isolation | §5 | All users; System Administrator for platform controls | P0 | Tenant isolation must apply to all tenant-owned records and derived resources, including database reads and writes, API lookups, search/report results, exports, uploaded files, cache entries, and queued/background work. Cross-tenant access attempts must fail closed and must not reveal whether another tenant’s resource exists. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | +| `BRD-FR-046` | Controlled Privileged Support Access | §5 | System Administrator | P0 | Platform support must not imply routine unrestricted access to tenant business data. Support staff have no standing access to tenant business data. Ordinary exceptional access requires approval by that tenant’s Tenant Administrator for a specific support case and a limited duration. For an urgent incident, a designated platform security administrator may grant a break-glass access window of at most one hour, with a recorded reason, immediate audit alert, and notice to the tenant administrator within one business day. All access is recorded for tenant and platform security review. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | +| `BRD-FR-047` | Personal Data Purpose, Notice & Consent Records | §5 | Tenant Administrator; System Administrator for platform-controlled processing | P0 | The service must allow each responsible Data Fiduciary to determine and approve the processing purpose, applicable lawful basis, and privacy notice for its processing, then document personal-data categories, purpose, basis, notice version, and accountable contact. Tenant firms own these decisions for trading data; the ATB operator records them separately for its own account, security, and service processing. Privacy controls cover every natural person whose personal data is processed in tenant or platform contexts, whether or not that person has an application account. Where consent is the applicable basis, the service must capture evidence of the notice and consent, support withdrawal, and record resulting processing restrictions. Tenant and platform processing contexts must remain distinguishable. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | +| `BRD-FR-048` | Data Principal Rights & Grievance Case Management | §5 | Tenant Administrator; System Administrator for platform-controlled processing | P0 | The service must support receipt, identity verification, routing, tracking, response, and evidence retention for Data Principal requests and grievances concerning access to information, correction, erasure, consent withdrawal, grievance redressal, and nomination, as applicable, including for individuals who do not hold application accounts. Requests must be routed to the responsible Data Fiduciary and handled within the applicable statutory or approved contractual time limit. A request channel must be available without requiring a general customer or supplier portal account. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | +| `BRD-FR-049` | Personal Data Breach Response Coordination | §5 | System Administrator; Tenant Administrator for tenant-scoped incidents | P0 | The service must support recording, triaging, investigation, impact assessment, remediation, and notification coordination for suspected or confirmed personal-data breaches. The platform operator must be able to identify affected tenants and notify the responsible tenant Data Fiduciary promptly when acting as its Data Processor. The workflow must support applicable notification content and deadlines to affected Data Principals and the Data Protection Board, including phased or subsequently amended statutory requirements. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | +| `BRD-FR-050` | Purpose-Aware Retention, Erasure & Legal Hold | §5 | Tenant Administrator; System Administrator for platform-controlled processing | P0 | Use four internal sensitivity levels—Public, Internal, Confidential, and Restricted—with a separate personal-data flag and processing-purpose tag; these are product handling labels, not statutory DPDP classifications. The responsible Data Fiduciary must approve retention schedules by personal-data category and processing purpose after legal/accounting review (tenant firms for trading data; ATB operator for its own account, security, and service data). Authorized operators must be able to apply these schedules by tenant/platform responsibility and applicable legal obligation. The service must support correction, erasure or irreversible de-identification when required, legal holds and statutory retention exceptions, and deletion handling for derived copies and processors, including backups according to the approved schedule. Statutory processing-log retention requirements must be represented separately from general business-record retention. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | +| `BRD-FR-051` | Data Processor & Subprocessor Governance | §5 | System Administrator | P0 | The platform operator must maintain an inventory of processors and subprocessors used for tenant personal data, their processing purpose and location, applicable safeguards and contractual obligations, and status of due diligence. The operator must support tenant Data Fiduciaries with information and operational assistance needed for security safeguards, Data Principal requests, breach response, retention, and erasure obligations. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | +| `BRD-FR-052` | Tenant Operating Policy Configuration & Audit | §5 | Partner / Managing Director; authorized tenant functional managers | P0 | The service must provide tenant-scoped configuration for the provisional operating thresholds listed in §6.2, including market-price variance, weighment shortage, bag tare/packing, commodity quality grading/deductions, credit exposure, warehouse capacity/adjustments/transfers, dispatch tolerances, and alert timing. Policies must support commodity, grade, contract, or other applicable scope and effective dates where needed. Only roles authorized in the tenant permission model may change them; changes must record actor, timestamp, reason, prior value, and new value. Seed values remain provisional. Before each affected live workflow is enabled for a tenant, that tenant’s Partner/Managing Director or delegated authorized business owner must review and confirm or edit every applicable threshold. Missing or unreviewed thresholds block only the affected risk-sensitive workflow. Confirmed policies are versioned with an effective date and changes are audited. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | + +## Extracted Non-Functional Requirements (`BRD-NFR-xxx`) + +NFRs are retained under their source IDs; they are not reminted as functional requirement IDs. + +| NFR ID | Requirement Area | Statement & Quantitative Metric | Priority | +|---|---|---|---| +| `BRD-NFR-001` | Commercial Calculation Integrity | Dual-unit mathematical conversions ($\text{Value} = \text{MT} \times 10 \times \text{Rate}_{\text{Qtl}}$) and bag tare deductions must maintain decimal precision to 3 decimal places for weight and 2 decimal places for currency without rounding drift. | P0 | +| `BRD-NFR-002` | UI Rendering Performance | Web views, forms, and executive dashboards must achieve page load rendering times $\le 1.5\text{ seconds}$ on standard broadband (10 Mbps). | P0 | +| `BRD-NFR-003` | API Latency SLAs | Standard resource CRUD endpoints and list filter queries must achieve response latencies $\le 250\text{ ms}$ (p95) under normal operating load. | P0 | +| `BRD-NFR-004` | High-Volume Reporting SLA | 20-day trading trend snapshots and multi-godown stock position reports must generate in $\le 1.0\text{ second}$ for a tenant with historical ledgers containing $\ge 50,000$ transaction rows. | P0 | +| `BRD-NFR-005` | Programmatic FSM Invariant Protection | Finite State Machines for Lot Quality (`Under QC` $\rightarrow$ `QC Hold` / `Released`) and Outbound Dispatches must be enforced in backend domain logic, preventing client-side or API bypass. | P0 | +| `BRD-NFR-006` | Tenant Data Isolation | Tenant data must remain isolated according to the row-level security model configured in `tech-profile.yaml`; unauthorized cross-tenant access must be prevented and tested. | P0 | +| `BRD-NFR-007` | Offline Sandbox Testability | Configured identity, payment, and messaging integration adapters must provide deterministic local mocks capable of offline, reproducible verification without external network access. | P0 | +| `BRD-NFR-008` | Automated Test Coverage Budgets | Code must meet UP-AI differentiated coverage budgets: $\ge 95\%$ statement/branch coverage for backend domain services and FSMs, $\ge 90\%$ for sandbox adapters, and $\ge 80\%$ for frontend components. | P0 | +| `BRD-NFR-009` | Application Security Assurance | The v1 launch is India-first and must support compliance with India’s Digital Personal Data Protection Act, 2023 and the DPDP Rules applicable at production launch. Supporting tenants subject to other jurisdictions requires a separate legal and privacy assessment before onboarding. Application-security verification must target OWASP ASVS v5.0.0 Level 2. Applicable requirements must be mapped to verification evidence; any non-applicable requirement or exception must be documented with rationale and an accountable owner. Authentication, session handling, authorization, input validation, secure configuration, and sensitive-data protections in transit and at rest must be verified before production release. The compliance design must account for phased commencement and be revalidated against current official notifications before release. | P0 | +| `BRD-NFR-010` | Tenant Isolation Assurance | Tenant isolation must fail closed across synchronous and asynchronous paths, including APIs, database connections, exports, files, caches, scheduled jobs, and support tooling. Automated tests must include cross-tenant negative cases and privileged-role bypass cases. | P0 | +| `BRD-NFR-011` | Availability and Recoverability | Production service availability must be at least 99.9% per month, measured 24/7. Recovery time objective (RTO) must be no more than 4 hours and recovery point objective (RPO) no more than 15 minutes. Backups must be encrypted, taken daily, support point-in-time recovery, and be retained for 35 days. Restore exercises must be performed quarterly and their results recorded before production release. | P0 | +| `BRD-NFR-012` | Capacity and Tenant Fairness | The initial production capacity-planning envelope is 50 tenant firms, up to 25 named users per tenant, and 250 concurrent active users across the service. Report performance must be validated with at least 50,000 ledger rows for a tenant. Load-test the platform for 200 core business documents per tenant per operating day and a 5× peak-hour burst, across the approved tenant/user envelope. This is a provisional capacity-planning scenario, not a customer usage cap. No fixed business-document quota is imposed by this planning envelope. Per-tenant resource use must be observable, with configurable early warnings near the tested fair-share budget. Under contention, the service may apply backpressure or temporarily throttle resource-intensive reports and bulk exports to protect service levels, while preserving and safely reporting the outcome of accepted core business transactions. Numeric fair-share budgets and alert thresholds must be set from architecture/load-test evidence. | P0 | +| `BRD-NFR-013` | Operational Observability | Production operations must provide service-level and tenant-scoped health, error, latency, and workload signals with actionable alerts. Logs and telemetry must carry tenant/correlation context where authorized and must exclude secrets and unnecessary sensitive business data. | P0 | +| `BRD-NFR-014` | Data Governance and Retention | The service must define and enforce four internal sensitivity levels (Public, Internal, Confidential, Restricted), with personal-data and processing-purpose tags applied independently, alongside purpose-aware retention, Data Principal request handling, export, correction, erasure, and legal-hold handling, including tenant closure, in support of applicable DPDP obligations and other applicable laws. These internal labels do not represent statutory DPDP categories. Each responsible Data Fiduciary must approve retention durations by category and purpose after legal/accounting review. The system must preserve applicable statutory minimums and legal holds, and support erasure when purposes and retention obligations end. Backup, processing-log, and audit-data retention and access must follow the approved policy and applicable statutory periods. | P0 | + +## Open Evidence Dependencies + +The following ambiguities remain open and are carried forward; their values are not resolved by this inventory: + +- `AMB-001` / `ASM-001`: gather pre- and post-rollout pilot evidence before setting numeric efficiency targets. +- `AMB-006` / `ASM-002`: obtain qualified review of retention durations and applicable legal/contractual obligations before production release. +- `AMB-008` / `ASM-003`: derive fair-share budgets and alert thresholds from architecture/load-test evidence and pilot telemetry before production capacity acceptance. diff --git a/prompts/20261011T074829Z-session-greenfield-bootstrap.md b/prompts/20261011T074829Z-session-greenfield-bootstrap.md index 66ec4eb..ad8f45d 100644 --- a/prompts/20261011T074829Z-session-greenfield-bootstrap.md +++ b/prompts/20261011T074829Z-session-greenfield-bootstrap.md @@ -282,3 +282,12 @@ Accepted the recommended `AMB-001` pilot protocol: use a representative tenant, ## 2026-10-11T09:37:28Z — Assistant — Action summary Updated PRD §1.3 to specify the 30-operating-day pre-rollout manual baseline and 30-operating-day post-rollout comparison. Recorded stakeholder decision `DEC-019`; kept `AMB-001` open only for measured baseline/target values. Updated master context and `CKPT-006`/checkpoint index: Stage 0B now proceeds to a Human Review Brief, while `AMB-006` needs qualified legal/accounting evidence and `AMB-008` needs load-test and pilot evidence. The PRD remains Draft pending evidence and explicit baseline approval. Verification: 52 unique FR IDs (`001`–`052`), 14 unique NFR IDs (`001`–`014`), open ambiguities `AMB-001`, `AMB-006`, and `AMB-008`; scoped `git diff --check` passed. No tests or traceability gate run. + + +## 2026-10-11T09:44:33Z — Assistant — Correction + +The first extraction attempt stopped on a heading-parser mismatch after the PRD status, bounded assumption text, assumptions register, and `DEC-020` had been written. The parser was corrected; no duplicate decision or assumption entries were added. The complete Stage 1 inventory and `CKPT-007` were then generated, with `AMB-001`, `AMB-006`, and `AMB-008` still open. Verification pending. + +## 2026-10-11T09:46:12Z — Assistant — Action summary + +Completed Stage 1 extraction. Updated the master context to reflect the bounded Stage 1 baseline and corrected `AMB-006` to make qualified review a production-release gate. `brd_inventory.md` contains all 52 PRD functional requirements with source section, actor, priority, statement, Greenfield legacy-comparison status, and downstream mapping status, plus all 14 NFRs. Created `CKPT-007`. Verification: pending. From e76630db313b7af73e1859f13a94cf688b9dba2d Mon Sep 17 00:00:00 2001 From: Prashant Shendre Date: Sun, 11 Oct 2026 15:45:19 +0530 Subject: [PATCH 02/13] Generated use cases --- ...eckpoint-008-stage-5-use-case-authoring.md | 20 +++ .../checkpoints/checkpoint_index.md | 2 + .../00_process_control/traceability_graph.md | 105 ++++++++++++++- .../01_source_inventories/brd_inventory.md | 104 +++++++-------- .../functional-reqs.md | 53 ++++++++ .../use-case.md | 70 ++++++++++ .../functional-reqs.md | 31 +++++ .../uc-003-market-trend-analytics/use-case.md | 56 ++++++++ .../functional-reqs.md | 94 +++++++++++++ .../uc-004-procurement-contracts/use-case.md | 69 ++++++++++ .../functional-reqs.md | 126 ++++++++++++++++++ .../uc-005-inward-receiving/use-case.md | 73 ++++++++++ .../functional-reqs.md | 89 +++++++++++++ .../use-case.md | 67 ++++++++++ .../functional-reqs.md | 72 ++++++++++ .../uc-007-warehouse-inventory/use-case.md | 65 +++++++++ .../uc-008-sales-contracts/functional-reqs.md | 71 ++++++++++ .../uc-008-sales-contracts/use-case.md | 64 +++++++++ .../functional-reqs.md | 71 ++++++++++ .../uc-009-dispatch-delivery/use-case.md | 64 +++++++++ .../uc-010-fleet-registry/functional-reqs.md | 35 +++++ .../uc-010-fleet-registry/use-case.md | 58 ++++++++ .../functional-reqs.md | 89 +++++++++++++ .../uc-011-customer-receivables/use-case.md | 67 ++++++++++ .../functional-reqs.md | 31 +++++ .../uc-012-supplier-payables/use-case.md | 56 ++++++++ .../functional-reqs.md | 35 +++++ .../uc-013-operating-expenses/use-case.md | 58 ++++++++ .../functional-reqs.md | 35 +++++ .../uc-014-operational-alerts/use-case.md | 60 +++++++++ .../functional-reqs.md | 53 ++++++++ .../uc-015-executive-reporting/use-case.md | 61 +++++++++ .../uc-016-master-data/functional-reqs.md | 49 +++++++ .../use_cases/uc-016-master-data/use-case.md | 59 ++++++++ .../functional-reqs.md | 67 ++++++++++ .../uc-017-tenant-security-audit/use-case.md | 62 +++++++++ .../functional-reqs.md | 31 +++++ .../uc-018-tenant-lifecycle/use-case.md | 56 ++++++++ .../functional-reqs.md | 49 +++++++ .../use-case.md | 58 ++++++++ .../functional-reqs.md | 49 +++++++ .../use-case.md | 58 ++++++++ .../functional-reqs.md | 31 +++++ .../use-case.md | 56 ++++++++ .../functional-reqs.md | 31 +++++ .../uc-022-data-principal-rights/use-case.md | 56 ++++++++ .../functional-reqs.md | 31 +++++ .../use-case.md | 56 ++++++++ .../functional-reqs.md | 31 +++++ .../uc-024-retention-erasure/use-case.md | 56 ++++++++ .../functional-reqs.md | 31 +++++ .../uc-025-processor-governance/use-case.md | 56 ++++++++ .../functional-reqs.md | 33 +++++ .../use-case.md | 56 ++++++++ ...11T074829Z-session-greenfield-bootstrap.md | 24 ++++ 55 files changed, 3032 insertions(+), 58 deletions(-) create mode 100644 04_generated_documentation/00_process_control/checkpoints/checkpoint-008-stage-5-use-case-authoring.md create mode 100644 04_generated_documentation/03_requirements/use_cases/uc-002-market-desk-observations/functional-reqs.md create mode 100644 04_generated_documentation/03_requirements/use_cases/uc-002-market-desk-observations/use-case.md create mode 100644 04_generated_documentation/03_requirements/use_cases/uc-003-market-trend-analytics/functional-reqs.md create mode 100644 04_generated_documentation/03_requirements/use_cases/uc-003-market-trend-analytics/use-case.md create mode 100644 04_generated_documentation/03_requirements/use_cases/uc-004-procurement-contracts/functional-reqs.md create mode 100644 04_generated_documentation/03_requirements/use_cases/uc-004-procurement-contracts/use-case.md create mode 100644 04_generated_documentation/03_requirements/use_cases/uc-005-inward-receiving/functional-reqs.md create mode 100644 04_generated_documentation/03_requirements/use_cases/uc-005-inward-receiving/use-case.md create mode 100644 04_generated_documentation/03_requirements/use_cases/uc-006-quality-and-lot-control/functional-reqs.md create mode 100644 04_generated_documentation/03_requirements/use_cases/uc-006-quality-and-lot-control/use-case.md create mode 100644 04_generated_documentation/03_requirements/use_cases/uc-007-warehouse-inventory/functional-reqs.md create mode 100644 04_generated_documentation/03_requirements/use_cases/uc-007-warehouse-inventory/use-case.md create mode 100644 04_generated_documentation/03_requirements/use_cases/uc-008-sales-contracts/functional-reqs.md create mode 100644 04_generated_documentation/03_requirements/use_cases/uc-008-sales-contracts/use-case.md create mode 100644 04_generated_documentation/03_requirements/use_cases/uc-009-dispatch-delivery/functional-reqs.md create mode 100644 04_generated_documentation/03_requirements/use_cases/uc-009-dispatch-delivery/use-case.md create mode 100644 04_generated_documentation/03_requirements/use_cases/uc-010-fleet-registry/functional-reqs.md create mode 100644 04_generated_documentation/03_requirements/use_cases/uc-010-fleet-registry/use-case.md create mode 100644 04_generated_documentation/03_requirements/use_cases/uc-011-customer-receivables/functional-reqs.md create mode 100644 04_generated_documentation/03_requirements/use_cases/uc-011-customer-receivables/use-case.md create mode 100644 04_generated_documentation/03_requirements/use_cases/uc-012-supplier-payables/functional-reqs.md create mode 100644 04_generated_documentation/03_requirements/use_cases/uc-012-supplier-payables/use-case.md create mode 100644 04_generated_documentation/03_requirements/use_cases/uc-013-operating-expenses/functional-reqs.md create mode 100644 04_generated_documentation/03_requirements/use_cases/uc-013-operating-expenses/use-case.md create mode 100644 04_generated_documentation/03_requirements/use_cases/uc-014-operational-alerts/functional-reqs.md create mode 100644 04_generated_documentation/03_requirements/use_cases/uc-014-operational-alerts/use-case.md create mode 100644 04_generated_documentation/03_requirements/use_cases/uc-015-executive-reporting/functional-reqs.md create mode 100644 04_generated_documentation/03_requirements/use_cases/uc-015-executive-reporting/use-case.md create mode 100644 04_generated_documentation/03_requirements/use_cases/uc-016-master-data/functional-reqs.md create mode 100644 04_generated_documentation/03_requirements/use_cases/uc-016-master-data/use-case.md create mode 100644 04_generated_documentation/03_requirements/use_cases/uc-017-tenant-security-audit/functional-reqs.md create mode 100644 04_generated_documentation/03_requirements/use_cases/uc-017-tenant-security-audit/use-case.md create mode 100644 04_generated_documentation/03_requirements/use_cases/uc-018-tenant-lifecycle/functional-reqs.md create mode 100644 04_generated_documentation/03_requirements/use_cases/uc-018-tenant-lifecycle/use-case.md create mode 100644 04_generated_documentation/03_requirements/use_cases/uc-019-tenant-membership-context/functional-reqs.md create mode 100644 04_generated_documentation/03_requirements/use_cases/uc-019-tenant-membership-context/use-case.md create mode 100644 04_generated_documentation/03_requirements/use_cases/uc-020-tenant-support-security/functional-reqs.md create mode 100644 04_generated_documentation/03_requirements/use_cases/uc-020-tenant-support-security/use-case.md create mode 100644 04_generated_documentation/03_requirements/use_cases/uc-021-privacy-purpose-consent/functional-reqs.md create mode 100644 04_generated_documentation/03_requirements/use_cases/uc-021-privacy-purpose-consent/use-case.md create mode 100644 04_generated_documentation/03_requirements/use_cases/uc-022-data-principal-rights/functional-reqs.md create mode 100644 04_generated_documentation/03_requirements/use_cases/uc-022-data-principal-rights/use-case.md create mode 100644 04_generated_documentation/03_requirements/use_cases/uc-023-privacy-breach-response/functional-reqs.md create mode 100644 04_generated_documentation/03_requirements/use_cases/uc-023-privacy-breach-response/use-case.md create mode 100644 04_generated_documentation/03_requirements/use_cases/uc-024-retention-erasure/functional-reqs.md create mode 100644 04_generated_documentation/03_requirements/use_cases/uc-024-retention-erasure/use-case.md create mode 100644 04_generated_documentation/03_requirements/use_cases/uc-025-processor-governance/functional-reqs.md create mode 100644 04_generated_documentation/03_requirements/use_cases/uc-025-processor-governance/use-case.md create mode 100644 04_generated_documentation/03_requirements/use_cases/uc-026-tenant-operating-policies/functional-reqs.md create mode 100644 04_generated_documentation/03_requirements/use_cases/uc-026-tenant-operating-policies/use-case.md diff --git a/04_generated_documentation/00_process_control/checkpoints/checkpoint-008-stage-5-use-case-authoring.md b/04_generated_documentation/00_process_control/checkpoints/checkpoint-008-stage-5-use-case-authoring.md new file mode 100644 index 0000000..44bf9ce --- /dev/null +++ b/04_generated_documentation/00_process_control/checkpoints/checkpoint-008-stage-5-use-case-authoring.md @@ -0,0 +1,20 @@ +# Checkpoint 008 — Stage 5 Use-Case Authoring + +- **Checkpoint ID:** `CKPT-008` +- **Date:** 2026-10-11 +- **Active Stage:** Stage 5 — Use Case Authoring +- **Active Track:** Greenfield, India-first, multi-tenant Agriculture Trading Backoffice (ATB) +- **Active Skill:** `up-use-case-author` completed; Gate 5.1 run + +## Completed +- Authored use cases `UC-002`–`UC-026` with corresponding `functional-reqs.md` artifacts; the pre-existing `UC-001` remains unchanged. +- Mapped every `BRD-FR-001`–`BRD-FR-052` to a use case in `04_generated_documentation/01_source_inventories/brd_inventory.md`. +- Gate 5.1 passes structurally for 26 UCs and 55 child FRs, with zero Critical, Major, or Minor validator findings. +- Recorded the current gate result and new nodes in `traceability_graph.md`; Gate 9.1 is not run for the expanded Stage 5 scope. + +## Open Items +- Existing `UC-001` authentication FRs cite `BRD-FR-001`–`BRD-FR-003`, which the baselined PRD defines as Market Desk requirements. This is a semantic traceability Major recorded in `traceability_graph.md`; do not revise those baseline mappings before a Change Request is analyzed and dispositioned. +- `AMB-001`, `AMB-006`, and `AMB-008` remain open evidence gates per `ambiguity_register.md`. + +## Exact Next Action +Invoke `/up-change-request-impact` to analyze the UC-001 source-feature mapping discrepancy and obtain a disposition before changing the baselined mapping. After the mapping issue is dispositioned, continue to Stage 6 with `/up-arch-risk-spike`, scoring the full current use-case set. 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 b638627..e40f654 100644 --- a/04_generated_documentation/00_process_control/checkpoints/checkpoint_index.md +++ b/04_generated_documentation/00_process_control/checkpoints/checkpoint_index.md @@ -25,3 +25,5 @@ | `CKPT-006` | 2026-10-11 | Stage 0B (Requirements elicitation / Inception) | ATB draft PRD expanded to 52 FRs and 14 NFRs; decisions recorded through DEC-019, including the accepted pre/post pilot KPI measurement protocol. | `AMB-001`, `AMB-006`, and `AMB-008` remain open for pilot results, qualified legal/accounting evidence, and load-test/pilot telemetry; PRD baseline approval pending. | Prepare Stage 0B Human Review Brief and review the Draft PRD; collect evidence for the remaining ambiguities, then obtain explicit baseline approval before Stage 1. | `checkpoint-006-atb-requirements-elicitation.md` | | `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` | diff --git a/04_generated_documentation/00_process_control/traceability_graph.md b/04_generated_documentation/00_process_control/traceability_graph.md index 883639b..070aa95 100644 --- a/04_generated_documentation/00_process_control/traceability_graph.md +++ b/04_generated_documentation/00_process_control/traceability_graph.md @@ -4,7 +4,7 @@ |---|---| | **Governed Standard** | SEI-CMMI Level 3 (UP-AI v1.1) | | **Document Path** | `04_generated_documentation/00_process_control/traceability_graph.md` | -| **Last Updated** | 2026-10-03 | +| **Last Updated** | 2026-10-11 | | **Gated By** | `up-traceability-gate`, `scripts/verify_traceability_gates.py` | @@ -12,13 +12,13 @@ ## 1. Graph Summary Statistics -- **Total Use Cases (UC-xxx):** 1 -- **Total Functional Requirements (FR-xxx):** 3 +- **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) -- **Gate 9.1 Status:** **PASS** (Zero critical findings) +- **Gate 9.1 Status:** **Not Run for expanded Stage 5 scope** --- @@ -26,7 +26,7 @@ ```mermaid graph TD - BRD["BRD-FR-001 (User Auth & Access)"] --> UC001["UC-001 (User Identity & Role Governance)"] + 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)"] @@ -54,7 +54,100 @@ graph TD | Node ID | Node Name | Parent ID | Downstream Linkages | Status | |---|---|---|---|---| -| `UC-001` | User Identity & Role Governance | `BRD-FR-001` | `FR-AUTH-001`, `FR-AUTH-002`, `FR-AUTH-003` | Baselined | +| `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 | + +--- + +## Gate 5.1 Check — 2026-10-11 (Complete Stage 5 Set) + +| 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. | + +**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. + +### Additional Stage 5 Nodes (UC-002–UC-026) + +| Node ID | Node Name | Parent ID | Source | Status | +|---|---|---|---|---| +| `UC-002` | Record Daily Mandi Arrivals and Prices | — | `BRD-FR-001`, `BRD-FR-002` | Draft | +| `FR-MKT-001` | Capture Daily Mandi Arrival Observations | `UC-002` | `BRD-FR-001` | Draft | +| `FR-MKT-002` | Capture Daily Mandi Price Range and Modal Rate | `UC-002` | `BRD-FR-002` | Draft | +| `UC-003` | Mandi Price Trend Analytics | — | `BRD-FR-003` | Draft | +| `FR-MARKETTRENDANALYTICS-001` | Intraday Price Trend Analysis & 20-Day Benchmark Analytics | `UC-003` | `BRD-FR-003` | Draft | +| `UC-004` | Purchase Sauda and Supplier Payables Setup | — | `BRD-FR-004`, `BRD-FR-005`, `BRD-FR-006`, `BRD-FR-007` | Draft | +| `FR-PROCUREMENTCONTRACTS-001` | Procurement Price Variance Alert vs. Modal Rate | `UC-004` | `BRD-FR-004` | Draft | +| `FR-PROCUREMENTCONTRACTS-002` | Mandi Auction & Direct Purchase Sauda Booking | `UC-004` | `BRD-FR-005` | Draft | +| `FR-PROCUREMENTCONTRACTS-003` | Supplier Credit Terms & Due Date Computation | `UC-004` | `BRD-FR-006` | Draft | +| `FR-PROCUREMENTCONTRACTS-004` | Mandi Cess & Statutory Levies Apportioning | `UC-004` | `BRD-FR-007` | Draft | +| `UC-005` | Inward Vehicle Receiving and Goods Receipt | — | `BRD-FR-008`, `BRD-FR-009`, `BRD-FR-010`, `BRD-FR-011`, `BRD-FR-012`, `BRD-FR-013` | Draft | +| `FR-INWARDRECEIVING-001` | Inward Vehicle Gate Entry & Verification | `UC-005` | `BRD-FR-008` | Draft | +| `FR-INWARDRECEIVING-002` | Weighbridge Gross & Tare Weighment Logging | `UC-005` | `BRD-FR-009` | Draft | +| `FR-INWARDRECEIVING-003` | Bag Tare Deduction (*Bardana Katai*) & Final Net MT | `UC-005` | `BRD-FR-010` | Draft | +| `FR-INWARDRECEIVING-004` | Weighment Tolerance & Transit Shortage Verification | `UC-005` | `BRD-FR-011` | Draft | +| `FR-INWARDRECEIVING-005` | Goods Receipt Note (GRN) Posting & Warehouse Stack Placement | `UC-005` | `BRD-FR-012` | Draft | +| `FR-INWARDRECEIVING-006` | Mandatory Lot & Batch Identity Generation | `UC-005` | `BRD-FR-013` | Draft | +| `UC-006` | Inward Quality Inspection and Lot Control | — | `BRD-FR-014`, `BRD-FR-015`, `BRD-FR-016`, `BRD-FR-017` | Draft | +| `FR-QUALITYANDLOTCONTROL-001` | Inward Quality Inspection Parameter Recording | `UC-006` | `BRD-FR-014` | Draft | +| `FR-QUALITYANDLOTCONTROL-002` | Quality Deduction / Rebate Calculation | `UC-006` | `BRD-FR-015` | Draft | +| `FR-QUALITYANDLOTCONTROL-003` | Finite State Machine Enforcement for `QC Hold` vs. `Released` | `UC-006` | `BRD-FR-016` | Draft | +| `FR-QUALITYANDLOTCONTROL-004` | Lot Splitting & Blending Traceability | `UC-006` | `BRD-FR-017` | Draft | +| `UC-007` | Warehouse Stock, Audit, Capacity and Transfer | — | `BRD-FR-018`, `BRD-FR-019`, `BRD-FR-020` | Draft | +| `FR-WAREHOUSEINVENTORY-001` | Multi-Godown Dual-Unit Stock Ledger | `UC-007` | `BRD-FR-018` | Draft | +| `FR-WAREHOUSEINVENTORY-002` | Godown Capacity & Volume Utilization Tracking | `UC-007` | `BRD-FR-019` | Draft | +| `FR-WAREHOUSEINVENTORY-003` | Godown-to-Godown Internal Stock Transfer | `UC-007` | `BRD-FR-020` | Draft | +| `UC-008` | Customer Sales Contract, Credit Check and Allocation | — | `BRD-FR-021`, `BRD-FR-022`, `BRD-FR-023` | Draft | +| `FR-SALESCONTRACTS-001` | Customer Sales Contract Booking | `UC-008` | `BRD-FR-021` | Draft | +| `FR-SALESCONTRACTS-002` | Customer Credit Limit & Pre-Order Exposure Verification | `UC-008` | `BRD-FR-022` | Draft | +| `FR-SALESCONTRACTS-003` | Sales Order Inventory Allocation | `UC-008` | `BRD-FR-023` | Draft | +| `UC-009` | Outbound Dispatch and Delivery | — | `BRD-FR-024`, `BRD-FR-025`, `BRD-FR-026` | Draft | +| `FR-DISPATCHDELIVERY-001` | Outbound Dispatch Board Console | `UC-009` | `BRD-FR-024` | Draft | +| `FR-DISPATCHDELIVERY-002` | Outbound Weighbridge & Dispatch Bilty/Manifest | `UC-009` | `BRD-FR-025` | Draft | +| `FR-DISPATCHDELIVERY-003` | In-Transit Tracking & Proof of Delivery (POD) | `UC-009` | `BRD-FR-026` | Draft | +| `UC-010` | Transport Fleet Registry | — | `BRD-FR-027` | Draft | +| `FR-FLEETREGISTRY-001` | Transport Fleet Registry | `UC-010` | `BRD-FR-027` | Draft | +| `UC-011` | Customer Receivables and Credit Controls | — | `BRD-FR-028`, `BRD-FR-029`, `BRD-FR-030`, `BRD-FR-031` | Draft | +| `FR-CUSTOMERRECEIVABLES-001` | Customer Ledger & Aging Statement | `UC-011` | `BRD-FR-028` | Draft | +| `FR-CUSTOMERRECEIVABLES-002` | Automated Customer Credit Exposure Watch & Threshold Alert | `UC-011` | `BRD-FR-029` | Draft | +| `FR-CUSTOMERRECEIVABLES-003` | Credit Breach Dispatch Lock & Partner Override | `UC-011` | `BRD-FR-030` | Draft | +| `FR-CUSTOMERRECEIVABLES-004` | Customer Payment Receipt Posting | `UC-011` | `BRD-FR-031` | Draft | +| `UC-012` | Supplier Payables and Aging | — | `BRD-FR-032` | Draft | +| `FR-SUPPLIERPAYABLES-001` | Supplier Payables Aging & Balance Snapshots | `UC-012` | `BRD-FR-032` | Draft | +| `UC-013` | Mandi Operating Expense Recording | — | `BRD-FR-033` | Draft | +| `FR-OPERATINGEXPENSES-001` | Mandi Operating Expense Classification & Recording | `UC-013` | `BRD-FR-033` | Draft | +| `UC-014` | Operational Alert Review | — | `BRD-FR-034` | Draft | +| `FR-OPERATIONALALERTS-001` | Real-Time Operational Alerts Engine | `UC-014` | `BRD-FR-034` | Draft | +| `UC-015` | Executive Dashboard and Trading Snapshots | — | `BRD-FR-035`, `BRD-FR-036` | Draft | +| `FR-EXECUTIVEREPORTING-001` | Executive Control Centre Dashboard | `UC-015` | `BRD-FR-035` | Draft | +| `FR-EXECUTIVEREPORTING-002` | 20-Day Consolidated Trading Trend Reporting | `UC-015` | `BRD-FR-036` | Draft | +| `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 | +| `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 | +| `UC-019` | Tenant Membership and Verified Context | — | `BRD-FR-043`, `BRD-FR-044` | Draft | +| `FR-TENANTMEMBERSHIPCONTEXT-001` | Tenant Membership and Role Administration | `UC-019` | `BRD-FR-043` | Draft | +| `FR-TENANTMEMBERSHIPCONTEXT-002` | Verified Tenant Context for Every Operation | `UC-019` | `BRD-FR-044` | Draft | +| `UC-020` | Tenant Resource Isolation and Privileged Support | — | `BRD-FR-045`, `BRD-FR-046` | Draft | +| `FR-TENANTSUPPORTSECURITY-001` | End-to-End Tenant Resource Isolation | `UC-020` | `BRD-FR-045` | Draft | +| `FR-TENANTSUPPORTSECURITY-002` | Controlled Privileged Support Access | `UC-020` | `BRD-FR-046` | Draft | +| `UC-021` | Personal Data Purpose, Notice and Consent | — | `BRD-FR-047` | Draft | +| `FR-PRIVACYPURPOSECONSENT-001` | Personal Data Purpose, Notice & Consent Records | `UC-021` | `BRD-FR-047` | Draft | +| `UC-022` | Data Principal Rights and Grievance Requests | — | `BRD-FR-048` | Draft | +| `FR-DATAPRINCIPALRIGHTS-001` | Data Principal Rights & Grievance Case Management | `UC-022` | `BRD-FR-048` | Draft | +| `UC-023` | Personal Data Breach Response Coordination | — | `BRD-FR-049` | Draft | +| `FR-PRIVACYBREACHRESPONSE-001` | Personal Data Breach Response Coordination | `UC-023` | `BRD-FR-049` | Draft | +| `UC-024` | Purpose-Aware Retention, Erasure and Legal Holds | — | `BRD-FR-050` | Draft | +| `FR-RETENTIONERASURE-001` | Purpose-Aware Retention, Erasure & Legal Hold | `UC-024` | `BRD-FR-050` | Draft | +| `UC-025` | Processor and Subprocessor Governance | — | `BRD-FR-051` | Draft | +| `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 | diff --git a/04_generated_documentation/01_source_inventories/brd_inventory.md b/04_generated_documentation/01_source_inventories/brd_inventory.md index a09e2dd..40b543d 100644 --- a/04_generated_documentation/01_source_inventories/brd_inventory.md +++ b/04_generated_documentation/01_source_inventories/brd_inventory.md @@ -14,58 +14,58 @@ Every functional feature from PRD §5 is represented once. Stage 1 extraction do | Feature ID | Feature Name | PRD Reference | Primary Actor(s) | Priority | Extracted Business Requirement | Legacy Overlap / Conflict | Downstream Use Case | |---|---|---|---|---|---|---|---| -| `BRD-FR-001` | Daily APMC Mandi Arrival Ingestion & Tracking | §5 | Procurement Executive / Mandi Buyer | P0 | The system must record daily physical arrival volumes at APMC mandi yards across target commodities (Chana, Coriander, Cumin, Fenugreek, Groundnut, Isabgol, Jaggery, Maize, Mustard, Soybean, Turmeric, Wheat) across monitored markets (Neemuch, Mandsaur, Ratlam, Kota, Indore, Jaora, Ujjain, Chittorgarh). | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | -| `BRD-FR-002` | Daily Modal & Range Pricing Tracking (₹/Qtl) | §5 | Procurement Executive / Purchase Manager | P0 | For each daily mandi arrival record, the system must capture the quoted price range (Min Rate ₹/Qtl, Max Rate ₹/Qtl) and the official modal clearing price (Modal Rate ₹/Qtl). | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | -| `BRD-FR-003` | Intraday Price Trend Analysis & 20-Day Benchmark Analytics | §5 | Purchase Manager / Partner | P0 | The system must provide interactive visual charts and trend tables comparing the 20-day historical modal rate trend per commodity across markets, computing 20-day moving averages, 20-day highs/lows, and price velocity. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | -| `BRD-FR-004` | Procurement Price Variance Alert vs. Modal Rate | §5 | Purchase Manager | P1 | When booking a purchase sauda, the system must compare the offered trade rate against the latest modal clearing rate for that commodity/mandi. If the offered rate exceeds the modal rate by $>5\%$, the system must display an inline warning and require confirmation. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | -| `BRD-FR-005` | Mandi Auction & Direct Purchase Sauda Booking | §5 | Procurement Executive / Purchase Manager | P0 | The system must record purchase contracts (*saudas*) negotiated in mandi auctions or directly with suppliers. Each sauda must capture supplier code, sourcing market, commodity, variety, trade rate (₹/Qtl), estimated bag count, and booked quantity in MT. The system must support multi-truck partial delivery: a sauda may be fulfilled across multiple trucks/GRNs over consecutive delivery days, tracking cumulative received MT and remaining balance MT until fully fulfilled. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | -| `BRD-FR-006` | Supplier Credit Terms & Due Date Computation | §5 | Purchase Manager / Accounts Executive | P0 | The system must automatically compute the supplier payment due date by adding the supplier's contractual credit days (e.g., 7, 15, or 21 days) to the sauda or GRN receipt date. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | -| `BRD-FR-007` | Mandi Cess & Statutory Levies Apportioning | §5 | Accounts Executive | P1 | The system must calculate statutory mandi cess (e.g., 1.5% APMC market fee + 0.2% Nirashrit fee) based on the gross sauda value and append it to the total procurement cost. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | -| `BRD-FR-008` | Inward Vehicle Gate Entry & Verification | §5 | Yard Supervisor | P0 | Upon vehicle arrival at the godown, the Yard Supervisor must log gate entry linking the vehicle registration number and driver details to an active booked sauda. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | -| `BRD-FR-009` | Weighbridge Gross & Tare Weighment Logging | §5 | Yard Supervisor | P0 | The system must record dual-phase weighbridge measurements for incoming trucks: (1) Gross Weighment (truck + commodity) upon arrival, and (2) Tare Weighment (empty truck) after unloading. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | -| `BRD-FR-010` | Bag Tare Deduction (*Bardana Katai*) & Final Net MT | §5 | Yard Supervisor | P0 | The system must deduct the weight of packaging bags from the gross commodity weight using the defined tare deduction factor (default 1.0 kg/gunny bag) to calculate true Net Payable MT. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | -| `BRD-FR-011` | Weighment Tolerance & Transit Shortage Verification | §5 | Yard Supervisor / Purchase Manager | P0 | The system must compare the Final Net Weighbridge MT against the Booked Sauda MT. If shortage exceeds $0.5\%$, the system must flag a `Transit Shortage Warning` and adjust the final payable amount to the actual net received weight. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | -| `BRD-FR-012` | Goods Receipt Note (GRN) Posting & Warehouse Stack Placement | §5 | Yard Supervisor | P0 | Upon weighment completion, the system must generate a formal GRN document, allocate the physical goods to a specific warehouse/godown and stack location, credit the warehouse stock book, and mint an inward Commodity Lot. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | -| `BRD-FR-013` | Mandatory Lot & Batch Identity Generation | §5 | Yard Supervisor / Quality Officer | P0 | The system must automatically generate a globally unique, immutable Lot ID (`LOT-YYYYMM-xxx`) for every inward consignment processed through a GRN. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | -| `BRD-FR-014` | Inward Quality Inspection Parameter Recording | §5 | Quality Officer | P0 | The Quality Officer must log laboratory/physical test parameters for the lot: Moisture %, Foreign Matter / Dust %, Admixture (other grains) %, Damaged / Discolored %, and Weevil count. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | -| `BRD-FR-015` | Quality Deduction / Rebate Calculation | §5 | Quality Officer / Accounts Executive | P1 | If moisture or foreign matter exceeds standard contract baselines (e.g., standard moisture baseline 10.0%), the system must automatically compute a quality price deduction (e.g., ₹10 deduction per quintal for each 0.5% moisture above baseline). | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | -| `BRD-FR-016` | Finite State Machine Enforcement for `QC Hold` vs. `Released` | §5 | Quality Officer | P0 | The system must enforce strict FSM transitions on the Lot record. If moisture $>12\%$ or foreign matter $>2\%$, the lot must be transitioned to `QC Hold`. A lot on `QC Hold` is programmatically blocked from sales order allocation and dispatch loading. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | -| `BRD-FR-017` | Lot Splitting & Blending Traceability | §5 | Yard Supervisor / Quality Officer | P1 | The system must support splitting a parent lot into sub-lots (e.g., when dividing a consignment across two warehouses) or blending multiple lots, maintaining parent-child lineage in the traceability graph. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | -| `BRD-FR-018` | Multi-Godown Dual-Unit Stock Ledger | §5 | Yard Supervisor / Management | P0 | The system must maintain a real-time, double-entry stock ledger tracking commodity positions across warehouses (WH-01 Neemuch Main Yard, WH-02 Neemuch North Godown, WH-03 Mandsaur Transit Godown, WH-04 Indore Buffer Depot). For each commodity, variety, and grade, it must maintain Opening Stock MT, Received MT, Dispatched MT, Closing Stock MT, and physical Bag counts. The system must support Periodic Physical Stock Audits: recording physical tally counts against book balances and generating supervisor-authorized Stock Adjustment Vouchers capturing natural storage loss/gain (*ghat / nami* due to moisture evaporation or seasonal humidity) or handling spillage with mandatory reason codes. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | -| `BRD-FR-019` | Godown Capacity & Volume Utilization Tracking | §5 | Yard Supervisor / Partner | P0 | The system must track the physical storage capacity of each warehouse in Metric Tonnes and calculate real-time percentage utilization: | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | -| `BRD-FR-020` | Godown-to-Godown Internal Stock Transfer | §5 | Yard Supervisor / Logistics Coordinator | P0 | The system must support recording stock transfers between godowns (e.g., from Mandsaur Transit Godown to Neemuch Main Yard), logging origin outward deduction, in-transit state, destination weighment, and destination inward credit. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | -| `BRD-FR-021` | Customer Sales Contract Booking | §5 | Sales Manager / Sales Executive | P0 | The system must record customer sales orders/contracts specifying customer code, destination city, customer segment (`Wholesale`, `Processor`, `Institutional`, `Distributor`), commodity, variety, grade, contracted quantity in MT, contract rate in ₹/Qtl, and delivery timeline. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | -| `BRD-FR-022` | Customer Credit Limit & Pre-Order Exposure Verification | §5 | Sales Manager / Accounts Executive | P0 | Prior to confirming a sales order, the system must evaluate the customer's current outstanding receivables plus the value of the new order against their sanctioned credit limit. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | -| `BRD-FR-023` | Sales Order Inventory Allocation | §5 | Sales Manager / Yard Supervisor | P0 | The Sales Manager must allocate specific available inventory lot(s) from a warehouse to a confirmed sales order. The system must verify that selected lots are in `Released` state and have sufficient unreserved balance. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | -| `BRD-FR-024` | Outbound Dispatch Board Console | §5 | Logistics Coordinator | P0 | The system must provide a visual dispatch management board displaying scheduled, loading, and in-transit consignments, matching confirmed sales orders to allocated warehouse lots and transport vehicles. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | -| `BRD-FR-025` | Outbound Weighbridge & Dispatch Bilty/Manifest | §5 | Yard Supervisor / Logistics Coordinator | P0 | The system must capture outward weighbridge weights for loaded dispatch trucks (Tare truck before loading, Gross truck after loading), verify loaded weight against order MT, and generate a printable transport manifest / Bilty. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | -| `BRD-FR-026` | In-Transit Tracking & Proof of Delivery (POD) | §5 | Logistics Coordinator | P0 | The system must track dispatch states from `In Transit` to `Delivered`. Upon consignee receipt, the Logistics Coordinator logs confirmation date, destination weighment, and uploads POD document reference. If destination weighment or quality parameters reveal a transit shortage or damage acknowledged by the buyer, the system must allow recording a Consignee Shortage Note and automatically generating a compensating Sales Credit Note against the customer ledger without altering the immutable outbound dispatch manifest. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | -| `BRD-FR-027` | Transport Fleet Registry | §5 | Logistics Coordinator | P1 | The system must maintain a registry of transport trucks (owned and contract carriers) including registration number, vehicle model, gross payload capacity in MT, ownership type (`Own` vs `Contract`), insurance/fitness expiry dates, and operational status (`Available`, `On Route`, `Maintenance`). | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | -| `BRD-FR-028` | Customer Ledger & Aging Statement | §5 | Accounts Executive / Sales Manager | P0 | The system must maintain an immutable party sub-ledger for each customer, debiting finalized sales invoices, crediting payment receipts, and presenting a real-time outstanding balance and aging schedule (0–7 days, 8–15 days, 16–30 days, >30 days). | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | -| `BRD-FR-029` | Automated Customer Credit Exposure Watch & Threshold Alert | §5 | Accounts Executive / Partner | P0 | The system must continuously recompute the customer exposure ratio ($\text{Outstanding} / \text{Credit Limit}$). If exposure $>80\%$, the account must be automatically tagged with a visual `Watch` badge, and an operational warning alert generated on the Executive Dashboard. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | -| `BRD-FR-030` | Credit Breach Dispatch Lock & Partner Override | §5 | Partner / Managing Director | P0 | If a customer's outstanding receivables exceed 100% of their sanctioned credit limit, all pending dispatches for that customer must be locked. Only a Partner user can record an explicit electronic approval override with mandatory justification notes to release the lock. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | -| `BRD-FR-031` | Customer Payment Receipt Posting | §5 | Accounts Executive | P0 | The system must record customer payments capturing payment date, customer code, received amount in INR, payment instrument mode (`NEFT`, `RTGS`, `Cheque`, `Cash`, `UPI`), bank reference/UTR number, and payment status (`Pending Clearance`, `Cleared`, `Bounced`). The system must enforce automatic reversal upon Cheque/Instrument Bounce: if an instrument status transitions to `Bounced`, the system must immediately reverse the credit entry on the customer sub-ledger, restore the previous outstanding debt, recompute exposure ratio %, reinstate credit locks if exposure $>100\%$, and trigger an urgent financial alert. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | -| `BRD-FR-032` | Supplier Payables Aging & Balance Snapshots | §5 | Accounts Executive / Partner | P0 | The system must track supplier payables arising from accepted GRNs, applying supplier credit days, generating aging schedules, and providing daily aggregate payables snapshots. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | -| `BRD-FR-033` | Mandi Operating Expense Classification & Recording | §5 | Accounts Executive | P1 | The system must record operational expenses incurred in mandi and godown operations categorizing entries under: Labor / Hamali (loading/unloading), Freight / Cartage, Weighbridge Fees, Godown Rent, Mandi Cess, Pest Control/Fumigation, and Office Expenses. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | -| `BRD-FR-034` | Real-Time Operational Alerts Engine | §5 | Partner / Operations Supervisor | P0 | The system must evaluate active business data and publish automated proactive alerts across four critical categories: | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | -| `BRD-FR-035` | Executive Control Centre Dashboard | §5 | Partner / Managing Director | P0 | The system must provide a unified operational dashboard displaying real-time metrics: Total Stock on Hand (MT), Total Active Stock Lines, Intraday Purchase Value INR, Intraday Sales Revenue INR, Total Customer Receivables INR, Top 10 Stock Lines by Volume, Top Recent Sales, and Warehouse Utilization Barometers. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | -| `BRD-FR-036` | 20-Day Consolidated Trading Trend Reporting | §5 | Partner / Managing Director | P0 | The system must compile daily management snapshots across a rolling 20-day trading window, tabulating: Date, Purchases MT, Sales MT, Closing Stock MT, Total Receivables INR, and Total Payables INR. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | -| `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) | Not yet mapped (Stage 5) | -| `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) | Not yet mapped (Stage 5) | -| `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) | Not yet mapped (Stage 5) | -| `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) | Not yet mapped (Stage 5) | -| `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) | Not yet mapped (Stage 5) | -| `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) | Not yet mapped (Stage 5) | -| `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) | Not yet mapped (Stage 5) | -| `BRD-FR-044` | Verified Tenant Context for Every Operation | §5 | All authenticated users | P0 | The service must derive the effective tenant context from the authenticated user’s verified tenant membership. A client-supplied tenant identifier alone must never grant or switch tenant access. A user associated with multiple tenants must explicitly select the active tenant after sign-in; the service verifies that membership and its role for every request before permitting action in that tenant. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | -| `BRD-FR-045` | End-to-End Tenant Resource Isolation | §5 | All users; System Administrator for platform controls | P0 | Tenant isolation must apply to all tenant-owned records and derived resources, including database reads and writes, API lookups, search/report results, exports, uploaded files, cache entries, and queued/background work. Cross-tenant access attempts must fail closed and must not reveal whether another tenant’s resource exists. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | -| `BRD-FR-046` | Controlled Privileged Support Access | §5 | System Administrator | P0 | Platform support must not imply routine unrestricted access to tenant business data. Support staff have no standing access to tenant business data. Ordinary exceptional access requires approval by that tenant’s Tenant Administrator for a specific support case and a limited duration. For an urgent incident, a designated platform security administrator may grant a break-glass access window of at most one hour, with a recorded reason, immediate audit alert, and notice to the tenant administrator within one business day. All access is recorded for tenant and platform security review. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | -| `BRD-FR-047` | Personal Data Purpose, Notice & Consent Records | §5 | Tenant Administrator; System Administrator for platform-controlled processing | P0 | The service must allow each responsible Data Fiduciary to determine and approve the processing purpose, applicable lawful basis, and privacy notice for its processing, then document personal-data categories, purpose, basis, notice version, and accountable contact. Tenant firms own these decisions for trading data; the ATB operator records them separately for its own account, security, and service processing. Privacy controls cover every natural person whose personal data is processed in tenant or platform contexts, whether or not that person has an application account. Where consent is the applicable basis, the service must capture evidence of the notice and consent, support withdrawal, and record resulting processing restrictions. Tenant and platform processing contexts must remain distinguishable. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | -| `BRD-FR-048` | Data Principal Rights & Grievance Case Management | §5 | Tenant Administrator; System Administrator for platform-controlled processing | P0 | The service must support receipt, identity verification, routing, tracking, response, and evidence retention for Data Principal requests and grievances concerning access to information, correction, erasure, consent withdrawal, grievance redressal, and nomination, as applicable, including for individuals who do not hold application accounts. Requests must be routed to the responsible Data Fiduciary and handled within the applicable statutory or approved contractual time limit. A request channel must be available without requiring a general customer or supplier portal account. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | -| `BRD-FR-049` | Personal Data Breach Response Coordination | §5 | System Administrator; Tenant Administrator for tenant-scoped incidents | P0 | The service must support recording, triaging, investigation, impact assessment, remediation, and notification coordination for suspected or confirmed personal-data breaches. The platform operator must be able to identify affected tenants and notify the responsible tenant Data Fiduciary promptly when acting as its Data Processor. The workflow must support applicable notification content and deadlines to affected Data Principals and the Data Protection Board, including phased or subsequently amended statutory requirements. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | -| `BRD-FR-050` | Purpose-Aware Retention, Erasure & Legal Hold | §5 | Tenant Administrator; System Administrator for platform-controlled processing | P0 | Use four internal sensitivity levels—Public, Internal, Confidential, and Restricted—with a separate personal-data flag and processing-purpose tag; these are product handling labels, not statutory DPDP classifications. The responsible Data Fiduciary must approve retention schedules by personal-data category and processing purpose after legal/accounting review (tenant firms for trading data; ATB operator for its own account, security, and service data). Authorized operators must be able to apply these schedules by tenant/platform responsibility and applicable legal obligation. The service must support correction, erasure or irreversible de-identification when required, legal holds and statutory retention exceptions, and deletion handling for derived copies and processors, including backups according to the approved schedule. Statutory processing-log retention requirements must be represented separately from general business-record retention. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | -| `BRD-FR-051` | Data Processor & Subprocessor Governance | §5 | System Administrator | P0 | The platform operator must maintain an inventory of processors and subprocessors used for tenant personal data, their processing purpose and location, applicable safeguards and contractual obligations, and status of due diligence. The operator must support tenant Data Fiduciaries with information and operational assistance needed for security safeguards, Data Principal requests, breach response, retention, and erasure obligations. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | -| `BRD-FR-052` | Tenant Operating Policy Configuration & Audit | §5 | Partner / Managing Director; authorized tenant functional managers | P0 | The service must provide tenant-scoped configuration for the provisional operating thresholds listed in §6.2, including market-price variance, weighment shortage, bag tare/packing, commodity quality grading/deductions, credit exposure, warehouse capacity/adjustments/transfers, dispatch tolerances, and alert timing. Policies must support commodity, grade, contract, or other applicable scope and effective dates where needed. Only roles authorized in the tenant permission model may change them; changes must record actor, timestamp, reason, prior value, and new value. Seed values remain provisional. Before each affected live workflow is enabled for a tenant, that tenant’s Partner/Managing Director or delegated authorized business owner must review and confirm or edit every applicable threshold. Missing or unreviewed thresholds block only the affected risk-sensitive workflow. Confirmed policies are versioned with an effective date and changes are audited. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | Not yet mapped (Stage 5) | +| `BRD-FR-001` | Daily APMC Mandi Arrival Ingestion & Tracking | §5 | Procurement Executive / Mandi Buyer | P0 | The system must record daily physical arrival volumes at APMC mandi yards across target commodities (Chana, Coriander, Cumin, Fenugreek, Groundnut, Isabgol, Jaggery, Maize, Mustard, Soybean, Turmeric, Wheat) across monitored markets (Neemuch, Mandsaur, Ratlam, Kota, Indore, Jaora, Ujjain, Chittorgarh). | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-002` | +| `BRD-FR-002` | Daily Modal & Range Pricing Tracking (₹/Qtl) | §5 | Procurement Executive / Purchase Manager | P0 | For each daily mandi arrival record, the system must capture the quoted price range (Min Rate ₹/Qtl, Max Rate ₹/Qtl) and the official modal clearing price (Modal Rate ₹/Qtl). | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-002` | +| `BRD-FR-003` | Intraday Price Trend Analysis & 20-Day Benchmark Analytics | §5 | Purchase Manager / Partner | P0 | The system must provide interactive visual charts and trend tables comparing the 20-day historical modal rate trend per commodity across markets, computing 20-day moving averages, 20-day highs/lows, and price velocity. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-003` | +| `BRD-FR-004` | Procurement Price Variance Alert vs. Modal Rate | §5 | Purchase Manager | P1 | When booking a purchase sauda, the system must compare the offered trade rate against the latest modal clearing rate for that commodity/mandi. If the offered rate exceeds the modal rate by $>5\%$, the system must display an inline warning and require confirmation. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-004` | +| `BRD-FR-005` | Mandi Auction & Direct Purchase Sauda Booking | §5 | Procurement Executive / Purchase Manager | P0 | The system must record purchase contracts (*saudas*) negotiated in mandi auctions or directly with suppliers. Each sauda must capture supplier code, sourcing market, commodity, variety, trade rate (₹/Qtl), estimated bag count, and booked quantity in MT. The system must support multi-truck partial delivery: a sauda may be fulfilled across multiple trucks/GRNs over consecutive delivery days, tracking cumulative received MT and remaining balance MT until fully fulfilled. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-004` | +| `BRD-FR-006` | Supplier Credit Terms & Due Date Computation | §5 | Purchase Manager / Accounts Executive | P0 | The system must automatically compute the supplier payment due date by adding the supplier's contractual credit days (e.g., 7, 15, or 21 days) to the sauda or GRN receipt date. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-004` | +| `BRD-FR-007` | Mandi Cess & Statutory Levies Apportioning | §5 | Accounts Executive | P1 | The system must calculate statutory mandi cess (e.g., 1.5% APMC market fee + 0.2% Nirashrit fee) based on the gross sauda value and append it to the total procurement cost. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-004` | +| `BRD-FR-008` | Inward Vehicle Gate Entry & Verification | §5 | Yard Supervisor | P0 | Upon vehicle arrival at the godown, the Yard Supervisor must log gate entry linking the vehicle registration number and driver details to an active booked sauda. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-005` | +| `BRD-FR-009` | Weighbridge Gross & Tare Weighment Logging | §5 | Yard Supervisor | P0 | The system must record dual-phase weighbridge measurements for incoming trucks: (1) Gross Weighment (truck + commodity) upon arrival, and (2) Tare Weighment (empty truck) after unloading. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-005` | +| `BRD-FR-010` | Bag Tare Deduction (*Bardana Katai*) & Final Net MT | §5 | Yard Supervisor | P0 | The system must deduct the weight of packaging bags from the gross commodity weight using the defined tare deduction factor (default 1.0 kg/gunny bag) to calculate true Net Payable MT. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-005` | +| `BRD-FR-011` | Weighment Tolerance & Transit Shortage Verification | §5 | Yard Supervisor / Purchase Manager | P0 | The system must compare the Final Net Weighbridge MT against the Booked Sauda MT. If shortage exceeds $0.5\%$, the system must flag a `Transit Shortage Warning` and adjust the final payable amount to the actual net received weight. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-005` | +| `BRD-FR-012` | Goods Receipt Note (GRN) Posting & Warehouse Stack Placement | §5 | Yard Supervisor | P0 | Upon weighment completion, the system must generate a formal GRN document, allocate the physical goods to a specific warehouse/godown and stack location, credit the warehouse stock book, and mint an inward Commodity Lot. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-005` | +| `BRD-FR-013` | Mandatory Lot & Batch Identity Generation | §5 | Yard Supervisor / Quality Officer | P0 | The system must automatically generate a globally unique, immutable Lot ID (`LOT-YYYYMM-xxx`) for every inward consignment processed through a GRN. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-005` | +| `BRD-FR-014` | Inward Quality Inspection Parameter Recording | §5 | Quality Officer | P0 | The Quality Officer must log laboratory/physical test parameters for the lot: Moisture %, Foreign Matter / Dust %, Admixture (other grains) %, Damaged / Discolored %, and Weevil count. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-006` | +| `BRD-FR-015` | Quality Deduction / Rebate Calculation | §5 | Quality Officer / Accounts Executive | P1 | If moisture or foreign matter exceeds standard contract baselines (e.g., standard moisture baseline 10.0%), the system must automatically compute a quality price deduction (e.g., ₹10 deduction per quintal for each 0.5% moisture above baseline). | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-006` | +| `BRD-FR-016` | Finite State Machine Enforcement for `QC Hold` vs. `Released` | §5 | Quality Officer | P0 | The system must enforce strict FSM transitions on the Lot record. If moisture $>12\%$ or foreign matter $>2\%$, the lot must be transitioned to `QC Hold`. A lot on `QC Hold` is programmatically blocked from sales order allocation and dispatch loading. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-006` | +| `BRD-FR-017` | Lot Splitting & Blending Traceability | §5 | Yard Supervisor / Quality Officer | P1 | The system must support splitting a parent lot into sub-lots (e.g., when dividing a consignment across two warehouses) or blending multiple lots, maintaining parent-child lineage in the traceability graph. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-006` | +| `BRD-FR-018` | Multi-Godown Dual-Unit Stock Ledger | §5 | Yard Supervisor / Management | P0 | The system must maintain a real-time, double-entry stock ledger tracking commodity positions across warehouses (WH-01 Neemuch Main Yard, WH-02 Neemuch North Godown, WH-03 Mandsaur Transit Godown, WH-04 Indore Buffer Depot). For each commodity, variety, and grade, it must maintain Opening Stock MT, Received MT, Dispatched MT, Closing Stock MT, and physical Bag counts. The system must support Periodic Physical Stock Audits: recording physical tally counts against book balances and generating supervisor-authorized Stock Adjustment Vouchers capturing natural storage loss/gain (*ghat / nami* due to moisture evaporation or seasonal humidity) or handling spillage with mandatory reason codes. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-007` | +| `BRD-FR-019` | Godown Capacity & Volume Utilization Tracking | §5 | Yard Supervisor / Partner | P0 | The system must track the physical storage capacity of each warehouse in Metric Tonnes and calculate real-time percentage utilization: | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-007` | +| `BRD-FR-020` | Godown-to-Godown Internal Stock Transfer | §5 | Yard Supervisor / Logistics Coordinator | P0 | The system must support recording stock transfers between godowns (e.g., from Mandsaur Transit Godown to Neemuch Main Yard), logging origin outward deduction, in-transit state, destination weighment, and destination inward credit. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-007` | +| `BRD-FR-021` | Customer Sales Contract Booking | §5 | Sales Manager / Sales Executive | P0 | The system must record customer sales orders/contracts specifying customer code, destination city, customer segment (`Wholesale`, `Processor`, `Institutional`, `Distributor`), commodity, variety, grade, contracted quantity in MT, contract rate in ₹/Qtl, and delivery timeline. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-008` | +| `BRD-FR-022` | Customer Credit Limit & Pre-Order Exposure Verification | §5 | Sales Manager / Accounts Executive | P0 | Prior to confirming a sales order, the system must evaluate the customer's current outstanding receivables plus the value of the new order against their sanctioned credit limit. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-008` | +| `BRD-FR-023` | Sales Order Inventory Allocation | §5 | Sales Manager / Yard Supervisor | P0 | The Sales Manager must allocate specific available inventory lot(s) from a warehouse to a confirmed sales order. The system must verify that selected lots are in `Released` state and have sufficient unreserved balance. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-008` | +| `BRD-FR-024` | Outbound Dispatch Board Console | §5 | Logistics Coordinator | P0 | The system must provide a visual dispatch management board displaying scheduled, loading, and in-transit consignments, matching confirmed sales orders to allocated warehouse lots and transport vehicles. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-009` | +| `BRD-FR-025` | Outbound Weighbridge & Dispatch Bilty/Manifest | §5 | Yard Supervisor / Logistics Coordinator | P0 | The system must capture outward weighbridge weights for loaded dispatch trucks (Tare truck before loading, Gross truck after loading), verify loaded weight against order MT, and generate a printable transport manifest / Bilty. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-009` | +| `BRD-FR-026` | In-Transit Tracking & Proof of Delivery (POD) | §5 | Logistics Coordinator | P0 | The system must track dispatch states from `In Transit` to `Delivered`. Upon consignee receipt, the Logistics Coordinator logs confirmation date, destination weighment, and uploads POD document reference. If destination weighment or quality parameters reveal a transit shortage or damage acknowledged by the buyer, the system must allow recording a Consignee Shortage Note and automatically generating a compensating Sales Credit Note against the customer ledger without altering the immutable outbound dispatch manifest. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-009` | +| `BRD-FR-027` | Transport Fleet Registry | §5 | Logistics Coordinator | P1 | The system must maintain a registry of transport trucks (owned and contract carriers) including registration number, vehicle model, gross payload capacity in MT, ownership type (`Own` vs `Contract`), insurance/fitness expiry dates, and operational status (`Available`, `On Route`, `Maintenance`). | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-010` | +| `BRD-FR-028` | Customer Ledger & Aging Statement | §5 | Accounts Executive / Sales Manager | P0 | The system must maintain an immutable party sub-ledger for each customer, debiting finalized sales invoices, crediting payment receipts, and presenting a real-time outstanding balance and aging schedule (0–7 days, 8–15 days, 16–30 days, >30 days). | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-011` | +| `BRD-FR-029` | Automated Customer Credit Exposure Watch & Threshold Alert | §5 | Accounts Executive / Partner | P0 | The system must continuously recompute the customer exposure ratio ($\text{Outstanding} / \text{Credit Limit}$). If exposure $>80\%$, the account must be automatically tagged with a visual `Watch` badge, and an operational warning alert generated on the Executive Dashboard. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-011` | +| `BRD-FR-030` | Credit Breach Dispatch Lock & Partner Override | §5 | Partner / Managing Director | P0 | If a customer's outstanding receivables exceed 100% of their sanctioned credit limit, all pending dispatches for that customer must be locked. Only a Partner user can record an explicit electronic approval override with mandatory justification notes to release the lock. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-011` | +| `BRD-FR-031` | Customer Payment Receipt Posting | §5 | Accounts Executive | P0 | The system must record customer payments capturing payment date, customer code, received amount in INR, payment instrument mode (`NEFT`, `RTGS`, `Cheque`, `Cash`, `UPI`), bank reference/UTR number, and payment status (`Pending Clearance`, `Cleared`, `Bounced`). The system must enforce automatic reversal upon Cheque/Instrument Bounce: if an instrument status transitions to `Bounced`, the system must immediately reverse the credit entry on the customer sub-ledger, restore the previous outstanding debt, recompute exposure ratio %, reinstate credit locks if exposure $>100\%$, and trigger an urgent financial alert. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-011` | +| `BRD-FR-032` | Supplier Payables Aging & Balance Snapshots | §5 | Accounts Executive / Partner | P0 | The system must track supplier payables arising from accepted GRNs, applying supplier credit days, generating aging schedules, and providing daily aggregate payables snapshots. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-012` | +| `BRD-FR-033` | Mandi Operating Expense Classification & Recording | §5 | Accounts Executive | P1 | The system must record operational expenses incurred in mandi and godown operations categorizing entries under: Labor / Hamali (loading/unloading), Freight / Cartage, Weighbridge Fees, Godown Rent, Mandi Cess, Pest Control/Fumigation, and Office Expenses. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-013` | +| `BRD-FR-034` | Real-Time Operational Alerts Engine | §5 | Partner / Operations Supervisor | P0 | The system must evaluate active business data and publish automated proactive alerts across four critical categories: | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-014` | +| `BRD-FR-035` | Executive Control Centre Dashboard | §5 | Partner / Managing Director | P0 | The system must provide a unified operational dashboard displaying real-time metrics: Total Stock on Hand (MT), Total Active Stock Lines, Intraday Purchase Value INR, Intraday Sales Revenue INR, Total Customer Receivables INR, Top 10 Stock Lines by Volume, Top Recent Sales, and Warehouse Utilization Barometers. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-015` | +| `BRD-FR-036` | 20-Day Consolidated Trading Trend Reporting | §5 | Partner / Managing Director | P0 | The system must compile daily management snapshots across a rolling 20-day trading window, tabulating: Date, Purchases MT, Sales MT, Closing Stock MT, Total Receivables INR, and Total Payables INR. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-015` | +| `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-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` | +| `BRD-FR-044` | Verified Tenant Context for Every Operation | §5 | All authenticated users | P0 | The service must derive the effective tenant context from the authenticated user’s verified tenant membership. A client-supplied tenant identifier alone must never grant or switch tenant access. A user associated with multiple tenants must explicitly select the active tenant after sign-in; the service verifies that membership and its role for every request before permitting action in that tenant. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-019` | +| `BRD-FR-045` | End-to-End Tenant Resource Isolation | §5 | All users; System Administrator for platform controls | P0 | Tenant isolation must apply to all tenant-owned records and derived resources, including database reads and writes, API lookups, search/report results, exports, uploaded files, cache entries, and queued/background work. Cross-tenant access attempts must fail closed and must not reveal whether another tenant’s resource exists. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-020` | +| `BRD-FR-046` | Controlled Privileged Support Access | §5 | System Administrator | P0 | Platform support must not imply routine unrestricted access to tenant business data. Support staff have no standing access to tenant business data. Ordinary exceptional access requires approval by that tenant’s Tenant Administrator for a specific support case and a limited duration. For an urgent incident, a designated platform security administrator may grant a break-glass access window of at most one hour, with a recorded reason, immediate audit alert, and notice to the tenant administrator within one business day. All access is recorded for tenant and platform security review. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-020` | +| `BRD-FR-047` | Personal Data Purpose, Notice & Consent Records | §5 | Tenant Administrator; System Administrator for platform-controlled processing | P0 | The service must allow each responsible Data Fiduciary to determine and approve the processing purpose, applicable lawful basis, and privacy notice for its processing, then document personal-data categories, purpose, basis, notice version, and accountable contact. Tenant firms own these decisions for trading data; the ATB operator records them separately for its own account, security, and service processing. Privacy controls cover every natural person whose personal data is processed in tenant or platform contexts, whether or not that person has an application account. Where consent is the applicable basis, the service must capture evidence of the notice and consent, support withdrawal, and record resulting processing restrictions. Tenant and platform processing contexts must remain distinguishable. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-021` | +| `BRD-FR-048` | Data Principal Rights & Grievance Case Management | §5 | Tenant Administrator; System Administrator for platform-controlled processing | P0 | The service must support receipt, identity verification, routing, tracking, response, and evidence retention for Data Principal requests and grievances concerning access to information, correction, erasure, consent withdrawal, grievance redressal, and nomination, as applicable, including for individuals who do not hold application accounts. Requests must be routed to the responsible Data Fiduciary and handled within the applicable statutory or approved contractual time limit. A request channel must be available without requiring a general customer or supplier portal account. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-022` | +| `BRD-FR-049` | Personal Data Breach Response Coordination | §5 | System Administrator; Tenant Administrator for tenant-scoped incidents | P0 | The service must support recording, triaging, investigation, impact assessment, remediation, and notification coordination for suspected or confirmed personal-data breaches. The platform operator must be able to identify affected tenants and notify the responsible tenant Data Fiduciary promptly when acting as its Data Processor. The workflow must support applicable notification content and deadlines to affected Data Principals and the Data Protection Board, including phased or subsequently amended statutory requirements. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-023` | +| `BRD-FR-050` | Purpose-Aware Retention, Erasure & Legal Hold | §5 | Tenant Administrator; System Administrator for platform-controlled processing | P0 | Use four internal sensitivity levels—Public, Internal, Confidential, and Restricted—with a separate personal-data flag and processing-purpose tag; these are product handling labels, not statutory DPDP classifications. The responsible Data Fiduciary must approve retention schedules by personal-data category and processing purpose after legal/accounting review (tenant firms for trading data; ATB operator for its own account, security, and service data). Authorized operators must be able to apply these schedules by tenant/platform responsibility and applicable legal obligation. The service must support correction, erasure or irreversible de-identification when required, legal holds and statutory retention exceptions, and deletion handling for derived copies and processors, including backups according to the approved schedule. Statutory processing-log retention requirements must be represented separately from general business-record retention. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-024` | +| `BRD-FR-051` | Data Processor & Subprocessor Governance | §5 | System Administrator | P0 | The platform operator must maintain an inventory of processors and subprocessors used for tenant personal data, their processing purpose and location, applicable safeguards and contractual obligations, and status of due diligence. The operator must support tenant Data Fiduciaries with information and operational assistance needed for security safeguards, Data Principal requests, breach response, retention, and erasure obligations. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-025` | +| `BRD-FR-052` | Tenant Operating Policy Configuration & Audit | §5 | Partner / Managing Director; authorized tenant functional managers | P0 | The service must provide tenant-scoped configuration for the provisional operating thresholds listed in §6.2, including market-price variance, weighment shortage, bag tare/packing, commodity quality grading/deductions, credit exposure, warehouse capacity/adjustments/transfers, dispatch tolerances, and alert timing. Policies must support commodity, grade, contract, or other applicable scope and effective dates where needed. Only roles authorized in the tenant permission model may change them; changes must record actor, timestamp, reason, prior value, and new value. Seed values remain provisional. Before each affected live workflow is enabled for a tenant, that tenant’s Partner/Managing Director or delegated authorized business owner must review and confirm or edit every applicable threshold. Missing or unreviewed thresholds block only the affected risk-sensitive workflow. Confirmed policies are versioned with an effective date and changes are audited. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-026` | ## Extracted Non-Functional Requirements (`BRD-NFR-xxx`) diff --git a/04_generated_documentation/03_requirements/use_cases/uc-002-market-desk-observations/functional-reqs.md b/04_generated_documentation/03_requirements/use_cases/uc-002-market-desk-observations/functional-reqs.md new file mode 100644 index 0000000..551d3d9 --- /dev/null +++ b/04_generated_documentation/03_requirements/use_cases/uc-002-market-desk-observations/functional-reqs.md @@ -0,0 +1,53 @@ +--- +id: UC-002-FR +version: 1.0.0 +status: Draft +--- + +# Functional Requirements — UC-002 Record Daily Mandi Arrivals and Prices + +| Field | Value | +|---|---| +| **Parent Use Case** | `UC-002` | +| **Status** | Draft | +| **Version** | 1.0.0 | + +## FR-MKT-001: Capture Daily Mandi Arrival Observations + +- **Requirement ID:** `FR-MKT-001` +- **Parent UC:** `UC-002` +- **Source Feature:** `BRD-FR-001` +- **Priority:** Must (P0) +- **Referenced Screen / Route:** Market Desk daily observation entry and list (route TBD in Stage 11) +- **Business Rules:** Observation date cannot be in the future; arrival quantity must be ≥ 0.0 MT; duplicate observations for the same market, commodity, variety, and date are blocked; when arrival data is unavailable due to a holiday or strike, the market can be flagged `Closed / Mandi Holiday`. + +### Statement + +The system shall allow an authorized Procurement Executive / Mandi Buyer to record a daily APMC mandi observation for a monitored market yard and commodity, including observation date, market yard, commodity, variety, grade, arrival quantity in MT, internal stock position in MT, observation source, and timestamp. The system shall reject future observation dates, negative arrival quantities, and duplicate observations with the same market, commodity, variety, and date. When arrival data is unavailable because of a holiday or strike, the system shall allow the actor to flag the market as `Closed / Mandi Holiday`. + +### Acceptance Criteria + +1. The saved observation contains all BRD-FR-001 data attributes: observation date, market yard, commodity, variety, grade, arrival quantity in MT, internal stock position in MT, observation source, and timestamp. +2. The system rejects an observation date later than the current date. +3. The system rejects arrival quantity below 0.0 MT and accepts 0.0 MT. +4. The system blocks a second observation with the same market, commodity, variety, and date. +5. The actor can record `Closed / Mandi Holiday` when arrival data is unavailable due to a holiday or strike, without supplying unavailable arrival data. + +## FR-MKT-002: Capture Daily Mandi Price Range and Modal Rate + +- **Requirement ID:** `FR-MKT-002` +- **Parent UC:** `UC-002` +- **Source Feature:** `BRD-FR-002` +- **Priority:** Must (P0) +- **Referenced Screen / Route:** Market Desk daily observation entry and list (route TBD in Stage 11) +- **Business Rules:** All rates must be > 0; `Min Rate ≤ Modal Rate ≤ Max Rate`. + +### Statement + +For each daily mandi arrival observation, the system shall capture the quoted minimum and maximum rates and official modal clearing rate in ₹/Qtl. The system shall reject a save if any rate is not greater than zero or if the modal rate falls outside the inclusive minimum-to-maximum range, and shall identify the arithmetic constraint in its validation response. + +### Acceptance Criteria + +1. The observation captures minimum, maximum, and modal rates in ₹/Qtl. +2. The system accepts rates only when all three values are greater than zero and `Min Rate ≤ Modal Rate ≤ Max Rate`. +3. If the modal rate is outside the inclusive minimum-to-maximum range, the system rejects the save and reports the arithmetic constraint error. diff --git a/04_generated_documentation/03_requirements/use_cases/uc-002-market-desk-observations/use-case.md b/04_generated_documentation/03_requirements/use_cases/uc-002-market-desk-observations/use-case.md new file mode 100644 index 0000000..7fefef3 --- /dev/null +++ b/04_generated_documentation/03_requirements/use_cases/uc-002-market-desk-observations/use-case.md @@ -0,0 +1,70 @@ +--- +id: UC-002 +version: 1.0.0 +status: Draft +--- + +# UC-002 — Record Daily Mandi Arrivals and Prices + +| Field | Value | +|---|---| +| **Use Case ID** | `UC-002` | +| **Name** | Record Daily Mandi Arrivals and Prices | +| **Owning Domain** | Market Desk | +| **Primary Actor** | Procurement Executive / Mandi Buyer | +| **Supporting Actors** | Purchase Manager | +| **Source Features** | `BRD-FR-001`, `BRD-FR-002` | +| **Status** | Draft | +| **Version** | 1.0.0 | + +## Goal + +Record a daily mandi observation for a market, commodity, variety, and date, including arrival quantity and the quoted minimum, maximum, and modal prices, or record that the market is closed when arrival data is unavailable due to a holiday or strike. + +## Preconditions + +1. The actor is authenticated and authorized to record Market Desk observations for the active tenant. +2. The market yard and commodity are within the monitored scope in `BRD-FR-001`. + +## Trigger + +The Procurement Executive / Mandi Buyer records the day's mandi arrival and price information, or reports that the market is closed because of a holiday or strike. + +## Main Success Flow + +1. The actor starts a daily observation and selects the observation date, market yard, commodity, variety, and grade. +2. The actor enters arrival quantity in MT, internal stock position in MT, and observation source. +3. The actor enters the quoted minimum rate, maximum rate, and modal clearing rate in ₹/Qtl. +4. The system validates the observation date, arrival quantity, uniqueness key, and price constraints. +5. The system records the observation with its timestamp and makes it available as a daily Market Desk record. + +## Alternate Flows + +- **A1 — Market closed:** If arrival data is unavailable because of a holiday or strike, the actor flags the market as `Closed / Mandi Holiday`; the system records the closure instead of requiring unavailable arrival and price values. + +## Exception Flows + +- **E1 — Future observation date:** The system rejects the observation because the date cannot be in the future. +- **E2 — Negative arrival quantity:** The system rejects the observation because arrival quantity must be at least 0.0 MT. +- **E3 — Duplicate observation:** The system blocks a duplicate for the same market, commodity, variety, and date. +- **E4 — Invalid price range:** The system rejects the observation if any rate is not greater than zero or if `Min Rate ≤ Modal Rate ≤ Max Rate` is false, and reports the arithmetic constraint error. + +## Postconditions + +- On success, the daily observation is stored with its date, market, commodity, variety, grade, arrival quantity, internal stock position, observation source, timestamp, and price values. +- On the market-closed alternate flow, the market closure is recorded for the observation date. +- On a rejected flow, no invalid or duplicate observation is saved. + +## Referenced Screens / Routes + +- Market Desk daily observation entry and list — route to be specified during Stage 11 screen design. + +## Business Rules Invoked + +- `BRD-FR-001`: observation date is not in the future; arrival quantity is ≥ 0.0 MT; uniqueness by market, commodity, variety, and date; allow `Closed / Mandi Holiday` when data is unavailable due to holiday/strike. +- `BRD-FR-002`: all rates are > 0 and `Min Rate ≤ Modal Rate ≤ Max Rate`. + +## Child Functional Requirements + +- [FR-MKT-001 — Capture Daily Mandi Arrival Observations](functional-reqs.md#fr-mkt-001) +- [FR-MKT-002 — Capture Daily Mandi Price Range and Modal Rate](functional-reqs.md#fr-mkt-002) diff --git a/04_generated_documentation/03_requirements/use_cases/uc-003-market-trend-analytics/functional-reqs.md b/04_generated_documentation/03_requirements/use_cases/uc-003-market-trend-analytics/functional-reqs.md new file mode 100644 index 0000000..ad38a3b --- /dev/null +++ b/04_generated_documentation/03_requirements/use_cases/uc-003-market-trend-analytics/functional-reqs.md @@ -0,0 +1,31 @@ +--- +id: UC-003-FR +version: 1.0.0 +status: Draft +--- + +# Functional Requirements — UC-003 Mandi Price Trend Analytics + +| Field | Value | +|---|---| +| **Parent Use Case** | `UC-003` | +| **Status** | Draft | +| **Version** | 1.0.0 | + +## FR-MARKETTRENDANALYTICS-001: Intraday Price Trend Analysis & 20-Day Benchmark Analytics + +- **Requirement ID:** `FR-MARKETTRENDANALYTICS-001` +- **Parent UC:** `UC-003` +- **Source Feature:** `BRD-FR-003` +- **Priority:** Must (P0) +- **Referenced Screen / Route:** Market Desk workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **Business Rules:** Calculations must dynamically update upon new observation save. Execution time $\le 500\text{ms}$. + +### Statement + +The system must provide interactive visual charts and trend tables comparing the 20-day historical modal rate trend per commodity across markets, computing 20-day moving averages, 20-day highs/lows, and price velocity. + +### Acceptance Criteria + +1. The requirement records, computes, or presents the source-defined data attributes: Historical Date Range, Commodity Filter, Market Filter, 20-Day SMA (Simple Moving Average), Price Spread. +2. The system enforces the source-defined validation rules: Calculations must dynamically update upon new observation save. Execution time $\le 500\text{ms}$. diff --git a/04_generated_documentation/03_requirements/use_cases/uc-003-market-trend-analytics/use-case.md b/04_generated_documentation/03_requirements/use_cases/uc-003-market-trend-analytics/use-case.md new file mode 100644 index 0000000..83862eb --- /dev/null +++ b/04_generated_documentation/03_requirements/use_cases/uc-003-market-trend-analytics/use-case.md @@ -0,0 +1,56 @@ +--- +id: UC-003 +version: 1.0.0 +status: Draft +--- + +# UC-003 — Mandi Price Trend Analytics + +| Field | Value | +|---|---| +| **Use Case ID** | `UC-003` | +| **Name** | Mandi Price Trend Analytics | +| **Owning Domain** | Market Desk | +| **Primary Actor(s)** | Purchase Manager / Partner | +| **Supporting Actor(s)** | Purchase Manager, Partner | +| **Source Features** | `BRD-FR-003` | +| **Status** | Draft | +| **Version** | 1.0.0 | + +## Goal + +Review the historical modal-price movement for a selected commodity across markets. + +## Preconditions + +1. The actor is authenticated and has the role and tenant scope required by the source feature(s). +2. Any source records or master data explicitly required by the selected feature are available and in the required state. + +## Trigger + +The actor initiates one of the 1 business operations covered by this use case: intraday price trend analysis & 20-day benchmark analytics. + +## Main Success Flow + +1. The actor initiates **Intraday Price Trend Analysis & 20-Day Benchmark Analytics**. The system performs the source-defined behavior: The system must provide interactive visual charts and trend tables comparing the 20-day historical modal rate trend per commodity across markets, computing 20-day moving averages, 20-day highs/lows, and price velocity. + +## Alternate Flows + +- No alternate business flow is specified by the source features. + +## Exception Flows + +- **BRD-FR-003:** Reject or prevent the operation when its stated validation rules are not met: Calculations must dynamically update upon new observation save. Execution time $\le 500\text{ms}$. + +## Postconditions + +- Successful operations create or update only the business records and outcomes stated in the linked BRD features. +- Rejected operations do not bypass the validations and controls stated by those features. + +## Referenced Screens / Routes + +- Market Desk workflow screen(s) — route(s) to be specified during Stage 11 screen design + +## Child Functional Requirements + +- [FR-MARKETTRENDANALYTICS-001: Intraday Price Trend Analysis & 20-Day Benchmark Analytics](functional-reqs.md#fr-markettrendanalytics-001) diff --git a/04_generated_documentation/03_requirements/use_cases/uc-004-procurement-contracts/functional-reqs.md b/04_generated_documentation/03_requirements/use_cases/uc-004-procurement-contracts/functional-reqs.md new file mode 100644 index 0000000..012bed3 --- /dev/null +++ b/04_generated_documentation/03_requirements/use_cases/uc-004-procurement-contracts/functional-reqs.md @@ -0,0 +1,94 @@ +--- +id: UC-004-FR +version: 1.0.0 +status: Draft +--- + +# Functional Requirements — UC-004 Purchase Sauda and Supplier Payables Setup + +| Field | Value | +|---|---| +| **Parent Use Case** | `UC-004` | +| **Status** | Draft | +| **Version** | 1.0.0 | + +## FR-PROCUREMENTCONTRACTS-001: Procurement Price Variance Alert vs. Modal Rate + +- **Requirement ID:** `FR-PROCUREMENTCONTRACTS-001` +- **Parent UC:** `UC-004` +- **Source Feature:** `BRD-FR-004` +- **Priority:** Should (P1) +- **Referenced Screen / Route:** Market Desk & Procurement workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **Business Rules:** Informational alert only; does not hard-block procurement unless configured in company policy. + +--- + +### Statement + +When booking a purchase sauda, the system must compare the offered trade rate against the latest modal clearing rate for that commodity/mandi. If the offered rate exceeds the modal rate by $>5\%$, the system must display an inline warning and require confirmation. + +### Acceptance Criteria + +1. The requirement records, computes, or presents the source-defined data attributes: Offered Rate, Benchmark Modal Rate, Variance \%. +2. The system enforces the source-defined validation rules: Informational alert only; does not hard-block procurement unless configured in company policy. + +--- + +## FR-PROCUREMENTCONTRACTS-002: Mandi Auction & Direct Purchase Sauda Booking + +- **Requirement ID:** `FR-PROCUREMENTCONTRACTS-002` +- **Parent UC:** `UC-004` +- **Source Feature:** `BRD-FR-005` +- **Priority:** Must (P0) +- **Referenced Screen / Route:** Market Desk & Procurement workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **Business Rules:** Supplier must be an active master record. Booked MT must be $> 0$. Trade rate must be $> 0$. Gross value must equal $\text{Booked MT} \times 10 \times \text{Rate}$. Status remains `Partially Received` until cumulative received MT reaches booked MT (within tolerance) or explicitly closed by Purchase Manager. + +### Statement + +The system must record purchase contracts (*saudas*) negotiated in mandi auctions or directly with suppliers. Each sauda must capture supplier code, sourcing market, commodity, variety, trade rate (₹/Qtl), estimated bag count, and booked quantity in MT. The system must support multi-truck partial delivery: a sauda may be fulfilled across multiple trucks/GRNs over consecutive delivery days, tracking cumulative received MT and remaining balance MT until fully fulfilled. + +### Acceptance Criteria + +1. The requirement records, computes, or presents the source-defined data attributes: Sauda ID (`PUR-YYYYMM-xxx`), Sauda Date, Supplier ID, Sourcing Mandi, Commodity, Variety, Booked Qty MT, Estimated Bags, Trade Rate (₹/Qtl), Gross Value INR, Cumulative Received MT, Remaining Balance MT, Status. +2. The system enforces the source-defined validation rules: Supplier must be an active master record. Booked MT must be $> 0$. Trade rate must be $> 0$. Gross value must equal $\text{Booked MT} \times 10 \times \text{Rate}$. Status remains `Partially Received` until cumulative received MT reaches booked MT (within tolerance) or explicitly closed by Purchase Manager. +3. The system handles the source-defined failure condition as follows: If supplier is deactivated or blacklisted, booking must be blocked. + +## FR-PROCUREMENTCONTRACTS-003: Supplier Credit Terms & Due Date Computation + +- **Requirement ID:** `FR-PROCUREMENTCONTRACTS-003` +- **Parent UC:** `UC-004` +- **Source Feature:** `BRD-FR-006` +- **Priority:** Must (P0) +- **Referenced Screen / Route:** Market Desk & Procurement workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **Business Rules:** Default credit days inherited from Supplier master; editable only by Purchase Manager. + +### Statement + +The system must automatically compute the supplier payment due date by adding the supplier's contractual credit days (e.g., 7, 15, or 21 days) to the sauda or GRN receipt date. + +### Acceptance Criteria + +1. The requirement records, computes, or presents the source-defined data attributes: Supplier Credit Days, Transaction Date, Computed Due Date, Payment Status (`Pending`, `Paid`). +2. The system enforces the source-defined validation rules: Default credit days inherited from Supplier master; editable only by Purchase Manager. + +## FR-PROCUREMENTCONTRACTS-004: Mandi Cess & Statutory Levies Apportioning + +- **Requirement ID:** `FR-PROCUREMENTCONTRACTS-004` +- **Parent UC:** `UC-004` +- **Source Feature:** `BRD-FR-007` +- **Priority:** Should (P1) +- **Referenced Screen / Route:** Market Desk & Procurement workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **Business Rules:** Configurable per commodity and market jurisdiction. + +--- + +### Statement + +The system must calculate statutory mandi cess (e.g., 1.5% APMC market fee + 0.2% Nirashrit fee) based on the gross sauda value and append it to the total procurement cost. + +### Acceptance Criteria + +1. The requirement records, computes, or presents the source-defined data attributes: Mandi Cess Rate %, Cess Amount INR, Total Landed Procurement Cost INR. +2. The system enforces the source-defined validation rules: Configurable per commodity and market jurisdiction. + +--- diff --git a/04_generated_documentation/03_requirements/use_cases/uc-004-procurement-contracts/use-case.md b/04_generated_documentation/03_requirements/use_cases/uc-004-procurement-contracts/use-case.md new file mode 100644 index 0000000..ad6dfd6 --- /dev/null +++ b/04_generated_documentation/03_requirements/use_cases/uc-004-procurement-contracts/use-case.md @@ -0,0 +1,69 @@ +--- +id: UC-004 +version: 1.0.0 +status: Draft +--- + +# UC-004 — Purchase Sauda and Supplier Payables Setup + +| Field | Value | +|---|---| +| **Use Case ID** | `UC-004` | +| **Name** | Purchase Sauda and Supplier Payables Setup | +| **Owning Domain** | Market Desk & Procurement | +| **Primary Actor(s)** | Procurement Executive / Purchase Manager / Accounts Executive | +| **Supporting Actor(s)** | Purchase Manager, Procurement Executive, Accounts Executive | +| **Source Features** | `BRD-FR-004`, `BRD-FR-005`, `BRD-FR-006`, `BRD-FR-007` | +| **Status** | Draft | +| **Version** | 1.0.0 | + +## Goal + +Record and manage mandi or direct purchase commitments, including benchmark comparison and the related supplier due-date and levy calculations. + +## Preconditions + +1. The actor is authenticated and has the role and tenant scope required by the source feature(s). +2. Any source records or master data explicitly required by the selected feature are available and in the required state. + +## Trigger + +The actor initiates one of the 4 business operations covered by this use case: procurement price variance alert vs. modal rate; mandi auction & direct purchase sauda booking; supplier credit terms & due date computation; mandi cess & statutory levies apportioning. + +## Main Success Flow + +1. The actor initiates **Procurement Price Variance Alert vs. Modal Rate**. The system performs the source-defined behavior: When booking a purchase sauda, the system must compare the offered trade rate against the latest modal clearing rate for that commodity/mandi. If the offered rate exceeds the modal rate by $>5\%$, the system must display an inline warning and require confirmation. +2. The actor initiates **Mandi Auction & Direct Purchase Sauda Booking**. The system performs the source-defined behavior: The system must record purchase contracts (*saudas*) negotiated in mandi auctions or directly with suppliers. Each sauda must capture supplier code, sourcing market, commodity, variety, trade rate (₹/Qtl), estimated bag count, and booked quantity in MT. The system must support multi-truck partial delivery: a sauda may be fulfilled across multiple trucks/GRNs over consecutive delivery days, tracking cumulative received MT and remaining balance MT until fully fulfilled. +3. The actor initiates **Supplier Credit Terms & Due Date Computation**. The system performs the source-defined behavior: The system must automatically compute the supplier payment due date by adding the supplier's contractual credit days (e.g., 7, 15, or 21 days) to the sauda or GRN receipt date. +4. The actor initiates **Mandi Cess & Statutory Levies Apportioning**. The system performs the source-defined behavior: The system must calculate statutory mandi cess (e.g., 1.5% APMC market fee + 0.2% Nirashrit fee) based on the gross sauda value and append it to the total procurement cost. + +## Alternate Flows + +- **BRD-FR-005 — Mandi Auction & Direct Purchase Sauda Booking:** If supplier is deactivated or blacklisted, booking must be blocked. + +## Exception Flows + +- **BRD-FR-004:** Reject or prevent the operation when its stated validation rules are not met: Informational alert only; does not hard-block procurement unless configured in company policy. + +--- +- **BRD-FR-005:** Reject or prevent the operation when its stated validation rules are not met: Supplier must be an active master record. Booked MT must be $> 0$. Trade rate must be $> 0$. Gross value must equal $\text{Booked MT} \times 10 \times \text{Rate}$. Status remains `Partially Received` until cumulative received MT reaches booked MT (within tolerance) or explicitly closed by Purchase Manager. +- **BRD-FR-006:** Reject or prevent the operation when its stated validation rules are not met: Default credit days inherited from Supplier master; editable only by Purchase Manager. +- **BRD-FR-007:** Reject or prevent the operation when its stated validation rules are not met: Configurable per commodity and market jurisdiction. + +--- + +## Postconditions + +- Successful operations create or update only the business records and outcomes stated in the linked BRD features. +- Rejected operations do not bypass the validations and controls stated by those features. + +## Referenced Screens / Routes + +- Market Desk & Procurement workflow screen(s) — route(s) to be specified during Stage 11 screen design + +## Child Functional Requirements + +- [FR-PROCUREMENTCONTRACTS-001: Procurement Price Variance Alert vs. Modal Rate](functional-reqs.md#fr-procurementcontracts-001) +- [FR-PROCUREMENTCONTRACTS-002: Mandi Auction & Direct Purchase Sauda Booking](functional-reqs.md#fr-procurementcontracts-002) +- [FR-PROCUREMENTCONTRACTS-003: Supplier Credit Terms & Due Date Computation](functional-reqs.md#fr-procurementcontracts-003) +- [FR-PROCUREMENTCONTRACTS-004: Mandi Cess & Statutory Levies Apportioning](functional-reqs.md#fr-procurementcontracts-004) diff --git a/04_generated_documentation/03_requirements/use_cases/uc-005-inward-receiving/functional-reqs.md b/04_generated_documentation/03_requirements/use_cases/uc-005-inward-receiving/functional-reqs.md new file mode 100644 index 0000000..4e17398 --- /dev/null +++ b/04_generated_documentation/03_requirements/use_cases/uc-005-inward-receiving/functional-reqs.md @@ -0,0 +1,126 @@ +--- +id: UC-005-FR +version: 1.0.0 +status: Draft +--- + +# Functional Requirements — UC-005 Inward Vehicle Receiving and Goods Receipt + +| Field | Value | +|---|---| +| **Parent Use Case** | `UC-005` | +| **Status** | Draft | +| **Version** | 1.0.0 | + +## FR-INWARDRECEIVING-001: Inward Vehicle Gate Entry & Verification + +- **Requirement ID:** `FR-INWARDRECEIVING-001` +- **Parent UC:** `UC-005` +- **Source Feature:** `BRD-FR-008` +- **Priority:** Must (P0) +- **Referenced Screen / Route:** Goods Receipt workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **Business Rules:** Linked sauda must be in state `Booked`. + +### Statement + +Upon vehicle arrival at the godown, the Yard Supervisor must log gate entry linking the vehicle registration number and driver details to an active booked sauda. + +### Acceptance Criteria + +1. The requirement records, computes, or presents the source-defined data attributes: Gate Entry ID, Inward Date/Time, Vehicle Reg No, Driver Name, Contact No, Linked Sauda ID, Supplier Name, Gate Pass No. +2. The system enforces the source-defined validation rules: Linked sauda must be in state `Booked`. + +## FR-INWARDRECEIVING-002: Weighbridge Gross & Tare Weighment Logging + +- **Requirement ID:** `FR-INWARDRECEIVING-002` +- **Parent UC:** `UC-005` +- **Source Feature:** `BRD-FR-009` +- **Priority:** Must (P0) +- **Referenced Screen / Route:** Goods Receipt workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **Business Rules:** $\text{Gross Weight} > \text{Tare Weight} > 0$. Weighbridge slip number mandatory. + +### Statement + +The system must record dual-phase weighbridge measurements for incoming trucks: (1) Gross Weighment (truck + commodity) upon arrival, and (2) Tare Weighment (empty truck) after unloading. + +### Acceptance Criteria + +1. The requirement records, computes, or presents the source-defined data attributes: Gross Weight kg, Gross Timestamp, Tare Weight kg, Tare Timestamp, Gross Net Weight kg ($Gross - Tare$), Weighbridge Slip No. +2. The system enforces the source-defined validation rules: $\text{Gross Weight} > \text{Tare Weight} > 0$. Weighbridge slip number mandatory. +3. The system handles the source-defined failure condition as follows: If Tare Weight $\ge$ Gross Weight, system must hard-block submission with an error. + +## FR-INWARDRECEIVING-003: Bag Tare Deduction (*Bardana Katai*) & Final Net MT + +- **Requirement ID:** `FR-INWARDRECEIVING-003` +- **Parent UC:** `UC-005` +- **Source Feature:** `BRD-FR-010` +- **Priority:** Must (P0) +- **Referenced Screen / Route:** Goods Receipt workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **Business Rules:** Formula: $\text{Net MT} = (\text{Gross kg} - \text{Tare kg} - (\text{Bags} \times \text{Bag Tare Rate})) / 1000$. Net MT must be $> 0$. + +### Statement + +The system must deduct the weight of packaging bags from the gross commodity weight using the defined tare deduction factor (default 1.0 kg/gunny bag) to calculate true Net Payable MT. + +### Acceptance Criteria + +1. The requirement records, computes, or presents the source-defined data attributes: Physical Bag Count, Packaging Type (`Gunny/Jute`, `HDPE/Plastic`), Bag Tare Deduction Rate kg/bag, Total Bag Tare kg, Final Net Weight MT. +2. The system enforces the source-defined validation rules: Formula: $\text{Net MT} = (\text{Gross kg} - \text{Tare kg} - (\text{Bags} \times \text{Bag Tare Rate})) / 1000$. Net MT must be $> 0$. + +## FR-INWARDRECEIVING-004: Weighment Tolerance & Transit Shortage Verification + +- **Requirement ID:** `FR-INWARDRECEIVING-004` +- **Parent UC:** `UC-005` +- **Source Feature:** `BRD-FR-011` +- **Priority:** Must (P0) +- **Referenced Screen / Route:** Goods Receipt workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **Business Rules:** If shortage exceeds $2.0\%$, the GRN requires mandatory Purchase Manager approval before stock posting. + +### Statement + +The system must compare the Final Net Weighbridge MT against the Booked Sauda MT. If shortage exceeds $0.5\%$, the system must flag a `Transit Shortage Warning` and adjust the final payable amount to the actual net received weight. + +### Acceptance Criteria + +1. The requirement records, computes, or presents the source-defined data attributes: Shortage MT, Shortage Value INR, Variance \%, Shortage Status (`Normal`, `Disputed`). +2. The system enforces the source-defined validation rules: If shortage exceeds $2.0\%$, the GRN requires mandatory Purchase Manager approval before stock posting. + +## FR-INWARDRECEIVING-005: Goods Receipt Note (GRN) Posting & Warehouse Stack Placement + +- **Requirement ID:** `FR-INWARDRECEIVING-005` +- **Parent UC:** `UC-005` +- **Source Feature:** `BRD-FR-012` +- **Priority:** Must (P0) +- **Referenced Screen / Route:** Goods Receipt workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **Business Rules:** GRN submission atomically updates inventory and creates Lot record in state `Under QC`. + +--- + +### Statement + +Upon weighment completion, the system must generate a formal GRN document, allocate the physical goods to a specific warehouse/godown and stack location, credit the warehouse stock book, and mint an inward Commodity Lot. + +### Acceptance Criteria + +1. The requirement records, computes, or presents the source-defined data attributes: GRN ID (`GRN-YYYYMM-xxx`), Receiving Warehouse ID, Stack/Chamber No, Accepted Bags, Accepted Net MT. +2. The system enforces the source-defined validation rules: GRN submission atomically updates inventory and creates Lot record in state `Under QC`. + +--- + +## FR-INWARDRECEIVING-006: Mandatory Lot & Batch Identity Generation + +- **Requirement ID:** `FR-INWARDRECEIVING-006` +- **Parent UC:** `UC-005` +- **Source Feature:** `BRD-FR-013` +- **Priority:** Must (P0) +- **Referenced Screen / Route:** Goods Receipt workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **Business Rules:** Initial status must be `Under QC`. Lot ID must be permanent and traceable through all sales and dispatches. + +### Statement + +The system must automatically generate a globally unique, immutable Lot ID (`LOT-YYYYMM-xxx`) for every inward consignment processed through a GRN. + +### Acceptance Criteria + +1. The requirement records, computes, or presents the source-defined data attributes: Lot ID, Inward Date, Origin Market, Supplier ID, Commodity, Variety, Receiving Warehouse, Net MT, Bag Count, Quality Status. +2. The system enforces the source-defined validation rules: Initial status must be `Under QC`. Lot ID must be permanent and traceable through all sales and dispatches. diff --git a/04_generated_documentation/03_requirements/use_cases/uc-005-inward-receiving/use-case.md b/04_generated_documentation/03_requirements/use_cases/uc-005-inward-receiving/use-case.md new file mode 100644 index 0000000..0f7b1bb --- /dev/null +++ b/04_generated_documentation/03_requirements/use_cases/uc-005-inward-receiving/use-case.md @@ -0,0 +1,73 @@ +--- +id: UC-005 +version: 1.0.0 +status: Draft +--- + +# UC-005 — Inward Vehicle Receiving and Goods Receipt + +| Field | Value | +|---|---| +| **Use Case ID** | `UC-005` | +| **Name** | Inward Vehicle Receiving and Goods Receipt | +| **Owning Domain** | Goods Receipt | +| **Primary Actor(s)** | Yard Supervisor / Purchase Manager | +| **Supporting Actor(s)** | Yard Supervisor, Purchase Manager, Quality Officer | +| **Source Features** | `BRD-FR-008`, `BRD-FR-009`, `BRD-FR-010`, `BRD-FR-011`, `BRD-FR-012`, `BRD-FR-013` | +| **Status** | Draft | +| **Version** | 1.0.0 | + +## Goal + +Receive a truck against a booked sauda, capture weighment, calculate accepted quantity, post the GRN, and establish the inward lot. + +## Preconditions + +1. The actor is authenticated and has the role and tenant scope required by the source feature(s). +2. Any source records or master data explicitly required by the selected feature are available and in the required state. + +## Trigger + +The actor initiates one of the 6 business operations covered by this use case: inward vehicle gate entry & verification; weighbridge gross & tare weighment logging; bag tare deduction (*bardana katai*) & final net mt; weighment tolerance & transit shortage verification; goods receipt note (grn) posting & warehouse stack placement; mandatory lot & batch identity generation. + +## Main Success Flow + +1. The actor initiates **Inward Vehicle Gate Entry & Verification**. The system performs the source-defined behavior: Upon vehicle arrival at the godown, the Yard Supervisor must log gate entry linking the vehicle registration number and driver details to an active booked sauda. +2. The actor initiates **Weighbridge Gross & Tare Weighment Logging**. The system performs the source-defined behavior: The system must record dual-phase weighbridge measurements for incoming trucks: (1) Gross Weighment (truck + commodity) upon arrival, and (2) Tare Weighment (empty truck) after unloading. +3. The actor initiates **Bag Tare Deduction (*Bardana Katai*) & Final Net MT**. The system performs the source-defined behavior: The system must deduct the weight of packaging bags from the gross commodity weight using the defined tare deduction factor (default 1.0 kg/gunny bag) to calculate true Net Payable MT. +4. The actor initiates **Weighment Tolerance & Transit Shortage Verification**. The system performs the source-defined behavior: The system must compare the Final Net Weighbridge MT against the Booked Sauda MT. If shortage exceeds $0.5\%$, the system must flag a `Transit Shortage Warning` and adjust the final payable amount to the actual net received weight. +5. The actor initiates **Goods Receipt Note (GRN) Posting & Warehouse Stack Placement**. The system performs the source-defined behavior: Upon weighment completion, the system must generate a formal GRN document, allocate the physical goods to a specific warehouse/godown and stack location, credit the warehouse stock book, and mint an inward Commodity Lot. +6. The actor initiates **Mandatory Lot & Batch Identity Generation**. The system performs the source-defined behavior: The system must automatically generate a globally unique, immutable Lot ID (`LOT-YYYYMM-xxx`) for every inward consignment processed through a GRN. + +## Alternate Flows + +- **BRD-FR-009 — Weighbridge Gross & Tare Weighment Logging:** If Tare Weight $\ge$ Gross Weight, system must hard-block submission with an error. + +## Exception Flows + +- **BRD-FR-008:** Reject or prevent the operation when its stated validation rules are not met: Linked sauda must be in state `Booked`. +- **BRD-FR-009:** Reject or prevent the operation when its stated validation rules are not met: $\text{Gross Weight} > \text{Tare Weight} > 0$. Weighbridge slip number mandatory. +- **BRD-FR-010:** Reject or prevent the operation when its stated validation rules are not met: Formula: $\text{Net MT} = (\text{Gross kg} - \text{Tare kg} - (\text{Bags} \times \text{Bag Tare Rate})) / 1000$. Net MT must be $> 0$. +- **BRD-FR-011:** Reject or prevent the operation when its stated validation rules are not met: If shortage exceeds $2.0\%$, the GRN requires mandatory Purchase Manager approval before stock posting. +- **BRD-FR-012:** Reject or prevent the operation when its stated validation rules are not met: GRN submission atomically updates inventory and creates Lot record in state `Under QC`. + +--- +- **BRD-FR-013:** Reject or prevent the operation when its stated validation rules are not met: Initial status must be `Under QC`. Lot ID must be permanent and traceable through all sales and dispatches. + +## Postconditions + +- Successful operations create or update only the business records and outcomes stated in the linked BRD features. +- Rejected operations do not bypass the validations and controls stated by those features. + +## Referenced Screens / Routes + +- Goods Receipt workflow screen(s) — route(s) to be specified during Stage 11 screen design + +## Child Functional Requirements + +- [FR-INWARDRECEIVING-001: Inward Vehicle Gate Entry & Verification](functional-reqs.md#fr-inwardreceiving-001) +- [FR-INWARDRECEIVING-002: Weighbridge Gross & Tare Weighment Logging](functional-reqs.md#fr-inwardreceiving-002) +- [FR-INWARDRECEIVING-003: Bag Tare Deduction (*Bardana Katai*) & Final Net MT](functional-reqs.md#fr-inwardreceiving-003) +- [FR-INWARDRECEIVING-004: Weighment Tolerance & Transit Shortage Verification](functional-reqs.md#fr-inwardreceiving-004) +- [FR-INWARDRECEIVING-005: Goods Receipt Note (GRN) Posting & Warehouse Stack Placement](functional-reqs.md#fr-inwardreceiving-005) +- [FR-INWARDRECEIVING-006: Mandatory Lot & Batch Identity Generation](functional-reqs.md#fr-inwardreceiving-006) diff --git a/04_generated_documentation/03_requirements/use_cases/uc-006-quality-and-lot-control/functional-reqs.md b/04_generated_documentation/03_requirements/use_cases/uc-006-quality-and-lot-control/functional-reqs.md new file mode 100644 index 0000000..636d1dd --- /dev/null +++ b/04_generated_documentation/03_requirements/use_cases/uc-006-quality-and-lot-control/functional-reqs.md @@ -0,0 +1,89 @@ +--- +id: UC-006-FR +version: 1.0.0 +status: Draft +--- + +# Functional Requirements — UC-006 Inward Quality Inspection and Lot Control + +| Field | Value | +|---|---| +| **Parent Use Case** | `UC-006` | +| **Status** | Draft | +| **Version** | 1.0.0 | + +## FR-QUALITYANDLOTCONTROL-001: Inward Quality Inspection Parameter Recording + +- **Requirement ID:** `FR-QUALITYANDLOTCONTROL-001` +- **Parent UC:** `UC-006` +- **Source Feature:** `BRD-FR-014` +- **Priority:** Must (P0) +- **Referenced Screen / Route:** Quality Control workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **Business Rules:** Percentage values must be between $0.00\%$ and $100.00\%$. + +### Statement + +The Quality Officer must log laboratory/physical test parameters for the lot: Moisture %, Foreign Matter / Dust %, Admixture (other grains) %, Damaged / Discolored %, and Weevil count. + +### Acceptance Criteria + +1. The requirement records, computes, or presents the source-defined data attributes: Inspection Date, Quality Officer ID, Moisture %, Foreign Matter %, Admixture %, Damaged %, Weevil Infestation (`None`, `Mild`, `Severe`), Assigned Commercial Grade (`FAQ`, `Premium`, `Below FAQ`). +2. The system enforces the source-defined validation rules: Percentage values must be between $0.00\%$ and $100.00\%$. + +## FR-QUALITYANDLOTCONTROL-002: Quality Deduction / Rebate Calculation + +- **Requirement ID:** `FR-QUALITYANDLOTCONTROL-002` +- **Parent UC:** `UC-006` +- **Source Feature:** `BRD-FR-015` +- **Priority:** Should (P1) +- **Referenced Screen / Route:** Quality Control workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **Business Rules:** Deductions cannot reduce rate below 50% of base rate without partner authorization. + +### Statement + +If moisture or foreign matter exceeds standard contract baselines (e.g., standard moisture baseline 10.0%), the system must automatically compute a quality price deduction (e.g., ₹10 deduction per quintal for each 0.5% moisture above baseline). + +### Acceptance Criteria + +1. The requirement records, computes, or presents the source-defined data attributes: Base Contract Rate ₹/Qtl, Quality Penalty Rate ₹/Qtl, Adjusted Final Rate ₹/Qtl, Net Purchase Adjustment INR. +2. The system enforces the source-defined validation rules: Deductions cannot reduce rate below 50% of base rate without partner authorization. + +## FR-QUALITYANDLOTCONTROL-003: Finite State Machine Enforcement for `QC Hold` vs. `Released` + +- **Requirement ID:** `FR-QUALITYANDLOTCONTROL-003` +- **Parent UC:** `UC-006` +- **Source Feature:** `BRD-FR-016` +- **Priority:** Must (P0) +- **Referenced Screen / Route:** Quality Control workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **Business Rules:** Only users with `Quality Officer` or `Partner` roles can transition a lot from `QC Hold` to `Released`. System must hard-block dispatch of unreleased lots. + +### Statement + +The system must enforce strict FSM transitions on the Lot record. If moisture $>12\%$ or foreign matter $>2\%$, the lot must be transitioned to `QC Hold`. A lot on `QC Hold` is programmatically blocked from sales order allocation and dispatch loading. + +### Acceptance Criteria + +1. The requirement records, computes, or presents the source-defined data attributes: Previous Status, New Status (`QC Hold`, `Released`), Hold Reason, Action Plan (`Drying`, `Cleaning`, `Re-testing`), Release Timestamp. +2. The system enforces the source-defined validation rules: Only users with `Quality Officer` or `Partner` roles can transition a lot from `QC Hold` to `Released`. System must hard-block dispatch of unreleased lots. + +## FR-QUALITYANDLOTCONTROL-004: Lot Splitting & Blending Traceability + +- **Requirement ID:** `FR-QUALITYANDLOTCONTROL-004` +- **Parent UC:** `UC-006` +- **Source Feature:** `BRD-FR-017` +- **Priority:** Should (P1) +- **Referenced Screen / Route:** Quality Control workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **Business Rules:** Sum of child lot quantities must exactly equal parent quantity deducted. + +--- + +### Statement + +The system must support splitting a parent lot into sub-lots (e.g., when dividing a consignment across two warehouses) or blending multiple lots, maintaining parent-child lineage in the traceability graph. + +### Acceptance Criteria + +1. The requirement records, computes, or presents the source-defined data attributes: Parent Lot ID, Child Lot ID(s), Split Qty MT, Split Bag Count, Linage Tree. +2. The system enforces the source-defined validation rules: Sum of child lot quantities must exactly equal parent quantity deducted. + +--- diff --git a/04_generated_documentation/03_requirements/use_cases/uc-006-quality-and-lot-control/use-case.md b/04_generated_documentation/03_requirements/use_cases/uc-006-quality-and-lot-control/use-case.md new file mode 100644 index 0000000..5b030c9 --- /dev/null +++ b/04_generated_documentation/03_requirements/use_cases/uc-006-quality-and-lot-control/use-case.md @@ -0,0 +1,67 @@ +--- +id: UC-006 +version: 1.0.0 +status: Draft +--- + +# UC-006 — Inward Quality Inspection and Lot Control + +| Field | Value | +|---|---| +| **Use Case ID** | `UC-006` | +| **Name** | Inward Quality Inspection and Lot Control | +| **Owning Domain** | Quality Control | +| **Primary Actor(s)** | Quality Officer / Yard Supervisor / Accounts Executive | +| **Supporting Actor(s)** | Quality Officer, Accounts Executive, Yard Supervisor | +| **Source Features** | `BRD-FR-014`, `BRD-FR-015`, `BRD-FR-016`, `BRD-FR-017` | +| **Status** | Draft | +| **Version** | 1.0.0 | + +## Goal + +Inspect an inward lot, apply contract quality treatment, control its release state, and retain lot lineage through approved splitting or blending. + +## Preconditions + +1. The actor is authenticated and has the role and tenant scope required by the source feature(s). +2. Any source records or master data explicitly required by the selected feature are available and in the required state. + +## Trigger + +The actor initiates one of the 4 business operations covered by this use case: inward quality inspection parameter recording; quality deduction / rebate calculation; finite state machine enforcement for `qc hold` vs. `released`; lot splitting & blending traceability. + +## Main Success Flow + +1. The actor initiates **Inward Quality Inspection Parameter Recording**. The system performs the source-defined behavior: The Quality Officer must log laboratory/physical test parameters for the lot: Moisture %, Foreign Matter / Dust %, Admixture (other grains) %, Damaged / Discolored %, and Weevil count. +2. The actor initiates **Quality Deduction / Rebate Calculation**. The system performs the source-defined behavior: If moisture or foreign matter exceeds standard contract baselines (e.g., standard moisture baseline 10.0%), the system must automatically compute a quality price deduction (e.g., ₹10 deduction per quintal for each 0.5% moisture above baseline). +3. The actor initiates **Finite State Machine Enforcement for `QC Hold` vs. `Released`**. The system performs the source-defined behavior: The system must enforce strict FSM transitions on the Lot record. If moisture $>12\%$ or foreign matter $>2\%$, the lot must be transitioned to `QC Hold`. A lot on `QC Hold` is programmatically blocked from sales order allocation and dispatch loading. +4. The actor initiates **Lot Splitting & Blending Traceability**. The system performs the source-defined behavior: The system must support splitting a parent lot into sub-lots (e.g., when dividing a consignment across two warehouses) or blending multiple lots, maintaining parent-child lineage in the traceability graph. + +## Alternate Flows + +- No alternate business flow is specified by the source features. + +## Exception Flows + +- **BRD-FR-014:** Reject or prevent the operation when its stated validation rules are not met: Percentage values must be between $0.00\%$ and $100.00\%$. +- **BRD-FR-015:** Reject or prevent the operation when its stated validation rules are not met: Deductions cannot reduce rate below 50% of base rate without partner authorization. +- **BRD-FR-016:** Reject or prevent the operation when its stated validation rules are not met: Only users with `Quality Officer` or `Partner` roles can transition a lot from `QC Hold` to `Released`. System must hard-block dispatch of unreleased lots. +- **BRD-FR-017:** Reject or prevent the operation when its stated validation rules are not met: Sum of child lot quantities must exactly equal parent quantity deducted. + +--- + +## Postconditions + +- Successful operations create or update only the business records and outcomes stated in the linked BRD features. +- Rejected operations do not bypass the validations and controls stated by those features. + +## Referenced Screens / Routes + +- Quality Control workflow screen(s) — route(s) to be specified during Stage 11 screen design + +## Child Functional Requirements + +- [FR-QUALITYANDLOTCONTROL-001: Inward Quality Inspection Parameter Recording](functional-reqs.md#fr-qualityandlotcontrol-001) +- [FR-QUALITYANDLOTCONTROL-002: Quality Deduction / Rebate Calculation](functional-reqs.md#fr-qualityandlotcontrol-002) +- [FR-QUALITYANDLOTCONTROL-003: Finite State Machine Enforcement for `QC Hold` vs. `Released`](functional-reqs.md#fr-qualityandlotcontrol-003) +- [FR-QUALITYANDLOTCONTROL-004: Lot Splitting & Blending Traceability](functional-reqs.md#fr-qualityandlotcontrol-004) diff --git a/04_generated_documentation/03_requirements/use_cases/uc-007-warehouse-inventory/functional-reqs.md b/04_generated_documentation/03_requirements/use_cases/uc-007-warehouse-inventory/functional-reqs.md new file mode 100644 index 0000000..a1729a3 --- /dev/null +++ b/04_generated_documentation/03_requirements/use_cases/uc-007-warehouse-inventory/functional-reqs.md @@ -0,0 +1,72 @@ +--- +id: UC-007-FR +version: 1.0.0 +status: Draft +--- + +# Functional Requirements — UC-007 Warehouse Stock, Audit, Capacity and Transfer + +| Field | Value | +|---|---| +| **Parent Use Case** | `UC-007` | +| **Status** | Draft | +| **Version** | 1.0.0 | + +## FR-WAREHOUSEINVENTORY-001: Multi-Godown Dual-Unit Stock Ledger + +- **Requirement ID:** `FR-WAREHOUSEINVENTORY-001` +- **Parent UC:** `UC-007` +- **Source Feature:** `BRD-FR-018` +- **Priority:** Must (P0) +- **Referenced Screen / Route:** Inventory workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **Business Rules:** Closing stock MT and bags must never be negative ($\ge 0$). Adjustments exceeding $\pm 1.0\%$ of godown balance require mandatory Partner electronic sign-off. + +### Statement + +The system must maintain a real-time, double-entry stock ledger tracking commodity positions across warehouses (WH-01 Neemuch Main Yard, WH-02 Neemuch North Godown, WH-03 Mandsaur Transit Godown, WH-04 Indore Buffer Depot). For each commodity, variety, and grade, it must maintain Opening Stock MT, Received MT, Dispatched MT, Closing Stock MT, and physical Bag counts. The system must support Periodic Physical Stock Audits: recording physical tally counts against book balances and generating supervisor-authorized Stock Adjustment Vouchers capturing natural storage loss/gain (*ghat / nami* due to moisture evaporation or seasonal humidity) or handling spillage with mandatory reason codes. + +### Acceptance Criteria + +1. The requirement records, computes, or presents the source-defined data attributes: Stock Entry ID, Date, Warehouse ID, Commodity, Variety, Grade, Opening MT, Inward MT, Outward MT, Closing MT, Bag Delta, Closing Bags, Physical Count MT, Adjustment Variance MT, Variance Reason Code (`Moisture Loss / Ghat`, `Handling Spillage`, `Bag Burst`, `Seasonal Humidity Gain`). +2. The system enforces the source-defined validation rules: Closing stock MT and bags must never be negative ($\ge 0$). Adjustments exceeding $\pm 1.0\%$ of godown balance require mandatory Partner electronic sign-off. + +## FR-WAREHOUSEINVENTORY-002: Godown Capacity & Volume Utilization Tracking + +- **Requirement ID:** `FR-WAREHOUSEINVENTORY-002` +- **Parent UC:** `UC-007` +- **Source Feature:** `BRD-FR-019` +- **Priority:** Must (P0) +- **Referenced Screen / Route:** Inventory workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **Business Rules:** Warning status triggered when Utilisation exceeds 85%. + +### Statement + +The system must track the physical storage capacity of each warehouse in Metric Tonnes and calculate real-time percentage utilization: + $$\text{Utilisation \%} = \frac{\text{Current Closing Stock (MT)}}{\text{Storage Capacity (MT)}} \times 100$$ + +### Acceptance Criteria + +1. The requirement records, computes, or presents the source-defined data attributes: Warehouse ID, Name, City, Capacity MT, Current Stock MT, Utilisation \%. +2. The system enforces the source-defined validation rules: Warning status triggered when Utilisation exceeds 85%. + +## FR-WAREHOUSEINVENTORY-003: Godown-to-Godown Internal Stock Transfer + +- **Requirement ID:** `FR-WAREHOUSEINVENTORY-003` +- **Parent UC:** `UC-007` +- **Source Feature:** `BRD-FR-020` +- **Priority:** Must (P0) +- **Referenced Screen / Route:** Inventory workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **Business Rules:** Outward and inward entries must reconcile within $\pm 0.2\%$ transfer tolerance. + +--- + +### Statement + +The system must support recording stock transfers between godowns (e.g., from Mandsaur Transit Godown to Neemuch Main Yard), logging origin outward deduction, in-transit state, destination weighment, and destination inward credit. + +### Acceptance Criteria + +1. The requirement records, computes, or presents the source-defined data attributes: Transfer ID, Origin Warehouse, Destination Warehouse, Commodity, Lot ID, Transfer Qty MT, Transfer Bags, Vehicle Reg No, Transit Status. +2. The system enforces the source-defined validation rules: Outward and inward entries must reconcile within $\pm 0.2\%$ transfer tolerance. + +--- diff --git a/04_generated_documentation/03_requirements/use_cases/uc-007-warehouse-inventory/use-case.md b/04_generated_documentation/03_requirements/use_cases/uc-007-warehouse-inventory/use-case.md new file mode 100644 index 0000000..b7ce297 --- /dev/null +++ b/04_generated_documentation/03_requirements/use_cases/uc-007-warehouse-inventory/use-case.md @@ -0,0 +1,65 @@ +--- +id: UC-007 +version: 1.0.0 +status: Draft +--- + +# UC-007 — Warehouse Stock, Audit, Capacity and Transfer + +| Field | Value | +|---|---| +| **Use Case ID** | `UC-007` | +| **Name** | Warehouse Stock, Audit, Capacity and Transfer | +| **Owning Domain** | Inventory | +| **Primary Actor(s)** | Yard Supervisor / Logistics Coordinator / Partner | +| **Supporting Actor(s)** | Yard Supervisor, Management, Partner, Logistics Coordinator | +| **Source Features** | `BRD-FR-018`, `BRD-FR-019`, `BRD-FR-020` | +| **Status** | Draft | +| **Version** | 1.0.0 | + +## Goal + +Maintain warehouse stock positions, reconcile physical counts, monitor capacity, and record inter-godown transfers. + +## Preconditions + +1. The actor is authenticated and has the role and tenant scope required by the source feature(s). +2. Any source records or master data explicitly required by the selected feature are available and in the required state. + +## Trigger + +The actor initiates one of the 3 business operations covered by this use case: multi-godown dual-unit stock ledger; godown capacity & volume utilization tracking; godown-to-godown internal stock transfer. + +## Main Success Flow + +1. The actor initiates **Multi-Godown Dual-Unit Stock Ledger**. The system performs the source-defined behavior: The system must maintain a real-time, double-entry stock ledger tracking commodity positions across warehouses (WH-01 Neemuch Main Yard, WH-02 Neemuch North Godown, WH-03 Mandsaur Transit Godown, WH-04 Indore Buffer Depot). For each commodity, variety, and grade, it must maintain Opening Stock MT, Received MT, Dispatched MT, Closing Stock MT, and physical Bag counts. The system must support Periodic Physical Stock Audits: recording physical tally counts against book balances and generating supervisor-authorized Stock Adjustment Vouchers capturing natural storage loss/gain (*ghat / nami* due to moisture evaporation or seasonal humidity) or handling spillage with mandatory reason codes. +2. The actor initiates **Godown Capacity & Volume Utilization Tracking**. The system performs the source-defined behavior: The system must track the physical storage capacity of each warehouse in Metric Tonnes and calculate real-time percentage utilization: + $$\text{Utilisation \%} = \frac{\text{Current Closing Stock (MT)}}{\text{Storage Capacity (MT)}} \times 100$$ +3. The actor initiates **Godown-to-Godown Internal Stock Transfer**. The system performs the source-defined behavior: The system must support recording stock transfers between godowns (e.g., from Mandsaur Transit Godown to Neemuch Main Yard), logging origin outward deduction, in-transit state, destination weighment, and destination inward credit. + +## Alternate Flows + +- No alternate business flow is specified by the source features. + +## Exception Flows + +- **BRD-FR-018:** Reject or prevent the operation when its stated validation rules are not met: Closing stock MT and bags must never be negative ($\ge 0$). Adjustments exceeding $\pm 1.0\%$ of godown balance require mandatory Partner electronic sign-off. +- **BRD-FR-019:** Reject or prevent the operation when its stated validation rules are not met: Warning status triggered when Utilisation exceeds 85%. +- **BRD-FR-020:** Reject or prevent the operation when its stated validation rules are not met: Outward and inward entries must reconcile within $\pm 0.2\%$ transfer tolerance. + +--- + +## Postconditions + +- Successful operations create or update only the business records and outcomes stated in the linked BRD features. +- Rejected operations do not bypass the validations and controls stated by those features. + +## Referenced Screens / Routes + +- Inventory workflow screen(s) — route(s) to be specified during Stage 11 screen design + +## Child Functional Requirements + +- [FR-WAREHOUSEINVENTORY-001: Multi-Godown Dual-Unit Stock Ledger](functional-reqs.md#fr-warehouseinventory-001) +- [FR-WAREHOUSEINVENTORY-002: Godown Capacity & Volume Utilization Tracking](functional-reqs.md#fr-warehouseinventory-002) +- [FR-WAREHOUSEINVENTORY-003: Godown-to-Godown Internal Stock Transfer](functional-reqs.md#fr-warehouseinventory-003) diff --git a/04_generated_documentation/03_requirements/use_cases/uc-008-sales-contracts/functional-reqs.md b/04_generated_documentation/03_requirements/use_cases/uc-008-sales-contracts/functional-reqs.md new file mode 100644 index 0000000..0d4b5ca --- /dev/null +++ b/04_generated_documentation/03_requirements/use_cases/uc-008-sales-contracts/functional-reqs.md @@ -0,0 +1,71 @@ +--- +id: UC-008-FR +version: 1.0.0 +status: Draft +--- + +# Functional Requirements — UC-008 Customer Sales Contract, Credit Check and Allocation + +| Field | Value | +|---|---| +| **Parent Use Case** | `UC-008` | +| **Status** | Draft | +| **Version** | 1.0.0 | + +## FR-SALESCONTRACTS-001: Customer Sales Contract Booking + +- **Requirement ID:** `FR-SALESCONTRACTS-001` +- **Parent UC:** `UC-008` +- **Source Feature:** `BRD-FR-021` +- **Priority:** Must (P0) +- **Referenced Screen / Route:** Sales workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **Business Rules:** Total Sales Value must equal $\text{Contract Qty MT} \times 10 \times \text{Rate ₹/Qtl}$. + +### Statement + +The system must record customer sales orders/contracts specifying customer code, destination city, customer segment (`Wholesale`, `Processor`, `Institutional`, `Distributor`), commodity, variety, grade, contracted quantity in MT, contract rate in ₹/Qtl, and delivery timeline. + +### Acceptance Criteria + +1. The requirement records, computes, or presents the source-defined data attributes: Sales Order ID (`SAL-YYYYMM-xxx`), Order Date, Customer ID, Destination City, Commodity, Variety, Grade, Contract Qty MT, Contract Rate ₹/Qtl, Total Sales Value INR, Payment Terms, Status. +2. The system enforces the source-defined validation rules: Total Sales Value must equal $\text{Contract Qty MT} \times 10 \times \text{Rate ₹/Qtl}$. + +## FR-SALESCONTRACTS-002: Customer Credit Limit & Pre-Order Exposure Verification + +- **Requirement ID:** `FR-SALESCONTRACTS-002` +- **Parent UC:** `UC-008` +- **Source Feature:** `BRD-FR-022` +- **Priority:** Must (P0) +- **Referenced Screen / Route:** Sales workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **Business Rules:** If Projected Exposure Ratio $>80\%$, display inline warning. If Projected Exposure Ratio $>100\%$, system must prevent order confirmation unless authorized by Partner. + +### Statement + +Prior to confirming a sales order, the system must evaluate the customer's current outstanding receivables plus the value of the new order against their sanctioned credit limit. + +### Acceptance Criteria + +1. The requirement records, computes, or presents the source-defined data attributes: Sanctioned Credit Limit INR, Current Outstanding INR, New Order Value INR, Projected Exposure INR, Projected Exposure Ratio \%. +2. The system enforces the source-defined validation rules: If Projected Exposure Ratio $>80\%$, display inline warning. If Projected Exposure Ratio $>100\%$, system must prevent order confirmation unless authorized by Partner. + +## FR-SALESCONTRACTS-003: Sales Order Inventory Allocation + +- **Requirement ID:** `FR-SALESCONTRACTS-003` +- **Parent UC:** `UC-008` +- **Source Feature:** `BRD-FR-023` +- **Priority:** Must (P0) +- **Referenced Screen / Route:** Sales workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **Business Rules:** Allocation fails if Lot status is `QC Hold` or `Under QC`, or if available lot unreserved MT $<$ allocated MT. + +--- + +### Statement + +The Sales Manager must allocate specific available inventory lot(s) from a warehouse to a confirmed sales order. The system must verify that selected lots are in `Released` state and have sufficient unreserved balance. + +### Acceptance Criteria + +1. The requirement records, computes, or presents the source-defined data attributes: Sales Order ID, Allocated Lot ID, Allocated Qty MT, Allocated Bags, Warehouse ID. +2. The system enforces the source-defined validation rules: Allocation fails if Lot status is `QC Hold` or `Under QC`, or if available lot unreserved MT $<$ allocated MT. + +--- diff --git a/04_generated_documentation/03_requirements/use_cases/uc-008-sales-contracts/use-case.md b/04_generated_documentation/03_requirements/use_cases/uc-008-sales-contracts/use-case.md new file mode 100644 index 0000000..5c1a556 --- /dev/null +++ b/04_generated_documentation/03_requirements/use_cases/uc-008-sales-contracts/use-case.md @@ -0,0 +1,64 @@ +--- +id: UC-008 +version: 1.0.0 +status: Draft +--- + +# UC-008 — Customer Sales Contract, Credit Check and Allocation + +| Field | Value | +|---|---| +| **Use Case ID** | `UC-008` | +| **Name** | Customer Sales Contract, Credit Check and Allocation | +| **Owning Domain** | Sales | +| **Primary Actor(s)** | Sales Manager / Sales Executive / Accounts Executive / Yard Supervisor | +| **Supporting Actor(s)** | Sales Manager, Sales Executive, Accounts Executive, Yard Supervisor | +| **Source Features** | `BRD-FR-021`, `BRD-FR-022`, `BRD-FR-023` | +| **Status** | Draft | +| **Version** | 1.0.0 | + +## Goal + +Record a customer sales contract, evaluate exposure before confirmation, and allocate eligible available lots. + +## Preconditions + +1. The actor is authenticated and has the role and tenant scope required by the source feature(s). +2. Any source records or master data explicitly required by the selected feature are available and in the required state. + +## Trigger + +The actor initiates one of the 3 business operations covered by this use case: customer sales contract booking; customer credit limit & pre-order exposure verification; sales order inventory allocation. + +## Main Success Flow + +1. The actor initiates **Customer Sales Contract Booking**. The system performs the source-defined behavior: The system must record customer sales orders/contracts specifying customer code, destination city, customer segment (`Wholesale`, `Processor`, `Institutional`, `Distributor`), commodity, variety, grade, contracted quantity in MT, contract rate in ₹/Qtl, and delivery timeline. +2. The actor initiates **Customer Credit Limit & Pre-Order Exposure Verification**. The system performs the source-defined behavior: Prior to confirming a sales order, the system must evaluate the customer's current outstanding receivables plus the value of the new order against their sanctioned credit limit. +3. The actor initiates **Sales Order Inventory Allocation**. The system performs the source-defined behavior: The Sales Manager must allocate specific available inventory lot(s) from a warehouse to a confirmed sales order. The system must verify that selected lots are in `Released` state and have sufficient unreserved balance. + +## Alternate Flows + +- No alternate business flow is specified by the source features. + +## Exception Flows + +- **BRD-FR-021:** Reject or prevent the operation when its stated validation rules are not met: Total Sales Value must equal $\text{Contract Qty MT} \times 10 \times \text{Rate ₹/Qtl}$. +- **BRD-FR-022:** Reject or prevent the operation when its stated validation rules are not met: If Projected Exposure Ratio $>80\%$, display inline warning. If Projected Exposure Ratio $>100\%$, system must prevent order confirmation unless authorized by Partner. +- **BRD-FR-023:** Reject or prevent the operation when its stated validation rules are not met: Allocation fails if Lot status is `QC Hold` or `Under QC`, or if available lot unreserved MT $<$ allocated MT. + +--- + +## Postconditions + +- Successful operations create or update only the business records and outcomes stated in the linked BRD features. +- Rejected operations do not bypass the validations and controls stated by those features. + +## Referenced Screens / Routes + +- Sales workflow screen(s) — route(s) to be specified during Stage 11 screen design + +## Child Functional Requirements + +- [FR-SALESCONTRACTS-001: Customer Sales Contract Booking](functional-reqs.md#fr-salescontracts-001) +- [FR-SALESCONTRACTS-002: Customer Credit Limit & Pre-Order Exposure Verification](functional-reqs.md#fr-salescontracts-002) +- [FR-SALESCONTRACTS-003: Sales Order Inventory Allocation](functional-reqs.md#fr-salescontracts-003) diff --git a/04_generated_documentation/03_requirements/use_cases/uc-009-dispatch-delivery/functional-reqs.md b/04_generated_documentation/03_requirements/use_cases/uc-009-dispatch-delivery/functional-reqs.md new file mode 100644 index 0000000..6cf5986 --- /dev/null +++ b/04_generated_documentation/03_requirements/use_cases/uc-009-dispatch-delivery/functional-reqs.md @@ -0,0 +1,71 @@ +--- +id: UC-009-FR +version: 1.0.0 +status: Draft +--- + +# Functional Requirements — UC-009 Outbound Dispatch and Delivery + +| Field | Value | +|---|---| +| **Parent Use Case** | `UC-009` | +| **Status** | Draft | +| **Version** | 1.0.0 | + +## FR-DISPATCHDELIVERY-001: Outbound Dispatch Board Console + +- **Requirement ID:** `FR-DISPATCHDELIVERY-001` +- **Parent UC:** `UC-009` +- **Source Feature:** `BRD-FR-024` +- **Priority:** Must (P0) +- **Referenced Screen / Route:** Logistics workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **Business Rules:** Dispatch cannot be created without an approved sales order and assigned vehicle. + +### Statement + +The system must provide a visual dispatch management board displaying scheduled, loading, and in-transit consignments, matching confirmed sales orders to allocated warehouse lots and transport vehicles. + +### Acceptance Criteria + +1. The requirement records, computes, or presents the source-defined data attributes: Dispatch ID (`DISP-YYYYMM-xxx`), Dispatch Date, Linked Sales Order ID, Customer Name, Destination City, Commodity, Dispatch Qty MT, Assigned Vehicle Reg No, Driver Details, Status (`Scheduled`, `Loading`, `In Transit`, `Delivered`). +2. The system enforces the source-defined validation rules: Dispatch cannot be created without an approved sales order and assigned vehicle. + +## FR-DISPATCHDELIVERY-002: Outbound Weighbridge & Dispatch Bilty/Manifest + +- **Requirement ID:** `FR-DISPATCHDELIVERY-002` +- **Parent UC:** `UC-009` +- **Source Feature:** `BRD-FR-025` +- **Priority:** Must (P0) +- **Referenced Screen / Route:** Logistics workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **Business Rules:** Net loaded MT must match allocated order MT within $\pm 1.0\%$ loading tolerance. + +### Statement + +The system must capture outward weighbridge weights for loaded dispatch trucks (Tare truck before loading, Gross truck after loading), verify loaded weight against order MT, and generate a printable transport manifest / Bilty. + +### Acceptance Criteria + +1. The requirement records, computes, or presents the source-defined data attributes: Dispatch ID, Outward Tare kg, Outward Gross kg, Net Loaded MT, Loaded Bag Count, Transporter Bilty No, e-Way Bill No. +2. The system enforces the source-defined validation rules: Net loaded MT must match allocated order MT within $\pm 1.0\%$ loading tolerance. + +## FR-DISPATCHDELIVERY-003: In-Transit Tracking & Proof of Delivery (POD) + +- **Requirement ID:** `FR-DISPATCHDELIVERY-003` +- **Parent UC:** `UC-009` +- **Source Feature:** `BRD-FR-026` +- **Priority:** Must (P0) +- **Referenced Screen / Route:** Logistics workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **Business Rules:** Setting status to `Delivered` triggers automatic generation of finalized Sales Invoice. Consignee shortage deductions exceeding 2.0% require mandatory Sales Manager approval before issuing Credit Note. + +--- + +### Statement + +The system must track dispatch states from `In Transit` to `Delivered`. Upon consignee receipt, the Logistics Coordinator logs confirmation date, destination weighment, and uploads POD document reference. If destination weighment or quality parameters reveal a transit shortage or damage acknowledged by the buyer, the system must allow recording a Consignee Shortage Note and automatically generating a compensating Sales Credit Note against the customer ledger without altering the immutable outbound dispatch manifest. + +### Acceptance Criteria + +1. The requirement records, computes, or presents the source-defined data attributes: Transit Status, Departure Date/Time, Expected Delivery Date, Actual Delivery Date, Destination Weighbridge Net MT, Transit Loss MT, Consignee Acknowledgement Note, POD Ref, Credit Note ID (if applicable). +2. The system enforces the source-defined validation rules: Setting status to `Delivered` triggers automatic generation of finalized Sales Invoice. Consignee shortage deductions exceeding 2.0% require mandatory Sales Manager approval before issuing Credit Note. + +--- diff --git a/04_generated_documentation/03_requirements/use_cases/uc-009-dispatch-delivery/use-case.md b/04_generated_documentation/03_requirements/use_cases/uc-009-dispatch-delivery/use-case.md new file mode 100644 index 0000000..a703234 --- /dev/null +++ b/04_generated_documentation/03_requirements/use_cases/uc-009-dispatch-delivery/use-case.md @@ -0,0 +1,64 @@ +--- +id: UC-009 +version: 1.0.0 +status: Draft +--- + +# UC-009 — Outbound Dispatch and Delivery + +| Field | Value | +|---|---| +| **Use Case ID** | `UC-009` | +| **Name** | Outbound Dispatch and Delivery | +| **Owning Domain** | Logistics | +| **Primary Actor(s)** | Logistics Coordinator / Yard Supervisor | +| **Supporting Actor(s)** | Logistics Coordinator, Yard Supervisor | +| **Source Features** | `BRD-FR-024`, `BRD-FR-025`, `BRD-FR-026` | +| **Status** | Draft | +| **Version** | 1.0.0 | + +## Goal + +Schedule an approved sales order for dispatch, record outward weighment and transport documents, and complete delivery with consignee evidence. + +## Preconditions + +1. The actor is authenticated and has the role and tenant scope required by the source feature(s). +2. Any source records or master data explicitly required by the selected feature are available and in the required state. + +## Trigger + +The actor initiates one of the 3 business operations covered by this use case: outbound dispatch board console; outbound weighbridge & dispatch bilty/manifest; in-transit tracking & proof of delivery (pod). + +## Main Success Flow + +1. The actor initiates **Outbound Dispatch Board Console**. The system performs the source-defined behavior: The system must provide a visual dispatch management board displaying scheduled, loading, and in-transit consignments, matching confirmed sales orders to allocated warehouse lots and transport vehicles. +2. The actor initiates **Outbound Weighbridge & Dispatch Bilty/Manifest**. The system performs the source-defined behavior: The system must capture outward weighbridge weights for loaded dispatch trucks (Tare truck before loading, Gross truck after loading), verify loaded weight against order MT, and generate a printable transport manifest / Bilty. +3. The actor initiates **In-Transit Tracking & Proof of Delivery (POD)**. The system performs the source-defined behavior: The system must track dispatch states from `In Transit` to `Delivered`. Upon consignee receipt, the Logistics Coordinator logs confirmation date, destination weighment, and uploads POD document reference. If destination weighment or quality parameters reveal a transit shortage or damage acknowledged by the buyer, the system must allow recording a Consignee Shortage Note and automatically generating a compensating Sales Credit Note against the customer ledger without altering the immutable outbound dispatch manifest. + +## Alternate Flows + +- No alternate business flow is specified by the source features. + +## Exception Flows + +- **BRD-FR-024:** Reject or prevent the operation when its stated validation rules are not met: Dispatch cannot be created without an approved sales order and assigned vehicle. +- **BRD-FR-025:** Reject or prevent the operation when its stated validation rules are not met: Net loaded MT must match allocated order MT within $\pm 1.0\%$ loading tolerance. +- **BRD-FR-026:** Reject or prevent the operation when its stated validation rules are not met: Setting status to `Delivered` triggers automatic generation of finalized Sales Invoice. Consignee shortage deductions exceeding 2.0% require mandatory Sales Manager approval before issuing Credit Note. + +--- + +## Postconditions + +- Successful operations create or update only the business records and outcomes stated in the linked BRD features. +- Rejected operations do not bypass the validations and controls stated by those features. + +## Referenced Screens / Routes + +- Logistics workflow screen(s) — route(s) to be specified during Stage 11 screen design + +## Child Functional Requirements + +- [FR-DISPATCHDELIVERY-001: Outbound Dispatch Board Console](functional-reqs.md#fr-dispatchdelivery-001) +- [FR-DISPATCHDELIVERY-002: Outbound Weighbridge & Dispatch Bilty/Manifest](functional-reqs.md#fr-dispatchdelivery-002) +- [FR-DISPATCHDELIVERY-003: In-Transit Tracking & Proof of Delivery (POD)](functional-reqs.md#fr-dispatchdelivery-003) diff --git a/04_generated_documentation/03_requirements/use_cases/uc-010-fleet-registry/functional-reqs.md b/04_generated_documentation/03_requirements/use_cases/uc-010-fleet-registry/functional-reqs.md new file mode 100644 index 0000000..a02fc51 --- /dev/null +++ b/04_generated_documentation/03_requirements/use_cases/uc-010-fleet-registry/functional-reqs.md @@ -0,0 +1,35 @@ +--- +id: UC-010-FR +version: 1.0.0 +status: Draft +--- + +# Functional Requirements — UC-010 Transport Fleet Registry + +| Field | Value | +|---|---| +| **Parent Use Case** | `UC-010` | +| **Status** | Draft | +| **Version** | 1.0.0 | + +## FR-FLEETREGISTRY-001: Transport Fleet Registry + +- **Requirement ID:** `FR-FLEETREGISTRY-001` +- **Parent UC:** `UC-010` +- **Source Feature:** `BRD-FR-027` +- **Priority:** Should (P1) +- **Referenced Screen / Route:** Logistics & Fleet workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **Business Rules:** Vehicles with status `Maintenance` cannot be assigned to dispatches. + +--- + +### Statement + +The system must maintain a registry of transport trucks (owned and contract carriers) including registration number, vehicle model, gross payload capacity in MT, ownership type (`Own` vs `Contract`), insurance/fitness expiry dates, and operational status (`Available`, `On Route`, `Maintenance`). + +### Acceptance Criteria + +1. The requirement records, computes, or presents the source-defined data attributes: Vehicle Reg No, Make/Model, Payload Capacity MT, Ownership Type, Transporter Name, Status, Fitness Expiry Date. +2. The system enforces the source-defined validation rules: Vehicles with status `Maintenance` cannot be assigned to dispatches. + +--- diff --git a/04_generated_documentation/03_requirements/use_cases/uc-010-fleet-registry/use-case.md b/04_generated_documentation/03_requirements/use_cases/uc-010-fleet-registry/use-case.md new file mode 100644 index 0000000..9dee5b8 --- /dev/null +++ b/04_generated_documentation/03_requirements/use_cases/uc-010-fleet-registry/use-case.md @@ -0,0 +1,58 @@ +--- +id: UC-010 +version: 1.0.0 +status: Draft +--- + +# UC-010 — Transport Fleet Registry + +| Field | Value | +|---|---| +| **Use Case ID** | `UC-010` | +| **Name** | Transport Fleet Registry | +| **Owning Domain** | Logistics & Fleet | +| **Primary Actor(s)** | Logistics Coordinator | +| **Supporting Actor(s)** | None stated | +| **Source Features** | `BRD-FR-027` | +| **Status** | Draft | +| **Version** | 1.0.0 | + +## Goal + +Maintain the fleet records required to assign transport vehicles to dispatches. + +## Preconditions + +1. The actor is authenticated and has the role and tenant scope required by the source feature(s). +2. Any source records or master data explicitly required by the selected feature are available and in the required state. + +## Trigger + +The actor initiates one of the 1 business operations covered by this use case: transport fleet registry. + +## Main Success Flow + +1. The actor initiates **Transport Fleet Registry**. The system performs the source-defined behavior: The system must maintain a registry of transport trucks (owned and contract carriers) including registration number, vehicle model, gross payload capacity in MT, ownership type (`Own` vs `Contract`), insurance/fitness expiry dates, and operational status (`Available`, `On Route`, `Maintenance`). + +## Alternate Flows + +- No alternate business flow is specified by the source features. + +## Exception Flows + +- **BRD-FR-027:** Reject or prevent the operation when its stated validation rules are not met: Vehicles with status `Maintenance` cannot be assigned to dispatches. + +--- + +## Postconditions + +- Successful operations create or update only the business records and outcomes stated in the linked BRD features. +- Rejected operations do not bypass the validations and controls stated by those features. + +## Referenced Screens / Routes + +- Logistics & Fleet workflow screen(s) — route(s) to be specified during Stage 11 screen design + +## Child Functional Requirements + +- [FR-FLEETREGISTRY-001: Transport Fleet Registry](functional-reqs.md#fr-fleetregistry-001) diff --git a/04_generated_documentation/03_requirements/use_cases/uc-011-customer-receivables/functional-reqs.md b/04_generated_documentation/03_requirements/use_cases/uc-011-customer-receivables/functional-reqs.md new file mode 100644 index 0000000..98b7d63 --- /dev/null +++ b/04_generated_documentation/03_requirements/use_cases/uc-011-customer-receivables/functional-reqs.md @@ -0,0 +1,89 @@ +--- +id: UC-011-FR +version: 1.0.0 +status: Draft +--- + +# Functional Requirements — UC-011 Customer Receivables and Credit Controls + +| Field | Value | +|---|---| +| **Parent Use Case** | `UC-011` | +| **Status** | Draft | +| **Version** | 1.0.0 | + +## FR-CUSTOMERRECEIVABLES-001: Customer Ledger & Aging Statement + +- **Requirement ID:** `FR-CUSTOMERRECEIVABLES-001` +- **Parent UC:** `UC-011` +- **Source Feature:** `BRD-FR-028` +- **Priority:** Must (P0) +- **Referenced Screen / Route:** Finance workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **Business Rules:** Sub-ledger entries are immutable; corrections require credit/debit adjustment vouchers. + +### Statement + +The system must maintain an immutable party sub-ledger for each customer, debiting finalized sales invoices, crediting payment receipts, and presenting a real-time outstanding balance and aging schedule (0–7 days, 8–15 days, 16–30 days, >30 days). + +### Acceptance Criteria + +1. The requirement records, computes, or presents the source-defined data attributes: Customer ID, Posting Date, Voucher Type (`Sales Invoice`, `Payment Receipt`), Voucher No, Debit Amount INR, Credit Amount INR, Running Outstanding INR. +2. The system enforces the source-defined validation rules: Sub-ledger entries are immutable; corrections require credit/debit adjustment vouchers. + +## FR-CUSTOMERRECEIVABLES-002: Automated Customer Credit Exposure Watch & Threshold Alert + +- **Requirement ID:** `FR-CUSTOMERRECEIVABLES-002` +- **Parent UC:** `UC-011` +- **Source Feature:** `BRD-FR-029` +- **Priority:** Must (P0) +- **Referenced Screen / Route:** Finance workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **Business Rules:** Evaluated in real time upon every sales invoice post and payment receipt post. + +### Statement + +The system must continuously recompute the customer exposure ratio ($\text{Outstanding} / \text{Credit Limit}$). If exposure $>80\%$, the account must be automatically tagged with a visual `Watch` badge, and an operational warning alert generated on the Executive Dashboard. + +### Acceptance Criteria + +1. The requirement records, computes, or presents the source-defined data attributes: Customer Code, Customer Name, Sanctioned Credit Limit INR, Outstanding INR, Exposure %, Risk Flag (`Normal`, `Watch`, `Critical`). +2. The system enforces the source-defined validation rules: Evaluated in real time upon every sales invoice post and payment receipt post. + +## FR-CUSTOMERRECEIVABLES-003: Credit Breach Dispatch Lock & Partner Override + +- **Requirement ID:** `FR-CUSTOMERRECEIVABLES-003` +- **Parent UC:** `UC-011` +- **Source Feature:** `BRD-FR-030` +- **Priority:** Must (P0) +- **Referenced Screen / Route:** Finance workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **Business Rules:** Override action permanently logged in audit trail. + +--- + +### Statement + +If a customer's outstanding receivables exceed 100% of their sanctioned credit limit, all pending dispatches for that customer must be locked. Only a Partner user can record an explicit electronic approval override with mandatory justification notes to release the lock. + +### Acceptance Criteria + +1. The requirement records, computes, or presents the source-defined data attributes: Lock Status (`Active`, `Overridden`), Override Approved By, Override Reason, Timestamp. +2. The system enforces the source-defined validation rules: Override action permanently logged in audit trail. + +--- + +## FR-CUSTOMERRECEIVABLES-004: Customer Payment Receipt Posting + +- **Requirement ID:** `FR-CUSTOMERRECEIVABLES-004` +- **Parent UC:** `UC-011` +- **Source Feature:** `BRD-FR-031` +- **Priority:** Must (P0) +- **Referenced Screen / Route:** Finance workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **Business Rules:** Amount must be $> 0$. Credit applied to customer ledger immediately upon `Cleared` status. Reversal action generates immutable audit trail entry and notifies Accounts Executive and Sales Manager. + +### Statement + +The system must record customer payments capturing payment date, customer code, received amount in INR, payment instrument mode (`NEFT`, `RTGS`, `Cheque`, `Cash`, `UPI`), bank reference/UTR number, and payment status (`Pending Clearance`, `Cleared`, `Bounced`). The system must enforce automatic reversal upon Cheque/Instrument Bounce: if an instrument status transitions to `Bounced`, the system must immediately reverse the credit entry on the customer sub-ledger, restore the previous outstanding debt, recompute exposure ratio %, reinstate credit locks if exposure $>100\%$, and trigger an urgent financial alert. + +### Acceptance Criteria + +1. The requirement records, computes, or presents the source-defined data attributes: Receipt ID (`PAY-YYYYMM-xxx`), Date, Customer ID, Amount INR, Payment Mode, UTR/Cheque No, Bank Name, Clearance Status, Bounce Reason, Reversal Voucher ID. +2. The system enforces the source-defined validation rules: Amount must be $> 0$. Credit applied to customer ledger immediately upon `Cleared` status. Reversal action generates immutable audit trail entry and notifies Accounts Executive and Sales Manager. diff --git a/04_generated_documentation/03_requirements/use_cases/uc-011-customer-receivables/use-case.md b/04_generated_documentation/03_requirements/use_cases/uc-011-customer-receivables/use-case.md new file mode 100644 index 0000000..336ece6 --- /dev/null +++ b/04_generated_documentation/03_requirements/use_cases/uc-011-customer-receivables/use-case.md @@ -0,0 +1,67 @@ +--- +id: UC-011 +version: 1.0.0 +status: Draft +--- + +# UC-011 — Customer Receivables and Credit Controls + +| Field | Value | +|---|---| +| **Use Case ID** | `UC-011` | +| **Name** | Customer Receivables and Credit Controls | +| **Owning Domain** | Finance | +| **Primary Actor(s)** | Accounts Executive / Partner / Sales Manager | +| **Supporting Actor(s)** | Accounts Executive, Sales Manager, Partner, Managing Director | +| **Source Features** | `BRD-FR-028`, `BRD-FR-029`, `BRD-FR-030`, `BRD-FR-031` | +| **Status** | Draft | +| **Version** | 1.0.0 | + +## Goal + +Review customer balances and exposure, record payments, and enforce authorized controls when exposure breaches the approved limit. + +## Preconditions + +1. The actor is authenticated and has the role and tenant scope required by the source feature(s). +2. Any source records or master data explicitly required by the selected feature are available and in the required state. + +## Trigger + +The actor initiates one of the 4 business operations covered by this use case: customer ledger & aging statement; automated customer credit exposure watch & threshold alert; credit breach dispatch lock & partner override; customer payment receipt posting. + +## Main Success Flow + +1. The actor initiates **Customer Ledger & Aging Statement**. The system performs the source-defined behavior: The system must maintain an immutable party sub-ledger for each customer, debiting finalized sales invoices, crediting payment receipts, and presenting a real-time outstanding balance and aging schedule (0–7 days, 8–15 days, 16–30 days, >30 days). +2. The actor initiates **Automated Customer Credit Exposure Watch & Threshold Alert**. The system performs the source-defined behavior: The system must continuously recompute the customer exposure ratio ($\text{Outstanding} / \text{Credit Limit}$). If exposure $>80\%$, the account must be automatically tagged with a visual `Watch` badge, and an operational warning alert generated on the Executive Dashboard. +3. The actor initiates **Credit Breach Dispatch Lock & Partner Override**. The system performs the source-defined behavior: If a customer's outstanding receivables exceed 100% of their sanctioned credit limit, all pending dispatches for that customer must be locked. Only a Partner user can record an explicit electronic approval override with mandatory justification notes to release the lock. +4. The actor initiates **Customer Payment Receipt Posting**. The system performs the source-defined behavior: The system must record customer payments capturing payment date, customer code, received amount in INR, payment instrument mode (`NEFT`, `RTGS`, `Cheque`, `Cash`, `UPI`), bank reference/UTR number, and payment status (`Pending Clearance`, `Cleared`, `Bounced`). The system must enforce automatic reversal upon Cheque/Instrument Bounce: if an instrument status transitions to `Bounced`, the system must immediately reverse the credit entry on the customer sub-ledger, restore the previous outstanding debt, recompute exposure ratio %, reinstate credit locks if exposure $>100\%$, and trigger an urgent financial alert. + +## Alternate Flows + +- No alternate business flow is specified by the source features. + +## Exception Flows + +- **BRD-FR-028:** Reject or prevent the operation when its stated validation rules are not met: Sub-ledger entries are immutable; corrections require credit/debit adjustment vouchers. +- **BRD-FR-029:** Reject or prevent the operation when its stated validation rules are not met: Evaluated in real time upon every sales invoice post and payment receipt post. +- **BRD-FR-030:** Reject or prevent the operation when its stated validation rules are not met: Override action permanently logged in audit trail. + +--- +- **BRD-FR-031:** Reject or prevent the operation when its stated validation rules are not met: Amount must be $> 0$. Credit applied to customer ledger immediately upon `Cleared` status. Reversal action generates immutable audit trail entry and notifies Accounts Executive and Sales Manager. + +## Postconditions + +- Successful operations create or update only the business records and outcomes stated in the linked BRD features. +- Rejected operations do not bypass the validations and controls stated by those features. + +## Referenced Screens / Routes + +- Finance workflow screen(s) — route(s) to be specified during Stage 11 screen design + +## Child Functional Requirements + +- [FR-CUSTOMERRECEIVABLES-001: Customer Ledger & Aging Statement](functional-reqs.md#fr-customerreceivables-001) +- [FR-CUSTOMERRECEIVABLES-002: Automated Customer Credit Exposure Watch & Threshold Alert](functional-reqs.md#fr-customerreceivables-002) +- [FR-CUSTOMERRECEIVABLES-003: Credit Breach Dispatch Lock & Partner Override](functional-reqs.md#fr-customerreceivables-003) +- [FR-CUSTOMERRECEIVABLES-004: Customer Payment Receipt Posting](functional-reqs.md#fr-customerreceivables-004) diff --git a/04_generated_documentation/03_requirements/use_cases/uc-012-supplier-payables/functional-reqs.md b/04_generated_documentation/03_requirements/use_cases/uc-012-supplier-payables/functional-reqs.md new file mode 100644 index 0000000..87f8d07 --- /dev/null +++ b/04_generated_documentation/03_requirements/use_cases/uc-012-supplier-payables/functional-reqs.md @@ -0,0 +1,31 @@ +--- +id: UC-012-FR +version: 1.0.0 +status: Draft +--- + +# Functional Requirements — UC-012 Supplier Payables and Aging + +| Field | Value | +|---|---| +| **Parent Use Case** | `UC-012` | +| **Status** | Draft | +| **Version** | 1.0.0 | + +## FR-SUPPLIERPAYABLES-001: Supplier Payables Aging & Balance Snapshots + +- **Requirement ID:** `FR-SUPPLIERPAYABLES-001` +- **Parent UC:** `UC-012` +- **Source Feature:** `BRD-FR-032` +- **Priority:** Must (P0) +- **Referenced Screen / Route:** Finance workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **Business Rules:** Automated calculation of due date based on GRN date + credit days. + +### Statement + +The system must track supplier payables arising from accepted GRNs, applying supplier credit days, generating aging schedules, and providing daily aggregate payables snapshots. + +### Acceptance Criteria + +1. The requirement records, computes, or presents the source-defined data attributes: Supplier ID, GRN No, Invoice Amount INR, Due Date, Days Overdue, Payment Status (`Unpaid`, `Partially Paid`, `Paid`). +2. The system enforces the source-defined validation rules: Automated calculation of due date based on GRN date + credit days. diff --git a/04_generated_documentation/03_requirements/use_cases/uc-012-supplier-payables/use-case.md b/04_generated_documentation/03_requirements/use_cases/uc-012-supplier-payables/use-case.md new file mode 100644 index 0000000..97c6dd5 --- /dev/null +++ b/04_generated_documentation/03_requirements/use_cases/uc-012-supplier-payables/use-case.md @@ -0,0 +1,56 @@ +--- +id: UC-012 +version: 1.0.0 +status: Draft +--- + +# UC-012 — Supplier Payables and Aging + +| Field | Value | +|---|---| +| **Use Case ID** | `UC-012` | +| **Name** | Supplier Payables and Aging | +| **Owning Domain** | Finance | +| **Primary Actor(s)** | Accounts Executive | +| **Supporting Actor(s)** | Partner | +| **Source Features** | `BRD-FR-032` | +| **Status** | Draft | +| **Version** | 1.0.0 | + +## Goal + +Review supplier payable balances and aging snapshots. + +## Preconditions + +1. The actor is authenticated and has the role and tenant scope required by the source feature(s). +2. Any source records or master data explicitly required by the selected feature are available and in the required state. + +## Trigger + +The actor initiates one of the 1 business operations covered by this use case: supplier payables aging & balance snapshots. + +## Main Success Flow + +1. The actor initiates **Supplier Payables Aging & Balance Snapshots**. The system performs the source-defined behavior: The system must track supplier payables arising from accepted GRNs, applying supplier credit days, generating aging schedules, and providing daily aggregate payables snapshots. + +## Alternate Flows + +- No alternate business flow is specified by the source features. + +## Exception Flows + +- **BRD-FR-032:** Reject or prevent the operation when its stated validation rules are not met: Automated calculation of due date based on GRN date + credit days. + +## Postconditions + +- Successful operations create or update only the business records and outcomes stated in the linked BRD features. +- Rejected operations do not bypass the validations and controls stated by those features. + +## Referenced Screens / Routes + +- Finance workflow screen(s) — route(s) to be specified during Stage 11 screen design + +## Child Functional Requirements + +- [FR-SUPPLIERPAYABLES-001: Supplier Payables Aging & Balance Snapshots](functional-reqs.md#fr-supplierpayables-001) diff --git a/04_generated_documentation/03_requirements/use_cases/uc-013-operating-expenses/functional-reqs.md b/04_generated_documentation/03_requirements/use_cases/uc-013-operating-expenses/functional-reqs.md new file mode 100644 index 0000000..e0feaac --- /dev/null +++ b/04_generated_documentation/03_requirements/use_cases/uc-013-operating-expenses/functional-reqs.md @@ -0,0 +1,35 @@ +--- +id: UC-013-FR +version: 1.0.0 +status: Draft +--- + +# Functional Requirements — UC-013 Mandi Operating Expense Recording + +| Field | Value | +|---|---| +| **Parent Use Case** | `UC-013` | +| **Status** | Draft | +| **Version** | 1.0.0 | + +## FR-OPERATINGEXPENSES-001: Mandi Operating Expense Classification & Recording + +- **Requirement ID:** `FR-OPERATINGEXPENSES-001` +- **Parent UC:** `UC-013` +- **Source Feature:** `BRD-FR-033` +- **Priority:** Should (P1) +- **Referenced Screen / Route:** Finance workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **Business Rules:** Expense vouchers must balance against cash/bank ledger accounts. + +--- + +### Statement + +The system must record operational expenses incurred in mandi and godown operations categorizing entries under: Labor / Hamali (loading/unloading), Freight / Cartage, Weighbridge Fees, Godown Rent, Mandi Cess, Pest Control/Fumigation, and Office Expenses. + +### Acceptance Criteria + +1. The requirement records, computes, or presents the source-defined data attributes: Expense ID (`EXP-YYYYMM-xxx`), Date, Category, Amount INR, Payee / Vendor, Linked Consignment / Sauda (if applicable), Payment Mode, Status. +2. The system enforces the source-defined validation rules: Expense vouchers must balance against cash/bank ledger accounts. + +--- diff --git a/04_generated_documentation/03_requirements/use_cases/uc-013-operating-expenses/use-case.md b/04_generated_documentation/03_requirements/use_cases/uc-013-operating-expenses/use-case.md new file mode 100644 index 0000000..3c4043a --- /dev/null +++ b/04_generated_documentation/03_requirements/use_cases/uc-013-operating-expenses/use-case.md @@ -0,0 +1,58 @@ +--- +id: UC-013 +version: 1.0.0 +status: Draft +--- + +# UC-013 — Mandi Operating Expense Recording + +| Field | Value | +|---|---| +| **Use Case ID** | `UC-013` | +| **Name** | Mandi Operating Expense Recording | +| **Owning Domain** | Finance | +| **Primary Actor(s)** | Accounts Executive | +| **Supporting Actor(s)** | None stated | +| **Source Features** | `BRD-FR-033` | +| **Status** | Draft | +| **Version** | 1.0.0 | + +## Goal + +Record and classify a mandi or godown operating expense and reconcile its voucher against the cash or bank ledger. + +## Preconditions + +1. The actor is authenticated and has the role and tenant scope required by the source feature(s). +2. Any source records or master data explicitly required by the selected feature are available and in the required state. + +## Trigger + +The actor initiates one of the 1 business operations covered by this use case: mandi operating expense classification & recording. + +## Main Success Flow + +1. The actor initiates **Mandi Operating Expense Classification & Recording**. The system performs the source-defined behavior: The system must record operational expenses incurred in mandi and godown operations categorizing entries under: Labor / Hamali (loading/unloading), Freight / Cartage, Weighbridge Fees, Godown Rent, Mandi Cess, Pest Control/Fumigation, and Office Expenses. + +## Alternate Flows + +- No alternate business flow is specified by the source features. + +## Exception Flows + +- **BRD-FR-033:** Reject or prevent the operation when its stated validation rules are not met: Expense vouchers must balance against cash/bank ledger accounts. + +--- + +## Postconditions + +- Successful operations create or update only the business records and outcomes stated in the linked BRD features. +- Rejected operations do not bypass the validations and controls stated by those features. + +## Referenced Screens / Routes + +- Finance workflow screen(s) — route(s) to be specified during Stage 11 screen design + +## Child Functional Requirements + +- [FR-OPERATINGEXPENSES-001: Mandi Operating Expense Classification & Recording](functional-reqs.md#fr-operatingexpenses-001) diff --git a/04_generated_documentation/03_requirements/use_cases/uc-014-operational-alerts/functional-reqs.md b/04_generated_documentation/03_requirements/use_cases/uc-014-operational-alerts/functional-reqs.md new file mode 100644 index 0000000..589d47e --- /dev/null +++ b/04_generated_documentation/03_requirements/use_cases/uc-014-operational-alerts/functional-reqs.md @@ -0,0 +1,35 @@ +--- +id: UC-014-FR +version: 1.0.0 +status: Draft +--- + +# Functional Requirements — UC-014 Operational Alert Review + +| Field | Value | +|---|---| +| **Parent Use Case** | `UC-014` | +| **Status** | Draft | +| **Version** | 1.0.0 | + +## FR-OPERATIONALALERTS-001: Real-Time Operational Alerts Engine + +- **Requirement ID:** `FR-OPERATIONALALERTS-001` +- **Parent UC:** `UC-014` +- **Source Feature:** `BRD-FR-034` +- **Priority:** Must (P0) +- **Referenced Screen / Route:** Management & Alerts workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **Business Rules:** Evaluated synchronously upon transaction mutations and refreshed periodically. + +### Statement + +The system must evaluate active business data and publish automated proactive alerts across four critical categories: + 1. **QC Pending Alert:** Lots in state `Under QC` for $>24$ hours or currently on `QC Hold`. + 2. **Warehouse Capacity Alert:** Godowns exceeding 85% storage capacity utilization. + 3. **Credit Risk Alert:** Customer accounts exceeding 80% or 100% of sanctioned credit limit. + 4. **Active Procurement Window Alert:** Mandis with open buying orders during active trading hours. + +### Acceptance Criteria + +1. The requirement records, computes, or presents the source-defined data attributes: Alert ID, Severity (`Info`, `Warning`, `Critical`), Category, Title, Detail Text, Timestamp, Dismissed Status. +2. The system enforces the source-defined validation rules: Evaluated synchronously upon transaction mutations and refreshed periodically. diff --git a/04_generated_documentation/03_requirements/use_cases/uc-014-operational-alerts/use-case.md b/04_generated_documentation/03_requirements/use_cases/uc-014-operational-alerts/use-case.md new file mode 100644 index 0000000..e21a764 --- /dev/null +++ b/04_generated_documentation/03_requirements/use_cases/uc-014-operational-alerts/use-case.md @@ -0,0 +1,60 @@ +--- +id: UC-014 +version: 1.0.0 +status: Draft +--- + +# UC-014 — Operational Alert Review + +| Field | Value | +|---|---| +| **Use Case ID** | `UC-014` | +| **Name** | Operational Alert Review | +| **Owning Domain** | Management & Alerts | +| **Primary Actor(s)** | Partner / Operations Supervisor | +| **Supporting Actor(s)** | Partner, Operations Supervisor | +| **Source Features** | `BRD-FR-034` | +| **Status** | Draft | +| **Version** | 1.0.0 | + +## Goal + +Review proactive alerts for QC, warehouse capacity, customer credit risk, and active procurement windows. + +## Preconditions + +1. The actor is authenticated and has the role and tenant scope required by the source feature(s). +2. Any source records or master data explicitly required by the selected feature are available and in the required state. + +## Trigger + +The actor initiates one of the 1 business operations covered by this use case: real-time operational alerts engine. + +## Main Success Flow + +1. The actor initiates **Real-Time Operational Alerts Engine**. The system performs the source-defined behavior: The system must evaluate active business data and publish automated proactive alerts across four critical categories: + 1. **QC Pending Alert:** Lots in state `Under QC` for $>24$ hours or currently on `QC Hold`. + 2. **Warehouse Capacity Alert:** Godowns exceeding 85% storage capacity utilization. + 3. **Credit Risk Alert:** Customer accounts exceeding 80% or 100% of sanctioned credit limit. + 4. **Active Procurement Window Alert:** Mandis with open buying orders during active trading hours. + +## Alternate Flows + +- No alternate business flow is specified by the source features. + +## Exception Flows + +- **BRD-FR-034:** Reject or prevent the operation when its stated validation rules are not met: Evaluated synchronously upon transaction mutations and refreshed periodically. + +## Postconditions + +- Successful operations create or update only the business records and outcomes stated in the linked BRD features. +- Rejected operations do not bypass the validations and controls stated by those features. + +## Referenced Screens / Routes + +- Management & Alerts workflow screen(s) — route(s) to be specified during Stage 11 screen design + +## Child Functional Requirements + +- [FR-OPERATIONALALERTS-001: Real-Time Operational Alerts Engine](functional-reqs.md#fr-operationalalerts-001) diff --git a/04_generated_documentation/03_requirements/use_cases/uc-015-executive-reporting/functional-reqs.md b/04_generated_documentation/03_requirements/use_cases/uc-015-executive-reporting/functional-reqs.md new file mode 100644 index 0000000..3e3bb01 --- /dev/null +++ b/04_generated_documentation/03_requirements/use_cases/uc-015-executive-reporting/functional-reqs.md @@ -0,0 +1,53 @@ +--- +id: UC-015-FR +version: 1.0.0 +status: Draft +--- + +# Functional Requirements — UC-015 Executive Dashboard and Trading Snapshots + +| Field | Value | +|---|---| +| **Parent Use Case** | `UC-015` | +| **Status** | Draft | +| **Version** | 1.0.0 | + +## FR-EXECUTIVEREPORTING-001: Executive Control Centre Dashboard + +- **Requirement ID:** `FR-EXECUTIVEREPORTING-001` +- **Parent UC:** `UC-015` +- **Source Feature:** `BRD-FR-035` +- **Priority:** Must (P0) +- **Referenced Screen / Route:** Management workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **Business Rules:** Dashboard must load within $\le 1.5\text{s}$. + +### Statement + +The system must provide a unified operational dashboard displaying real-time metrics: Total Stock on Hand (MT), Total Active Stock Lines, Intraday Purchase Value INR, Intraday Sales Revenue INR, Total Customer Receivables INR, Top 10 Stock Lines by Volume, Top Recent Sales, and Warehouse Utilization Barometers. + +### Acceptance Criteria + +1. The requirement records, computes, or presents the source-defined data attributes: KPI Metric Cards, Warehouse Position Table, Top Stock Grid, Recent Sales Feed, Active Alerts Feed. +2. The system enforces the source-defined validation rules: Dashboard must load within $\le 1.5\text{s}$. + +## FR-EXECUTIVEREPORTING-002: 20-Day Consolidated Trading Trend Reporting + +- **Requirement ID:** `FR-EXECUTIVEREPORTING-002` +- **Parent UC:** `UC-015` +- **Source Feature:** `BRD-FR-036` +- **Priority:** Must (P0) +- **Referenced Screen / Route:** Management workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **Business Rules:** Dynamically calculated from transaction ledgers; sub-second query performance. + +--- + +### Statement + +The system must compile daily management snapshots across a rolling 20-day trading window, tabulating: Date, Purchases MT, Sales MT, Closing Stock MT, Total Receivables INR, and Total Payables INR. + +### Acceptance Criteria + +1. The requirement records, computes, or presents the source-defined data attributes: Daily Snapshot Array (Date, Purchases MT, Sales MT, Stock MT, Receivables INR, Payables INR). +2. The system enforces the source-defined validation rules: Dynamically calculated from transaction ledgers; sub-second query performance. + +--- diff --git a/04_generated_documentation/03_requirements/use_cases/uc-015-executive-reporting/use-case.md b/04_generated_documentation/03_requirements/use_cases/uc-015-executive-reporting/use-case.md new file mode 100644 index 0000000..3a7f532 --- /dev/null +++ b/04_generated_documentation/03_requirements/use_cases/uc-015-executive-reporting/use-case.md @@ -0,0 +1,61 @@ +--- +id: UC-015 +version: 1.0.0 +status: Draft +--- + +# UC-015 — Executive Dashboard and Trading Snapshots + +| Field | Value | +|---|---| +| **Use Case ID** | `UC-015` | +| **Name** | Executive Dashboard and Trading Snapshots | +| **Owning Domain** | Management | +| **Primary Actor(s)** | Partner / Managing Director | +| **Supporting Actor(s)** | Partner, Managing Director | +| **Source Features** | `BRD-FR-035`, `BRD-FR-036` | +| **Status** | Draft | +| **Version** | 1.0.0 | + +## Goal + +Review current operational indicators and rolling 20-day purchase, sales, stock, receivable, and payable snapshots. + +## Preconditions + +1. The actor is authenticated and has the role and tenant scope required by the source feature(s). +2. Any source records or master data explicitly required by the selected feature are available and in the required state. + +## Trigger + +The actor initiates one of the 2 business operations covered by this use case: executive control centre dashboard; 20-day consolidated trading trend reporting. + +## Main Success Flow + +1. The actor initiates **Executive Control Centre Dashboard**. The system performs the source-defined behavior: The system must provide a unified operational dashboard displaying real-time metrics: Total Stock on Hand (MT), Total Active Stock Lines, Intraday Purchase Value INR, Intraday Sales Revenue INR, Total Customer Receivables INR, Top 10 Stock Lines by Volume, Top Recent Sales, and Warehouse Utilization Barometers. +2. The actor initiates **20-Day Consolidated Trading Trend Reporting**. The system performs the source-defined behavior: The system must compile daily management snapshots across a rolling 20-day trading window, tabulating: Date, Purchases MT, Sales MT, Closing Stock MT, Total Receivables INR, and Total Payables INR. + +## Alternate Flows + +- No alternate business flow is specified by the source features. + +## Exception Flows + +- **BRD-FR-035:** Reject or prevent the operation when its stated validation rules are not met: Dashboard must load within $\le 1.5\text{s}$. +- **BRD-FR-036:** Reject or prevent the operation when its stated validation rules are not met: Dynamically calculated from transaction ledgers; sub-second query performance. + +--- + +## Postconditions + +- Successful operations create or update only the business records and outcomes stated in the linked BRD features. +- Rejected operations do not bypass the validations and controls stated by those features. + +## Referenced Screens / Routes + +- Management workflow screen(s) — route(s) to be specified during Stage 11 screen design + +## Child Functional Requirements + +- [FR-EXECUTIVEREPORTING-001: Executive Control Centre Dashboard](functional-reqs.md#fr-executivereporting-001) +- [FR-EXECUTIVEREPORTING-002: 20-Day Consolidated Trading Trend Reporting](functional-reqs.md#fr-executivereporting-002) diff --git a/04_generated_documentation/03_requirements/use_cases/uc-016-master-data/functional-reqs.md b/04_generated_documentation/03_requirements/use_cases/uc-016-master-data/functional-reqs.md new file mode 100644 index 0000000..cf03797 --- /dev/null +++ b/04_generated_documentation/03_requirements/use_cases/uc-016-master-data/functional-reqs.md @@ -0,0 +1,49 @@ +--- +id: UC-016-FR +version: 1.0.0 +status: Draft +--- + +# Functional Requirements — UC-016 Commodity and Trading Counterparty Master Data + +| Field | Value | +|---|---| +| **Parent Use Case** | `UC-016` | +| **Status** | Draft | +| **Version** | 1.0.0 | + +## FR-MASTERDATA-001: Agricultural Commodity Master Data Management + +- **Requirement ID:** `FR-MASTERDATA-001` +- **Parent UC:** `UC-016` +- **Source Feature:** `BRD-FR-037` +- **Priority:** Must (P0) +- **Referenced Screen / Route:** Master Data workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **Business Rules:** Commodity code must be unique; cannot delete commodities with active stock ledger entries. + +### Statement + +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`). + +### Acceptance Criteria + +1. The requirement records, computes, or presents the source-defined data attributes: Commodity Code, Commodity Name, Category (`Grains`, `Pulses`, `Oilseeds`, `Spices`), Varieties List, Standard Bag Weight kg. +2. The system enforces the source-defined validation rules: Commodity code must be unique; cannot delete commodities with active stock ledger entries. + +## FR-MASTERDATA-002: Trading Counterparty Masters (Suppliers, Customers & Godowns) + +- **Requirement ID:** `FR-MASTERDATA-002` +- **Parent UC:** `UC-016` +- **Source Feature:** `BRD-FR-038` +- **Priority:** Must (P0) +- **Referenced Screen / Route:** Master Data workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **Business Rules:** Tax IDs validated where applicable. + +### Statement + +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). + +### Acceptance Criteria + +1. The requirement records, computes, or presents the source-defined data attributes: Entity Code, Name, Address, GSTIN/PAN, Bank Details, Status (`Active`, `Inactive`). +2. The system enforces the source-defined validation rules: Tax IDs validated where applicable. diff --git a/04_generated_documentation/03_requirements/use_cases/uc-016-master-data/use-case.md b/04_generated_documentation/03_requirements/use_cases/uc-016-master-data/use-case.md new file mode 100644 index 0000000..b837c4d --- /dev/null +++ b/04_generated_documentation/03_requirements/use_cases/uc-016-master-data/use-case.md @@ -0,0 +1,59 @@ +--- +id: UC-016 +version: 1.0.0 +status: Draft +--- + +# UC-016 — Commodity and Trading Counterparty Master Data + +| Field | Value | +|---|---| +| **Use Case ID** | `UC-016` | +| **Name** | Commodity and Trading Counterparty Master Data | +| **Owning Domain** | Master Data | +| **Primary Actor(s)** | System Administrator / Accounts Executive | +| **Supporting Actor(s)** | System Administrator, Accounts Executive | +| **Source Features** | `BRD-FR-037`, `BRD-FR-038` | +| **Status** | Draft | +| **Version** | 1.0.0 | + +## Goal + +Maintain the commodity catalogs and trading-party/warehouse registries used by business workflows. + +## Preconditions + +1. The actor is authenticated and has the role and tenant scope required by the source feature(s). +2. Any source records or master data explicitly required by the selected feature are available and in the required state. + +## Trigger + +The actor initiates one of the 2 business operations covered by this use case: agricultural commodity master data management; trading counterparty masters (suppliers, customers & godowns). + +## Main Success Flow + +1. The actor initiates **Agricultural Commodity Master Data Management**. The system performs the source-defined behavior: 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`). +2. The actor initiates **Trading Counterparty Masters (Suppliers, Customers & Godowns)**. The system performs the source-defined behavior: 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). + +## Alternate Flows + +- No alternate business flow is specified by the source features. + +## Exception Flows + +- **BRD-FR-037:** Reject or prevent the operation when its stated validation rules are not met: Commodity code must be unique; cannot delete commodities with active stock ledger entries. +- **BRD-FR-038:** Reject or prevent the operation when its stated validation rules are not met: Tax IDs validated where applicable. + +## Postconditions + +- Successful operations create or update only the business records and outcomes stated in the linked BRD features. +- Rejected operations do not bypass the validations and controls stated by those features. + +## Referenced Screens / Routes + +- Master Data workflow screen(s) — route(s) to be specified during Stage 11 screen design + +## Child Functional Requirements + +- [FR-MASTERDATA-001: Agricultural Commodity Master Data Management](functional-reqs.md#fr-masterdata-001) +- [FR-MASTERDATA-002: Trading Counterparty Masters (Suppliers, Customers & Godowns)](functional-reqs.md#fr-masterdata-002) diff --git a/04_generated_documentation/03_requirements/use_cases/uc-017-tenant-security-audit/functional-reqs.md b/04_generated_documentation/03_requirements/use_cases/uc-017-tenant-security-audit/functional-reqs.md new file mode 100644 index 0000000..45d34a7 --- /dev/null +++ b/04_generated_documentation/03_requirements/use_cases/uc-017-tenant-security-audit/functional-reqs.md @@ -0,0 +1,67 @@ +--- +id: UC-017-FR +version: 1.0.0 +status: Draft +--- + +# Functional Requirements — UC-017 Tenant Isolation, Business Permissions and Audit + +| Field | Value | +|---|---| +| **Parent Use Case** | `UC-017` | +| **Status** | Draft | +| **Version** | 1.0.0 | + +## FR-TENANTSECURITYAUDIT-001: Tenant Data Isolation + +- **Requirement ID:** `FR-TENANTSECURITYAUDIT-001` +- **Parent UC:** `UC-017` +- **Source Feature:** `BRD-FR-039` +- **Priority:** Must (P0) +- **Referenced Screen / Route:** Architecture & Security workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **Business Rules:** Tenant context must be enforced on every applicable business operation and verified for cross-tenant data access. + +### Statement + +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. + +### Acceptance Criteria + +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` +- **Parent UC:** `UC-017` +- **Source Feature:** `BRD-FR-041` +- **Priority:** Must (P0) +- **Referenced Screen / Route:** Architecture & Security workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **Business Rules:** Audit history cannot be deleted or modified through normal application operations. + +### Statement + +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. + +### Acceptance Criteria + +1. The requirement records, computes, or presents the source-defined data attributes: Audit Trail Log ID, Document Type, Document Name, Modified By, Modified Timestamp, Field Diff JSON. +2. The system enforces the source-defined validation rules: Audit history cannot be deleted or modified through normal application operations. diff --git a/04_generated_documentation/03_requirements/use_cases/uc-017-tenant-security-audit/use-case.md b/04_generated_documentation/03_requirements/use_cases/uc-017-tenant-security-audit/use-case.md new file mode 100644 index 0000000..3cf7678 --- /dev/null +++ b/04_generated_documentation/03_requirements/use_cases/uc-017-tenant-security-audit/use-case.md @@ -0,0 +1,62 @@ +--- +id: UC-017 +version: 1.0.0 +status: Draft +--- + +# UC-017 — Tenant Isolation, Business Permissions and Audit + +| Field | Value | +|---|---| +| **Use Case ID** | `UC-017` | +| **Name** | Tenant Isolation, Business Permissions and 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` | +| **Status** | Draft | +| **Version** | 1.0.0 | + +## Goal + +Enforce tenant data boundaries and business-role permissions while preserving immutable histories of governed transactions. + +## Preconditions + +1. The actor is authenticated and has the role and tenant scope required by the source feature(s). +2. Any source records or master data explicitly required by the selected feature are available and in the required state. + +## 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. + +## 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. + +## Alternate Flows + +- No alternate business flow is specified by the source features. + +## 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 + +- Successful operations create or update only the business records and outcomes stated in the linked BRD features. +- Rejected operations do not bypass the validations and controls stated by those features. + +## Referenced Screens / Routes + +- Architecture & Security workflow screen(s) — route(s) to be specified during Stage 11 screen design + +## 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) diff --git a/04_generated_documentation/03_requirements/use_cases/uc-018-tenant-lifecycle/functional-reqs.md b/04_generated_documentation/03_requirements/use_cases/uc-018-tenant-lifecycle/functional-reqs.md new file mode 100644 index 0000000..2bdf772 --- /dev/null +++ b/04_generated_documentation/03_requirements/use_cases/uc-018-tenant-lifecycle/functional-reqs.md @@ -0,0 +1,31 @@ +--- +id: UC-018-FR +version: 1.0.0 +status: Draft +--- + +# Functional Requirements — UC-018 Tenant Provisioning and Lifecycle + +| Field | Value | +|---|---| +| **Parent Use Case** | `UC-018` | +| **Status** | Draft | +| **Version** | 1.0.0 | + +## FR-TENANTLIFECYCLE-001: Tenant Provisioning and Lifecycle Management + +- **Requirement ID:** `FR-TENANTLIFECYCLE-001` +- **Parent UC:** `UC-018` +- **Source Feature:** `BRD-FR-042` +- **Priority:** Must (P0) +- **Referenced Screen / Route:** Platform Administration workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **Business Rules:** None stated in the source feature. + +### Statement + +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. + +### Acceptance Criteria + +1. The requirement records, computes, or presents the source-defined data attributes: Tenant ID, Tenant Name, Lifecycle Status, Created/Updated Timestamps, Tenant Administrator, Lifecycle Actor and Reason. +2. The outcome satisfies the source-defined acceptance intent: Each lifecycle transition is authorized, recorded, and reflected consistently across application access, API requests, and scheduled work. Closed/suspended tenant data handling follows the retention and deletion policy approved for the service. diff --git a/04_generated_documentation/03_requirements/use_cases/uc-018-tenant-lifecycle/use-case.md b/04_generated_documentation/03_requirements/use_cases/uc-018-tenant-lifecycle/use-case.md new file mode 100644 index 0000000..8d6be5e --- /dev/null +++ b/04_generated_documentation/03_requirements/use_cases/uc-018-tenant-lifecycle/use-case.md @@ -0,0 +1,56 @@ +--- +id: UC-018 +version: 1.0.0 +status: Draft +--- + +# UC-018 — Tenant Provisioning and Lifecycle + +| Field | Value | +|---|---| +| **Use Case ID** | `UC-018` | +| **Name** | Tenant Provisioning and Lifecycle | +| **Owning Domain** | Platform Administration | +| **Primary Actor(s)** | System Administrator | +| **Supporting Actor(s)** | None stated | +| **Source Features** | `BRD-FR-042` | +| **Status** | Draft | +| **Version** | 1.0.0 | + +## Goal + +Create, configure, activate, suspend, or close a tenant through an authorized and recorded lifecycle. + +## Preconditions + +1. The actor is authenticated and has the role and tenant scope required by the source feature(s). +2. Any source records or master data explicitly required by the selected feature are available and in the required state. + +## Trigger + +The actor initiates one of the 1 business operations covered by this use case: tenant provisioning and lifecycle management. + +## Main Success Flow + +1. The actor initiates **Tenant Provisioning and Lifecycle Management**. The system performs the source-defined behavior: 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. + +## Alternate Flows + +- No alternate business flow is specified by the source features. + +## Exception Flows + +- Any exceptions remain as specified in the source feature; no additional behavior is inferred. + +## Postconditions + +- Successful operations create or update only the business records and outcomes stated in the linked BRD features. +- Rejected operations do not bypass the validations and controls stated by those features. + +## Referenced Screens / Routes + +- Platform Administration workflow screen(s) — route(s) to be specified during Stage 11 screen design + +## Child Functional Requirements + +- [FR-TENANTLIFECYCLE-001: Tenant Provisioning and Lifecycle Management](functional-reqs.md#fr-tenantlifecycle-001) diff --git a/04_generated_documentation/03_requirements/use_cases/uc-019-tenant-membership-context/functional-reqs.md b/04_generated_documentation/03_requirements/use_cases/uc-019-tenant-membership-context/functional-reqs.md new file mode 100644 index 0000000..e39e312 --- /dev/null +++ b/04_generated_documentation/03_requirements/use_cases/uc-019-tenant-membership-context/functional-reqs.md @@ -0,0 +1,49 @@ +--- +id: UC-019-FR +version: 1.0.0 +status: Draft +--- + +# Functional Requirements — UC-019 Tenant Membership and Verified Context + +| Field | Value | +|---|---| +| **Parent Use Case** | `UC-019` | +| **Status** | Draft | +| **Version** | 1.0.0 | + +## FR-TENANTMEMBERSHIPCONTEXT-001: Tenant Membership and Role Administration + +- **Requirement ID:** `FR-TENANTMEMBERSHIPCONTEXT-001` +- **Parent UC:** `UC-019` +- **Source Feature:** `BRD-FR-043` +- **Priority:** Must (P0) +- **Referenced Screen / Route:** Identity & Access Management workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **Business Rules:** None stated in the source feature. + +### Statement + +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. + +### Acceptance Criteria + +1. The requirement records, computes, or presents the source-defined data attributes: User ID, Tenant ID, Membership Status, Role Assignments, Changed By, Changed At. +2. The outcome satisfies the source-defined acceptance intent: Users receive no tenant access without an active membership and role assignment; membership changes take effect on subsequent authorized operations and are auditable. + +## FR-TENANTMEMBERSHIPCONTEXT-002: Verified Tenant Context for Every Operation + +- **Requirement ID:** `FR-TENANTMEMBERSHIPCONTEXT-002` +- **Parent UC:** `UC-019` +- **Source Feature:** `BRD-FR-044` +- **Priority:** Must (P0) +- **Referenced Screen / Route:** Identity & Access Management workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **Business Rules:** None stated in the source feature. + +### Statement + +The service must derive the effective tenant context from the authenticated user’s verified tenant membership. A client-supplied tenant identifier alone must never grant or switch tenant access. A user associated with multiple tenants must explicitly select the active tenant after sign-in; the service verifies that membership and its role for every request before permitting action in that tenant. + +### Acceptance Criteria + +1. The requirement records, computes, or presents the source-defined data attributes: Authenticated Subject, Effective Tenant ID, Membership, Role Claims, Request/Correlation ID. +2. The outcome satisfies the source-defined acceptance intent: Missing, invalid, or unauthorized tenant context is denied by default; the same checks apply to REST APIs and non-interactive operations. diff --git a/04_generated_documentation/03_requirements/use_cases/uc-019-tenant-membership-context/use-case.md b/04_generated_documentation/03_requirements/use_cases/uc-019-tenant-membership-context/use-case.md new file mode 100644 index 0000000..7b3b8c4 --- /dev/null +++ b/04_generated_documentation/03_requirements/use_cases/uc-019-tenant-membership-context/use-case.md @@ -0,0 +1,58 @@ +--- +id: UC-019 +version: 1.0.0 +status: Draft +--- + +# UC-019 — Tenant Membership and Verified Context + +| Field | Value | +|---|---| +| **Use Case ID** | `UC-019` | +| **Name** | Tenant Membership and Verified Context | +| **Owning Domain** | Identity & Access Management | +| **Primary Actor(s)** | Tenant Administrator / authenticated users | +| **Supporting Actor(s)** | Tenant Administrator, All authenticated users | +| **Source Features** | `BRD-FR-043`, `BRD-FR-044` | +| **Status** | Draft | +| **Version** | 1.0.0 | + +## Goal + +Administer tenant-scoped memberships and roles, then verify active tenant membership and role for each operation. + +## Preconditions + +1. The actor is authenticated and has the role and tenant scope required by the source feature(s). +2. Any source records or master data explicitly required by the selected feature are available and in the required state. + +## Trigger + +The actor initiates one of the 2 business operations covered by this use case: tenant membership and role administration; verified tenant context for every operation. + +## Main Success Flow + +1. The actor initiates **Tenant Membership and Role Administration**. The system performs the source-defined behavior: 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. +2. The actor initiates **Verified Tenant Context for Every Operation**. The system performs the source-defined behavior: The service must derive the effective tenant context from the authenticated user’s verified tenant membership. A client-supplied tenant identifier alone must never grant or switch tenant access. A user associated with multiple tenants must explicitly select the active tenant after sign-in; the service verifies that membership and its role for every request before permitting action in that tenant. + +## Alternate Flows + +- No alternate business flow is specified by the source features. + +## Exception Flows + +- Any exceptions remain as specified in the source feature; no additional behavior is inferred. + +## Postconditions + +- Successful operations create or update only the business records and outcomes stated in the linked BRD features. +- Rejected operations do not bypass the validations and controls stated by those features. + +## Referenced Screens / Routes + +- Identity & Access Management workflow screen(s) — route(s) to be specified during Stage 11 screen design + +## Child Functional Requirements + +- [FR-TENANTMEMBERSHIPCONTEXT-001: Tenant Membership and Role Administration](functional-reqs.md#fr-tenantmembershipcontext-001) +- [FR-TENANTMEMBERSHIPCONTEXT-002: Verified Tenant Context for Every Operation](functional-reqs.md#fr-tenantmembershipcontext-002) diff --git a/04_generated_documentation/03_requirements/use_cases/uc-020-tenant-support-security/functional-reqs.md b/04_generated_documentation/03_requirements/use_cases/uc-020-tenant-support-security/functional-reqs.md new file mode 100644 index 0000000..5bdef49 --- /dev/null +++ b/04_generated_documentation/03_requirements/use_cases/uc-020-tenant-support-security/functional-reqs.md @@ -0,0 +1,49 @@ +--- +id: UC-020-FR +version: 1.0.0 +status: Draft +--- + +# Functional Requirements — UC-020 Tenant Resource Isolation and Privileged Support + +| Field | Value | +|---|---| +| **Parent Use Case** | `UC-020` | +| **Status** | Draft | +| **Version** | 1.0.0 | + +## FR-TENANTSUPPORTSECURITY-001: End-to-End Tenant Resource Isolation + +- **Requirement ID:** `FR-TENANTSUPPORTSECURITY-001` +- **Parent UC:** `UC-020` +- **Source Feature:** `BRD-FR-045` +- **Priority:** Must (P0) +- **Referenced Screen / Route:** Platform Security workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **Business Rules:** None stated in the source feature. + +### Statement + +Tenant isolation must apply to all tenant-owned records and derived resources, including database reads and writes, API lookups, search/report results, exports, uploaded files, cache entries, and queued/background work. Cross-tenant access attempts must fail closed and must not reveal whether another tenant’s resource exists. + +### Acceptance Criteria + +1. The requirement records, computes, or presents the source-defined data attributes: Tenant ID on tenant-owned resources; resource owner; access decision; actor; timestamp; correlation ID. +2. The outcome satisfies the source-defined acceptance intent: Automated negative tests demonstrate that users, crafted identifiers, concurrent requests, reused database connections, and background jobs cannot read or mutate another tenant’s resources. Database roles and policies must not allow normal application paths to bypass the configured row-level security controls. + +## FR-TENANTSUPPORTSECURITY-002: Controlled Privileged Support Access + +- **Requirement ID:** `FR-TENANTSUPPORTSECURITY-002` +- **Parent UC:** `UC-020` +- **Source Feature:** `BRD-FR-046` +- **Priority:** Must (P0) +- **Referenced Screen / Route:** Platform Security workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **Business Rules:** None stated in the source feature. + +### Statement + +Platform support must not imply routine unrestricted access to tenant business data. Support staff have no standing access to tenant business data. Ordinary exceptional access requires approval by that tenant’s Tenant Administrator for a specific support case and a limited duration. For an urgent incident, a designated platform security administrator may grant a break-glass access window of at most one hour, with a recorded reason, immediate audit alert, and notice to the tenant administrator within one business day. All access is recorded for tenant and platform security review. + +### Acceptance Criteria + +1. The requirement records, computes, or presents the source-defined data attributes: Support Actor, Tenant ID, Reason/Case Reference, Approval, Start/End Time, Resources Accessed, Audit Event. +2. The outcome satisfies the source-defined acceptance intent: Privileged access can be granted and revoked through a controlled workflow; all such access is attributable and reviewable. Ordinary access requires tenant-admin approval; emergency break-glass access follows the one-hour limit and notification controls above. diff --git a/04_generated_documentation/03_requirements/use_cases/uc-020-tenant-support-security/use-case.md b/04_generated_documentation/03_requirements/use_cases/uc-020-tenant-support-security/use-case.md new file mode 100644 index 0000000..b02badb --- /dev/null +++ b/04_generated_documentation/03_requirements/use_cases/uc-020-tenant-support-security/use-case.md @@ -0,0 +1,58 @@ +--- +id: UC-020 +version: 1.0.0 +status: Draft +--- + +# UC-020 — Tenant Resource Isolation and Privileged Support + +| Field | Value | +|---|---| +| **Use Case ID** | `UC-020` | +| **Name** | Tenant Resource Isolation and Privileged Support | +| **Owning Domain** | Platform Security | +| **Primary Actor(s)** | System Administrator / Tenant Administrator / users | +| **Supporting Actor(s)** | All users; System Administrator for platform controls, System Administrator | +| **Source Features** | `BRD-FR-045`, `BRD-FR-046` | +| **Status** | Draft | +| **Version** | 1.0.0 | + +## Goal + +Protect tenant resources across application and asynchronous paths, and govern exceptional support access. + +## Preconditions + +1. The actor is authenticated and has the role and tenant scope required by the source feature(s). +2. Any source records or master data explicitly required by the selected feature are available and in the required state. + +## Trigger + +The actor initiates one of the 2 business operations covered by this use case: end-to-end tenant resource isolation; controlled privileged support access. + +## Main Success Flow + +1. The actor initiates **End-to-End Tenant Resource Isolation**. The system performs the source-defined behavior: Tenant isolation must apply to all tenant-owned records and derived resources, including database reads and writes, API lookups, search/report results, exports, uploaded files, cache entries, and queued/background work. Cross-tenant access attempts must fail closed and must not reveal whether another tenant’s resource exists. +2. The actor initiates **Controlled Privileged Support Access**. The system performs the source-defined behavior: Platform support must not imply routine unrestricted access to tenant business data. Support staff have no standing access to tenant business data. Ordinary exceptional access requires approval by that tenant’s Tenant Administrator for a specific support case and a limited duration. For an urgent incident, a designated platform security administrator may grant a break-glass access window of at most one hour, with a recorded reason, immediate audit alert, and notice to the tenant administrator within one business day. All access is recorded for tenant and platform security review. + +## Alternate Flows + +- No alternate business flow is specified by the source features. + +## Exception Flows + +- Any exceptions remain as specified in the source feature; no additional behavior is inferred. + +## Postconditions + +- Successful operations create or update only the business records and outcomes stated in the linked BRD features. +- Rejected operations do not bypass the validations and controls stated by those features. + +## Referenced Screens / Routes + +- Platform Security workflow screen(s) — route(s) to be specified during Stage 11 screen design + +## Child Functional Requirements + +- [FR-TENANTSUPPORTSECURITY-001: End-to-End Tenant Resource Isolation](functional-reqs.md#fr-tenantsupportsecurity-001) +- [FR-TENANTSUPPORTSECURITY-002: Controlled Privileged Support Access](functional-reqs.md#fr-tenantsupportsecurity-002) diff --git a/04_generated_documentation/03_requirements/use_cases/uc-021-privacy-purpose-consent/functional-reqs.md b/04_generated_documentation/03_requirements/use_cases/uc-021-privacy-purpose-consent/functional-reqs.md new file mode 100644 index 0000000..d6ecd35 --- /dev/null +++ b/04_generated_documentation/03_requirements/use_cases/uc-021-privacy-purpose-consent/functional-reqs.md @@ -0,0 +1,31 @@ +--- +id: UC-021-FR +version: 1.0.0 +status: Draft +--- + +# Functional Requirements — UC-021 Personal Data Purpose, Notice and Consent + +| Field | Value | +|---|---| +| **Parent Use Case** | `UC-021` | +| **Status** | Draft | +| **Version** | 1.0.0 | + +## FR-PRIVACYPURPOSECONSENT-001: Personal Data Purpose, Notice & Consent Records + +- **Requirement ID:** `FR-PRIVACYPURPOSECONSENT-001` +- **Parent UC:** `UC-021` +- **Source Feature:** `BRD-FR-047` +- **Priority:** Must (P0) +- **Referenced Screen / Route:** Privacy Operations workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **Business Rules:** None stated in the source feature. + +### Statement + +The service must allow each responsible Data Fiduciary to determine and approve the processing purpose, applicable lawful basis, and privacy notice for its processing, then document personal-data categories, purpose, basis, notice version, and accountable contact. Tenant firms own these decisions for trading data; the ATB operator records them separately for its own account, security, and service processing. Privacy controls cover every natural person whose personal data is processed in tenant or platform contexts, whether or not that person has an application account. Where consent is the applicable basis, the service must capture evidence of the notice and consent, support withdrawal, and record resulting processing restrictions. Tenant and platform processing contexts must remain distinguishable. + +### Acceptance Criteria + +1. The requirement records, computes, or presents the source-defined data attributes: Processing Purpose ID, Data Category, Responsible Entity/Role, Processing Basis, Notice Version, Consent Status and Timestamp, Withdrawal Timestamp, Contact. +2. The outcome satisfies the source-defined acceptance intent: Personal data processing purposes and notices are attributable to the responsible Data Fiduciary; consent-dependent processing can be stopped or adjusted following a verified withdrawal, subject to applicable lawful retention or other legal obligations. diff --git a/04_generated_documentation/03_requirements/use_cases/uc-021-privacy-purpose-consent/use-case.md b/04_generated_documentation/03_requirements/use_cases/uc-021-privacy-purpose-consent/use-case.md new file mode 100644 index 0000000..c782230 --- /dev/null +++ b/04_generated_documentation/03_requirements/use_cases/uc-021-privacy-purpose-consent/use-case.md @@ -0,0 +1,56 @@ +--- +id: UC-021 +version: 1.0.0 +status: Draft +--- + +# UC-021 — Personal Data Purpose, Notice and Consent + +| Field | Value | +|---|---| +| **Use Case ID** | `UC-021` | +| **Name** | Personal Data Purpose, Notice and Consent | +| **Owning Domain** | Privacy Operations | +| **Primary Actor(s)** | Tenant Administrator / System Administrator | +| **Supporting Actor(s)** | Tenant Administrator; System Administrator for platform-controlled processing | +| **Source Features** | `BRD-FR-047` | +| **Status** | Draft | +| **Version** | 1.0.0 | + +## Goal + +Record each responsible Data Fiduciary’s processing purpose, lawful basis, notice, accountable contact, and any applicable consent and withdrawal evidence. + +## Preconditions + +1. The actor is authenticated and has the role and tenant scope required by the source feature(s). +2. Any source records or master data explicitly required by the selected feature are available and in the required state. + +## Trigger + +The actor initiates one of the 1 business operations covered by this use case: personal data purpose, notice & consent records. + +## Main Success Flow + +1. The actor initiates **Personal Data Purpose, Notice & Consent Records**. The system performs the source-defined behavior: The service must allow each responsible Data Fiduciary to determine and approve the processing purpose, applicable lawful basis, and privacy notice for its processing, then document personal-data categories, purpose, basis, notice version, and accountable contact. Tenant firms own these decisions for trading data; the ATB operator records them separately for its own account, security, and service processing. Privacy controls cover every natural person whose personal data is processed in tenant or platform contexts, whether or not that person has an application account. Where consent is the applicable basis, the service must capture evidence of the notice and consent, support withdrawal, and record resulting processing restrictions. Tenant and platform processing contexts must remain distinguishable. + +## Alternate Flows + +- No alternate business flow is specified by the source features. + +## Exception Flows + +- Any exceptions remain as specified in the source feature; no additional behavior is inferred. + +## Postconditions + +- Successful operations create or update only the business records and outcomes stated in the linked BRD features. +- Rejected operations do not bypass the validations and controls stated by those features. + +## Referenced Screens / Routes + +- Privacy Operations workflow screen(s) — route(s) to be specified during Stage 11 screen design + +## Child Functional Requirements + +- [FR-PRIVACYPURPOSECONSENT-001: Personal Data Purpose, Notice & Consent Records](functional-reqs.md#fr-privacypurposeconsent-001) diff --git a/04_generated_documentation/03_requirements/use_cases/uc-022-data-principal-rights/functional-reqs.md b/04_generated_documentation/03_requirements/use_cases/uc-022-data-principal-rights/functional-reqs.md new file mode 100644 index 0000000..4ce0051 --- /dev/null +++ b/04_generated_documentation/03_requirements/use_cases/uc-022-data-principal-rights/functional-reqs.md @@ -0,0 +1,31 @@ +--- +id: UC-022-FR +version: 1.0.0 +status: Draft +--- + +# Functional Requirements — UC-022 Data Principal Rights and Grievance Requests + +| Field | Value | +|---|---| +| **Parent Use Case** | `UC-022` | +| **Status** | Draft | +| **Version** | 1.0.0 | + +## FR-DATAPRINCIPALRIGHTS-001: Data Principal Rights & Grievance Case Management + +- **Requirement ID:** `FR-DATAPRINCIPALRIGHTS-001` +- **Parent UC:** `UC-022` +- **Source Feature:** `BRD-FR-048` +- **Priority:** Must (P0) +- **Referenced Screen / Route:** Privacy Operations workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **Business Rules:** None stated in the source feature. + +### Statement + +The service must support receipt, identity verification, routing, tracking, response, and evidence retention for Data Principal requests and grievances concerning access to information, correction, erasure, consent withdrawal, grievance redressal, and nomination, as applicable, including for individuals who do not hold application accounts. Requests must be routed to the responsible Data Fiduciary and handled within the applicable statutory or approved contractual time limit. A request channel must be available without requiring a general customer or supplier portal account. + +### Acceptance Criteria + +1. The requirement records, computes, or presents the source-defined data attributes: Request ID, Data Principal Identifier, Tenant/Platform Scope, Request Type, Verification Evidence, Responsible Fiduciary, Received/Due/Resolved Timestamps, Disposition, Response Evidence. +2. The outcome satisfies the source-defined acceptance intent: Requests are not silently lost or fulfilled against the wrong tenant; authorized operators can track deadlines, exceptions, approvals, and completion evidence while preserving tenant isolation. diff --git a/04_generated_documentation/03_requirements/use_cases/uc-022-data-principal-rights/use-case.md b/04_generated_documentation/03_requirements/use_cases/uc-022-data-principal-rights/use-case.md new file mode 100644 index 0000000..8cdc4fb --- /dev/null +++ b/04_generated_documentation/03_requirements/use_cases/uc-022-data-principal-rights/use-case.md @@ -0,0 +1,56 @@ +--- +id: UC-022 +version: 1.0.0 +status: Draft +--- + +# UC-022 — Data Principal Rights and Grievance Requests + +| Field | Value | +|---|---| +| **Use Case ID** | `UC-022` | +| **Name** | Data Principal Rights and Grievance Requests | +| **Owning Domain** | Privacy Operations | +| **Primary Actor(s)** | Tenant Administrator / System Administrator | +| **Supporting Actor(s)** | Tenant Administrator; System Administrator for platform-controlled processing | +| **Source Features** | `BRD-FR-048` | +| **Status** | Draft | +| **Version** | 1.0.0 | + +## Goal + +Receive, verify, route, track, and respond to Data Principal requests and grievances, including requests from people without application accounts. + +## Preconditions + +1. The actor is authenticated and has the role and tenant scope required by the source feature(s). +2. Any source records or master data explicitly required by the selected feature are available and in the required state. + +## Trigger + +The actor initiates one of the 1 business operations covered by this use case: data principal rights & grievance case management. + +## Main Success Flow + +1. The actor initiates **Data Principal Rights & Grievance Case Management**. The system performs the source-defined behavior: The service must support receipt, identity verification, routing, tracking, response, and evidence retention for Data Principal requests and grievances concerning access to information, correction, erasure, consent withdrawal, grievance redressal, and nomination, as applicable, including for individuals who do not hold application accounts. Requests must be routed to the responsible Data Fiduciary and handled within the applicable statutory or approved contractual time limit. A request channel must be available without requiring a general customer or supplier portal account. + +## Alternate Flows + +- No alternate business flow is specified by the source features. + +## Exception Flows + +- Any exceptions remain as specified in the source feature; no additional behavior is inferred. + +## Postconditions + +- Successful operations create or update only the business records and outcomes stated in the linked BRD features. +- Rejected operations do not bypass the validations and controls stated by those features. + +## Referenced Screens / Routes + +- Privacy Operations workflow screen(s) — route(s) to be specified during Stage 11 screen design + +## Child Functional Requirements + +- [FR-DATAPRINCIPALRIGHTS-001: Data Principal Rights & Grievance Case Management](functional-reqs.md#fr-dataprincipalrights-001) diff --git a/04_generated_documentation/03_requirements/use_cases/uc-023-privacy-breach-response/functional-reqs.md b/04_generated_documentation/03_requirements/use_cases/uc-023-privacy-breach-response/functional-reqs.md new file mode 100644 index 0000000..56bb316 --- /dev/null +++ b/04_generated_documentation/03_requirements/use_cases/uc-023-privacy-breach-response/functional-reqs.md @@ -0,0 +1,31 @@ +--- +id: UC-023-FR +version: 1.0.0 +status: Draft +--- + +# Functional Requirements — UC-023 Personal Data Breach Response Coordination + +| Field | Value | +|---|---| +| **Parent Use Case** | `UC-023` | +| **Status** | Draft | +| **Version** | 1.0.0 | + +## FR-PRIVACYBREACHRESPONSE-001: Personal Data Breach Response Coordination + +- **Requirement ID:** `FR-PRIVACYBREACHRESPONSE-001` +- **Parent UC:** `UC-023` +- **Source Feature:** `BRD-FR-049` +- **Priority:** Must (P0) +- **Referenced Screen / Route:** Privacy Operations & Security Operations workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **Business Rules:** None stated in the source feature. + +### Statement + +The service must support recording, triaging, investigation, impact assessment, remediation, and notification coordination for suspected or confirmed personal-data breaches. The platform operator must be able to identify affected tenants and notify the responsible tenant Data Fiduciary promptly when acting as its Data Processor. The workflow must support applicable notification content and deadlines to affected Data Principals and the Data Protection Board, including phased or subsequently amended statutory requirements. + +### Acceptance Criteria + +1. The requirement records, computes, or presents the source-defined data attributes: Incident ID, Detection Time, Affected Data/Tenants/Principals, Processor/Fiduciary Roles, Severity, Timeline, Evidence, Mitigation, Notifications and Delivery Status. +2. The outcome satisfies the source-defined acceptance intent: Each incident has an accountable owner and audit trail; the responsible Data Fiduciary can assemble required facts and evidence for notifications and demonstrate completion within applicable deadlines. diff --git a/04_generated_documentation/03_requirements/use_cases/uc-023-privacy-breach-response/use-case.md b/04_generated_documentation/03_requirements/use_cases/uc-023-privacy-breach-response/use-case.md new file mode 100644 index 0000000..804f609 --- /dev/null +++ b/04_generated_documentation/03_requirements/use_cases/uc-023-privacy-breach-response/use-case.md @@ -0,0 +1,56 @@ +--- +id: UC-023 +version: 1.0.0 +status: Draft +--- + +# UC-023 — Personal Data Breach Response Coordination + +| Field | Value | +|---|---| +| **Use Case ID** | `UC-023` | +| **Name** | Personal Data Breach Response Coordination | +| **Owning Domain** | Privacy Operations & Security Operations | +| **Primary Actor(s)** | System Administrator / Tenant Administrator | +| **Supporting Actor(s)** | System Administrator; Tenant Administrator for tenant-scoped incidents | +| **Source Features** | `BRD-FR-049` | +| **Status** | Draft | +| **Version** | 1.0.0 | + +## Goal + +Coordinate assessment, remediation, and notification work for suspected or confirmed personal-data breaches. + +## Preconditions + +1. The actor is authenticated and has the role and tenant scope required by the source feature(s). +2. Any source records or master data explicitly required by the selected feature are available and in the required state. + +## Trigger + +The actor initiates one of the 1 business operations covered by this use case: personal data breach response coordination. + +## Main Success Flow + +1. The actor initiates **Personal Data Breach Response Coordination**. The system performs the source-defined behavior: The service must support recording, triaging, investigation, impact assessment, remediation, and notification coordination for suspected or confirmed personal-data breaches. The platform operator must be able to identify affected tenants and notify the responsible tenant Data Fiduciary promptly when acting as its Data Processor. The workflow must support applicable notification content and deadlines to affected Data Principals and the Data Protection Board, including phased or subsequently amended statutory requirements. + +## Alternate Flows + +- No alternate business flow is specified by the source features. + +## Exception Flows + +- Any exceptions remain as specified in the source feature; no additional behavior is inferred. + +## Postconditions + +- Successful operations create or update only the business records and outcomes stated in the linked BRD features. +- Rejected operations do not bypass the validations and controls stated by those features. + +## Referenced Screens / Routes + +- Privacy Operations & Security Operations workflow screen(s) — route(s) to be specified during Stage 11 screen design + +## Child Functional Requirements + +- [FR-PRIVACYBREACHRESPONSE-001: Personal Data Breach Response Coordination](functional-reqs.md#fr-privacybreachresponse-001) diff --git a/04_generated_documentation/03_requirements/use_cases/uc-024-retention-erasure/functional-reqs.md b/04_generated_documentation/03_requirements/use_cases/uc-024-retention-erasure/functional-reqs.md new file mode 100644 index 0000000..f37e180 --- /dev/null +++ b/04_generated_documentation/03_requirements/use_cases/uc-024-retention-erasure/functional-reqs.md @@ -0,0 +1,31 @@ +--- +id: UC-024-FR +version: 1.0.0 +status: Draft +--- + +# Functional Requirements — UC-024 Purpose-Aware Retention, Erasure and Legal Holds + +| Field | Value | +|---|---| +| **Parent Use Case** | `UC-024` | +| **Status** | Draft | +| **Version** | 1.0.0 | + +## FR-RETENTIONERASURE-001: Purpose-Aware Retention, Erasure & Legal Hold + +- **Requirement ID:** `FR-RETENTIONERASURE-001` +- **Parent UC:** `UC-024` +- **Source Feature:** `BRD-FR-050` +- **Priority:** Must (P0) +- **Referenced Screen / Route:** Privacy Operations & Data Governance workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **Business Rules:** None stated in the source feature. + +### Statement + +Use four internal sensitivity levels—Public, Internal, Confidential, and Restricted—with a separate personal-data flag and processing-purpose tag; these are product handling labels, not statutory DPDP classifications. The responsible Data Fiduciary must approve retention schedules by personal-data category and processing purpose after legal/accounting review (tenant firms for trading data; ATB operator for its own account, security, and service data). Authorized operators must be able to apply these schedules by tenant/platform responsibility and applicable legal obligation. The service must support correction, erasure or irreversible de-identification when required, legal holds and statutory retention exceptions, and deletion handling for derived copies and processors, including backups according to the approved schedule. Statutory processing-log retention requirements must be represented separately from general business-record retention. + +### Acceptance Criteria + +1. The requirement records, computes, or presents the source-defined data attributes: Data Category, Purpose, Responsible Fiduciary, Retention Rule, Trigger Date, Legal Basis/Exception, Hold Status, Erasure/De-identification Evidence, Processor Completion. +2. The outcome satisfies the source-defined acceptance intent: Data is not erased while an applicable hold or mandatory retention obligation applies; once all approved purposes and legal exceptions expire, erasure is trackable across applicable system copies and contracted processors. diff --git a/04_generated_documentation/03_requirements/use_cases/uc-024-retention-erasure/use-case.md b/04_generated_documentation/03_requirements/use_cases/uc-024-retention-erasure/use-case.md new file mode 100644 index 0000000..86b272f --- /dev/null +++ b/04_generated_documentation/03_requirements/use_cases/uc-024-retention-erasure/use-case.md @@ -0,0 +1,56 @@ +--- +id: UC-024 +version: 1.0.0 +status: Draft +--- + +# UC-024 — Purpose-Aware Retention, Erasure and Legal Holds + +| Field | Value | +|---|---| +| **Use Case ID** | `UC-024` | +| **Name** | Purpose-Aware Retention, Erasure and Legal Holds | +| **Owning Domain** | Privacy Operations & Data Governance | +| **Primary Actor(s)** | Tenant Administrator / System Administrator | +| **Supporting Actor(s)** | Tenant Administrator; System Administrator for platform-controlled processing | +| **Source Features** | `BRD-FR-050` | +| **Status** | Draft | +| **Version** | 1.0.0 | + +## Goal + +Apply approved retention schedules and manage correction, erasure, de-identification, legal holds, exceptions, and deletion evidence. + +## Preconditions + +1. The actor is authenticated and has the role and tenant scope required by the source feature(s). +2. Any source records or master data explicitly required by the selected feature are available and in the required state. + +## Trigger + +The actor initiates one of the 1 business operations covered by this use case: purpose-aware retention, erasure & legal hold. + +## Main Success Flow + +1. The actor initiates **Purpose-Aware Retention, Erasure & Legal Hold**. The system performs the source-defined behavior: Use four internal sensitivity levels—Public, Internal, Confidential, and Restricted—with a separate personal-data flag and processing-purpose tag; these are product handling labels, not statutory DPDP classifications. The responsible Data Fiduciary must approve retention schedules by personal-data category and processing purpose after legal/accounting review (tenant firms for trading data; ATB operator for its own account, security, and service data). Authorized operators must be able to apply these schedules by tenant/platform responsibility and applicable legal obligation. The service must support correction, erasure or irreversible de-identification when required, legal holds and statutory retention exceptions, and deletion handling for derived copies and processors, including backups according to the approved schedule. Statutory processing-log retention requirements must be represented separately from general business-record retention. + +## Alternate Flows + +- No alternate business flow is specified by the source features. + +## Exception Flows + +- Any exceptions remain as specified in the source feature; no additional behavior is inferred. + +## Postconditions + +- Successful operations create or update only the business records and outcomes stated in the linked BRD features. +- Rejected operations do not bypass the validations and controls stated by those features. + +## Referenced Screens / Routes + +- Privacy Operations & Data Governance workflow screen(s) — route(s) to be specified during Stage 11 screen design + +## Child Functional Requirements + +- [FR-RETENTIONERASURE-001: Purpose-Aware Retention, Erasure & Legal Hold](functional-reqs.md#fr-retentionerasure-001) diff --git a/04_generated_documentation/03_requirements/use_cases/uc-025-processor-governance/functional-reqs.md b/04_generated_documentation/03_requirements/use_cases/uc-025-processor-governance/functional-reqs.md new file mode 100644 index 0000000..104e559 --- /dev/null +++ b/04_generated_documentation/03_requirements/use_cases/uc-025-processor-governance/functional-reqs.md @@ -0,0 +1,31 @@ +--- +id: UC-025-FR +version: 1.0.0 +status: Draft +--- + +# Functional Requirements — UC-025 Processor and Subprocessor Governance + +| Field | Value | +|---|---| +| **Parent Use Case** | `UC-025` | +| **Status** | Draft | +| **Version** | 1.0.0 | + +## FR-PROCESSORGOVERNANCE-001: Data Processor & Subprocessor Governance + +- **Requirement ID:** `FR-PROCESSORGOVERNANCE-001` +- **Parent UC:** `UC-025` +- **Source Feature:** `BRD-FR-051` +- **Priority:** Must (P0) +- **Referenced Screen / Route:** Platform Governance workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **Business Rules:** None stated in the source feature. + +### Statement + +The platform operator must maintain an inventory of processors and subprocessors used for tenant personal data, their processing purpose and location, applicable safeguards and contractual obligations, and status of due diligence. The operator must support tenant Data Fiduciaries with information and operational assistance needed for security safeguards, Data Principal requests, breach response, retention, and erasure obligations. + +### Acceptance Criteria + +1. The requirement records, computes, or presents the source-defined data attributes: Processor/Subprocessor, Processing Purpose, Data Categories, Processing Location, Contract/Safeguard Reference, Due-Diligence Status, Incident/Request Assistance Record. +2. The outcome satisfies the source-defined acceptance intent: Processor and subprocessor relationships are identifiable and reviewable; support actions are attributable and consistent with documented tenant instructions and applicable contractual safeguards. diff --git a/04_generated_documentation/03_requirements/use_cases/uc-025-processor-governance/use-case.md b/04_generated_documentation/03_requirements/use_cases/uc-025-processor-governance/use-case.md new file mode 100644 index 0000000..0a52ccc --- /dev/null +++ b/04_generated_documentation/03_requirements/use_cases/uc-025-processor-governance/use-case.md @@ -0,0 +1,56 @@ +--- +id: UC-025 +version: 1.0.0 +status: Draft +--- + +# UC-025 — Processor and Subprocessor Governance + +| Field | Value | +|---|---| +| **Use Case ID** | `UC-025` | +| **Name** | Processor and Subprocessor Governance | +| **Owning Domain** | Platform Governance | +| **Primary Actor(s)** | System Administrator | +| **Supporting Actor(s)** | None stated | +| **Source Features** | `BRD-FR-051` | +| **Status** | Draft | +| **Version** | 1.0.0 | + +## Goal + +Maintain processor and subprocessor records and provide accountable operational assistance to tenant Data Fiduciaries. + +## Preconditions + +1. The actor is authenticated and has the role and tenant scope required by the source feature(s). +2. Any source records or master data explicitly required by the selected feature are available and in the required state. + +## Trigger + +The actor initiates one of the 1 business operations covered by this use case: data processor & subprocessor governance. + +## Main Success Flow + +1. The actor initiates **Data Processor & Subprocessor Governance**. The system performs the source-defined behavior: The platform operator must maintain an inventory of processors and subprocessors used for tenant personal data, their processing purpose and location, applicable safeguards and contractual obligations, and status of due diligence. The operator must support tenant Data Fiduciaries with information and operational assistance needed for security safeguards, Data Principal requests, breach response, retention, and erasure obligations. + +## Alternate Flows + +- No alternate business flow is specified by the source features. + +## Exception Flows + +- Any exceptions remain as specified in the source feature; no additional behavior is inferred. + +## Postconditions + +- Successful operations create or update only the business records and outcomes stated in the linked BRD features. +- Rejected operations do not bypass the validations and controls stated by those features. + +## Referenced Screens / Routes + +- Platform Governance workflow screen(s) — route(s) to be specified during Stage 11 screen design + +## Child Functional Requirements + +- [FR-PROCESSORGOVERNANCE-001: Data Processor & Subprocessor Governance](functional-reqs.md#fr-processorgovernance-001) diff --git a/04_generated_documentation/03_requirements/use_cases/uc-026-tenant-operating-policies/functional-reqs.md b/04_generated_documentation/03_requirements/use_cases/uc-026-tenant-operating-policies/functional-reqs.md new file mode 100644 index 0000000..15f5e11 --- /dev/null +++ b/04_generated_documentation/03_requirements/use_cases/uc-026-tenant-operating-policies/functional-reqs.md @@ -0,0 +1,33 @@ +--- +id: UC-026-FR +version: 1.0.0 +status: Draft +--- + +# Functional Requirements — UC-026 Tenant Operating Policy Configuration + +| Field | Value | +|---|---| +| **Parent Use Case** | `UC-026` | +| **Status** | Draft | +| **Version** | 1.0.0 | + +## FR-TENANTOPERATINGPOLICIES-001: Tenant Operating Policy Configuration & Audit + +- **Requirement ID:** `FR-TENANTOPERATINGPOLICIES-001` +- **Parent UC:** `UC-026` +- **Source Feature:** `BRD-FR-052` +- **Priority:** Must (P0) +- **Referenced Screen / Route:** Tenant Business Administration workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **Business Rules:** None stated in the source feature. + +### Statement + +The service must provide tenant-scoped configuration for the provisional operating thresholds listed in §6.2, including market-price variance, weighment shortage, bag tare/packing, commodity quality grading/deductions, credit exposure, warehouse capacity/adjustments/transfers, dispatch tolerances, and alert timing. Policies must support commodity, grade, contract, or other applicable scope and effective dates where needed. Only roles authorized in the tenant permission model may change them; changes must record actor, timestamp, reason, prior value, and new value. Seed values remain provisional. Before each affected live workflow is enabled for a tenant, that tenant’s Partner/Managing Director or delegated authorized business owner must review and confirm or edit every applicable threshold. Missing or unreviewed thresholds block only the affected risk-sensitive workflow. Confirmed policies are versioned with an effective date and changes are audited. + +### Acceptance Criteria + +1. The requirement records, computes, or presents the source-defined data attributes: Tenant ID, Policy Type, Scope (Commodity/Grade/Contract), Value, Unit, Effective From/To, Changed By/At, Reason, Prior Value. +2. The outcome satisfies the source-defined acceptance intent: One tenant’s policy never changes another tenant’s behavior. Applicable policy versions can be identified for every governed transaction; unauthorized or unaudited changes are rejected. Candidate values are never silently treated as universally validated rules; the affected workflow remains disabled for a tenant until its authorized business owner confirms or edits the applicable values. + +--- diff --git a/04_generated_documentation/03_requirements/use_cases/uc-026-tenant-operating-policies/use-case.md b/04_generated_documentation/03_requirements/use_cases/uc-026-tenant-operating-policies/use-case.md new file mode 100644 index 0000000..250cefa --- /dev/null +++ b/04_generated_documentation/03_requirements/use_cases/uc-026-tenant-operating-policies/use-case.md @@ -0,0 +1,56 @@ +--- +id: UC-026 +version: 1.0.0 +status: Draft +--- + +# UC-026 — Tenant Operating Policy Configuration + +| Field | Value | +|---|---| +| **Use Case ID** | `UC-026` | +| **Name** | Tenant Operating Policy Configuration | +| **Owning Domain** | Tenant Business Administration | +| **Primary Actor(s)** | Partner / Managing Director / authorized tenant functional managers | +| **Supporting Actor(s)** | Partner, Managing Director; authorized tenant functional managers | +| **Source Features** | `BRD-FR-052` | +| **Status** | Draft | +| **Version** | 1.0.0 | + +## Goal + +Review, configure, approve, and audit tenant-scoped operating thresholds before affected workflows are enabled. + +## Preconditions + +1. The actor is authenticated and has the role and tenant scope required by the source feature(s). +2. Any source records or master data explicitly required by the selected feature are available and in the required state. + +## Trigger + +The actor initiates one of the 1 business operations covered by this use case: tenant operating policy configuration & audit. + +## Main Success Flow + +1. The actor initiates **Tenant Operating Policy Configuration & Audit**. The system performs the source-defined behavior: The service must provide tenant-scoped configuration for the provisional operating thresholds listed in §6.2, including market-price variance, weighment shortage, bag tare/packing, commodity quality grading/deductions, credit exposure, warehouse capacity/adjustments/transfers, dispatch tolerances, and alert timing. Policies must support commodity, grade, contract, or other applicable scope and effective dates where needed. Only roles authorized in the tenant permission model may change them; changes must record actor, timestamp, reason, prior value, and new value. Seed values remain provisional. Before each affected live workflow is enabled for a tenant, that tenant’s Partner/Managing Director or delegated authorized business owner must review and confirm or edit every applicable threshold. Missing or unreviewed thresholds block only the affected risk-sensitive workflow. Confirmed policies are versioned with an effective date and changes are audited. + +## Alternate Flows + +- No alternate business flow is specified by the source features. + +## Exception Flows + +- Any exceptions remain as specified in the source feature; no additional behavior is inferred. + +## Postconditions + +- Successful operations create or update only the business records and outcomes stated in the linked BRD features. +- Rejected operations do not bypass the validations and controls stated by those features. + +## Referenced Screens / Routes + +- Tenant Business Administration workflow screen(s) — route(s) to be specified during Stage 11 screen design + +## Child Functional Requirements + +- [FR-TENANTOPERATINGPOLICIES-001: Tenant Operating Policy Configuration & Audit](functional-reqs.md#fr-tenantoperatingpolicies-001) diff --git a/prompts/20261011T074829Z-session-greenfield-bootstrap.md b/prompts/20261011T074829Z-session-greenfield-bootstrap.md index ad8f45d..89789b4 100644 --- a/prompts/20261011T074829Z-session-greenfield-bootstrap.md +++ b/prompts/20261011T074829Z-session-greenfield-bootstrap.md @@ -291,3 +291,27 @@ The first extraction attempt stopped on a heading-parser mismatch after the PRD ## 2026-10-11T09:46:12Z — Assistant — Action summary Completed Stage 1 extraction. Updated the master context to reflect the bounded Stage 1 baseline and corrected `AMB-006` to make qualified review a production-release gate. `brd_inventory.md` contains all 52 PRD functional requirements with source section, actor, priority, statement, Greenfield legacy-comparison status, and downstream mapping status, plus all 14 NFRs. Created `CKPT-007`. Verification: pending. + +## 2026-10-11T09:53:40Z — User + +Asked: “As per the process, which is next action” + +## 2026-10-11T09:53:40Z — Assistant — Action summary + +Checked UP-AI guidance, active technology profile, current checkpoint, and master context. The current checkpoint is `CKPT-007` (Stage 1 complete). Next: review `04_generated_documentation/01_source_inventories/brd_inventory.md` for completeness and consistency, then proceed to Stage 5 by authoring use cases with `/up-use-case-author`. Carry `ASM-001`–`ASM-003` forward; keep `AMB-001`, `AMB-006`, and `AMB-008` open as evidence/release gates. No artifacts other than this transcript were changed; no tests or gates run. + +## 2026-10-11T09:56:00Z — User + +Invoked `/up-use-case-author` and supplied its canonical skill procedure. + +## 2026-10-11T09:56:00Z — Assistant — Action summary + +Authored `UC-002` (Record Daily Mandi Arrivals and Prices) with child requirements `FR-MKT-001` and `FR-MKT-002`, sourced to `BRD-FR-001` and `BRD-FR-002`. Ran Gate 5.1: zero Critical and zero validator Major findings; `git diff --check` passed. Semantic review found the existing `UC-001` authentication FRs cite `BRD-FR-001`–`003`, which are Market Desk requirements in the baselined PRD. Recorded this as a Major follow-up in the traceability graph; a CR disposition is required before altering that baseline mapping. No tests run. + +## 2026-10-11T10:14:08Z — User + +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. From aaa26a400aa7be3f9fce4aa8478702707fc2d15c Mon Sep 17 00:00:00 2001 From: Prashant Shendre Date: Sun, 11 Oct 2026 16:18:57 +0530 Subject: [PATCH 03/13] reconciliation --- .../architecture_risk_register.md | 8 +- .../change_request_register.md | 52 ++++++++- .../checkpoint-009-cr001-uc001-review.md | 21 ++++ .../checkpoint-010-cr001-rebaseline.md | 23 ++++ ...checkpoint-011-cr001-restored-artifacts.md | 22 ++++ .../checkpoints/checkpoint_index.md | 6 ++ .../00_process_control/traceability_graph.md | 59 +++++----- .../00_process_control/traceability_index.md | 10 +- .../01_source_inventories/brd_inventory.md | 4 +- .../functional-reqs.md | 82 ++++++++------ .../uc-001_user-authentication/use-case.md | 101 ++++++++++-------- .../functional-reqs.md | 26 +---- .../uc-017-tenant-security-audit/use-case.md | 21 ++-- .../04_architecture_design/hld.md | 9 +- .../lld/LLD-001_auth_service.md | 47 ++------ .../iteration-01/iteration_backlog.md | 8 +- .../iterations/iteration-01/iteration_plan.md | 18 ++-- .../iteration-01/iteration_surface_matrix.md | 10 +- .../iteration-01/parallel_work_plan.md | 8 +- .../06_wireframes/DESIGN.md | 12 +++ .../TC-001_auth_service.md | 28 ++--- .../iteration-01/MANUAL_TESTING_GUIDE.md | 32 +++--- .../07_test_design/regression_test_cases.md | 8 +- .../07_test_design/test_strategy.md | 6 +- ...11T074829Z-session-greenfield-bootstrap.md | 28 +++++ 25 files changed, 416 insertions(+), 233 deletions(-) create mode 100644 04_generated_documentation/00_process_control/checkpoints/checkpoint-009-cr001-uc001-review.md create mode 100644 04_generated_documentation/00_process_control/checkpoints/checkpoint-010-cr001-rebaseline.md create mode 100644 04_generated_documentation/00_process_control/checkpoints/checkpoint-011-cr001-restored-artifacts.md diff --git a/04_generated_documentation/00_process_control/architecture_risk_register.md b/04_generated_documentation/00_process_control/architecture_risk_register.md index 3333a71..05f9708 100644 --- a/04_generated_documentation/00_process_control/architecture_risk_register.md +++ b/04_generated_documentation/00_process_control/architecture_risk_register.md @@ -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`. | diff --git a/04_generated_documentation/00_process_control/change_request_register.md b/04_generated_documentation/00_process_control/change_request_register.md index 8cd2260..eb06a18 100644 --- a/04_generated_documentation/00_process_control/change_request_register.md +++ b/04_generated_documentation/00_process_control/change_request_register.md @@ -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. diff --git a/04_generated_documentation/00_process_control/checkpoints/checkpoint-009-cr001-uc001-review.md b/04_generated_documentation/00_process_control/checkpoints/checkpoint-009-cr001-uc001-review.md new file mode 100644 index 0000000..94b61aa --- /dev/null +++ b/04_generated_documentation/00_process_control/checkpoints/checkpoint-009-cr001-uc001-review.md @@ -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. diff --git a/04_generated_documentation/00_process_control/checkpoints/checkpoint-010-cr001-rebaseline.md b/04_generated_documentation/00_process_control/checkpoints/checkpoint-010-cr001-rebaseline.md new file mode 100644 index 0000000..f7cfad1 --- /dev/null +++ b/04_generated_documentation/00_process_control/checkpoints/checkpoint-010-cr001-rebaseline.md @@ -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. diff --git a/04_generated_documentation/00_process_control/checkpoints/checkpoint-011-cr001-restored-artifacts.md b/04_generated_documentation/00_process_control/checkpoints/checkpoint-011-cr001-restored-artifacts.md new file mode 100644 index 0000000..99c53a7 --- /dev/null +++ b/04_generated_documentation/00_process_control/checkpoints/checkpoint-011-cr001-restored-artifacts.md @@ -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. 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 e40f654..204b2e6 100644 --- a/04_generated_documentation/00_process_control/checkpoints/checkpoint_index.md +++ b/04_generated_documentation/00_process_control/checkpoints/checkpoint_index.md @@ -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` | diff --git a/04_generated_documentation/00_process_control/traceability_graph.md b/04_generated_documentation/00_process_control/traceability_graph.md index 070aa95..36935f2 100644 --- a/04_generated_documentation/00_process_control/traceability_graph.md +++ b/04_generated_documentation/00_process_control/traceability_graph.md @@ -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. diff --git a/04_generated_documentation/00_process_control/traceability_index.md b/04_generated_documentation/00_process_control/traceability_index.md index 351d475..ff90170 100644 --- a/04_generated_documentation/00_process_control/traceability_index.md +++ b/04_generated_documentation/00_process_control/traceability_index.md @@ -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 | diff --git a/04_generated_documentation/01_source_inventories/brd_inventory.md b/04_generated_documentation/01_source_inventories/brd_inventory.md index 40b543d..48b22c1 100644 --- a/04_generated_documentation/01_source_inventories/brd_inventory.md +++ b/04_generated_documentation/01_source_inventories/brd_inventory.md @@ -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` | diff --git a/04_generated_documentation/03_requirements/use_cases/uc-001_user-authentication/functional-reqs.md b/04_generated_documentation/03_requirements/use_cases/uc-001_user-authentication/functional-reqs.md index 9dc8f33..e65f942 100644 --- a/04_generated_documentation/03_requirements/use_cases/uc-001_user-authentication/functional-reqs.md +++ b/04_generated_documentation/03_requirements/use_cases/uc-001_user-authentication/functional-reqs.md @@ -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`. diff --git a/04_generated_documentation/03_requirements/use_cases/uc-001_user-authentication/use-case.md b/04_generated_documentation/03_requirements/use_cases/uc-001_user-authentication/use-case.md index 957ac89..5717547 100644 --- a/04_generated_documentation/03_requirements/use_cases/uc-001_user-authentication/use-case.md +++ b/04_generated_documentation/03_requirements/use_cases/uc-001_user-authentication/use-case.md @@ -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 ` 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) diff --git a/04_generated_documentation/03_requirements/use_cases/uc-017-tenant-security-audit/functional-reqs.md b/04_generated_documentation/03_requirements/use_cases/uc-017-tenant-security-audit/functional-reqs.md index 45d34a7..a473742 100644 --- a/04_generated_documentation/03_requirements/use_cases/uc-017-tenant-security-audit/functional-reqs.md +++ b/04_generated_documentation/03_requirements/use_cases/uc-017-tenant-security-audit/functional-reqs.md @@ -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` diff --git a/04_generated_documentation/03_requirements/use_cases/uc-017-tenant-security-audit/use-case.md b/04_generated_documentation/03_requirements/use_cases/uc-017-tenant-security-audit/use-case.md index 3cf7678..61b111d 100644 --- a/04_generated_documentation/03_requirements/use_cases/uc-017-tenant-security-audit/use-case.md +++ b/04_generated_documentation/03_requirements/use_cases/uc-017-tenant-security-audit/use-case.md @@ -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) diff --git a/04_generated_documentation/04_architecture_design/hld.md b/04_generated_documentation/04_architecture_design/hld.md index c9434ec..844ff24 100644 --- a/04_generated_documentation/04_architecture_design/hld.md +++ b/04_generated_documentation/04_architecture_design/hld.md @@ -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 = ''` 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. diff --git a/04_generated_documentation/04_architecture_design/lld/LLD-001_auth_service.md b/04_generated_documentation/04_architecture_design/lld/LLD-001_auth_service.md index 0ad27fe..370bc5f 100644 --- a/04_generated_documentation/04_architecture_design/lld/LLD-001_auth_service.md +++ b/04_generated_documentation/04_architecture_design/lld/LLD-001_auth_service.md @@ -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:`). -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`. 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 c19a430..6e596d7 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,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 | 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 8cff6a2..acb35c6 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 @@ -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. 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 8f00eb7..95e6bfe 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 @@ -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 | 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 95cce06..298685e 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 @@ -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`) diff --git a/04_generated_documentation/06_wireframes/DESIGN.md b/04_generated_documentation/06_wireframes/DESIGN.md index 03d1a27..9269d41 100644 --- a/04_generated_documentation/06_wireframes/DESIGN.md +++ b/04_generated_documentation/06_wireframes/DESIGN.md @@ -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 /