From 44167562cfad46a5e6d71a34fac7bc1bb3ca2093 Mon Sep 17 00:00:00 2001 From: Prashant Shendre Date: Sun, 11 Oct 2026 19:31:53 +0530 Subject: [PATCH] Arch decisions signed off and SRS created (stage 8) --- .../00_process_control/ambiguity_register.md | 2 +- ...kpoint-013-stage-7-approval-stage-8-srs.md | 23 + .../checkpoints/checkpoint_index.md | 1 + .../00_process_control/decision_log.md | 1 + .../00_process_control/master_context.md | 4 +- .../00_process_control/traceability_graph.md | 73 +- .../00_process_control/traceability_index.md | 4 + .../SRS-001_stage8_system_requirements.md | 2492 +++++++++++++++++ .../architecture_spike_report.md | 22 +- .../deployment_spike.md | 2 +- .../04_architecture_design/hld.md | 4 +- .../lld/LLD-001_auth_service.md | 2 +- .../LLD-002_tenant_context_and_isolation.md | 4 +- .../LLD-003_receiving_quality_inventory.md | 2 +- .../lld/LLD-004_financial_controls.md | 2 +- .../lld/LLD-005_reporting_and_events.md | 2 +- .../lld/LLD-006_privacy_lifecycle.md | 2 +- ...11T074829Z-session-greenfield-bootstrap.md | 16 + 18 files changed, 2628 insertions(+), 30 deletions(-) create mode 100644 04_generated_documentation/00_process_control/checkpoints/checkpoint-013-stage-7-approval-stage-8-srs.md create mode 100644 04_generated_documentation/03_requirements/SRS-001_stage8_system_requirements.md diff --git a/04_generated_documentation/00_process_control/ambiguity_register.md b/04_generated_documentation/00_process_control/ambiguity_register.md index 1dcd79b..bf788cc 100644 --- a/04_generated_documentation/00_process_control/ambiguity_register.md +++ b/04_generated_documentation/00_process_control/ambiguity_register.md @@ -18,4 +18,4 @@ Open requirements and architecture questions are tracked here (`AMB-xxx`). Unres | 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 | — | -| AMB-009 | 2026-10-11 | Stage 7 | Which candidate architecture patterns should be adopted for the Stage 7 walking skeleton, and what evidence is required before full-breadth design? | The Stage 7 report proposes transaction-local PostgreSQL tenant context with RLS, server-verified UC-019 membership, append-only audit and a transactional outbox, Keycloak session/logout semantics, provider-neutral HA/deployment controls, and an in-scope runtime validation threshold. These are not yet approved implementation decisions. | Candidate analysis is in 04_generated_documentation/04_architecture_design/architecture_spike_report.md; obtain human-lead approve/adjust/defer disposition. Runtime proof is explicitly pending product implementation/environment. | Open | — | +| AMB-009 | 2026-10-11 | Stage 7 | Which candidate architecture patterns should be adopted for the Stage 7 walking skeleton, and what evidence is required before full-breadth design? | The Stage 7 report proposes transaction-local PostgreSQL tenant context with RLS, server-verified UC-019 membership, append-only audit and a transactional outbox, Keycloak session/logout semantics, provider-neutral HA/deployment controls, and runtime validation. | Human lead approved the candidate modular-monolith/reference patterns as the Stage 7 design baseline (`DEC-021`) and authorized Stage 8/9 to proceed. Exact Keycloak session/logout contract, hosting and private-document storage providers, runtime proof, and load evidence remain open; no runtime validation is claimed. | Partially Resolved | Human lead, 2026-10-11 | diff --git a/04_generated_documentation/00_process_control/checkpoints/checkpoint-013-stage-7-approval-stage-8-srs.md b/04_generated_documentation/00_process_control/checkpoints/checkpoint-013-stage-7-approval-stage-8-srs.md new file mode 100644 index 0000000..d0c822b --- /dev/null +++ b/04_generated_documentation/00_process_control/checkpoints/checkpoint-013-stage-7-approval-stage-8-srs.md @@ -0,0 +1,23 @@ +# Checkpoint 013 — Stage 7 Approval and Stage 8 SRS + +- **Checkpoint ID:** CKPT-013 +- **Date:** 2026-10-11 +- **Active Stage:** Stage 7 approved; Stage 8 derived; Stage 9 next +- **Active Track:** Greenfield, India-first, multi-tenant Agriculture Trading Backoffice (ATB) +- **Active Skill:** up-srs-derive + +## Completed +- Human lead approved the Stage 7 candidate architecture patterns as the design baseline and authorized proceeding (`DEC-021`). The architecture report and Stage 7 HLD/LLDs/deployment artifacts now record reviewed design-baseline status. +- Partially resolved `AMB-009`: baseline patterns are approved; exact Keycloak logout/session details, hosting/storage selections, runtime proof, and load evidence remain open. +- Derived one uniquely identified, explicitly `parent_fr`-linked SRS record for each of the 54 FRs, plus four cross-cutting NFRs with explicit `parent_fr: cross-cutting` and a full 54-FR scope list. +- Updated the traceability graph and index with all 54 FR-to-SRS mappings. +- No runtime/load tests or product implementation were performed. + +## Open Items +- Stage 9 `/up-hld-lld-generate` must complete architecture linkage for every FR. +- Gate 9.1 has not been run; it follows Stage 9. +- `AMB-001`, `AMB-006`, and `AMB-008` remain evidence-gated; `AMB-009` remains partially open for implementation-level details/evidence. +- Iteration-01 remains Incomplete / Pending Construction; Gate 14.1 retains two Critical findings (dense QA workbook and Bruno collections missing). + +## Exact Next Action +Run `/up-hld-lld-generate` for the remaining, non-architecturally-significant use cases using the approved Stage 7 service template, ensure every FR has HLD/LLD linkage, then run `/up-traceability-gate 9.1`. Do not mark requirements Delivered or claim runtime validation. 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 2f61033..9100177 100644 --- a/04_generated_documentation/00_process_control/checkpoints/checkpoint_index.md +++ b/04_generated_documentation/00_process_control/checkpoints/checkpoint_index.md @@ -35,3 +35,4 @@ | `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` | | CKPT-012 | 2026-10-11 | Stage 6 complete / Stage 7 human review | Scored all 26 UCs/54 FRs; 16 architecturally significant. Drafted candidate HLD, LLDs, deployment view, and spike report; design walkthrough only, no runtime proof. | AMB-009 human-lead disposition; runtime validation and Gate 9.1 remain pending; iteration-01 Gate 14.1 blockers unchanged. | Review architecture_spike_report.md; record Approve / Approve with changes / Defer for AMB-009. If approved, proceed to Stage 8 SRS derivation. | checkpoint-012-stage-6-7-architecture-spike.md | +| CKPT-013 | 2026-10-11 | Stage 7 approved / Stage 8 derived | Human lead approved Stage 7 patterns (`DEC-021`); 54 FR-specific SRS records + 4 explicit cross-cutting NFRs authored and mapped. | Stage 9 HLD/LLD fan-out; Gate 9.1 follows Stage 9; runtime/load proof and AMB-001/006/008/009 evidence remain pending; Gate 14.1 blockers unchanged. | Run `/up-hld-lld-generate`, then `/up-traceability-gate 9.1`. | checkpoint-013-stage-7-approval-stage-8-srs.md | diff --git a/04_generated_documentation/00_process_control/decision_log.md b/04_generated_documentation/00_process_control/decision_log.md index 63f0fb7..76b141b 100644 --- a/04_generated_documentation/00_process_control/decision_log.md +++ b/04_generated_documentation/00_process_control/decision_log.md @@ -34,3 +34,4 @@ Project decisions made during requirements elicitation and bootstrap are recorde | 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 | +| DEC-021 | 2026-10-11 | Stage 7 | Approve the Stage 7 candidate modular-monolith architecture and reference patterns in `architecture_spike_report.md` as the design baseline for Stage 8 and Stage 9: verified membership before tenant RLS context, PostgreSQL transaction-local tenant context/RLS, append-only mutation audit, and a transactional outbox with idempotent consumers. | Retires the Stage 7 review gate so requirements derivation and detailed design can proceed from one approved architecture template. | Defer Stage 8 for a runnable prototype; approve changes to the candidate patterns. | Enables Stage 8 SRS derivation and Stage 9 full HLD/LLD fan-out. It is design approval only; runtime/load proof, exact Keycloak logout/session contract, hosting provider, document storage provider, and legal/load-test values remain pending. | Human lead (user approval, 2026-10-11) | diff --git a/04_generated_documentation/00_process_control/master_context.md b/04_generated_documentation/00_process_control/master_context.md index bab0d3b..6221542 100644 --- a/04_generated_documentation/00_process_control/master_context.md +++ b/04_generated_documentation/00_process_control/master_context.md @@ -86,6 +86,6 @@ stack: ## 4. Active Stage & Next Actions -- **Current Stage:** Stage 6 risk ranking is complete across 26 UCs. Stage 7 candidate HLD/LLD/deployment and a design-level walking-skeleton analysis are drafted; human-lead sign-off is pending under AMB-009. Runtime validation has not been performed. +- **Current Stage:** Stage 7 architecture design baseline approved by human lead (`DEC-021`). Stage 8 SRS derivation is complete for 54 FRs in `03_requirements/SRS-001_stage8_system_requirements.md`. No runtime/load validation has been performed. - **Active Iteration:** No iteration is in construction. Iteration-01 remains planned but Incomplete / Pending Construction; Gate 14.1 has two Critical findings (dense QA workbook and Bruno API collections missing). -- **Next:** Review 04_generated_documentation/04_architecture_design/architecture_spike_report.md and resolve AMB-009 (Approve / Approve with changes / Defer). If approved, continue to Stage 8 with /up-srs-derive, then Stage 9 /up-hld-lld-generate and Gate 9.1 before Construction. Gate 5.1 passed with two documented Major source-parser warnings for justified new auth requirements and no Critical findings. Carry ASM-001–ASM-003 and open production evidence gates AMB-001, AMB-006, AMB-008 forward. +- **Next:** Stage 9 `/up-hld-lld-generate` to complete HLD/LLD linkage for all FRs, then run Gate 9.1. Stage 7 runtime proof remains pending implementation/environment. Iteration-01 remains Incomplete / Pending Construction; Gate 14.1 has two Critical evidence findings (dense QA workbook and Bruno API collections). Carry `AMB-001`, `AMB-006`, `AMB-008`, `AMB-009` and `ASM-001`–`ASM-003` forward. diff --git a/04_generated_documentation/00_process_control/traceability_graph.md b/04_generated_documentation/00_process_control/traceability_graph.md index 018c140..ee4fd4e 100644 --- a/04_generated_documentation/00_process_control/traceability_graph.md +++ b/04_generated_documentation/00_process_control/traceability_graph.md @@ -16,12 +16,12 @@ - **Total Use Cases (UC-xxx):** 26 - **Total Functional Requirements (FR-xxx):** 54 -- **Total System Requirements (SRS):** 0 (Gate 9.1 not run) +- **Total System Requirements (SRS):** 54 FR-specific SRS records + 4 cross-cutting NFRs (Stage 8 complete) - **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 9.1 Status:** **Pending Stage 9 HLD/LLD fan-out** - **Gate 14.1 Status:** **Failed for iteration-01** (2 Critical construction-evidence findings; no FR Delivered) --- @@ -56,12 +56,12 @@ graph TD | Node ID | Node Name | Parent ID | Downstream Linkages | Status | |---|---|---|---|---| | `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` | Candidate HLD-ATB / LLD-001/002 (Stage 7); SRS pending Stage 8; story/test specs rebaselined under CR-001 | Baselined; pending Stage 7 sign-off and construction | -| `FR-AUTH-002` | Role-Based Authorization | `UC-001` | `BRD-FR-040`; candidate HLD-ATB / LLD-001/002 (Stage 7); SRS pending Stage 8 | Baselined; pending Stage 7 sign-off and construction | -| `FR-AUTH-003` | Session Handling and Logout | `UC-001` | `BRD-NFR-009`; candidate HLD-ATB / LLD-001/002 (Stage 7); SRS pending Stage 8 | Baselined; pending Stage 7 sign-off and construction | +| `FR-AUTH-001` | OIDC Authentication | `UC-001` | Approved Stage 7 HLD-ATB / LLD-001/002; `SRS-AUTH-001` (Stage 8); story/test specs rebaselined under CR-001 | Baselined; Stage 7 approved, construction pending | +| `FR-AUTH-002` | Role-Based Authorization | `UC-001` | `BRD-FR-040`; approved HLD-ATB / LLD-001/002; `SRS-AUTH-002` (Stage 8) | Baselined; Stage 7 approved, construction pending | +| `FR-AUTH-003` | Session Handling and Logout | `UC-001` | `BRD-NFR-009`; approved HLD-ATB / LLD-001/002; `SRS-AUTH-003` (Stage 8) | Baselined; Stage 7 approved, construction pending | -## Stage 7 Candidate Design Links (Draft; Gate 9.1 not run) +## Stage 7 Approved Design Links (DEC-021; Gate 9.1 pending Stage 9) | Use Case | Functional Requirements | Candidate Architecture Artifact | |---|---|---| @@ -185,3 +185,64 @@ These artifacts are candidate Stage 7 spike outputs. They do not replace Stage 8 - `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. + +## Stage 8 FR-to-SRS Traceability (54/54 linked) + +| Parent UC | Functional Requirement | System Requirement | Stage 7/9 Architecture Link | Status | +|---|---|---|---|---| +| `UC-001` | `FR-AUTH-001` | `SRS-AUTH-001` | HLD-ATB / LLD-001, LLD-002 | Stage 8 derived; Gate 9.1 pending Stage 9 | +| `UC-001` | `FR-AUTH-002` | `SRS-AUTH-002` | HLD-ATB / LLD-001, LLD-002 | Stage 8 derived; Gate 9.1 pending Stage 9 | +| `UC-001` | `FR-AUTH-003` | `SRS-AUTH-003` | HLD-ATB / LLD-001, LLD-002 | Stage 8 derived; Gate 9.1 pending Stage 9 | +| `UC-002` | `FR-MKT-001` | `SRS-MKT-001` | Stage 9 HLD/LLD pending | Stage 8 derived; Gate 9.1 pending Stage 9 | +| `UC-002` | `FR-MKT-002` | `SRS-MKT-002` | Stage 9 HLD/LLD pending | Stage 8 derived; Gate 9.1 pending Stage 9 | +| `UC-003` | `FR-MARKETTRENDANALYTICS-001` | `SRS-MARKETTRENDANALYTICS-001` | LLD-005 | Stage 8 derived; Gate 9.1 pending Stage 9 | +| `UC-004` | `FR-PROCUREMENTCONTRACTS-001` | `SRS-PROCUREMENTCONTRACTS-001` | LLD-004 | Stage 8 derived; Gate 9.1 pending Stage 9 | +| `UC-004` | `FR-PROCUREMENTCONTRACTS-002` | `SRS-PROCUREMENTCONTRACTS-002` | LLD-004 | Stage 8 derived; Gate 9.1 pending Stage 9 | +| `UC-004` | `FR-PROCUREMENTCONTRACTS-003` | `SRS-PROCUREMENTCONTRACTS-003` | LLD-004 | Stage 8 derived; Gate 9.1 pending Stage 9 | +| `UC-004` | `FR-PROCUREMENTCONTRACTS-004` | `SRS-PROCUREMENTCONTRACTS-004` | LLD-004 | Stage 8 derived; Gate 9.1 pending Stage 9 | +| `UC-005` | `FR-INWARDRECEIVING-001` | `SRS-INWARDRECEIVING-001` | LLD-003 | Stage 8 derived; Gate 9.1 pending Stage 9 | +| `UC-005` | `FR-INWARDRECEIVING-002` | `SRS-INWARDRECEIVING-002` | LLD-003 | Stage 8 derived; Gate 9.1 pending Stage 9 | +| `UC-005` | `FR-INWARDRECEIVING-003` | `SRS-INWARDRECEIVING-003` | LLD-003 | Stage 8 derived; Gate 9.1 pending Stage 9 | +| `UC-005` | `FR-INWARDRECEIVING-004` | `SRS-INWARDRECEIVING-004` | LLD-003 | Stage 8 derived; Gate 9.1 pending Stage 9 | +| `UC-005` | `FR-INWARDRECEIVING-005` | `SRS-INWARDRECEIVING-005` | LLD-003 | Stage 8 derived; Gate 9.1 pending Stage 9 | +| `UC-005` | `FR-INWARDRECEIVING-006` | `SRS-INWARDRECEIVING-006` | LLD-003 | Stage 8 derived; Gate 9.1 pending Stage 9 | +| `UC-006` | `FR-QUALITYANDLOTCONTROL-001` | `SRS-QUALITYANDLOTCONTROL-001` | LLD-003 | Stage 8 derived; Gate 9.1 pending Stage 9 | +| `UC-006` | `FR-QUALITYANDLOTCONTROL-002` | `SRS-QUALITYANDLOTCONTROL-002` | LLD-003 | Stage 8 derived; Gate 9.1 pending Stage 9 | +| `UC-006` | `FR-QUALITYANDLOTCONTROL-003` | `SRS-QUALITYANDLOTCONTROL-003` | LLD-003 | Stage 8 derived; Gate 9.1 pending Stage 9 | +| `UC-006` | `FR-QUALITYANDLOTCONTROL-004` | `SRS-QUALITYANDLOTCONTROL-004` | LLD-003 | Stage 8 derived; Gate 9.1 pending Stage 9 | +| `UC-007` | `FR-WAREHOUSEINVENTORY-001` | `SRS-WAREHOUSEINVENTORY-001` | LLD-003 | Stage 8 derived; Gate 9.1 pending Stage 9 | +| `UC-007` | `FR-WAREHOUSEINVENTORY-002` | `SRS-WAREHOUSEINVENTORY-002` | LLD-003 | Stage 8 derived; Gate 9.1 pending Stage 9 | +| `UC-007` | `FR-WAREHOUSEINVENTORY-003` | `SRS-WAREHOUSEINVENTORY-003` | LLD-003 | Stage 8 derived; Gate 9.1 pending Stage 9 | +| `UC-008` | `FR-SALESCONTRACTS-001` | `SRS-SALESCONTRACTS-001` | LLD-004 | Stage 8 derived; Gate 9.1 pending Stage 9 | +| `UC-008` | `FR-SALESCONTRACTS-002` | `SRS-SALESCONTRACTS-002` | LLD-004 | Stage 8 derived; Gate 9.1 pending Stage 9 | +| `UC-008` | `FR-SALESCONTRACTS-003` | `SRS-SALESCONTRACTS-003` | LLD-004 | Stage 8 derived; Gate 9.1 pending Stage 9 | +| `UC-009` | `FR-DISPATCHDELIVERY-001` | `SRS-DISPATCHDELIVERY-001` | LLD-004 | Stage 8 derived; Gate 9.1 pending Stage 9 | +| `UC-009` | `FR-DISPATCHDELIVERY-002` | `SRS-DISPATCHDELIVERY-002` | LLD-004 | Stage 8 derived; Gate 9.1 pending Stage 9 | +| `UC-009` | `FR-DISPATCHDELIVERY-003` | `SRS-DISPATCHDELIVERY-003` | LLD-004 | Stage 8 derived; Gate 9.1 pending Stage 9 | +| `UC-010` | `FR-FLEETREGISTRY-001` | `SRS-FLEETREGISTRY-001` | Stage 9 HLD/LLD pending | Stage 8 derived; Gate 9.1 pending Stage 9 | +| `UC-011` | `FR-CUSTOMERRECEIVABLES-001` | `SRS-CUSTOMERRECEIVABLES-001` | LLD-004 | Stage 8 derived; Gate 9.1 pending Stage 9 | +| `UC-011` | `FR-CUSTOMERRECEIVABLES-002` | `SRS-CUSTOMERRECEIVABLES-002` | LLD-004 | Stage 8 derived; Gate 9.1 pending Stage 9 | +| `UC-011` | `FR-CUSTOMERRECEIVABLES-003` | `SRS-CUSTOMERRECEIVABLES-003` | LLD-004 | Stage 8 derived; Gate 9.1 pending Stage 9 | +| `UC-011` | `FR-CUSTOMERRECEIVABLES-004` | `SRS-CUSTOMERRECEIVABLES-004` | LLD-004 | Stage 8 derived; Gate 9.1 pending Stage 9 | +| `UC-012` | `FR-SUPPLIERPAYABLES-001` | `SRS-SUPPLIERPAYABLES-001` | Stage 9 HLD/LLD pending | Stage 8 derived; Gate 9.1 pending Stage 9 | +| `UC-013` | `FR-OPERATINGEXPENSES-001` | `SRS-OPERATINGEXPENSES-001` | Stage 9 HLD/LLD pending | Stage 8 derived; Gate 9.1 pending Stage 9 | +| `UC-014` | `FR-OPERATIONALALERTS-001` | `SRS-OPERATIONALALERTS-001` | LLD-005 | Stage 8 derived; Gate 9.1 pending Stage 9 | +| `UC-015` | `FR-EXECUTIVEREPORTING-001` | `SRS-EXECUTIVEREPORTING-001` | LLD-005 | Stage 8 derived; Gate 9.1 pending Stage 9 | +| `UC-015` | `FR-EXECUTIVEREPORTING-002` | `SRS-EXECUTIVEREPORTING-002` | LLD-005 | Stage 8 derived; Gate 9.1 pending Stage 9 | +| `UC-016` | `FR-MASTERDATA-001` | `SRS-MASTERDATA-001` | Stage 9 HLD/LLD pending | Stage 8 derived; Gate 9.1 pending Stage 9 | +| `UC-016` | `FR-MASTERDATA-002` | `SRS-MASTERDATA-002` | Stage 9 HLD/LLD pending | Stage 8 derived; Gate 9.1 pending Stage 9 | +| `UC-017` | `FR-TENANTSECURITYAUDIT-001` | `SRS-TENANTSECURITYAUDIT-001` | LLD-002 | Stage 8 derived; Gate 9.1 pending Stage 9 | +| `UC-017` | `FR-TENANTSECURITYAUDIT-003` | `SRS-TENANTSECURITYAUDIT-003` | LLD-002 | Stage 8 derived; Gate 9.1 pending Stage 9 | +| `UC-018` | `FR-TENANTLIFECYCLE-001` | `SRS-TENANTLIFECYCLE-001` | LLD-002 | Stage 8 derived; Gate 9.1 pending Stage 9 | +| `UC-019` | `FR-TENANTMEMBERSHIPCONTEXT-001` | `SRS-TENANTMEMBERSHIPCONTEXT-001` | LLD-002 | Stage 8 derived; Gate 9.1 pending Stage 9 | +| `UC-019` | `FR-TENANTMEMBERSHIPCONTEXT-002` | `SRS-TENANTMEMBERSHIPCONTEXT-002` | LLD-002 | Stage 8 derived; Gate 9.1 pending Stage 9 | +| `UC-020` | `FR-TENANTSUPPORTSECURITY-001` | `SRS-TENANTSUPPORTSECURITY-001` | LLD-002 | Stage 8 derived; Gate 9.1 pending Stage 9 | +| `UC-020` | `FR-TENANTSUPPORTSECURITY-002` | `SRS-TENANTSUPPORTSECURITY-002` | LLD-002 | Stage 8 derived; Gate 9.1 pending Stage 9 | +| `UC-021` | `FR-PRIVACYPURPOSECONSENT-001` | `SRS-PRIVACYPURPOSECONSENT-001` | Stage 9 HLD/LLD pending | Stage 8 derived; Gate 9.1 pending Stage 9 | +| `UC-022` | `FR-DATAPRINCIPALRIGHTS-001` | `SRS-DATAPRINCIPALRIGHTS-001` | Stage 9 HLD/LLD pending | Stage 8 derived; Gate 9.1 pending Stage 9 | +| `UC-023` | `FR-PRIVACYBREACHRESPONSE-001` | `SRS-PRIVACYBREACHRESPONSE-001` | LLD-006 | Stage 8 derived; Gate 9.1 pending Stage 9 | +| `UC-024` | `FR-RETENTIONERASURE-001` | `SRS-RETENTIONERASURE-001` | LLD-006 | Stage 8 derived; Gate 9.1 pending Stage 9 | +| `UC-025` | `FR-PROCESSORGOVERNANCE-001` | `SRS-PROCESSORGOVERNANCE-001` | Stage 9 HLD/LLD pending | Stage 8 derived; Gate 9.1 pending Stage 9 | +| `UC-026` | `FR-TENANTOPERATINGPOLICIES-001` | `SRS-TENANTOPERATINGPOLICIES-001` | Stage 9 HLD/LLD pending | Stage 8 derived; Gate 9.1 pending Stage 9 | + +Cross-cutting NFRs `NFR-SEC-001`, `NFR-AUDIT-001`, `NFR-OPS-001`, and `NFR-CAP-001` each declare `parent_fr: cross-cutting` and explicitly enumerate the in-scope 54 FR IDs in `SRS-001_stage8_system_requirements.md`. diff --git a/04_generated_documentation/00_process_control/traceability_index.md b/04_generated_documentation/00_process_control/traceability_index.md index b7576ea..bf317b0 100644 --- a/04_generated_documentation/00_process_control/traceability_index.md +++ b/04_generated_documentation/00_process_control/traceability_index.md @@ -25,3 +25,7 @@ $$\text{BRD-FR-xxx} \longrightarrow \text{UC-xxx} \longrightarrow \text{FR-xxx} | `TR-001` | User Authentication & OIDC PKCE | All Users | `tech-profile.yaml`; `BRD-NFR-009` | `UC-001` | `FR-AUTH-001` | Candidate HLD-ATB / LLD-001/002 (Stage 7; draft) | `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` | Candidate HLD-ATB / LLD-001/002 (Stage 7; draft) | `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` | Candidate HLD-ATB / LLD-001/002 (Stage 7; draft) | `STORY-AUTH-003` | `TC-AUTH-004` | Pending Construction; not delivered | + +## Stage 8 SRS Traceability + +The complete 54-FR mapping, unique SRS IDs, and four explicitly scoped cross-cutting NFRs are maintained in [`SRS-001_stage8_system_requirements.md`](../03_requirements/SRS-001_stage8_system_requirements.md). Stage 7 candidate architecture patterns were approved as the design baseline by `DEC-021`; full Stage 9 HLD/LLD fan-out and Gate 9.1 remain pending. diff --git a/04_generated_documentation/03_requirements/SRS-001_stage8_system_requirements.md b/04_generated_documentation/03_requirements/SRS-001_stage8_system_requirements.md new file mode 100644 index 0000000..a1ffbb4 --- /dev/null +++ b/04_generated_documentation/03_requirements/SRS-001_stage8_system_requirements.md @@ -0,0 +1,2492 @@ +--- +id: SRS-CATALOG-001 +parent_ids: [UC-001, UC-002, UC-003, UC-004, UC-005, UC-006, UC-007, UC-008, UC-009, UC-010, UC-011, UC-012, UC-013, UC-014, UC-015, UC-016, UC-017, UC-018, UC-019, UC-020, UC-021, UC-022, UC-023, UC-024, UC-025, UC-026] +version: 1.0.0 +status: Draft — Stage 8 derived; Stage 9 design and Gate 9.1 pending +last_cr: CR-001 +--- + +# System Requirements Specification — ATB Stage 8 + +| Field | Value | +|---|---| +| **Scope** | All 54 functional requirements under UC-001–UC-026 | +| **Architecture baseline** | Stage 7 approved by human lead on 2026-10-11; design/runtime limitations remain explicit | +| **Technology profile** | FastAPI, React/TypeScript, Keycloak OIDC/PKCE + JWT bearer, PostgreSQL RLS, Valkey; `tech-profile.yaml` | +| **Stage status** | Derived; detailed API/schema/screen design belongs to Stage 9/11; Gate 9.1 follows Stage 9 | + +## 1. Derivation Rules + +Each record below preserves its owning FR as `parent_fr`. FR statements, source attributes, role rules, and acceptance constraints are carried forward as the authority. API paths, concrete SQL types/indexes, and screen routes are design details for the subsequent design stages where the FR does not already specify them. A missing value is called out as unresolved instead of filled by guesswork. + +## SRS-AUTH-001 — OIDC Authentication + +- **parent_fr:** `FR-AUTH-001` +- **parent_uc:** `UC-001` +- **Source:** `new — not in BRD` +- **FR basis:** 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. + +### Screen-to-system mapping + +- **Surface:** Login screen and authentication integration; route/contract details in LLD +- **System action:** The screen or initiating service presents the FR inputs, invokes the corresponding `OIDC Authentication` operation, and displays the recorded/computed outcome and any validation result. Exact route and field-level screen layout remain for Stage 11. + +### API requirement + +- **Resource / operation:** `OIDC Authentication`; operation semantics follow the FR basis above. The path, HTTP verb, pagination shape, and OpenAPI schema are assigned during Stage 9. +- **Request:** Accept only the FR-defined inputs and source-listed fields below; do not accept a client-supplied tenant selector as proof of access. Authenticated APIs resolve the verified tenant context before tenant data access, per approved Stage 7 patterns. +- **Response:** Return the FR-defined state, calculated result, or source-listed data required for the workflow; do not expose another tenant’s records. +- **Failure behavior:** Reject unauthenticated/unauthorized, invalid-state, and invalid-input requests without applying a partial business mutation. Return a stable validation/authorization error contract to be detailed in Stage 9. + +### Data requirement + +- **FR-defined attributes:** The FR does not enumerate a field list. Preserve the OIDC/authentication inputs and outcome explicitly defined in the FR; exact claims/session fields require the Stage 9 identity contract and remain open under AMB-009. +- **Constraints:** Preserve the units, enumerations, state names, formulas, and numeric boundaries stated in the FR basis and validation rules. Tenant-owned records use the approved transaction-local tenant context and PostgreSQL RLS; storage types and indexes are Stage 9 design. + +### Integration requirement + +- **Identity provider:** Use the configured Keycloak OIDC/PKCE integration and JWT bearer-token profile. Validate the successful provider response before establishing the application session; fail closed on invalid/unavailable identity responses. Do not add token lifetime, algorithm, or revocation-latency targets absent approved security evidence. + +### Validation and error handling + +- **Source validations/invariants:** 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 validations/invariants:** The application establishes a session only after validating a successful identity-provider response. +- **Source validations/invariants:** No signing algorithm, access-token lifetime, or latency value is fixed by this requirement; those values require approved security design evidence. +- **Failure atomicity:** A rejected command or failed transaction leaves no partial governed business state. + +### Audit requirement + +- This FR does not define a feature-specific audit record. Any governed mutation still uses the approved Stage 7 append-only transaction-audit pattern; do not invent additional audit fields or access-logging rules here. + +### NFR derivation + +- **Tenant security:** Applicable to tenant-scoped access in this FR; enforce verified membership/context before tenant data access, RLS isolation, and fail-closed authorization (NFR-SEC-001, `DEC-021`). +- **Platform availability/recovery:** This capability inherits the approved service targets in NFR-OPS-001 (`BRD-NFR-011`, `DEC-006`). +- **Capacity/performance:** Apply NFR-CAP-001 only where this FR participates in the stated tenant/user/load envelope or 50,000-row report validation; use an explicit FR-specific business response-time target only when present in this FR or source BRD. +- **Privacy:** If this FR processes personal data, apply applicable purpose, minimization, access, retention and legal-hold rules from `BRD-FR-047`–`BRD-FR-051`, `BRD-NFR-009`/`014`; do not supply unapproved legal bases or retention durations (`AMB-006`). + +## SRS-AUTH-002 — Role-Based Authorization + +- **parent_fr:** `FR-AUTH-002` +- **parent_uc:** `UC-001` +- **Source:** ``BRD-FR-040`` +- **FR basis:** 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. + +### Screen-to-system mapping + +- **Surface:** Authorization enforcement for protected business actions +- **System action:** The screen or initiating service presents the FR inputs, invokes the corresponding `Role-Based Authorization` operation, and displays the recorded/computed outcome and any validation result. Exact route and field-level screen layout remain for Stage 11. + +### API requirement + +- **Resource / operation:** `Role-Based Authorization`; operation semantics follow the FR basis above. The path, HTTP verb, pagination shape, and OpenAPI schema are assigned during Stage 9. +- **Request:** Accept only the FR-defined inputs and source-listed fields below; do not accept a client-supplied tenant selector as proof of access. Authenticated APIs resolve the verified tenant context before tenant data access, per approved Stage 7 patterns. +- **Response:** Return the FR-defined state, calculated result, or source-listed data required for the workflow; do not expose another tenant’s records. +- **Failure behavior:** Reject unauthenticated/unauthorized, invalid-state, and invalid-input requests without applying a partial business mutation. Return a stable validation/authorization error contract to be detailed in Stage 9. + +### Data requirement + +- **FR-defined attributes:** The FR does not enumerate a field list. Preserve the OIDC/authentication inputs and outcome explicitly defined in the FR; exact claims/session fields require the Stage 9 identity contract and remain open under AMB-009. +- **Constraints:** Preserve the units, enumerations, state names, formulas, and numeric boundaries stated in the FR basis and validation rules. Tenant-owned records use the approved transaction-local tenant context and PostgreSQL RLS; storage types and indexes are Stage 9 design. + +### Integration requirement + +- **External integration:** No external connector is explicitly required by this FR. Do not infer a weighbridge, payment, messaging, or other provider integration from manual capture or internal workflow language. + +### Validation and error handling + +- **Source validations/invariants:** 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`. +- **Source validations/invariants:** An operation not permitted by that matrix is denied before the business action is performed. +- **Source validations/invariants:** Quality Officers cannot edit prices, Yard Supervisors cannot confirm sales, and Sales Executives cannot override credit locks. +- **Source validations/invariants:** A tenant administrator's authorization applies only within that administrator's verified tenant membership; tenant context checks are performed by `UC-019`. +- **Failure atomicity:** A rejected command or failed transaction leaves no partial governed business state. + +### Audit requirement + +- This FR does not define a feature-specific audit record. Any governed mutation still uses the approved Stage 7 append-only transaction-audit pattern; do not invent additional audit fields or access-logging rules here. + +### NFR derivation + +- **Tenant security:** Applicable to tenant-scoped access in this FR; enforce verified membership/context before tenant data access, RLS isolation, and fail-closed authorization (NFR-SEC-001, `DEC-021`). +- **Platform availability/recovery:** This capability inherits the approved service targets in NFR-OPS-001 (`BRD-NFR-011`, `DEC-006`). +- **Capacity/performance:** Apply NFR-CAP-001 only where this FR participates in the stated tenant/user/load envelope or 50,000-row report validation; use an explicit FR-specific business response-time target only when present in this FR or source BRD. +- **Privacy:** If this FR processes personal data, apply applicable purpose, minimization, access, retention and legal-hold rules from `BRD-FR-047`–`BRD-FR-051`, `BRD-NFR-009`/`014`; do not supply unapproved legal bases or retention durations (`AMB-006`). + +## SRS-AUTH-003 — Session Handling and Logout + +- **parent_fr:** `FR-AUTH-003` +- **parent_uc:** `UC-001` +- **Source:** `new — not in BRD` +- **FR basis:** 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. + +### Screen-to-system mapping + +- **Surface:** Application session controls and authentication integration; endpoint contract in LLD +- **System action:** The screen or initiating service presents the FR inputs, invokes the corresponding `Session Handling and Logout` operation, and displays the recorded/computed outcome and any validation result. Exact route and field-level screen layout remain for Stage 11. + +### API requirement + +- **Resource / operation:** `Session Handling and Logout`; operation semantics follow the FR basis above. The path, HTTP verb, pagination shape, and OpenAPI schema are assigned during Stage 9. +- **Request:** Accept only the FR-defined inputs and source-listed fields below; do not accept a client-supplied tenant selector as proof of access. Authenticated APIs resolve the verified tenant context before tenant data access, per approved Stage 7 patterns. +- **Response:** Return the FR-defined state, calculated result, or source-listed data required for the workflow; do not expose another tenant’s records. +- **Failure behavior:** Reject unauthenticated/unauthorized, invalid-state, and invalid-input requests without applying a partial business mutation. Return a stable validation/authorization error contract to be detailed in Stage 9. + +### Data requirement + +- **FR-defined attributes:** The FR does not enumerate a field list. Preserve the OIDC/authentication inputs and outcome explicitly defined in the FR; exact claims/session fields require the Stage 9 identity contract and remain open under AMB-009. +- **Constraints:** Preserve the units, enumerations, state names, formulas, and numeric boundaries stated in the FR basis and validation rules. Tenant-owned records use the approved transaction-local tenant context and PostgreSQL RLS; storage types and indexes are Stage 9 design. + +### Integration requirement + +- **Identity provider:** Use the configured Keycloak OIDC/PKCE integration and JWT bearer-token profile. Validate the successful provider response before establishing the application session; fail closed on invalid/unavailable identity responses. Do not add token lifetime, algorithm, or revocation-latency targets absent approved security evidence. + +### Validation and error handling + +- **Source validations/invariants:** `BRD-NFR-009` requires session handling to be verified before production. The profile configures Keycloak OIDC and JWT bearer tokens. +- **Source validations/invariants:** After logout, the ended application session cannot be used to perform protected operations. +- **Source validations/invariants:** 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. +- **Failure atomicity:** A rejected command or failed transaction leaves no partial governed business state. + +### Audit requirement + +- This FR does not define a feature-specific audit record. Any governed mutation still uses the approved Stage 7 append-only transaction-audit pattern; do not invent additional audit fields or access-logging rules here. + +### NFR derivation + +- **Tenant security:** Applicable to tenant-scoped access in this FR; enforce verified membership/context before tenant data access, RLS isolation, and fail-closed authorization (NFR-SEC-001, `DEC-021`). +- **Platform availability/recovery:** This capability inherits the approved service targets in NFR-OPS-001 (`BRD-NFR-011`, `DEC-006`). +- **Capacity/performance:** Apply NFR-CAP-001 only where this FR participates in the stated tenant/user/load envelope or 50,000-row report validation; use an explicit FR-specific business response-time target only when present in this FR or source BRD. +- **Privacy:** If this FR processes personal data, apply applicable purpose, minimization, access, retention and legal-hold rules from `BRD-FR-047`–`BRD-FR-051`, `BRD-NFR-009`/`014`; do not supply unapproved legal bases or retention durations (`AMB-006`). + +## SRS-MKT-001 — Capture Daily Mandi Arrival Observations + +- **parent_fr:** `FR-MKT-001` +- **parent_uc:** `UC-002` +- **Source:** ``BRD-FR-001`` +- **FR basis:** 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`. + +### Screen-to-system mapping + +- **Surface:** Market Desk daily observation entry and list (route TBD in Stage 11) +- **System action:** The screen or initiating service presents the FR inputs, invokes the corresponding `Capture Daily Mandi Arrival Observations` operation, and displays the recorded/computed outcome and any validation result. Exact route and field-level screen layout remain for Stage 11. + +### API requirement + +- **Resource / operation:** `Capture Daily Mandi Arrival Observations`; operation semantics follow the FR basis above. The path, HTTP verb, pagination shape, and OpenAPI schema are assigned during Stage 9. +- **Request:** Accept only the FR-defined inputs and source-listed fields below; do not accept a client-supplied tenant selector as proof of access. Authenticated APIs resolve the verified tenant context before tenant data access, per approved Stage 7 patterns. +- **Response:** Return the FR-defined state, calculated result, or source-listed data required for the workflow; do not expose another tenant’s records. +- **Failure behavior:** Reject unauthenticated/unauthorized, invalid-state, and invalid-input requests without applying a partial business mutation. Return a stable validation/authorization error contract to be detailed in Stage 9. + +### Data requirement + +- **FR-defined attributes:** observation date, market yard, commodity, variety, grade, arrival quantity in MT, internal stock position in MT, observation source, and timestamp. +- **Constraints:** Preserve the units, enumerations, state names, formulas, and numeric boundaries stated in the FR basis and validation rules. Tenant-owned records use the approved transaction-local tenant context and PostgreSQL RLS; storage types and indexes are Stage 9 design. + +### Integration requirement + +- **External integration:** No external connector is explicitly required by this FR. Do not infer a weighbridge, payment, messaging, or other provider integration from manual capture or internal workflow language. + +### Validation and error handling + +- **Source validations/invariants:** 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`. +- **Source validations/invariants:** The system rejects an observation date later than the current date. +- **Source validations/invariants:** The system rejects arrival quantity below 0.0 MT and accepts 0.0 MT. +- **Source validations/invariants:** The system blocks a second observation with the same market, commodity, variety, and date. +- **Failure atomicity:** A rejected command or failed transaction leaves no partial governed business state. + +### Audit requirement + +- This FR does not define a feature-specific audit record. Any governed mutation still uses the approved Stage 7 append-only transaction-audit pattern; do not invent additional audit fields or access-logging rules here. + +### NFR derivation + +- **Tenant security:** Applicable to tenant-scoped access in this FR; enforce verified membership/context before tenant data access, RLS isolation, and fail-closed authorization (NFR-SEC-001, `DEC-021`). +- **Platform availability/recovery:** This capability inherits the approved service targets in NFR-OPS-001 (`BRD-NFR-011`, `DEC-006`). +- **Capacity/performance:** Apply NFR-CAP-001 only where this FR participates in the stated tenant/user/load envelope or 50,000-row report validation; use an explicit FR-specific business response-time target only when present in this FR or source BRD. +- **Privacy:** If this FR processes personal data, apply applicable purpose, minimization, access, retention and legal-hold rules from `BRD-FR-047`–`BRD-FR-051`, `BRD-NFR-009`/`014`; do not supply unapproved legal bases or retention durations (`AMB-006`). + +## SRS-MKT-002 — Capture Daily Mandi Price Range and Modal Rate + +- **parent_fr:** `FR-MKT-002` +- **parent_uc:** `UC-002` +- **Source:** ``BRD-FR-002`` +- **FR basis:** 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. + +### Screen-to-system mapping + +- **Surface:** Market Desk daily observation entry and list (route TBD in Stage 11) +- **System action:** The screen or initiating service presents the FR inputs, invokes the corresponding `Capture Daily Mandi Price Range and Modal Rate` operation, and displays the recorded/computed outcome and any validation result. Exact route and field-level screen layout remain for Stage 11. + +### API requirement + +- **Resource / operation:** `Capture Daily Mandi Price Range and Modal Rate`; operation semantics follow the FR basis above. The path, HTTP verb, pagination shape, and OpenAPI schema are assigned during Stage 9. +- **Request:** Accept only the FR-defined inputs and source-listed fields below; do not accept a client-supplied tenant selector as proof of access. Authenticated APIs resolve the verified tenant context before tenant data access, per approved Stage 7 patterns. +- **Response:** Return the FR-defined state, calculated result, or source-listed data required for the workflow; do not expose another tenant’s records. +- **Failure behavior:** Reject unauthenticated/unauthorized, invalid-state, and invalid-input requests without applying a partial business mutation. Return a stable validation/authorization error contract to be detailed in Stage 9. + +### Data requirement + +- **FR-defined attributes:** The FR does not enumerate a field list. Preserve the OIDC/authentication inputs and outcome explicitly defined in the FR; exact claims/session fields require the Stage 9 identity contract and remain open under AMB-009. +- **Constraints:** Preserve the units, enumerations, state names, formulas, and numeric boundaries stated in the FR basis and validation rules. Tenant-owned records use the approved transaction-local tenant context and PostgreSQL RLS; storage types and indexes are Stage 9 design. + +### Integration requirement + +- **External integration:** No external connector is explicitly required by this FR. Do not infer a weighbridge, payment, messaging, or other provider integration from manual capture or internal workflow language. + +### Validation and error handling + +- **Source validations/invariants:** All rates must be > 0; `Min Rate ≤ Modal Rate ≤ Max Rate`. +- **Source validations/invariants:** The system accepts rates only when all three values are greater than zero and `Min Rate ≤ Modal Rate ≤ Max Rate`. +- **Source validations/invariants:** If the modal rate is outside the inclusive minimum-to-maximum range, the system rejects the save and reports the arithmetic constraint error. +- **Failure atomicity:** A rejected command or failed transaction leaves no partial governed business state. + +### Audit requirement + +- This FR does not define a feature-specific audit record. Any governed mutation still uses the approved Stage 7 append-only transaction-audit pattern; do not invent additional audit fields or access-logging rules here. + +### NFR derivation + +- **Tenant security:** Applicable to tenant-scoped access in this FR; enforce verified membership/context before tenant data access, RLS isolation, and fail-closed authorization (NFR-SEC-001, `DEC-021`). +- **Platform availability/recovery:** This capability inherits the approved service targets in NFR-OPS-001 (`BRD-NFR-011`, `DEC-006`). +- **Capacity/performance:** Apply NFR-CAP-001 only where this FR participates in the stated tenant/user/load envelope or 50,000-row report validation; use an explicit FR-specific business response-time target only when present in this FR or source BRD. +- **Privacy:** If this FR processes personal data, apply applicable purpose, minimization, access, retention and legal-hold rules from `BRD-FR-047`–`BRD-FR-051`, `BRD-NFR-009`/`014`; do not supply unapproved legal bases or retention durations (`AMB-006`). + +## SRS-MARKETTRENDANALYTICS-001 — Intraday Price Trend Analysis & 20-Day Benchmark Analytics + +- **parent_fr:** `FR-MARKETTRENDANALYTICS-001` +- **parent_uc:** `UC-003` +- **Source:** ``BRD-FR-003`` +- **FR basis:** 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. + +### Screen-to-system mapping + +- **Surface:** Market Desk workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **System action:** The screen or initiating service presents the FR inputs, invokes the corresponding `Intraday Price Trend Analysis & 20-Day Benchmark Analytics` operation, and displays the recorded/computed outcome and any validation result. Exact route and field-level screen layout remain for Stage 11. + +### API requirement + +- **Resource / operation:** `Intraday Price Trend Analysis & 20-Day Benchmark Analytics`; operation semantics follow the FR basis above. The path, HTTP verb, pagination shape, and OpenAPI schema are assigned during Stage 9. +- **Request:** Accept only the FR-defined inputs and source-listed fields below; do not accept a client-supplied tenant selector as proof of access. Authenticated APIs resolve the verified tenant context before tenant data access, per approved Stage 7 patterns. +- **Response:** Return the FR-defined state, calculated result, or source-listed data required for the workflow; do not expose another tenant’s records. +- **Failure behavior:** Reject unauthenticated/unauthorized, invalid-state, and invalid-input requests without applying a partial business mutation. Return a stable validation/authorization error contract to be detailed in Stage 9. + +### Data requirement + +- **FR-defined attributes:** Historical Date Range, Commodity Filter, Market Filter, 20-Day SMA (Simple Moving Average), Price Spread. +- **Constraints:** Preserve the units, enumerations, state names, formulas, and numeric boundaries stated in the FR basis and validation rules. Tenant-owned records use the approved transaction-local tenant context and PostgreSQL RLS; storage types and indexes are Stage 9 design. + +### Integration requirement + +- **External integration:** No external connector is explicitly required by this FR. Do not infer a weighbridge, payment, messaging, or other provider integration from manual capture or internal workflow language. + +### Validation and error handling + +- **Source validations/invariants:** Calculations must dynamically update upon new observation save. Execution time $\le 500\text{ms}$. +- **Source validations/invariants:** The system enforces the source-defined validation rules: Calculations must dynamically update upon new observation save. Execution time $\le 500\text{ms}$. +- **Failure atomicity:** A rejected command or failed transaction leaves no partial governed business state. + +### Audit requirement + +- This FR does not define a feature-specific audit record. Any governed mutation still uses the approved Stage 7 append-only transaction-audit pattern; do not invent additional audit fields or access-logging rules here. + +### NFR derivation + +- **Tenant security:** Applicable to tenant-scoped access in this FR; enforce verified membership/context before tenant data access, RLS isolation, and fail-closed authorization (NFR-SEC-001, `DEC-021`). +- **Platform availability/recovery:** This capability inherits the approved service targets in NFR-OPS-001 (`BRD-NFR-011`, `DEC-006`). +- **Capacity/performance:** Apply NFR-CAP-001 only where this FR participates in the stated tenant/user/load envelope or 50,000-row report validation; use an explicit FR-specific business response-time target only when present in this FR or source BRD. +- **Privacy:** If this FR processes personal data, apply applicable purpose, minimization, access, retention and legal-hold rules from `BRD-FR-047`–`BRD-FR-051`, `BRD-NFR-009`/`014`; do not supply unapproved legal bases or retention durations (`AMB-006`). + +## SRS-PROCUREMENTCONTRACTS-001 — Procurement Price Variance Alert vs. Modal Rate + +- **parent_fr:** `FR-PROCUREMENTCONTRACTS-001` +- **parent_uc:** `UC-004` +- **Source:** ``BRD-FR-004`` +- **FR basis:** 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. + +### Screen-to-system mapping + +- **Surface:** Market Desk & Procurement workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **System action:** The screen or initiating service presents the FR inputs, invokes the corresponding `Procurement Price Variance Alert vs. Modal Rate` operation, and displays the recorded/computed outcome and any validation result. Exact route and field-level screen layout remain for Stage 11. + +### API requirement + +- **Resource / operation:** `Procurement Price Variance Alert vs. Modal Rate`; operation semantics follow the FR basis above. The path, HTTP verb, pagination shape, and OpenAPI schema are assigned during Stage 9. +- **Request:** Accept only the FR-defined inputs and source-listed fields below; do not accept a client-supplied tenant selector as proof of access. Authenticated APIs resolve the verified tenant context before tenant data access, per approved Stage 7 patterns. +- **Response:** Return the FR-defined state, calculated result, or source-listed data required for the workflow; do not expose another tenant’s records. +- **Failure behavior:** Reject unauthenticated/unauthorized, invalid-state, and invalid-input requests without applying a partial business mutation. Return a stable validation/authorization error contract to be detailed in Stage 9. + +### Data requirement + +- **FR-defined attributes:** Offered Rate, Benchmark Modal Rate, Variance \%. +- **Constraints:** Preserve the units, enumerations, state names, formulas, and numeric boundaries stated in the FR basis and validation rules. Tenant-owned records use the approved transaction-local tenant context and PostgreSQL RLS; storage types and indexes are Stage 9 design. + +### Integration requirement + +- **External integration:** No external connector is explicitly required by this FR. Do not infer a weighbridge, payment, messaging, or other provider integration from manual capture or internal workflow language. + +### Validation and error handling + +- **Source validations/invariants:** Informational alert only; does not hard-block procurement unless configured in company policy. +- **Source validations/invariants:** The system enforces the source-defined validation rules: Informational alert only; does not hard-block procurement unless configured in company policy. +- **Failure atomicity:** A rejected command or failed transaction leaves no partial governed business state. + +### Audit requirement + +- This FR does not define a feature-specific audit record. Any governed mutation still uses the approved Stage 7 append-only transaction-audit pattern; do not invent additional audit fields or access-logging rules here. + +### NFR derivation + +- **Tenant security:** Applicable to tenant-scoped access in this FR; enforce verified membership/context before tenant data access, RLS isolation, and fail-closed authorization (NFR-SEC-001, `DEC-021`). +- **Platform availability/recovery:** This capability inherits the approved service targets in NFR-OPS-001 (`BRD-NFR-011`, `DEC-006`). +- **Capacity/performance:** Apply NFR-CAP-001 only where this FR participates in the stated tenant/user/load envelope or 50,000-row report validation; use an explicit FR-specific business response-time target only when present in this FR or source BRD. +- **Privacy:** If this FR processes personal data, apply applicable purpose, minimization, access, retention and legal-hold rules from `BRD-FR-047`–`BRD-FR-051`, `BRD-NFR-009`/`014`; do not supply unapproved legal bases or retention durations (`AMB-006`). + +## SRS-PROCUREMENTCONTRACTS-002 — Mandi Auction & Direct Purchase Sauda Booking + +- **parent_fr:** `FR-PROCUREMENTCONTRACTS-002` +- **parent_uc:** `UC-004` +- **Source:** ``BRD-FR-005`` +- **FR basis:** 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. + +### Screen-to-system mapping + +- **Surface:** Market Desk & Procurement workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **System action:** The screen or initiating service presents the FR inputs, invokes the corresponding `Mandi Auction & Direct Purchase Sauda Booking` operation, and displays the recorded/computed outcome and any validation result. Exact route and field-level screen layout remain for Stage 11. + +### API requirement + +- **Resource / operation:** `Mandi Auction & Direct Purchase Sauda Booking`; operation semantics follow the FR basis above. The path, HTTP verb, pagination shape, and OpenAPI schema are assigned during Stage 9. +- **Request:** Accept only the FR-defined inputs and source-listed fields below; do not accept a client-supplied tenant selector as proof of access. Authenticated APIs resolve the verified tenant context before tenant data access, per approved Stage 7 patterns. +- **Response:** Return the FR-defined state, calculated result, or source-listed data required for the workflow; do not expose another tenant’s records. +- **Failure behavior:** Reject unauthenticated/unauthorized, invalid-state, and invalid-input requests without applying a partial business mutation. Return a stable validation/authorization error contract to be detailed in Stage 9. + +### Data requirement + +- **FR-defined 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. +- **Constraints:** Preserve the units, enumerations, state names, formulas, and numeric boundaries stated in the FR basis and validation rules. Tenant-owned records use the approved transaction-local tenant context and PostgreSQL RLS; storage types and indexes are Stage 9 design. + +### Integration requirement + +- **External integration:** No external connector is explicitly required by this FR. Do not infer a weighbridge, payment, messaging, or other provider integration from manual capture or internal workflow language. + +### Validation and error handling + +- **Source validations/invariants:** 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. +- **Source validations/invariants:** 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. +- **Source validations/invariants:** The system handles the source-defined failure condition as follows: If supplier is deactivated or blacklisted, booking must be blocked. +- **Failure atomicity:** A rejected command or failed transaction leaves no partial governed business state. + +### Audit requirement + +- This FR does not define a feature-specific audit record. Any governed mutation still uses the approved Stage 7 append-only transaction-audit pattern; do not invent additional audit fields or access-logging rules here. + +### NFR derivation + +- **Tenant security:** Applicable to tenant-scoped access in this FR; enforce verified membership/context before tenant data access, RLS isolation, and fail-closed authorization (NFR-SEC-001, `DEC-021`). +- **Platform availability/recovery:** This capability inherits the approved service targets in NFR-OPS-001 (`BRD-NFR-011`, `DEC-006`). +- **Capacity/performance:** Apply NFR-CAP-001 only where this FR participates in the stated tenant/user/load envelope or 50,000-row report validation; use an explicit FR-specific business response-time target only when present in this FR or source BRD. +- **Privacy:** If this FR processes personal data, apply applicable purpose, minimization, access, retention and legal-hold rules from `BRD-FR-047`–`BRD-FR-051`, `BRD-NFR-009`/`014`; do not supply unapproved legal bases or retention durations (`AMB-006`). + +## SRS-PROCUREMENTCONTRACTS-003 — Supplier Credit Terms & Due Date Computation + +- **parent_fr:** `FR-PROCUREMENTCONTRACTS-003` +- **parent_uc:** `UC-004` +- **Source:** ``BRD-FR-006`` +- **FR basis:** 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. + +### Screen-to-system mapping + +- **Surface:** Market Desk & Procurement workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **System action:** The screen or initiating service presents the FR inputs, invokes the corresponding `Supplier Credit Terms & Due Date Computation` operation, and displays the recorded/computed outcome and any validation result. Exact route and field-level screen layout remain for Stage 11. + +### API requirement + +- **Resource / operation:** `Supplier Credit Terms & Due Date Computation`; operation semantics follow the FR basis above. The path, HTTP verb, pagination shape, and OpenAPI schema are assigned during Stage 9. +- **Request:** Accept only the FR-defined inputs and source-listed fields below; do not accept a client-supplied tenant selector as proof of access. Authenticated APIs resolve the verified tenant context before tenant data access, per approved Stage 7 patterns. +- **Response:** Return the FR-defined state, calculated result, or source-listed data required for the workflow; do not expose another tenant’s records. +- **Failure behavior:** Reject unauthenticated/unauthorized, invalid-state, and invalid-input requests without applying a partial business mutation. Return a stable validation/authorization error contract to be detailed in Stage 9. + +### Data requirement + +- **FR-defined attributes:** Supplier Credit Days, Transaction Date, Computed Due Date, Payment Status (`Pending`, `Paid`). +- **Constraints:** Preserve the units, enumerations, state names, formulas, and numeric boundaries stated in the FR basis and validation rules. Tenant-owned records use the approved transaction-local tenant context and PostgreSQL RLS; storage types and indexes are Stage 9 design. + +### Integration requirement + +- **External integration:** No external connector is explicitly required by this FR. Do not infer a weighbridge, payment, messaging, or other provider integration from manual capture or internal workflow language. + +### Validation and error handling + +- **Source validations/invariants:** Default credit days inherited from Supplier master; editable only by Purchase Manager. +- **Source validations/invariants:** The system enforces the source-defined validation rules: Default credit days inherited from Supplier master; editable only by Purchase Manager. +- **Failure atomicity:** A rejected command or failed transaction leaves no partial governed business state. + +### Audit requirement + +- This FR does not define a feature-specific audit record. Any governed mutation still uses the approved Stage 7 append-only transaction-audit pattern; do not invent additional audit fields or access-logging rules here. + +### NFR derivation + +- **Tenant security:** Applicable to tenant-scoped access in this FR; enforce verified membership/context before tenant data access, RLS isolation, and fail-closed authorization (NFR-SEC-001, `DEC-021`). +- **Platform availability/recovery:** This capability inherits the approved service targets in NFR-OPS-001 (`BRD-NFR-011`, `DEC-006`). +- **Capacity/performance:** Apply NFR-CAP-001 only where this FR participates in the stated tenant/user/load envelope or 50,000-row report validation; use an explicit FR-specific business response-time target only when present in this FR or source BRD. +- **Privacy:** If this FR processes personal data, apply applicable purpose, minimization, access, retention and legal-hold rules from `BRD-FR-047`–`BRD-FR-051`, `BRD-NFR-009`/`014`; do not supply unapproved legal bases or retention durations (`AMB-006`). + +## SRS-PROCUREMENTCONTRACTS-004 — Mandi Cess & Statutory Levies Apportioning + +- **parent_fr:** `FR-PROCUREMENTCONTRACTS-004` +- **parent_uc:** `UC-004` +- **Source:** ``BRD-FR-007`` +- **FR basis:** 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. + +### Screen-to-system mapping + +- **Surface:** Market Desk & Procurement workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **System action:** The screen or initiating service presents the FR inputs, invokes the corresponding `Mandi Cess & Statutory Levies Apportioning` operation, and displays the recorded/computed outcome and any validation result. Exact route and field-level screen layout remain for Stage 11. + +### API requirement + +- **Resource / operation:** `Mandi Cess & Statutory Levies Apportioning`; operation semantics follow the FR basis above. The path, HTTP verb, pagination shape, and OpenAPI schema are assigned during Stage 9. +- **Request:** Accept only the FR-defined inputs and source-listed fields below; do not accept a client-supplied tenant selector as proof of access. Authenticated APIs resolve the verified tenant context before tenant data access, per approved Stage 7 patterns. +- **Response:** Return the FR-defined state, calculated result, or source-listed data required for the workflow; do not expose another tenant’s records. +- **Failure behavior:** Reject unauthenticated/unauthorized, invalid-state, and invalid-input requests without applying a partial business mutation. Return a stable validation/authorization error contract to be detailed in Stage 9. + +### Data requirement + +- **FR-defined attributes:** Mandi Cess Rate %, Cess Amount INR, Total Landed Procurement Cost INR. +- **Constraints:** Preserve the units, enumerations, state names, formulas, and numeric boundaries stated in the FR basis and validation rules. Tenant-owned records use the approved transaction-local tenant context and PostgreSQL RLS; storage types and indexes are Stage 9 design. + +### Integration requirement + +- **External integration:** No external connector is explicitly required by this FR. Do not infer a weighbridge, payment, messaging, or other provider integration from manual capture or internal workflow language. + +### Validation and error handling + +- **Source validations/invariants:** Configurable per commodity and market jurisdiction. +- **Source validations/invariants:** The system enforces the source-defined validation rules: Configurable per commodity and market jurisdiction. +- **Failure atomicity:** A rejected command or failed transaction leaves no partial governed business state. + +### Audit requirement + +- This FR does not define a feature-specific audit record. Any governed mutation still uses the approved Stage 7 append-only transaction-audit pattern; do not invent additional audit fields or access-logging rules here. + +### NFR derivation + +- **Tenant security:** Applicable to tenant-scoped access in this FR; enforce verified membership/context before tenant data access, RLS isolation, and fail-closed authorization (NFR-SEC-001, `DEC-021`). +- **Platform availability/recovery:** This capability inherits the approved service targets in NFR-OPS-001 (`BRD-NFR-011`, `DEC-006`). +- **Capacity/performance:** Apply NFR-CAP-001 only where this FR participates in the stated tenant/user/load envelope or 50,000-row report validation; use an explicit FR-specific business response-time target only when present in this FR or source BRD. +- **Privacy:** If this FR processes personal data, apply applicable purpose, minimization, access, retention and legal-hold rules from `BRD-FR-047`–`BRD-FR-051`, `BRD-NFR-009`/`014`; do not supply unapproved legal bases or retention durations (`AMB-006`). + +## SRS-INWARDRECEIVING-001 — Inward Vehicle Gate Entry & Verification + +- **parent_fr:** `FR-INWARDRECEIVING-001` +- **parent_uc:** `UC-005` +- **Source:** ``BRD-FR-008`` +- **FR basis:** 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. + +### Screen-to-system mapping + +- **Surface:** Goods Receipt workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **System action:** The screen or initiating service presents the FR inputs, invokes the corresponding `Inward Vehicle Gate Entry & Verification` operation, and displays the recorded/computed outcome and any validation result. Exact route and field-level screen layout remain for Stage 11. + +### API requirement + +- **Resource / operation:** `Inward Vehicle Gate Entry & Verification`; operation semantics follow the FR basis above. The path, HTTP verb, pagination shape, and OpenAPI schema are assigned during Stage 9. +- **Request:** Accept only the FR-defined inputs and source-listed fields below; do not accept a client-supplied tenant selector as proof of access. Authenticated APIs resolve the verified tenant context before tenant data access, per approved Stage 7 patterns. +- **Response:** Return the FR-defined state, calculated result, or source-listed data required for the workflow; do not expose another tenant’s records. +- **Failure behavior:** Reject unauthenticated/unauthorized, invalid-state, and invalid-input requests without applying a partial business mutation. Return a stable validation/authorization error contract to be detailed in Stage 9. + +### Data requirement + +- **FR-defined attributes:** Gate Entry ID, Inward Date/Time, Vehicle Reg No, Driver Name, Contact No, Linked Sauda ID, Supplier Name, Gate Pass No. +- **Constraints:** Preserve the units, enumerations, state names, formulas, and numeric boundaries stated in the FR basis and validation rules. Tenant-owned records use the approved transaction-local tenant context and PostgreSQL RLS; storage types and indexes are Stage 9 design. + +### Integration requirement + +- **External integration:** No external connector is explicitly required by this FR. Do not infer a weighbridge, payment, messaging, or other provider integration from manual capture or internal workflow language. + +### Validation and error handling + +- **Source validations/invariants:** Linked sauda must be in state `Booked`. +- **Source validations/invariants:** The system enforces the source-defined validation rules: Linked sauda must be in state `Booked`. +- **Failure atomicity:** A rejected command or failed transaction leaves no partial governed business state. + +### Audit requirement + +- This FR does not define a feature-specific audit record. Any governed mutation still uses the approved Stage 7 append-only transaction-audit pattern; do not invent additional audit fields or access-logging rules here. + +### NFR derivation + +- **Tenant security:** Applicable to tenant-scoped access in this FR; enforce verified membership/context before tenant data access, RLS isolation, and fail-closed authorization (NFR-SEC-001, `DEC-021`). +- **Platform availability/recovery:** This capability inherits the approved service targets in NFR-OPS-001 (`BRD-NFR-011`, `DEC-006`). +- **Capacity/performance:** Apply NFR-CAP-001 only where this FR participates in the stated tenant/user/load envelope or 50,000-row report validation; use an explicit FR-specific business response-time target only when present in this FR or source BRD. +- **Privacy:** If this FR processes personal data, apply applicable purpose, minimization, access, retention and legal-hold rules from `BRD-FR-047`–`BRD-FR-051`, `BRD-NFR-009`/`014`; do not supply unapproved legal bases or retention durations (`AMB-006`). + +## SRS-INWARDRECEIVING-002 — Weighbridge Gross & Tare Weighment Logging + +- **parent_fr:** `FR-INWARDRECEIVING-002` +- **parent_uc:** `UC-005` +- **Source:** ``BRD-FR-009`` +- **FR basis:** 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. + +### Screen-to-system mapping + +- **Surface:** Goods Receipt workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **System action:** The screen or initiating service presents the FR inputs, invokes the corresponding `Weighbridge Gross & Tare Weighment Logging` operation, and displays the recorded/computed outcome and any validation result. Exact route and field-level screen layout remain for Stage 11. + +### API requirement + +- **Resource / operation:** `Weighbridge Gross & Tare Weighment Logging`; operation semantics follow the FR basis above. The path, HTTP verb, pagination shape, and OpenAPI schema are assigned during Stage 9. +- **Request:** Accept only the FR-defined inputs and source-listed fields below; do not accept a client-supplied tenant selector as proof of access. Authenticated APIs resolve the verified tenant context before tenant data access, per approved Stage 7 patterns. +- **Response:** Return the FR-defined state, calculated result, or source-listed data required for the workflow; do not expose another tenant’s records. +- **Failure behavior:** Reject unauthenticated/unauthorized, invalid-state, and invalid-input requests without applying a partial business mutation. Return a stable validation/authorization error contract to be detailed in Stage 9. + +### Data requirement + +- **FR-defined attributes:** Gross Weight kg, Gross Timestamp, Tare Weight kg, Tare Timestamp, Gross Net Weight kg ($Gross - Tare$), Weighbridge Slip No. +- **Constraints:** Preserve the units, enumerations, state names, formulas, and numeric boundaries stated in the FR basis and validation rules. Tenant-owned records use the approved transaction-local tenant context and PostgreSQL RLS; storage types and indexes are Stage 9 design. + +### Integration requirement + +- **External integration:** No external connector is explicitly required by this FR. Do not infer a weighbridge, payment, messaging, or other provider integration from manual capture or internal workflow language. + +### Validation and error handling + +- **Source validations/invariants:** $\text{Gross Weight} > \text{Tare Weight} > 0$. Weighbridge slip number mandatory. +- **Source validations/invariants:** The system enforces the source-defined validation rules: $\text{Gross Weight} > \text{Tare Weight} > 0$. Weighbridge slip number mandatory. +- **Source validations/invariants:** The system handles the source-defined failure condition as follows: If Tare Weight $\ge$ Gross Weight, system must hard-block submission with an error. +- **Failure atomicity:** A rejected command or failed transaction leaves no partial governed business state. + +### Audit requirement + +- This FR does not define a feature-specific audit record. Any governed mutation still uses the approved Stage 7 append-only transaction-audit pattern; do not invent additional audit fields or access-logging rules here. + +### NFR derivation + +- **Tenant security:** Applicable to tenant-scoped access in this FR; enforce verified membership/context before tenant data access, RLS isolation, and fail-closed authorization (NFR-SEC-001, `DEC-021`). +- **Platform availability/recovery:** This capability inherits the approved service targets in NFR-OPS-001 (`BRD-NFR-011`, `DEC-006`). +- **Capacity/performance:** Apply NFR-CAP-001 only where this FR participates in the stated tenant/user/load envelope or 50,000-row report validation; use an explicit FR-specific business response-time target only when present in this FR or source BRD. +- **Privacy:** If this FR processes personal data, apply applicable purpose, minimization, access, retention and legal-hold rules from `BRD-FR-047`–`BRD-FR-051`, `BRD-NFR-009`/`014`; do not supply unapproved legal bases or retention durations (`AMB-006`). + +## SRS-INWARDRECEIVING-003 — Bag Tare Deduction (*Bardana Katai*) & Final Net MT + +- **parent_fr:** `FR-INWARDRECEIVING-003` +- **parent_uc:** `UC-005` +- **Source:** ``BRD-FR-010`` +- **FR basis:** 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. + +### Screen-to-system mapping + +- **Surface:** Goods Receipt workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **System action:** The screen or initiating service presents the FR inputs, invokes the corresponding `Bag Tare Deduction (*Bardana Katai*) & Final Net MT` operation, and displays the recorded/computed outcome and any validation result. Exact route and field-level screen layout remain for Stage 11. + +### API requirement + +- **Resource / operation:** `Bag Tare Deduction (*Bardana Katai*) & Final Net MT`; operation semantics follow the FR basis above. The path, HTTP verb, pagination shape, and OpenAPI schema are assigned during Stage 9. +- **Request:** Accept only the FR-defined inputs and source-listed fields below; do not accept a client-supplied tenant selector as proof of access. Authenticated APIs resolve the verified tenant context before tenant data access, per approved Stage 7 patterns. +- **Response:** Return the FR-defined state, calculated result, or source-listed data required for the workflow; do not expose another tenant’s records. +- **Failure behavior:** Reject unauthenticated/unauthorized, invalid-state, and invalid-input requests without applying a partial business mutation. Return a stable validation/authorization error contract to be detailed in Stage 9. + +### Data requirement + +- **FR-defined attributes:** Physical Bag Count, Packaging Type (`Gunny/Jute`, `HDPE/Plastic`), Bag Tare Deduction Rate kg/bag, Total Bag Tare kg, Final Net Weight MT. +- **Constraints:** Preserve the units, enumerations, state names, formulas, and numeric boundaries stated in the FR basis and validation rules. Tenant-owned records use the approved transaction-local tenant context and PostgreSQL RLS; storage types and indexes are Stage 9 design. + +### Integration requirement + +- **External integration:** No external connector is explicitly required by this FR. Do not infer a weighbridge, payment, messaging, or other provider integration from manual capture or internal workflow language. + +### Validation and error handling + +- **Source validations/invariants:** Formula: $\text{Net MT} = (\text{Gross kg} - \text{Tare kg} - (\text{Bags} \times \text{Bag Tare Rate})) / 1000$. Net MT must be $> 0$. +- **Source validations/invariants:** 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$. +- **Failure atomicity:** A rejected command or failed transaction leaves no partial governed business state. + +### Audit requirement + +- This FR does not define a feature-specific audit record. Any governed mutation still uses the approved Stage 7 append-only transaction-audit pattern; do not invent additional audit fields or access-logging rules here. + +### NFR derivation + +- **Tenant security:** Applicable to tenant-scoped access in this FR; enforce verified membership/context before tenant data access, RLS isolation, and fail-closed authorization (NFR-SEC-001, `DEC-021`). +- **Platform availability/recovery:** This capability inherits the approved service targets in NFR-OPS-001 (`BRD-NFR-011`, `DEC-006`). +- **Capacity/performance:** Apply NFR-CAP-001 only where this FR participates in the stated tenant/user/load envelope or 50,000-row report validation; use an explicit FR-specific business response-time target only when present in this FR or source BRD. +- **Privacy:** If this FR processes personal data, apply applicable purpose, minimization, access, retention and legal-hold rules from `BRD-FR-047`–`BRD-FR-051`, `BRD-NFR-009`/`014`; do not supply unapproved legal bases or retention durations (`AMB-006`). + +## SRS-INWARDRECEIVING-004 — Weighment Tolerance & Transit Shortage Verification + +- **parent_fr:** `FR-INWARDRECEIVING-004` +- **parent_uc:** `UC-005` +- **Source:** ``BRD-FR-011`` +- **FR basis:** 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. + +### Screen-to-system mapping + +- **Surface:** Goods Receipt workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **System action:** The screen or initiating service presents the FR inputs, invokes the corresponding `Weighment Tolerance & Transit Shortage Verification` operation, and displays the recorded/computed outcome and any validation result. Exact route and field-level screen layout remain for Stage 11. + +### API requirement + +- **Resource / operation:** `Weighment Tolerance & Transit Shortage Verification`; operation semantics follow the FR basis above. The path, HTTP verb, pagination shape, and OpenAPI schema are assigned during Stage 9. +- **Request:** Accept only the FR-defined inputs and source-listed fields below; do not accept a client-supplied tenant selector as proof of access. Authenticated APIs resolve the verified tenant context before tenant data access, per approved Stage 7 patterns. +- **Response:** Return the FR-defined state, calculated result, or source-listed data required for the workflow; do not expose another tenant’s records. +- **Failure behavior:** Reject unauthenticated/unauthorized, invalid-state, and invalid-input requests without applying a partial business mutation. Return a stable validation/authorization error contract to be detailed in Stage 9. + +### Data requirement + +- **FR-defined attributes:** Shortage MT, Shortage Value INR, Variance \%, Shortage Status (`Normal`, `Disputed`). +- **Constraints:** Preserve the units, enumerations, state names, formulas, and numeric boundaries stated in the FR basis and validation rules. Tenant-owned records use the approved transaction-local tenant context and PostgreSQL RLS; storage types and indexes are Stage 9 design. + +### Integration requirement + +- **External integration:** No external connector is explicitly required by this FR. Do not infer a weighbridge, payment, messaging, or other provider integration from manual capture or internal workflow language. + +### Validation and error handling + +- **Source validations/invariants:** If shortage exceeds $2.0\%$, the GRN requires mandatory Purchase Manager approval before stock posting. +- **Source validations/invariants:** The system enforces the source-defined validation rules: If shortage exceeds $2.0\%$, the GRN requires mandatory Purchase Manager approval before stock posting. +- **Failure atomicity:** A rejected command or failed transaction leaves no partial governed business state. + +### Audit requirement + +- This FR does not define a feature-specific audit record. Any governed mutation still uses the approved Stage 7 append-only transaction-audit pattern; do not invent additional audit fields or access-logging rules here. + +### NFR derivation + +- **Tenant security:** Applicable to tenant-scoped access in this FR; enforce verified membership/context before tenant data access, RLS isolation, and fail-closed authorization (NFR-SEC-001, `DEC-021`). +- **Platform availability/recovery:** This capability inherits the approved service targets in NFR-OPS-001 (`BRD-NFR-011`, `DEC-006`). +- **Capacity/performance:** Apply NFR-CAP-001 only where this FR participates in the stated tenant/user/load envelope or 50,000-row report validation; use an explicit FR-specific business response-time target only when present in this FR or source BRD. +- **Privacy:** If this FR processes personal data, apply applicable purpose, minimization, access, retention and legal-hold rules from `BRD-FR-047`–`BRD-FR-051`, `BRD-NFR-009`/`014`; do not supply unapproved legal bases or retention durations (`AMB-006`). + +## SRS-INWARDRECEIVING-005 — Goods Receipt Note (GRN) Posting & Warehouse Stack Placement + +- **parent_fr:** `FR-INWARDRECEIVING-005` +- **parent_uc:** `UC-005` +- **Source:** ``BRD-FR-012`` +- **FR basis:** 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. + +### Screen-to-system mapping + +- **Surface:** Goods Receipt workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **System action:** The screen or initiating service presents the FR inputs, invokes the corresponding `Goods Receipt Note (GRN) Posting & Warehouse Stack Placement` operation, and displays the recorded/computed outcome and any validation result. Exact route and field-level screen layout remain for Stage 11. + +### API requirement + +- **Resource / operation:** `Goods Receipt Note (GRN) Posting & Warehouse Stack Placement`; operation semantics follow the FR basis above. The path, HTTP verb, pagination shape, and OpenAPI schema are assigned during Stage 9. +- **Request:** Accept only the FR-defined inputs and source-listed fields below; do not accept a client-supplied tenant selector as proof of access. Authenticated APIs resolve the verified tenant context before tenant data access, per approved Stage 7 patterns. +- **Response:** Return the FR-defined state, calculated result, or source-listed data required for the workflow; do not expose another tenant’s records. +- **Failure behavior:** Reject unauthenticated/unauthorized, invalid-state, and invalid-input requests without applying a partial business mutation. Return a stable validation/authorization error contract to be detailed in Stage 9. + +### Data requirement + +- **FR-defined attributes:** GRN ID (`GRN-YYYYMM-xxx`), Receiving Warehouse ID, Stack/Chamber No, Accepted Bags, Accepted Net MT. +- **Constraints:** Preserve the units, enumerations, state names, formulas, and numeric boundaries stated in the FR basis and validation rules. Tenant-owned records use the approved transaction-local tenant context and PostgreSQL RLS; storage types and indexes are Stage 9 design. + +### Integration requirement + +- **External integration:** No external connector is explicitly required by this FR. Do not infer a weighbridge, payment, messaging, or other provider integration from manual capture or internal workflow language. + +### Validation and error handling + +- **Source validations/invariants:** GRN submission atomically updates inventory and creates Lot record in state `Under QC`. +- **Source validations/invariants:** The system enforces the source-defined validation rules: GRN submission atomically updates inventory and creates Lot record in state `Under QC`. +- **Failure atomicity:** A rejected command or failed transaction leaves no partial governed business state. + +### Audit requirement + +- This FR does not define a feature-specific audit record. Any governed mutation still uses the approved Stage 7 append-only transaction-audit pattern; do not invent additional audit fields or access-logging rules here. + +### NFR derivation + +- **Tenant security:** Applicable to tenant-scoped access in this FR; enforce verified membership/context before tenant data access, RLS isolation, and fail-closed authorization (NFR-SEC-001, `DEC-021`). +- **Platform availability/recovery:** This capability inherits the approved service targets in NFR-OPS-001 (`BRD-NFR-011`, `DEC-006`). +- **Capacity/performance:** Apply NFR-CAP-001 only where this FR participates in the stated tenant/user/load envelope or 50,000-row report validation; use an explicit FR-specific business response-time target only when present in this FR or source BRD. +- **Privacy:** If this FR processes personal data, apply applicable purpose, minimization, access, retention and legal-hold rules from `BRD-FR-047`–`BRD-FR-051`, `BRD-NFR-009`/`014`; do not supply unapproved legal bases or retention durations (`AMB-006`). + +## SRS-INWARDRECEIVING-006 — Mandatory Lot & Batch Identity Generation + +- **parent_fr:** `FR-INWARDRECEIVING-006` +- **parent_uc:** `UC-005` +- **Source:** ``BRD-FR-013`` +- **FR basis:** The system must automatically generate a globally unique, immutable Lot ID (`LOT-YYYYMM-xxx`) for every inward consignment processed through a GRN. + +### Screen-to-system mapping + +- **Surface:** Goods Receipt workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **System action:** The screen or initiating service presents the FR inputs, invokes the corresponding `Mandatory Lot & Batch Identity Generation` operation, and displays the recorded/computed outcome and any validation result. Exact route and field-level screen layout remain for Stage 11. + +### API requirement + +- **Resource / operation:** `Mandatory Lot & Batch Identity Generation`; operation semantics follow the FR basis above. The path, HTTP verb, pagination shape, and OpenAPI schema are assigned during Stage 9. +- **Request:** Accept only the FR-defined inputs and source-listed fields below; do not accept a client-supplied tenant selector as proof of access. Authenticated APIs resolve the verified tenant context before tenant data access, per approved Stage 7 patterns. +- **Response:** Return the FR-defined state, calculated result, or source-listed data required for the workflow; do not expose another tenant’s records. +- **Failure behavior:** Reject unauthenticated/unauthorized, invalid-state, and invalid-input requests without applying a partial business mutation. Return a stable validation/authorization error contract to be detailed in Stage 9. + +### Data requirement + +- **FR-defined attributes:** Lot ID, Inward Date, Origin Market, Supplier ID, Commodity, Variety, Receiving Warehouse, Net MT, Bag Count, Quality Status. +- **Constraints:** Preserve the units, enumerations, state names, formulas, and numeric boundaries stated in the FR basis and validation rules. Tenant-owned records use the approved transaction-local tenant context and PostgreSQL RLS; storage types and indexes are Stage 9 design. + +### Integration requirement + +- **External integration:** No external connector is explicitly required by this FR. Do not infer a weighbridge, payment, messaging, or other provider integration from manual capture or internal workflow language. + +### Validation and error handling + +- **Source validations/invariants:** Initial status must be `Under QC`. Lot ID must be permanent and traceable through all sales and dispatches. +- **Source validations/invariants:** 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. +- **Failure atomicity:** A rejected command or failed transaction leaves no partial governed business state. + +### Audit requirement + +- This FR does not define a feature-specific audit record. Any governed mutation still uses the approved Stage 7 append-only transaction-audit pattern; do not invent additional audit fields or access-logging rules here. + +### NFR derivation + +- **Tenant security:** Applicable to tenant-scoped access in this FR; enforce verified membership/context before tenant data access, RLS isolation, and fail-closed authorization (NFR-SEC-001, `DEC-021`). +- **Platform availability/recovery:** This capability inherits the approved service targets in NFR-OPS-001 (`BRD-NFR-011`, `DEC-006`). +- **Capacity/performance:** Apply NFR-CAP-001 only where this FR participates in the stated tenant/user/load envelope or 50,000-row report validation; use an explicit FR-specific business response-time target only when present in this FR or source BRD. +- **Privacy:** If this FR processes personal data, apply applicable purpose, minimization, access, retention and legal-hold rules from `BRD-FR-047`–`BRD-FR-051`, `BRD-NFR-009`/`014`; do not supply unapproved legal bases or retention durations (`AMB-006`). + +## SRS-QUALITYANDLOTCONTROL-001 — Inward Quality Inspection Parameter Recording + +- **parent_fr:** `FR-QUALITYANDLOTCONTROL-001` +- **parent_uc:** `UC-006` +- **Source:** ``BRD-FR-014`` +- **FR basis:** The Quality Officer must log laboratory/physical test parameters for the lot: Moisture %, Foreign Matter / Dust %, Admixture (other grains) %, Damaged / Discolored %, and Weevil count. + +### Screen-to-system mapping + +- **Surface:** Quality Control workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **System action:** The screen or initiating service presents the FR inputs, invokes the corresponding `Inward Quality Inspection Parameter Recording` operation, and displays the recorded/computed outcome and any validation result. Exact route and field-level screen layout remain for Stage 11. + +### API requirement + +- **Resource / operation:** `Inward Quality Inspection Parameter Recording`; operation semantics follow the FR basis above. The path, HTTP verb, pagination shape, and OpenAPI schema are assigned during Stage 9. +- **Request:** Accept only the FR-defined inputs and source-listed fields below; do not accept a client-supplied tenant selector as proof of access. Authenticated APIs resolve the verified tenant context before tenant data access, per approved Stage 7 patterns. +- **Response:** Return the FR-defined state, calculated result, or source-listed data required for the workflow; do not expose another tenant’s records. +- **Failure behavior:** Reject unauthenticated/unauthorized, invalid-state, and invalid-input requests without applying a partial business mutation. Return a stable validation/authorization error contract to be detailed in Stage 9. + +### Data requirement + +- **FR-defined attributes:** Inspection Date, Quality Officer ID, Moisture %, Foreign Matter %, Admixture %, Damaged %, Weevil Infestation (`None`, `Mild`, `Severe`), Assigned Commercial Grade (`FAQ`, `Premium`, `Below FAQ`). +- **Constraints:** Preserve the units, enumerations, state names, formulas, and numeric boundaries stated in the FR basis and validation rules. Tenant-owned records use the approved transaction-local tenant context and PostgreSQL RLS; storage types and indexes are Stage 9 design. + +### Integration requirement + +- **External integration:** No external connector is explicitly required by this FR. Do not infer a weighbridge, payment, messaging, or other provider integration from manual capture or internal workflow language. + +### Validation and error handling + +- **Source validations/invariants:** Percentage values must be between $0.00\%$ and $100.00\%$. +- **Source validations/invariants:** The system enforces the source-defined validation rules: Percentage values must be between $0.00\%$ and $100.00\%$. +- **Failure atomicity:** A rejected command or failed transaction leaves no partial governed business state. + +### Audit requirement + +- This FR does not define a feature-specific audit record. Any governed mutation still uses the approved Stage 7 append-only transaction-audit pattern; do not invent additional audit fields or access-logging rules here. + +### NFR derivation + +- **Tenant security:** Applicable to tenant-scoped access in this FR; enforce verified membership/context before tenant data access, RLS isolation, and fail-closed authorization (NFR-SEC-001, `DEC-021`). +- **Platform availability/recovery:** This capability inherits the approved service targets in NFR-OPS-001 (`BRD-NFR-011`, `DEC-006`). +- **Capacity/performance:** Apply NFR-CAP-001 only where this FR participates in the stated tenant/user/load envelope or 50,000-row report validation; use an explicit FR-specific business response-time target only when present in this FR or source BRD. +- **Privacy:** If this FR processes personal data, apply applicable purpose, minimization, access, retention and legal-hold rules from `BRD-FR-047`–`BRD-FR-051`, `BRD-NFR-009`/`014`; do not supply unapproved legal bases or retention durations (`AMB-006`). + +## SRS-QUALITYANDLOTCONTROL-002 — Quality Deduction / Rebate Calculation + +- **parent_fr:** `FR-QUALITYANDLOTCONTROL-002` +- **parent_uc:** `UC-006` +- **Source:** ``BRD-FR-015`` +- **FR basis:** 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). + +### Screen-to-system mapping + +- **Surface:** Quality Control workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **System action:** The screen or initiating service presents the FR inputs, invokes the corresponding `Quality Deduction / Rebate Calculation` operation, and displays the recorded/computed outcome and any validation result. Exact route and field-level screen layout remain for Stage 11. + +### API requirement + +- **Resource / operation:** `Quality Deduction / Rebate Calculation`; operation semantics follow the FR basis above. The path, HTTP verb, pagination shape, and OpenAPI schema are assigned during Stage 9. +- **Request:** Accept only the FR-defined inputs and source-listed fields below; do not accept a client-supplied tenant selector as proof of access. Authenticated APIs resolve the verified tenant context before tenant data access, per approved Stage 7 patterns. +- **Response:** Return the FR-defined state, calculated result, or source-listed data required for the workflow; do not expose another tenant’s records. +- **Failure behavior:** Reject unauthenticated/unauthorized, invalid-state, and invalid-input requests without applying a partial business mutation. Return a stable validation/authorization error contract to be detailed in Stage 9. + +### Data requirement + +- **FR-defined attributes:** Base Contract Rate ₹/Qtl, Quality Penalty Rate ₹/Qtl, Adjusted Final Rate ₹/Qtl, Net Purchase Adjustment INR. +- **Constraints:** Preserve the units, enumerations, state names, formulas, and numeric boundaries stated in the FR basis and validation rules. Tenant-owned records use the approved transaction-local tenant context and PostgreSQL RLS; storage types and indexes are Stage 9 design. + +### Integration requirement + +- **External integration:** No external connector is explicitly required by this FR. Do not infer a weighbridge, payment, messaging, or other provider integration from manual capture or internal workflow language. + +### Validation and error handling + +- **Source validations/invariants:** Deductions cannot reduce rate below 50% of base rate without partner authorization. +- **Source validations/invariants:** The system enforces the source-defined validation rules: Deductions cannot reduce rate below 50% of base rate without partner authorization. +- **Failure atomicity:** A rejected command or failed transaction leaves no partial governed business state. + +### Audit requirement + +- This FR does not define a feature-specific audit record. Any governed mutation still uses the approved Stage 7 append-only transaction-audit pattern; do not invent additional audit fields or access-logging rules here. + +### NFR derivation + +- **Tenant security:** Applicable to tenant-scoped access in this FR; enforce verified membership/context before tenant data access, RLS isolation, and fail-closed authorization (NFR-SEC-001, `DEC-021`). +- **Platform availability/recovery:** This capability inherits the approved service targets in NFR-OPS-001 (`BRD-NFR-011`, `DEC-006`). +- **Capacity/performance:** Apply NFR-CAP-001 only where this FR participates in the stated tenant/user/load envelope or 50,000-row report validation; use an explicit FR-specific business response-time target only when present in this FR or source BRD. +- **Privacy:** If this FR processes personal data, apply applicable purpose, minimization, access, retention and legal-hold rules from `BRD-FR-047`–`BRD-FR-051`, `BRD-NFR-009`/`014`; do not supply unapproved legal bases or retention durations (`AMB-006`). + +## SRS-QUALITYANDLOTCONTROL-003 — Finite State Machine Enforcement for `QC Hold` vs. `Released` + +- **parent_fr:** `FR-QUALITYANDLOTCONTROL-003` +- **parent_uc:** `UC-006` +- **Source:** ``BRD-FR-016`` +- **FR basis:** 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. + +### Screen-to-system mapping + +- **Surface:** Quality Control workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **System action:** The screen or initiating service presents the FR inputs, invokes the corresponding `Finite State Machine Enforcement for `QC Hold` vs. `Released`` operation, and displays the recorded/computed outcome and any validation result. Exact route and field-level screen layout remain for Stage 11. + +### API requirement + +- **Resource / operation:** `Finite State Machine Enforcement for `QC Hold` vs. `Released``; operation semantics follow the FR basis above. The path, HTTP verb, pagination shape, and OpenAPI schema are assigned during Stage 9. +- **Request:** Accept only the FR-defined inputs and source-listed fields below; do not accept a client-supplied tenant selector as proof of access. Authenticated APIs resolve the verified tenant context before tenant data access, per approved Stage 7 patterns. +- **Response:** Return the FR-defined state, calculated result, or source-listed data required for the workflow; do not expose another tenant’s records. +- **Failure behavior:** Reject unauthenticated/unauthorized, invalid-state, and invalid-input requests without applying a partial business mutation. Return a stable validation/authorization error contract to be detailed in Stage 9. + +### Data requirement + +- **FR-defined attributes:** Previous Status, New Status (`QC Hold`, `Released`), Hold Reason, Action Plan (`Drying`, `Cleaning`, `Re-testing`), Release Timestamp. +- **Constraints:** Preserve the units, enumerations, state names, formulas, and numeric boundaries stated in the FR basis and validation rules. Tenant-owned records use the approved transaction-local tenant context and PostgreSQL RLS; storage types and indexes are Stage 9 design. + +### Integration requirement + +- **External integration:** No external connector is explicitly required by this FR. Do not infer a weighbridge, payment, messaging, or other provider integration from manual capture or internal workflow language. + +### Validation and error handling + +- **Source validations/invariants:** 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. +- **Source validations/invariants:** 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. +- **Failure atomicity:** A rejected command or failed transaction leaves no partial governed business state. + +### Audit requirement + +- This FR does not define a feature-specific audit record. Any governed mutation still uses the approved Stage 7 append-only transaction-audit pattern; do not invent additional audit fields or access-logging rules here. + +### NFR derivation + +- **Tenant security:** Applicable to tenant-scoped access in this FR; enforce verified membership/context before tenant data access, RLS isolation, and fail-closed authorization (NFR-SEC-001, `DEC-021`). +- **Platform availability/recovery:** This capability inherits the approved service targets in NFR-OPS-001 (`BRD-NFR-011`, `DEC-006`). +- **Capacity/performance:** Apply NFR-CAP-001 only where this FR participates in the stated tenant/user/load envelope or 50,000-row report validation; use an explicit FR-specific business response-time target only when present in this FR or source BRD. +- **Privacy:** If this FR processes personal data, apply applicable purpose, minimization, access, retention and legal-hold rules from `BRD-FR-047`–`BRD-FR-051`, `BRD-NFR-009`/`014`; do not supply unapproved legal bases or retention durations (`AMB-006`). + +## SRS-QUALITYANDLOTCONTROL-004 — Lot Splitting & Blending Traceability + +- **parent_fr:** `FR-QUALITYANDLOTCONTROL-004` +- **parent_uc:** `UC-006` +- **Source:** ``BRD-FR-017`` +- **FR basis:** 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. + +### Screen-to-system mapping + +- **Surface:** Quality Control workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **System action:** The screen or initiating service presents the FR inputs, invokes the corresponding `Lot Splitting & Blending Traceability` operation, and displays the recorded/computed outcome and any validation result. Exact route and field-level screen layout remain for Stage 11. + +### API requirement + +- **Resource / operation:** `Lot Splitting & Blending Traceability`; operation semantics follow the FR basis above. The path, HTTP verb, pagination shape, and OpenAPI schema are assigned during Stage 9. +- **Request:** Accept only the FR-defined inputs and source-listed fields below; do not accept a client-supplied tenant selector as proof of access. Authenticated APIs resolve the verified tenant context before tenant data access, per approved Stage 7 patterns. +- **Response:** Return the FR-defined state, calculated result, or source-listed data required for the workflow; do not expose another tenant’s records. +- **Failure behavior:** Reject unauthenticated/unauthorized, invalid-state, and invalid-input requests without applying a partial business mutation. Return a stable validation/authorization error contract to be detailed in Stage 9. + +### Data requirement + +- **FR-defined attributes:** Parent Lot ID, Child Lot ID(s), Split Qty MT, Split Bag Count, Linage Tree. +- **Constraints:** Preserve the units, enumerations, state names, formulas, and numeric boundaries stated in the FR basis and validation rules. Tenant-owned records use the approved transaction-local tenant context and PostgreSQL RLS; storage types and indexes are Stage 9 design. + +### Integration requirement + +- **External integration:** No external connector is explicitly required by this FR. Do not infer a weighbridge, payment, messaging, or other provider integration from manual capture or internal workflow language. + +### Validation and error handling + +- **Source validations/invariants:** Sum of child lot quantities must exactly equal parent quantity deducted. +- **Source validations/invariants:** The system enforces the source-defined validation rules: Sum of child lot quantities must exactly equal parent quantity deducted. +- **Failure atomicity:** A rejected command or failed transaction leaves no partial governed business state. + +### Audit requirement + +- This FR does not define a feature-specific audit record. Any governed mutation still uses the approved Stage 7 append-only transaction-audit pattern; do not invent additional audit fields or access-logging rules here. + +### NFR derivation + +- **Tenant security:** Applicable to tenant-scoped access in this FR; enforce verified membership/context before tenant data access, RLS isolation, and fail-closed authorization (NFR-SEC-001, `DEC-021`). +- **Platform availability/recovery:** This capability inherits the approved service targets in NFR-OPS-001 (`BRD-NFR-011`, `DEC-006`). +- **Capacity/performance:** Apply NFR-CAP-001 only where this FR participates in the stated tenant/user/load envelope or 50,000-row report validation; use an explicit FR-specific business response-time target only when present in this FR or source BRD. +- **Privacy:** If this FR processes personal data, apply applicable purpose, minimization, access, retention and legal-hold rules from `BRD-FR-047`–`BRD-FR-051`, `BRD-NFR-009`/`014`; do not supply unapproved legal bases or retention durations (`AMB-006`). + +## SRS-WAREHOUSEINVENTORY-001 — Multi-Godown Dual-Unit Stock Ledger + +- **parent_fr:** `FR-WAREHOUSEINVENTORY-001` +- **parent_uc:** `UC-007` +- **Source:** ``BRD-FR-018`` +- **FR basis:** 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. + +### Screen-to-system mapping + +- **Surface:** Inventory workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **System action:** The screen or initiating service presents the FR inputs, invokes the corresponding `Multi-Godown Dual-Unit Stock Ledger` operation, and displays the recorded/computed outcome and any validation result. Exact route and field-level screen layout remain for Stage 11. + +### API requirement + +- **Resource / operation:** `Multi-Godown Dual-Unit Stock Ledger`; operation semantics follow the FR basis above. The path, HTTP verb, pagination shape, and OpenAPI schema are assigned during Stage 9. +- **Request:** Accept only the FR-defined inputs and source-listed fields below; do not accept a client-supplied tenant selector as proof of access. Authenticated APIs resolve the verified tenant context before tenant data access, per approved Stage 7 patterns. +- **Response:** Return the FR-defined state, calculated result, or source-listed data required for the workflow; do not expose another tenant’s records. +- **Failure behavior:** Reject unauthenticated/unauthorized, invalid-state, and invalid-input requests without applying a partial business mutation. Return a stable validation/authorization error contract to be detailed in Stage 9. + +### Data requirement + +- **FR-defined 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`). +- **Constraints:** Preserve the units, enumerations, state names, formulas, and numeric boundaries stated in the FR basis and validation rules. Tenant-owned records use the approved transaction-local tenant context and PostgreSQL RLS; storage types and indexes are Stage 9 design. + +### Integration requirement + +- **External integration:** No external connector is explicitly required by this FR. Do not infer a weighbridge, payment, messaging, or other provider integration from manual capture or internal workflow language. + +### Validation and error handling + +- **Source validations/invariants:** 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. +- **Source validations/invariants:** 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. +- **Failure atomicity:** A rejected command or failed transaction leaves no partial governed business state. + +### Audit requirement + +- Preserve the FR-defined actor, timestamp, reason, previous/new values, approval, or evidence fields as applicable. Use append-only governed-mutation audit under the approved Stage 7 pattern; precise event schema is Stage 9 design. + +### NFR derivation + +- **Tenant security:** Applicable to tenant-scoped access in this FR; enforce verified membership/context before tenant data access, RLS isolation, and fail-closed authorization (NFR-SEC-001, `DEC-021`). +- **Platform availability/recovery:** This capability inherits the approved service targets in NFR-OPS-001 (`BRD-NFR-011`, `DEC-006`). +- **Capacity/performance:** Apply NFR-CAP-001 only where this FR participates in the stated tenant/user/load envelope or 50,000-row report validation; use an explicit FR-specific business response-time target only when present in this FR or source BRD. +- **Privacy:** If this FR processes personal data, apply applicable purpose, minimization, access, retention and legal-hold rules from `BRD-FR-047`–`BRD-FR-051`, `BRD-NFR-009`/`014`; do not supply unapproved legal bases or retention durations (`AMB-006`). + +## SRS-WAREHOUSEINVENTORY-002 — Godown Capacity & Volume Utilization Tracking + +- **parent_fr:** `FR-WAREHOUSEINVENTORY-002` +- **parent_uc:** `UC-007` +- **Source:** ``BRD-FR-019`` +- **FR basis:** 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$$ + +### Screen-to-system mapping + +- **Surface:** Inventory workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **System action:** The screen or initiating service presents the FR inputs, invokes the corresponding `Godown Capacity & Volume Utilization Tracking` operation, and displays the recorded/computed outcome and any validation result. Exact route and field-level screen layout remain for Stage 11. + +### API requirement + +- **Resource / operation:** `Godown Capacity & Volume Utilization Tracking`; operation semantics follow the FR basis above. The path, HTTP verb, pagination shape, and OpenAPI schema are assigned during Stage 9. +- **Request:** Accept only the FR-defined inputs and source-listed fields below; do not accept a client-supplied tenant selector as proof of access. Authenticated APIs resolve the verified tenant context before tenant data access, per approved Stage 7 patterns. +- **Response:** Return the FR-defined state, calculated result, or source-listed data required for the workflow; do not expose another tenant’s records. +- **Failure behavior:** Reject unauthenticated/unauthorized, invalid-state, and invalid-input requests without applying a partial business mutation. Return a stable validation/authorization error contract to be detailed in Stage 9. + +### Data requirement + +- **FR-defined attributes:** Warehouse ID, Name, City, Capacity MT, Current Stock MT, Utilisation \%. +- **Constraints:** Preserve the units, enumerations, state names, formulas, and numeric boundaries stated in the FR basis and validation rules. Tenant-owned records use the approved transaction-local tenant context and PostgreSQL RLS; storage types and indexes are Stage 9 design. + +### Integration requirement + +- **External integration:** No external connector is explicitly required by this FR. Do not infer a weighbridge, payment, messaging, or other provider integration from manual capture or internal workflow language. + +### Validation and error handling + +- **Source validations/invariants:** Warning status triggered when Utilisation exceeds 85%. +- **Source validations/invariants:** The system enforces the source-defined validation rules: Warning status triggered when Utilisation exceeds 85%. +- **Failure atomicity:** A rejected command or failed transaction leaves no partial governed business state. + +### Audit requirement + +- This FR does not define a feature-specific audit record. Any governed mutation still uses the approved Stage 7 append-only transaction-audit pattern; do not invent additional audit fields or access-logging rules here. + +### NFR derivation + +- **Tenant security:** Applicable to tenant-scoped access in this FR; enforce verified membership/context before tenant data access, RLS isolation, and fail-closed authorization (NFR-SEC-001, `DEC-021`). +- **Platform availability/recovery:** This capability inherits the approved service targets in NFR-OPS-001 (`BRD-NFR-011`, `DEC-006`). +- **Capacity/performance:** Apply NFR-CAP-001 only where this FR participates in the stated tenant/user/load envelope or 50,000-row report validation; use an explicit FR-specific business response-time target only when present in this FR or source BRD. +- **Privacy:** If this FR processes personal data, apply applicable purpose, minimization, access, retention and legal-hold rules from `BRD-FR-047`–`BRD-FR-051`, `BRD-NFR-009`/`014`; do not supply unapproved legal bases or retention durations (`AMB-006`). + +## SRS-WAREHOUSEINVENTORY-003 — Godown-to-Godown Internal Stock Transfer + +- **parent_fr:** `FR-WAREHOUSEINVENTORY-003` +- **parent_uc:** `UC-007` +- **Source:** ``BRD-FR-020`` +- **FR basis:** 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. + +### Screen-to-system mapping + +- **Surface:** Inventory workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **System action:** The screen or initiating service presents the FR inputs, invokes the corresponding `Godown-to-Godown Internal Stock Transfer` operation, and displays the recorded/computed outcome and any validation result. Exact route and field-level screen layout remain for Stage 11. + +### API requirement + +- **Resource / operation:** `Godown-to-Godown Internal Stock Transfer`; operation semantics follow the FR basis above. The path, HTTP verb, pagination shape, and OpenAPI schema are assigned during Stage 9. +- **Request:** Accept only the FR-defined inputs and source-listed fields below; do not accept a client-supplied tenant selector as proof of access. Authenticated APIs resolve the verified tenant context before tenant data access, per approved Stage 7 patterns. +- **Response:** Return the FR-defined state, calculated result, or source-listed data required for the workflow; do not expose another tenant’s records. +- **Failure behavior:** Reject unauthenticated/unauthorized, invalid-state, and invalid-input requests without applying a partial business mutation. Return a stable validation/authorization error contract to be detailed in Stage 9. + +### Data requirement + +- **FR-defined attributes:** Transfer ID, Origin Warehouse, Destination Warehouse, Commodity, Lot ID, Transfer Qty MT, Transfer Bags, Vehicle Reg No, Transit Status. +- **Constraints:** Preserve the units, enumerations, state names, formulas, and numeric boundaries stated in the FR basis and validation rules. Tenant-owned records use the approved transaction-local tenant context and PostgreSQL RLS; storage types and indexes are Stage 9 design. + +### Integration requirement + +- **External integration:** No external connector is explicitly required by this FR. Do not infer a weighbridge, payment, messaging, or other provider integration from manual capture or internal workflow language. + +### Validation and error handling + +- **Source validations/invariants:** Outward and inward entries must reconcile within $\pm 0.2\%$ transfer tolerance. +- **Source validations/invariants:** The system enforces the source-defined validation rules: Outward and inward entries must reconcile within $\pm 0.2\%$ transfer tolerance. +- **Failure atomicity:** A rejected command or failed transaction leaves no partial governed business state. + +### Audit requirement + +- This FR does not define a feature-specific audit record. Any governed mutation still uses the approved Stage 7 append-only transaction-audit pattern; do not invent additional audit fields or access-logging rules here. + +### NFR derivation + +- **Tenant security:** Applicable to tenant-scoped access in this FR; enforce verified membership/context before tenant data access, RLS isolation, and fail-closed authorization (NFR-SEC-001, `DEC-021`). +- **Platform availability/recovery:** This capability inherits the approved service targets in NFR-OPS-001 (`BRD-NFR-011`, `DEC-006`). +- **Capacity/performance:** Apply NFR-CAP-001 only where this FR participates in the stated tenant/user/load envelope or 50,000-row report validation; use an explicit FR-specific business response-time target only when present in this FR or source BRD. +- **Privacy:** If this FR processes personal data, apply applicable purpose, minimization, access, retention and legal-hold rules from `BRD-FR-047`–`BRD-FR-051`, `BRD-NFR-009`/`014`; do not supply unapproved legal bases or retention durations (`AMB-006`). + +## SRS-SALESCONTRACTS-001 — Customer Sales Contract Booking + +- **parent_fr:** `FR-SALESCONTRACTS-001` +- **parent_uc:** `UC-008` +- **Source:** ``BRD-FR-021`` +- **FR basis:** 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. + +### Screen-to-system mapping + +- **Surface:** Sales workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **System action:** The screen or initiating service presents the FR inputs, invokes the corresponding `Customer Sales Contract Booking` operation, and displays the recorded/computed outcome and any validation result. Exact route and field-level screen layout remain for Stage 11. + +### API requirement + +- **Resource / operation:** `Customer Sales Contract Booking`; operation semantics follow the FR basis above. The path, HTTP verb, pagination shape, and OpenAPI schema are assigned during Stage 9. +- **Request:** Accept only the FR-defined inputs and source-listed fields below; do not accept a client-supplied tenant selector as proof of access. Authenticated APIs resolve the verified tenant context before tenant data access, per approved Stage 7 patterns. +- **Response:** Return the FR-defined state, calculated result, or source-listed data required for the workflow; do not expose another tenant’s records. +- **Failure behavior:** Reject unauthenticated/unauthorized, invalid-state, and invalid-input requests without applying a partial business mutation. Return a stable validation/authorization error contract to be detailed in Stage 9. + +### Data requirement + +- **FR-defined 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. +- **Constraints:** Preserve the units, enumerations, state names, formulas, and numeric boundaries stated in the FR basis and validation rules. Tenant-owned records use the approved transaction-local tenant context and PostgreSQL RLS; storage types and indexes are Stage 9 design. + +### Integration requirement + +- **External integration:** No external connector is explicitly required by this FR. Do not infer a weighbridge, payment, messaging, or other provider integration from manual capture or internal workflow language. + +### Validation and error handling + +- **Source validations/invariants:** Total Sales Value must equal $\text{Contract Qty MT} \times 10 \times \text{Rate ₹/Qtl}$. +- **Source validations/invariants:** The system enforces the source-defined validation rules: Total Sales Value must equal $\text{Contract Qty MT} \times 10 \times \text{Rate ₹/Qtl}$. +- **Failure atomicity:** A rejected command or failed transaction leaves no partial governed business state. + +### Audit requirement + +- This FR does not define a feature-specific audit record. Any governed mutation still uses the approved Stage 7 append-only transaction-audit pattern; do not invent additional audit fields or access-logging rules here. + +### NFR derivation + +- **Tenant security:** Applicable to tenant-scoped access in this FR; enforce verified membership/context before tenant data access, RLS isolation, and fail-closed authorization (NFR-SEC-001, `DEC-021`). +- **Platform availability/recovery:** This capability inherits the approved service targets in NFR-OPS-001 (`BRD-NFR-011`, `DEC-006`). +- **Capacity/performance:** Apply NFR-CAP-001 only where this FR participates in the stated tenant/user/load envelope or 50,000-row report validation; use an explicit FR-specific business response-time target only when present in this FR or source BRD. +- **Privacy:** If this FR processes personal data, apply applicable purpose, minimization, access, retention and legal-hold rules from `BRD-FR-047`–`BRD-FR-051`, `BRD-NFR-009`/`014`; do not supply unapproved legal bases or retention durations (`AMB-006`). + +## SRS-SALESCONTRACTS-002 — Customer Credit Limit & Pre-Order Exposure Verification + +- **parent_fr:** `FR-SALESCONTRACTS-002` +- **parent_uc:** `UC-008` +- **Source:** ``BRD-FR-022`` +- **FR basis:** 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. + +### Screen-to-system mapping + +- **Surface:** Sales workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **System action:** The screen or initiating service presents the FR inputs, invokes the corresponding `Customer Credit Limit & Pre-Order Exposure Verification` operation, and displays the recorded/computed outcome and any validation result. Exact route and field-level screen layout remain for Stage 11. + +### API requirement + +- **Resource / operation:** `Customer Credit Limit & Pre-Order Exposure Verification`; operation semantics follow the FR basis above. The path, HTTP verb, pagination shape, and OpenAPI schema are assigned during Stage 9. +- **Request:** Accept only the FR-defined inputs and source-listed fields below; do not accept a client-supplied tenant selector as proof of access. Authenticated APIs resolve the verified tenant context before tenant data access, per approved Stage 7 patterns. +- **Response:** Return the FR-defined state, calculated result, or source-listed data required for the workflow; do not expose another tenant’s records. +- **Failure behavior:** Reject unauthenticated/unauthorized, invalid-state, and invalid-input requests without applying a partial business mutation. Return a stable validation/authorization error contract to be detailed in Stage 9. + +### Data requirement + +- **FR-defined attributes:** Sanctioned Credit Limit INR, Current Outstanding INR, New Order Value INR, Projected Exposure INR, Projected Exposure Ratio \%. +- **Constraints:** Preserve the units, enumerations, state names, formulas, and numeric boundaries stated in the FR basis and validation rules. Tenant-owned records use the approved transaction-local tenant context and PostgreSQL RLS; storage types and indexes are Stage 9 design. + +### Integration requirement + +- **External integration:** No external connector is explicitly required by this FR. Do not infer a weighbridge, payment, messaging, or other provider integration from manual capture or internal workflow language. + +### Validation and error handling + +- **Source validations/invariants:** If Projected Exposure Ratio $>80\%$, display inline warning. If Projected Exposure Ratio $>100\%$, system must prevent order confirmation unless authorized by Partner. +- **Source validations/invariants:** 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. +- **Failure atomicity:** A rejected command or failed transaction leaves no partial governed business state. + +### Audit requirement + +- This FR does not define a feature-specific audit record. Any governed mutation still uses the approved Stage 7 append-only transaction-audit pattern; do not invent additional audit fields or access-logging rules here. + +### NFR derivation + +- **Tenant security:** Applicable to tenant-scoped access in this FR; enforce verified membership/context before tenant data access, RLS isolation, and fail-closed authorization (NFR-SEC-001, `DEC-021`). +- **Platform availability/recovery:** This capability inherits the approved service targets in NFR-OPS-001 (`BRD-NFR-011`, `DEC-006`). +- **Capacity/performance:** Apply NFR-CAP-001 only where this FR participates in the stated tenant/user/load envelope or 50,000-row report validation; use an explicit FR-specific business response-time target only when present in this FR or source BRD. +- **Privacy:** If this FR processes personal data, apply applicable purpose, minimization, access, retention and legal-hold rules from `BRD-FR-047`–`BRD-FR-051`, `BRD-NFR-009`/`014`; do not supply unapproved legal bases or retention durations (`AMB-006`). + +## SRS-SALESCONTRACTS-003 — Sales Order Inventory Allocation + +- **parent_fr:** `FR-SALESCONTRACTS-003` +- **parent_uc:** `UC-008` +- **Source:** ``BRD-FR-023`` +- **FR basis:** 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. + +### Screen-to-system mapping + +- **Surface:** Sales workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **System action:** The screen or initiating service presents the FR inputs, invokes the corresponding `Sales Order Inventory Allocation` operation, and displays the recorded/computed outcome and any validation result. Exact route and field-level screen layout remain for Stage 11. + +### API requirement + +- **Resource / operation:** `Sales Order Inventory Allocation`; operation semantics follow the FR basis above. The path, HTTP verb, pagination shape, and OpenAPI schema are assigned during Stage 9. +- **Request:** Accept only the FR-defined inputs and source-listed fields below; do not accept a client-supplied tenant selector as proof of access. Authenticated APIs resolve the verified tenant context before tenant data access, per approved Stage 7 patterns. +- **Response:** Return the FR-defined state, calculated result, or source-listed data required for the workflow; do not expose another tenant’s records. +- **Failure behavior:** Reject unauthenticated/unauthorized, invalid-state, and invalid-input requests without applying a partial business mutation. Return a stable validation/authorization error contract to be detailed in Stage 9. + +### Data requirement + +- **FR-defined attributes:** Sales Order ID, Allocated Lot ID, Allocated Qty MT, Allocated Bags, Warehouse ID. +- **Constraints:** Preserve the units, enumerations, state names, formulas, and numeric boundaries stated in the FR basis and validation rules. Tenant-owned records use the approved transaction-local tenant context and PostgreSQL RLS; storage types and indexes are Stage 9 design. + +### Integration requirement + +- **External integration:** No external connector is explicitly required by this FR. Do not infer a weighbridge, payment, messaging, or other provider integration from manual capture or internal workflow language. + +### Validation and error handling + +- **Source validations/invariants:** Allocation fails if Lot status is `QC Hold` or `Under QC`, or if available lot unreserved MT $<$ allocated MT. +- **Source validations/invariants:** 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. +- **Failure atomicity:** A rejected command or failed transaction leaves no partial governed business state. + +### Audit requirement + +- This FR does not define a feature-specific audit record. Any governed mutation still uses the approved Stage 7 append-only transaction-audit pattern; do not invent additional audit fields or access-logging rules here. + +### NFR derivation + +- **Tenant security:** Applicable to tenant-scoped access in this FR; enforce verified membership/context before tenant data access, RLS isolation, and fail-closed authorization (NFR-SEC-001, `DEC-021`). +- **Platform availability/recovery:** This capability inherits the approved service targets in NFR-OPS-001 (`BRD-NFR-011`, `DEC-006`). +- **Capacity/performance:** Apply NFR-CAP-001 only where this FR participates in the stated tenant/user/load envelope or 50,000-row report validation; use an explicit FR-specific business response-time target only when present in this FR or source BRD. +- **Privacy:** If this FR processes personal data, apply applicable purpose, minimization, access, retention and legal-hold rules from `BRD-FR-047`–`BRD-FR-051`, `BRD-NFR-009`/`014`; do not supply unapproved legal bases or retention durations (`AMB-006`). + +## SRS-DISPATCHDELIVERY-001 — Outbound Dispatch Board Console + +- **parent_fr:** `FR-DISPATCHDELIVERY-001` +- **parent_uc:** `UC-009` +- **Source:** ``BRD-FR-024`` +- **FR basis:** 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. + +### Screen-to-system mapping + +- **Surface:** Logistics workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **System action:** The screen or initiating service presents the FR inputs, invokes the corresponding `Outbound Dispatch Board Console` operation, and displays the recorded/computed outcome and any validation result. Exact route and field-level screen layout remain for Stage 11. + +### API requirement + +- **Resource / operation:** `Outbound Dispatch Board Console`; operation semantics follow the FR basis above. The path, HTTP verb, pagination shape, and OpenAPI schema are assigned during Stage 9. +- **Request:** Accept only the FR-defined inputs and source-listed fields below; do not accept a client-supplied tenant selector as proof of access. Authenticated APIs resolve the verified tenant context before tenant data access, per approved Stage 7 patterns. +- **Response:** Return the FR-defined state, calculated result, or source-listed data required for the workflow; do not expose another tenant’s records. +- **Failure behavior:** Reject unauthenticated/unauthorized, invalid-state, and invalid-input requests without applying a partial business mutation. Return a stable validation/authorization error contract to be detailed in Stage 9. + +### Data requirement + +- **FR-defined 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`). +- **Constraints:** Preserve the units, enumerations, state names, formulas, and numeric boundaries stated in the FR basis and validation rules. Tenant-owned records use the approved transaction-local tenant context and PostgreSQL RLS; storage types and indexes are Stage 9 design. + +### Integration requirement + +- **External integration:** No external connector is explicitly required by this FR. Do not infer a weighbridge, payment, messaging, or other provider integration from manual capture or internal workflow language. + +### Validation and error handling + +- **Source validations/invariants:** Dispatch cannot be created without an approved sales order and assigned vehicle. +- **Source validations/invariants:** The system enforces the source-defined validation rules: Dispatch cannot be created without an approved sales order and assigned vehicle. +- **Failure atomicity:** A rejected command or failed transaction leaves no partial governed business state. + +### Audit requirement + +- This FR does not define a feature-specific audit record. Any governed mutation still uses the approved Stage 7 append-only transaction-audit pattern; do not invent additional audit fields or access-logging rules here. + +### NFR derivation + +- **Tenant security:** Applicable to tenant-scoped access in this FR; enforce verified membership/context before tenant data access, RLS isolation, and fail-closed authorization (NFR-SEC-001, `DEC-021`). +- **Platform availability/recovery:** This capability inherits the approved service targets in NFR-OPS-001 (`BRD-NFR-011`, `DEC-006`). +- **Capacity/performance:** Apply NFR-CAP-001 only where this FR participates in the stated tenant/user/load envelope or 50,000-row report validation; use an explicit FR-specific business response-time target only when present in this FR or source BRD. +- **Privacy:** If this FR processes personal data, apply applicable purpose, minimization, access, retention and legal-hold rules from `BRD-FR-047`–`BRD-FR-051`, `BRD-NFR-009`/`014`; do not supply unapproved legal bases or retention durations (`AMB-006`). + +## SRS-DISPATCHDELIVERY-002 — Outbound Weighbridge & Dispatch Bilty/Manifest + +- **parent_fr:** `FR-DISPATCHDELIVERY-002` +- **parent_uc:** `UC-009` +- **Source:** ``BRD-FR-025`` +- **FR basis:** 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. + +### Screen-to-system mapping + +- **Surface:** Logistics workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **System action:** The screen or initiating service presents the FR inputs, invokes the corresponding `Outbound Weighbridge & Dispatch Bilty/Manifest` operation, and displays the recorded/computed outcome and any validation result. Exact route and field-level screen layout remain for Stage 11. + +### API requirement + +- **Resource / operation:** `Outbound Weighbridge & Dispatch Bilty/Manifest`; operation semantics follow the FR basis above. The path, HTTP verb, pagination shape, and OpenAPI schema are assigned during Stage 9. +- **Request:** Accept only the FR-defined inputs and source-listed fields below; do not accept a client-supplied tenant selector as proof of access. Authenticated APIs resolve the verified tenant context before tenant data access, per approved Stage 7 patterns. +- **Response:** Return the FR-defined state, calculated result, or source-listed data required for the workflow; do not expose another tenant’s records. +- **Failure behavior:** Reject unauthenticated/unauthorized, invalid-state, and invalid-input requests without applying a partial business mutation. Return a stable validation/authorization error contract to be detailed in Stage 9. + +### Data requirement + +- **FR-defined attributes:** Dispatch ID, Outward Tare kg, Outward Gross kg, Net Loaded MT, Loaded Bag Count, Transporter Bilty No, e-Way Bill No. +- **Constraints:** Preserve the units, enumerations, state names, formulas, and numeric boundaries stated in the FR basis and validation rules. Tenant-owned records use the approved transaction-local tenant context and PostgreSQL RLS; storage types and indexes are Stage 9 design. + +### Integration requirement + +- **External integration:** No external connector is explicitly required by this FR. Do not infer a weighbridge, payment, messaging, or other provider integration from manual capture or internal workflow language. + +### Validation and error handling + +- **Source validations/invariants:** Net loaded MT must match allocated order MT within $\pm 1.0\%$ loading tolerance. +- **Source validations/invariants:** The system enforces the source-defined validation rules: Net loaded MT must match allocated order MT within $\pm 1.0\%$ loading tolerance. +- **Failure atomicity:** A rejected command or failed transaction leaves no partial governed business state. + +### Audit requirement + +- This FR does not define a feature-specific audit record. Any governed mutation still uses the approved Stage 7 append-only transaction-audit pattern; do not invent additional audit fields or access-logging rules here. + +### NFR derivation + +- **Tenant security:** Applicable to tenant-scoped access in this FR; enforce verified membership/context before tenant data access, RLS isolation, and fail-closed authorization (NFR-SEC-001, `DEC-021`). +- **Platform availability/recovery:** This capability inherits the approved service targets in NFR-OPS-001 (`BRD-NFR-011`, `DEC-006`). +- **Capacity/performance:** Apply NFR-CAP-001 only where this FR participates in the stated tenant/user/load envelope or 50,000-row report validation; use an explicit FR-specific business response-time target only when present in this FR or source BRD. +- **Privacy:** If this FR processes personal data, apply applicable purpose, minimization, access, retention and legal-hold rules from `BRD-FR-047`–`BRD-FR-051`, `BRD-NFR-009`/`014`; do not supply unapproved legal bases or retention durations (`AMB-006`). + +## SRS-DISPATCHDELIVERY-003 — In-Transit Tracking & Proof of Delivery (POD) + +- **parent_fr:** `FR-DISPATCHDELIVERY-003` +- **parent_uc:** `UC-009` +- **Source:** ``BRD-FR-026`` +- **FR basis:** 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. + +### Screen-to-system mapping + +- **Surface:** Logistics workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **System action:** The screen or initiating service presents the FR inputs, invokes the corresponding `In-Transit Tracking & Proof of Delivery (POD)` operation, and displays the recorded/computed outcome and any validation result. Exact route and field-level screen layout remain for Stage 11. + +### API requirement + +- **Resource / operation:** `In-Transit Tracking & Proof of Delivery (POD)`; operation semantics follow the FR basis above. The path, HTTP verb, pagination shape, and OpenAPI schema are assigned during Stage 9. +- **Request:** Accept only the FR-defined inputs and source-listed fields below; do not accept a client-supplied tenant selector as proof of access. Authenticated APIs resolve the verified tenant context before tenant data access, per approved Stage 7 patterns. +- **Response:** Return the FR-defined state, calculated result, or source-listed data required for the workflow; do not expose another tenant’s records. +- **Failure behavior:** Reject unauthenticated/unauthorized, invalid-state, and invalid-input requests without applying a partial business mutation. Return a stable validation/authorization error contract to be detailed in Stage 9. + +### Data requirement + +- **FR-defined 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). +- **Constraints:** Preserve the units, enumerations, state names, formulas, and numeric boundaries stated in the FR basis and validation rules. Tenant-owned records use the approved transaction-local tenant context and PostgreSQL RLS; storage types and indexes are Stage 9 design. + +### Integration requirement + +- **External integration:** No external connector is explicitly required by this FR. Do not infer a weighbridge, payment, messaging, or other provider integration from manual capture or internal workflow language. + +### Validation and error handling + +- **Source validations/invariants:** 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. +- **Source validations/invariants:** 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. +- **Failure atomicity:** A rejected command or failed transaction leaves no partial governed business state. + +### Audit requirement + +- This FR does not define a feature-specific audit record. Any governed mutation still uses the approved Stage 7 append-only transaction-audit pattern; do not invent additional audit fields or access-logging rules here. + +### NFR derivation + +- **Tenant security:** Applicable to tenant-scoped access in this FR; enforce verified membership/context before tenant data access, RLS isolation, and fail-closed authorization (NFR-SEC-001, `DEC-021`). +- **Platform availability/recovery:** This capability inherits the approved service targets in NFR-OPS-001 (`BRD-NFR-011`, `DEC-006`). +- **Capacity/performance:** Apply NFR-CAP-001 only where this FR participates in the stated tenant/user/load envelope or 50,000-row report validation; use an explicit FR-specific business response-time target only when present in this FR or source BRD. +- **Privacy:** If this FR processes personal data, apply applicable purpose, minimization, access, retention and legal-hold rules from `BRD-FR-047`–`BRD-FR-051`, `BRD-NFR-009`/`014`; do not supply unapproved legal bases or retention durations (`AMB-006`). + +## SRS-FLEETREGISTRY-001 — Transport Fleet Registry + +- **parent_fr:** `FR-FLEETREGISTRY-001` +- **parent_uc:** `UC-010` +- **Source:** ``BRD-FR-027`` +- **FR basis:** 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`). + +### Screen-to-system mapping + +- **Surface:** Logistics & Fleet workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **System action:** The screen or initiating service presents the FR inputs, invokes the corresponding `Transport Fleet Registry` operation, and displays the recorded/computed outcome and any validation result. Exact route and field-level screen layout remain for Stage 11. + +### API requirement + +- **Resource / operation:** `Transport Fleet Registry`; operation semantics follow the FR basis above. The path, HTTP verb, pagination shape, and OpenAPI schema are assigned during Stage 9. +- **Request:** Accept only the FR-defined inputs and source-listed fields below; do not accept a client-supplied tenant selector as proof of access. Authenticated APIs resolve the verified tenant context before tenant data access, per approved Stage 7 patterns. +- **Response:** Return the FR-defined state, calculated result, or source-listed data required for the workflow; do not expose another tenant’s records. +- **Failure behavior:** Reject unauthenticated/unauthorized, invalid-state, and invalid-input requests without applying a partial business mutation. Return a stable validation/authorization error contract to be detailed in Stage 9. + +### Data requirement + +- **FR-defined attributes:** Vehicle Reg No, Make/Model, Payload Capacity MT, Ownership Type, Transporter Name, Status, Fitness Expiry Date. +- **Constraints:** Preserve the units, enumerations, state names, formulas, and numeric boundaries stated in the FR basis and validation rules. Tenant-owned records use the approved transaction-local tenant context and PostgreSQL RLS; storage types and indexes are Stage 9 design. + +### Integration requirement + +- **External integration:** No external connector is explicitly required by this FR. Do not infer a weighbridge, payment, messaging, or other provider integration from manual capture or internal workflow language. + +### Validation and error handling + +- **Source validations/invariants:** Vehicles with status `Maintenance` cannot be assigned to dispatches. +- **Source validations/invariants:** The system enforces the source-defined validation rules: Vehicles with status `Maintenance` cannot be assigned to dispatches. +- **Failure atomicity:** A rejected command or failed transaction leaves no partial governed business state. + +### Audit requirement + +- This FR does not define a feature-specific audit record. Any governed mutation still uses the approved Stage 7 append-only transaction-audit pattern; do not invent additional audit fields or access-logging rules here. + +### NFR derivation + +- **Tenant security:** Applicable to tenant-scoped access in this FR; enforce verified membership/context before tenant data access, RLS isolation, and fail-closed authorization (NFR-SEC-001, `DEC-021`). +- **Platform availability/recovery:** This capability inherits the approved service targets in NFR-OPS-001 (`BRD-NFR-011`, `DEC-006`). +- **Capacity/performance:** Apply NFR-CAP-001 only where this FR participates in the stated tenant/user/load envelope or 50,000-row report validation; use an explicit FR-specific business response-time target only when present in this FR or source BRD. +- **Privacy:** If this FR processes personal data, apply applicable purpose, minimization, access, retention and legal-hold rules from `BRD-FR-047`–`BRD-FR-051`, `BRD-NFR-009`/`014`; do not supply unapproved legal bases or retention durations (`AMB-006`). + +## SRS-CUSTOMERRECEIVABLES-001 — Customer Ledger & Aging Statement + +- **parent_fr:** `FR-CUSTOMERRECEIVABLES-001` +- **parent_uc:** `UC-011` +- **Source:** ``BRD-FR-028`` +- **FR basis:** 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). + +### Screen-to-system mapping + +- **Surface:** Finance workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **System action:** The screen or initiating service presents the FR inputs, invokes the corresponding `Customer Ledger & Aging Statement` operation, and displays the recorded/computed outcome and any validation result. Exact route and field-level screen layout remain for Stage 11. + +### API requirement + +- **Resource / operation:** `Customer Ledger & Aging Statement`; operation semantics follow the FR basis above. The path, HTTP verb, pagination shape, and OpenAPI schema are assigned during Stage 9. +- **Request:** Accept only the FR-defined inputs and source-listed fields below; do not accept a client-supplied tenant selector as proof of access. Authenticated APIs resolve the verified tenant context before tenant data access, per approved Stage 7 patterns. +- **Response:** Return the FR-defined state, calculated result, or source-listed data required for the workflow; do not expose another tenant’s records. +- **Failure behavior:** Reject unauthenticated/unauthorized, invalid-state, and invalid-input requests without applying a partial business mutation. Return a stable validation/authorization error contract to be detailed in Stage 9. + +### Data requirement + +- **FR-defined attributes:** Customer ID, Posting Date, Voucher Type (`Sales Invoice`, `Payment Receipt`), Voucher No, Debit Amount INR, Credit Amount INR, Running Outstanding INR. +- **Constraints:** Preserve the units, enumerations, state names, formulas, and numeric boundaries stated in the FR basis and validation rules. Tenant-owned records use the approved transaction-local tenant context and PostgreSQL RLS; storage types and indexes are Stage 9 design. + +### Integration requirement + +- **External integration:** No external connector is explicitly required by this FR. Do not infer a weighbridge, payment, messaging, or other provider integration from manual capture or internal workflow language. + +### Validation and error handling + +- **Source validations/invariants:** Sub-ledger entries are immutable; corrections require credit/debit adjustment vouchers. +- **Source validations/invariants:** The system enforces the source-defined validation rules: Sub-ledger entries are immutable; corrections require credit/debit adjustment vouchers. +- **Failure atomicity:** A rejected command or failed transaction leaves no partial governed business state. + +### Audit requirement + +- This FR does not define a feature-specific audit record. Any governed mutation still uses the approved Stage 7 append-only transaction-audit pattern; do not invent additional audit fields or access-logging rules here. + +### NFR derivation + +- **Tenant security:** Applicable to tenant-scoped access in this FR; enforce verified membership/context before tenant data access, RLS isolation, and fail-closed authorization (NFR-SEC-001, `DEC-021`). +- **Platform availability/recovery:** This capability inherits the approved service targets in NFR-OPS-001 (`BRD-NFR-011`, `DEC-006`). +- **Capacity/performance:** Apply NFR-CAP-001 only where this FR participates in the stated tenant/user/load envelope or 50,000-row report validation; use an explicit FR-specific business response-time target only when present in this FR or source BRD. +- **Privacy:** If this FR processes personal data, apply applicable purpose, minimization, access, retention and legal-hold rules from `BRD-FR-047`–`BRD-FR-051`, `BRD-NFR-009`/`014`; do not supply unapproved legal bases or retention durations (`AMB-006`). + +## SRS-CUSTOMERRECEIVABLES-002 — Automated Customer Credit Exposure Watch & Threshold Alert + +- **parent_fr:** `FR-CUSTOMERRECEIVABLES-002` +- **parent_uc:** `UC-011` +- **Source:** ``BRD-FR-029`` +- **FR basis:** 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. + +### Screen-to-system mapping + +- **Surface:** Finance workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **System action:** The screen or initiating service presents the FR inputs, invokes the corresponding `Automated Customer Credit Exposure Watch & Threshold Alert` operation, and displays the recorded/computed outcome and any validation result. Exact route and field-level screen layout remain for Stage 11. + +### API requirement + +- **Resource / operation:** `Automated Customer Credit Exposure Watch & Threshold Alert`; operation semantics follow the FR basis above. The path, HTTP verb, pagination shape, and OpenAPI schema are assigned during Stage 9. +- **Request:** Accept only the FR-defined inputs and source-listed fields below; do not accept a client-supplied tenant selector as proof of access. Authenticated APIs resolve the verified tenant context before tenant data access, per approved Stage 7 patterns. +- **Response:** Return the FR-defined state, calculated result, or source-listed data required for the workflow; do not expose another tenant’s records. +- **Failure behavior:** Reject unauthenticated/unauthorized, invalid-state, and invalid-input requests without applying a partial business mutation. Return a stable validation/authorization error contract to be detailed in Stage 9. + +### Data requirement + +- **FR-defined attributes:** Customer Code, Customer Name, Sanctioned Credit Limit INR, Outstanding INR, Exposure %, Risk Flag (`Normal`, `Watch`, `Critical`). +- **Constraints:** Preserve the units, enumerations, state names, formulas, and numeric boundaries stated in the FR basis and validation rules. Tenant-owned records use the approved transaction-local tenant context and PostgreSQL RLS; storage types and indexes are Stage 9 design. + +### Integration requirement + +- **External integration:** No external connector is explicitly required by this FR. Do not infer a weighbridge, payment, messaging, or other provider integration from manual capture or internal workflow language. + +### Validation and error handling + +- **Source validations/invariants:** Evaluated in real time upon every sales invoice post and payment receipt post. +- **Source validations/invariants:** The system enforces the source-defined validation rules: Evaluated in real time upon every sales invoice post and payment receipt post. +- **Failure atomicity:** A rejected command or failed transaction leaves no partial governed business state. + +### Audit requirement + +- This FR does not define a feature-specific audit record. Any governed mutation still uses the approved Stage 7 append-only transaction-audit pattern; do not invent additional audit fields or access-logging rules here. + +### NFR derivation + +- **Tenant security:** Applicable to tenant-scoped access in this FR; enforce verified membership/context before tenant data access, RLS isolation, and fail-closed authorization (NFR-SEC-001, `DEC-021`). +- **Platform availability/recovery:** This capability inherits the approved service targets in NFR-OPS-001 (`BRD-NFR-011`, `DEC-006`). +- **Capacity/performance:** Apply NFR-CAP-001 only where this FR participates in the stated tenant/user/load envelope or 50,000-row report validation; use an explicit FR-specific business response-time target only when present in this FR or source BRD. +- **Privacy:** If this FR processes personal data, apply applicable purpose, minimization, access, retention and legal-hold rules from `BRD-FR-047`–`BRD-FR-051`, `BRD-NFR-009`/`014`; do not supply unapproved legal bases or retention durations (`AMB-006`). + +## SRS-CUSTOMERRECEIVABLES-003 — Credit Breach Dispatch Lock & Partner Override + +- **parent_fr:** `FR-CUSTOMERRECEIVABLES-003` +- **parent_uc:** `UC-011` +- **Source:** ``BRD-FR-030`` +- **FR basis:** 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. + +### Screen-to-system mapping + +- **Surface:** Finance workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **System action:** The screen or initiating service presents the FR inputs, invokes the corresponding `Credit Breach Dispatch Lock & Partner Override` operation, and displays the recorded/computed outcome and any validation result. Exact route and field-level screen layout remain for Stage 11. + +### API requirement + +- **Resource / operation:** `Credit Breach Dispatch Lock & Partner Override`; operation semantics follow the FR basis above. The path, HTTP verb, pagination shape, and OpenAPI schema are assigned during Stage 9. +- **Request:** Accept only the FR-defined inputs and source-listed fields below; do not accept a client-supplied tenant selector as proof of access. Authenticated APIs resolve the verified tenant context before tenant data access, per approved Stage 7 patterns. +- **Response:** Return the FR-defined state, calculated result, or source-listed data required for the workflow; do not expose another tenant’s records. +- **Failure behavior:** Reject unauthenticated/unauthorized, invalid-state, and invalid-input requests without applying a partial business mutation. Return a stable validation/authorization error contract to be detailed in Stage 9. + +### Data requirement + +- **FR-defined attributes:** Lock Status (`Active`, `Overridden`), Override Approved By, Override Reason, Timestamp. +- **Constraints:** Preserve the units, enumerations, state names, formulas, and numeric boundaries stated in the FR basis and validation rules. Tenant-owned records use the approved transaction-local tenant context and PostgreSQL RLS; storage types and indexes are Stage 9 design. + +### Integration requirement + +- **External integration:** No external connector is explicitly required by this FR. Do not infer a weighbridge, payment, messaging, or other provider integration from manual capture or internal workflow language. + +### Validation and error handling + +- **Source validations/invariants:** Override action permanently logged in audit trail. +- **Source validations/invariants:** The system enforces the source-defined validation rules: Override action permanently logged in audit trail. +- **Failure atomicity:** A rejected command or failed transaction leaves no partial governed business state. + +### Audit requirement + +- Preserve the FR-defined actor, timestamp, reason, previous/new values, approval, or evidence fields as applicable. Use append-only governed-mutation audit under the approved Stage 7 pattern; precise event schema is Stage 9 design. + +### NFR derivation + +- **Tenant security:** Applicable to tenant-scoped access in this FR; enforce verified membership/context before tenant data access, RLS isolation, and fail-closed authorization (NFR-SEC-001, `DEC-021`). +- **Platform availability/recovery:** This capability inherits the approved service targets in NFR-OPS-001 (`BRD-NFR-011`, `DEC-006`). +- **Capacity/performance:** Apply NFR-CAP-001 only where this FR participates in the stated tenant/user/load envelope or 50,000-row report validation; use an explicit FR-specific business response-time target only when present in this FR or source BRD. +- **Privacy:** If this FR processes personal data, apply applicable purpose, minimization, access, retention and legal-hold rules from `BRD-FR-047`–`BRD-FR-051`, `BRD-NFR-009`/`014`; do not supply unapproved legal bases or retention durations (`AMB-006`). + +## SRS-CUSTOMERRECEIVABLES-004 — Customer Payment Receipt Posting + +- **parent_fr:** `FR-CUSTOMERRECEIVABLES-004` +- **parent_uc:** `UC-011` +- **Source:** ``BRD-FR-031`` +- **FR basis:** 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. + +### Screen-to-system mapping + +- **Surface:** Finance workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **System action:** The screen or initiating service presents the FR inputs, invokes the corresponding `Customer Payment Receipt Posting` operation, and displays the recorded/computed outcome and any validation result. Exact route and field-level screen layout remain for Stage 11. + +### API requirement + +- **Resource / operation:** `Customer Payment Receipt Posting`; operation semantics follow the FR basis above. The path, HTTP verb, pagination shape, and OpenAPI schema are assigned during Stage 9. +- **Request:** Accept only the FR-defined inputs and source-listed fields below; do not accept a client-supplied tenant selector as proof of access. Authenticated APIs resolve the verified tenant context before tenant data access, per approved Stage 7 patterns. +- **Response:** Return the FR-defined state, calculated result, or source-listed data required for the workflow; do not expose another tenant’s records. +- **Failure behavior:** Reject unauthenticated/unauthorized, invalid-state, and invalid-input requests without applying a partial business mutation. Return a stable validation/authorization error contract to be detailed in Stage 9. + +### Data requirement + +- **FR-defined 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. +- **Constraints:** Preserve the units, enumerations, state names, formulas, and numeric boundaries stated in the FR basis and validation rules. Tenant-owned records use the approved transaction-local tenant context and PostgreSQL RLS; storage types and indexes are Stage 9 design. + +### Integration requirement + +- **External integration:** No external connector is explicitly required by this FR. Do not infer a weighbridge, payment, messaging, or other provider integration from manual capture or internal workflow language. + +### Validation and error handling + +- **Source validations/invariants:** 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. +- **Source validations/invariants:** 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. +- **Failure atomicity:** A rejected command or failed transaction leaves no partial governed business state. + +### Audit requirement + +- Preserve the FR-defined actor, timestamp, reason, previous/new values, approval, or evidence fields as applicable. Use append-only governed-mutation audit under the approved Stage 7 pattern; precise event schema is Stage 9 design. + +### NFR derivation + +- **Tenant security:** Applicable to tenant-scoped access in this FR; enforce verified membership/context before tenant data access, RLS isolation, and fail-closed authorization (NFR-SEC-001, `DEC-021`). +- **Platform availability/recovery:** This capability inherits the approved service targets in NFR-OPS-001 (`BRD-NFR-011`, `DEC-006`). +- **Capacity/performance:** Apply NFR-CAP-001 only where this FR participates in the stated tenant/user/load envelope or 50,000-row report validation; use an explicit FR-specific business response-time target only when present in this FR or source BRD. +- **Privacy:** If this FR processes personal data, apply applicable purpose, minimization, access, retention and legal-hold rules from `BRD-FR-047`–`BRD-FR-051`, `BRD-NFR-009`/`014`; do not supply unapproved legal bases or retention durations (`AMB-006`). + +## SRS-SUPPLIERPAYABLES-001 — Supplier Payables Aging & Balance Snapshots + +- **parent_fr:** `FR-SUPPLIERPAYABLES-001` +- **parent_uc:** `UC-012` +- **Source:** ``BRD-FR-032`` +- **FR basis:** The system must track supplier payables arising from accepted GRNs, applying supplier credit days, generating aging schedules, and providing daily aggregate payables snapshots. + +### Screen-to-system mapping + +- **Surface:** Finance workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **System action:** The screen or initiating service presents the FR inputs, invokes the corresponding `Supplier Payables Aging & Balance Snapshots` operation, and displays the recorded/computed outcome and any validation result. Exact route and field-level screen layout remain for Stage 11. + +### API requirement + +- **Resource / operation:** `Supplier Payables Aging & Balance Snapshots`; operation semantics follow the FR basis above. The path, HTTP verb, pagination shape, and OpenAPI schema are assigned during Stage 9. +- **Request:** Accept only the FR-defined inputs and source-listed fields below; do not accept a client-supplied tenant selector as proof of access. Authenticated APIs resolve the verified tenant context before tenant data access, per approved Stage 7 patterns. +- **Response:** Return the FR-defined state, calculated result, or source-listed data required for the workflow; do not expose another tenant’s records. +- **Failure behavior:** Reject unauthenticated/unauthorized, invalid-state, and invalid-input requests without applying a partial business mutation. Return a stable validation/authorization error contract to be detailed in Stage 9. + +### Data requirement + +- **FR-defined attributes:** Supplier ID, GRN No, Invoice Amount INR, Due Date, Days Overdue, Payment Status (`Unpaid`, `Partially Paid`, `Paid`). +- **Constraints:** Preserve the units, enumerations, state names, formulas, and numeric boundaries stated in the FR basis and validation rules. Tenant-owned records use the approved transaction-local tenant context and PostgreSQL RLS; storage types and indexes are Stage 9 design. + +### Integration requirement + +- **External integration:** No external connector is explicitly required by this FR. Do not infer a weighbridge, payment, messaging, or other provider integration from manual capture or internal workflow language. + +### Validation and error handling + +- **Source validations/invariants:** Automated calculation of due date based on GRN date + credit days. +- **Source validations/invariants:** The system enforces the source-defined validation rules: Automated calculation of due date based on GRN date + credit days. +- **Failure atomicity:** A rejected command or failed transaction leaves no partial governed business state. + +### Audit requirement + +- This FR does not define a feature-specific audit record. Any governed mutation still uses the approved Stage 7 append-only transaction-audit pattern; do not invent additional audit fields or access-logging rules here. + +### NFR derivation + +- **Tenant security:** Applicable to tenant-scoped access in this FR; enforce verified membership/context before tenant data access, RLS isolation, and fail-closed authorization (NFR-SEC-001, `DEC-021`). +- **Platform availability/recovery:** This capability inherits the approved service targets in NFR-OPS-001 (`BRD-NFR-011`, `DEC-006`). +- **Capacity/performance:** Apply NFR-CAP-001 only where this FR participates in the stated tenant/user/load envelope or 50,000-row report validation; use an explicit FR-specific business response-time target only when present in this FR or source BRD. +- **Privacy:** If this FR processes personal data, apply applicable purpose, minimization, access, retention and legal-hold rules from `BRD-FR-047`–`BRD-FR-051`, `BRD-NFR-009`/`014`; do not supply unapproved legal bases or retention durations (`AMB-006`). + +## SRS-OPERATINGEXPENSES-001 — Mandi Operating Expense Classification & Recording + +- **parent_fr:** `FR-OPERATINGEXPENSES-001` +- **parent_uc:** `UC-013` +- **Source:** ``BRD-FR-033`` +- **FR basis:** 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. + +### Screen-to-system mapping + +- **Surface:** Finance workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **System action:** The screen or initiating service presents the FR inputs, invokes the corresponding `Mandi Operating Expense Classification & Recording` operation, and displays the recorded/computed outcome and any validation result. Exact route and field-level screen layout remain for Stage 11. + +### API requirement + +- **Resource / operation:** `Mandi Operating Expense Classification & Recording`; operation semantics follow the FR basis above. The path, HTTP verb, pagination shape, and OpenAPI schema are assigned during Stage 9. +- **Request:** Accept only the FR-defined inputs and source-listed fields below; do not accept a client-supplied tenant selector as proof of access. Authenticated APIs resolve the verified tenant context before tenant data access, per approved Stage 7 patterns. +- **Response:** Return the FR-defined state, calculated result, or source-listed data required for the workflow; do not expose another tenant’s records. +- **Failure behavior:** Reject unauthenticated/unauthorized, invalid-state, and invalid-input requests without applying a partial business mutation. Return a stable validation/authorization error contract to be detailed in Stage 9. + +### Data requirement + +- **FR-defined attributes:** Expense ID (`EXP-YYYYMM-xxx`), Date, Category, Amount INR, Payee / Vendor, Linked Consignment / Sauda (if applicable), Payment Mode, Status. +- **Constraints:** Preserve the units, enumerations, state names, formulas, and numeric boundaries stated in the FR basis and validation rules. Tenant-owned records use the approved transaction-local tenant context and PostgreSQL RLS; storage types and indexes are Stage 9 design. + +### Integration requirement + +- **External integration:** No external connector is explicitly required by this FR. Do not infer a weighbridge, payment, messaging, or other provider integration from manual capture or internal workflow language. + +### Validation and error handling + +- **Source validations/invariants:** Expense vouchers must balance against cash/bank ledger accounts. +- **Source validations/invariants:** The system enforces the source-defined validation rules: Expense vouchers must balance against cash/bank ledger accounts. +- **Failure atomicity:** A rejected command or failed transaction leaves no partial governed business state. + +### Audit requirement + +- This FR does not define a feature-specific audit record. Any governed mutation still uses the approved Stage 7 append-only transaction-audit pattern; do not invent additional audit fields or access-logging rules here. + +### NFR derivation + +- **Tenant security:** Applicable to tenant-scoped access in this FR; enforce verified membership/context before tenant data access, RLS isolation, and fail-closed authorization (NFR-SEC-001, `DEC-021`). +- **Platform availability/recovery:** This capability inherits the approved service targets in NFR-OPS-001 (`BRD-NFR-011`, `DEC-006`). +- **Capacity/performance:** Apply NFR-CAP-001 only where this FR participates in the stated tenant/user/load envelope or 50,000-row report validation; use an explicit FR-specific business response-time target only when present in this FR or source BRD. +- **Privacy:** If this FR processes personal data, apply applicable purpose, minimization, access, retention and legal-hold rules from `BRD-FR-047`–`BRD-FR-051`, `BRD-NFR-009`/`014`; do not supply unapproved legal bases or retention durations (`AMB-006`). + +## SRS-OPERATIONALALERTS-001 — Real-Time Operational Alerts Engine + +- **parent_fr:** `FR-OPERATIONALALERTS-001` +- **parent_uc:** `UC-014` +- **Source:** ``BRD-FR-034`` +- **FR basis:** 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. + +### Screen-to-system mapping + +- **Surface:** Management & Alerts workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **System action:** The screen or initiating service presents the FR inputs, invokes the corresponding `Real-Time Operational Alerts Engine` operation, and displays the recorded/computed outcome and any validation result. Exact route and field-level screen layout remain for Stage 11. + +### API requirement + +- **Resource / operation:** `Real-Time Operational Alerts Engine`; operation semantics follow the FR basis above. The path, HTTP verb, pagination shape, and OpenAPI schema are assigned during Stage 9. +- **Request:** Accept only the FR-defined inputs and source-listed fields below; do not accept a client-supplied tenant selector as proof of access. Authenticated APIs resolve the verified tenant context before tenant data access, per approved Stage 7 patterns. +- **Response:** Return the FR-defined state, calculated result, or source-listed data required for the workflow; do not expose another tenant’s records. +- **Failure behavior:** Reject unauthenticated/unauthorized, invalid-state, and invalid-input requests without applying a partial business mutation. Return a stable validation/authorization error contract to be detailed in Stage 9. + +### Data requirement + +- **FR-defined attributes:** Alert ID, Severity (`Info`, `Warning`, `Critical`), Category, Title, Detail Text, Timestamp, Dismissed Status. +- **Constraints:** Preserve the units, enumerations, state names, formulas, and numeric boundaries stated in the FR basis and validation rules. Tenant-owned records use the approved transaction-local tenant context and PostgreSQL RLS; storage types and indexes are Stage 9 design. + +### Integration requirement + +- **External integration:** No external connector is explicitly required by this FR. Do not infer a weighbridge, payment, messaging, or other provider integration from manual capture or internal workflow language. + +### Validation and error handling + +- **Source validations/invariants:** Evaluated synchronously upon transaction mutations and refreshed periodically. +- **Source validations/invariants:** The system enforces the source-defined validation rules: Evaluated synchronously upon transaction mutations and refreshed periodically. +- **Failure atomicity:** A rejected command or failed transaction leaves no partial governed business state. + +### Audit requirement + +- This FR does not define a feature-specific audit record. Any governed mutation still uses the approved Stage 7 append-only transaction-audit pattern; do not invent additional audit fields or access-logging rules here. + +### NFR derivation + +- **Tenant security:** Applicable to tenant-scoped access in this FR; enforce verified membership/context before tenant data access, RLS isolation, and fail-closed authorization (NFR-SEC-001, `DEC-021`). +- **Platform availability/recovery:** This capability inherits the approved service targets in NFR-OPS-001 (`BRD-NFR-011`, `DEC-006`). +- **Capacity/performance:** Apply NFR-CAP-001 only where this FR participates in the stated tenant/user/load envelope or 50,000-row report validation; use an explicit FR-specific business response-time target only when present in this FR or source BRD. +- **Privacy:** If this FR processes personal data, apply applicable purpose, minimization, access, retention and legal-hold rules from `BRD-FR-047`–`BRD-FR-051`, `BRD-NFR-009`/`014`; do not supply unapproved legal bases or retention durations (`AMB-006`). + +## SRS-EXECUTIVEREPORTING-001 — Executive Control Centre Dashboard + +- **parent_fr:** `FR-EXECUTIVEREPORTING-001` +- **parent_uc:** `UC-015` +- **Source:** ``BRD-FR-035`` +- **FR basis:** 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. + +### Screen-to-system mapping + +- **Surface:** Management workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **System action:** The screen or initiating service presents the FR inputs, invokes the corresponding `Executive Control Centre Dashboard` operation, and displays the recorded/computed outcome and any validation result. Exact route and field-level screen layout remain for Stage 11. + +### API requirement + +- **Resource / operation:** `Executive Control Centre Dashboard`; operation semantics follow the FR basis above. The path, HTTP verb, pagination shape, and OpenAPI schema are assigned during Stage 9. +- **Request:** Accept only the FR-defined inputs and source-listed fields below; do not accept a client-supplied tenant selector as proof of access. Authenticated APIs resolve the verified tenant context before tenant data access, per approved Stage 7 patterns. +- **Response:** Return the FR-defined state, calculated result, or source-listed data required for the workflow; do not expose another tenant’s records. +- **Failure behavior:** Reject unauthenticated/unauthorized, invalid-state, and invalid-input requests without applying a partial business mutation. Return a stable validation/authorization error contract to be detailed in Stage 9. + +### Data requirement + +- **FR-defined attributes:** KPI Metric Cards, Warehouse Position Table, Top Stock Grid, Recent Sales Feed, Active Alerts Feed. +- **Constraints:** Preserve the units, enumerations, state names, formulas, and numeric boundaries stated in the FR basis and validation rules. Tenant-owned records use the approved transaction-local tenant context and PostgreSQL RLS; storage types and indexes are Stage 9 design. + +### Integration requirement + +- **External integration:** No external connector is explicitly required by this FR. Do not infer a weighbridge, payment, messaging, or other provider integration from manual capture or internal workflow language. + +### Validation and error handling + +- **Source validations/invariants:** Dashboard must load within $\le 1.5\text{s}$. +- **Source validations/invariants:** The system enforces the source-defined validation rules: Dashboard must load within $\le 1.5\text{s}$. +- **Failure atomicity:** A rejected command or failed transaction leaves no partial governed business state. + +### Audit requirement + +- This FR does not define a feature-specific audit record. Any governed mutation still uses the approved Stage 7 append-only transaction-audit pattern; do not invent additional audit fields or access-logging rules here. + +### NFR derivation + +- **Tenant security:** Applicable to tenant-scoped access in this FR; enforce verified membership/context before tenant data access, RLS isolation, and fail-closed authorization (NFR-SEC-001, `DEC-021`). +- **Platform availability/recovery:** This capability inherits the approved service targets in NFR-OPS-001 (`BRD-NFR-011`, `DEC-006`). +- **Capacity/performance:** Apply NFR-CAP-001 only where this FR participates in the stated tenant/user/load envelope or 50,000-row report validation; use an explicit FR-specific business response-time target only when present in this FR or source BRD. +- **Privacy:** If this FR processes personal data, apply applicable purpose, minimization, access, retention and legal-hold rules from `BRD-FR-047`–`BRD-FR-051`, `BRD-NFR-009`/`014`; do not supply unapproved legal bases or retention durations (`AMB-006`). + +## SRS-EXECUTIVEREPORTING-002 — 20-Day Consolidated Trading Trend Reporting + +- **parent_fr:** `FR-EXECUTIVEREPORTING-002` +- **parent_uc:** `UC-015` +- **Source:** ``BRD-FR-036`` +- **FR basis:** 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. + +### Screen-to-system mapping + +- **Surface:** Management workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **System action:** The screen or initiating service presents the FR inputs, invokes the corresponding `20-Day Consolidated Trading Trend Reporting` operation, and displays the recorded/computed outcome and any validation result. Exact route and field-level screen layout remain for Stage 11. + +### API requirement + +- **Resource / operation:** `20-Day Consolidated Trading Trend Reporting`; operation semantics follow the FR basis above. The path, HTTP verb, pagination shape, and OpenAPI schema are assigned during Stage 9. +- **Request:** Accept only the FR-defined inputs and source-listed fields below; do not accept a client-supplied tenant selector as proof of access. Authenticated APIs resolve the verified tenant context before tenant data access, per approved Stage 7 patterns. +- **Response:** Return the FR-defined state, calculated result, or source-listed data required for the workflow; do not expose another tenant’s records. +- **Failure behavior:** Reject unauthenticated/unauthorized, invalid-state, and invalid-input requests without applying a partial business mutation. Return a stable validation/authorization error contract to be detailed in Stage 9. + +### Data requirement + +- **FR-defined attributes:** Daily Snapshot Array (Date, Purchases MT, Sales MT, Stock MT, Receivables INR, Payables INR). +- **Constraints:** Preserve the units, enumerations, state names, formulas, and numeric boundaries stated in the FR basis and validation rules. Tenant-owned records use the approved transaction-local tenant context and PostgreSQL RLS; storage types and indexes are Stage 9 design. + +### Integration requirement + +- **External integration:** No external connector is explicitly required by this FR. Do not infer a weighbridge, payment, messaging, or other provider integration from manual capture or internal workflow language. + +### Validation and error handling + +- **Source validations/invariants:** Dynamically calculated from transaction ledgers; sub-second query performance. +- **Source validations/invariants:** The system enforces the source-defined validation rules: Dynamically calculated from transaction ledgers; sub-second query performance. +- **Failure atomicity:** A rejected command or failed transaction leaves no partial governed business state. + +### Audit requirement + +- This FR does not define a feature-specific audit record. Any governed mutation still uses the approved Stage 7 append-only transaction-audit pattern; do not invent additional audit fields or access-logging rules here. + +### NFR derivation + +- **Tenant security:** Applicable to tenant-scoped access in this FR; enforce verified membership/context before tenant data access, RLS isolation, and fail-closed authorization (NFR-SEC-001, `DEC-021`). +- **Platform availability/recovery:** This capability inherits the approved service targets in NFR-OPS-001 (`BRD-NFR-011`, `DEC-006`). +- **Capacity/performance:** Apply NFR-CAP-001 only where this FR participates in the stated tenant/user/load envelope or 50,000-row report validation; use an explicit FR-specific business response-time target only when present in this FR or source BRD. +- **Privacy:** If this FR processes personal data, apply applicable purpose, minimization, access, retention and legal-hold rules from `BRD-FR-047`–`BRD-FR-051`, `BRD-NFR-009`/`014`; do not supply unapproved legal bases or retention durations (`AMB-006`). + +## SRS-MASTERDATA-001 — Agricultural Commodity Master Data Management + +- **parent_fr:** `FR-MASTERDATA-001` +- **parent_uc:** `UC-016` +- **Source:** ``BRD-FR-037`` +- **FR basis:** 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`). + +### Screen-to-system mapping + +- **Surface:** Master Data workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **System action:** The screen or initiating service presents the FR inputs, invokes the corresponding `Agricultural Commodity Master Data Management` operation, and displays the recorded/computed outcome and any validation result. Exact route and field-level screen layout remain for Stage 11. + +### API requirement + +- **Resource / operation:** `Agricultural Commodity Master Data Management`; operation semantics follow the FR basis above. The path, HTTP verb, pagination shape, and OpenAPI schema are assigned during Stage 9. +- **Request:** Accept only the FR-defined inputs and source-listed fields below; do not accept a client-supplied tenant selector as proof of access. Authenticated APIs resolve the verified tenant context before tenant data access, per approved Stage 7 patterns. +- **Response:** Return the FR-defined state, calculated result, or source-listed data required for the workflow; do not expose another tenant’s records. +- **Failure behavior:** Reject unauthenticated/unauthorized, invalid-state, and invalid-input requests without applying a partial business mutation. Return a stable validation/authorization error contract to be detailed in Stage 9. + +### Data requirement + +- **FR-defined attributes:** Commodity Code, Commodity Name, Category (`Grains`, `Pulses`, `Oilseeds`, `Spices`), Varieties List, Standard Bag Weight kg. +- **Constraints:** Preserve the units, enumerations, state names, formulas, and numeric boundaries stated in the FR basis and validation rules. Tenant-owned records use the approved transaction-local tenant context and PostgreSQL RLS; storage types and indexes are Stage 9 design. + +### Integration requirement + +- **External integration:** No external connector is explicitly required by this FR. Do not infer a weighbridge, payment, messaging, or other provider integration from manual capture or internal workflow language. + +### Validation and error handling + +- **Source validations/invariants:** Commodity code must be unique; cannot delete commodities with active stock ledger entries. +- **Source validations/invariants:** The system enforces the source-defined validation rules: Commodity code must be unique; cannot delete commodities with active stock ledger entries. +- **Failure atomicity:** A rejected command or failed transaction leaves no partial governed business state. + +### Audit requirement + +- This FR does not define a feature-specific audit record. Any governed mutation still uses the approved Stage 7 append-only transaction-audit pattern; do not invent additional audit fields or access-logging rules here. + +### NFR derivation + +- **Tenant security:** Applicable to tenant-scoped access in this FR; enforce verified membership/context before tenant data access, RLS isolation, and fail-closed authorization (NFR-SEC-001, `DEC-021`). +- **Platform availability/recovery:** This capability inherits the approved service targets in NFR-OPS-001 (`BRD-NFR-011`, `DEC-006`). +- **Capacity/performance:** Apply NFR-CAP-001 only where this FR participates in the stated tenant/user/load envelope or 50,000-row report validation; use an explicit FR-specific business response-time target only when present in this FR or source BRD. +- **Privacy:** If this FR processes personal data, apply applicable purpose, minimization, access, retention and legal-hold rules from `BRD-FR-047`–`BRD-FR-051`, `BRD-NFR-009`/`014`; do not supply unapproved legal bases or retention durations (`AMB-006`). + +## SRS-MASTERDATA-002 — Trading Counterparty Masters (Suppliers, Customers & Godowns) + +- **parent_fr:** `FR-MASTERDATA-002` +- **parent_uc:** `UC-016` +- **Source:** ``BRD-FR-038`` +- **FR basis:** 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). + +### Screen-to-system mapping + +- **Surface:** Master Data workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **System action:** The screen or initiating service presents the FR inputs, invokes the corresponding `Trading Counterparty Masters (Suppliers, Customers & Godowns)` operation, and displays the recorded/computed outcome and any validation result. Exact route and field-level screen layout remain for Stage 11. + +### API requirement + +- **Resource / operation:** `Trading Counterparty Masters (Suppliers, Customers & Godowns)`; operation semantics follow the FR basis above. The path, HTTP verb, pagination shape, and OpenAPI schema are assigned during Stage 9. +- **Request:** Accept only the FR-defined inputs and source-listed fields below; do not accept a client-supplied tenant selector as proof of access. Authenticated APIs resolve the verified tenant context before tenant data access, per approved Stage 7 patterns. +- **Response:** Return the FR-defined state, calculated result, or source-listed data required for the workflow; do not expose another tenant’s records. +- **Failure behavior:** Reject unauthenticated/unauthorized, invalid-state, and invalid-input requests without applying a partial business mutation. Return a stable validation/authorization error contract to be detailed in Stage 9. + +### Data requirement + +- **FR-defined attributes:** Entity Code, Name, Address, GSTIN/PAN, Bank Details, Status (`Active`, `Inactive`). +- **Constraints:** Preserve the units, enumerations, state names, formulas, and numeric boundaries stated in the FR basis and validation rules. Tenant-owned records use the approved transaction-local tenant context and PostgreSQL RLS; storage types and indexes are Stage 9 design. + +### Integration requirement + +- **External integration:** No external connector is explicitly required by this FR. Do not infer a weighbridge, payment, messaging, or other provider integration from manual capture or internal workflow language. + +### Validation and error handling + +- **Source validations/invariants:** Tax IDs validated where applicable. +- **Source validations/invariants:** The system enforces the source-defined validation rules: Tax IDs validated where applicable. +- **Failure atomicity:** A rejected command or failed transaction leaves no partial governed business state. + +### Audit requirement + +- This FR does not define a feature-specific audit record. Any governed mutation still uses the approved Stage 7 append-only transaction-audit pattern; do not invent additional audit fields or access-logging rules here. + +### NFR derivation + +- **Tenant security:** Applicable to tenant-scoped access in this FR; enforce verified membership/context before tenant data access, RLS isolation, and fail-closed authorization (NFR-SEC-001, `DEC-021`). +- **Platform availability/recovery:** This capability inherits the approved service targets in NFR-OPS-001 (`BRD-NFR-011`, `DEC-006`). +- **Capacity/performance:** Apply NFR-CAP-001 only where this FR participates in the stated tenant/user/load envelope or 50,000-row report validation; use an explicit FR-specific business response-time target only when present in this FR or source BRD. +- **Privacy:** If this FR processes personal data, apply applicable purpose, minimization, access, retention and legal-hold rules from `BRD-FR-047`–`BRD-FR-051`, `BRD-NFR-009`/`014`; do not supply unapproved legal bases or retention durations (`AMB-006`). + +## SRS-TENANTSECURITYAUDIT-001 — Tenant Data Isolation + +- **parent_fr:** `FR-TENANTSECURITYAUDIT-001` +- **parent_uc:** `UC-017` +- **Source:** ``BRD-FR-039`` +- **FR basis:** 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. + +### Screen-to-system mapping + +- **Surface:** Architecture & Security workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **System action:** The screen or initiating service presents the FR inputs, invokes the corresponding `Tenant Data Isolation` operation, and displays the recorded/computed outcome and any validation result. Exact route and field-level screen layout remain for Stage 11. + +### API requirement + +- **Resource / operation:** `Tenant Data Isolation`; operation semantics follow the FR basis above. The path, HTTP verb, pagination shape, and OpenAPI schema are assigned during Stage 9. +- **Request:** Accept only the FR-defined inputs and source-listed fields below; do not accept a client-supplied tenant selector as proof of access. Authenticated APIs resolve the verified tenant context before tenant data access, per approved Stage 7 patterns. +- **Response:** Return the FR-defined state, calculated result, or source-listed data required for the workflow; do not expose another tenant’s records. +- **Failure behavior:** Reject unauthenticated/unauthorized, invalid-state, and invalid-input requests without applying a partial business mutation. Return a stable validation/authorization error contract to be detailed in Stage 9. + +### Data requirement + +- **FR-defined attributes:** Tenant ID, Tenant Name, Tenant Status, Tenant Administrator, Branch and Godown IDs. +- **Constraints:** Preserve the units, enumerations, state names, formulas, and numeric boundaries stated in the FR basis and validation rules. Tenant-owned records use the approved transaction-local tenant context and PostgreSQL RLS; storage types and indexes are Stage 9 design. + +### Integration requirement + +- **External integration:** No external connector is explicitly required by this FR. Do not infer a weighbridge, payment, messaging, or other provider integration from manual capture or internal workflow language. + +### Validation and error handling + +- **Source validations/invariants:** Tenant context must be enforced on every applicable business operation and verified for cross-tenant data access. +- **Source validations/invariants:** 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. +- **Failure atomicity:** A rejected command or failed transaction leaves no partial governed business state. + +### Audit requirement + +- This FR does not define a feature-specific audit record. Any governed mutation still uses the approved Stage 7 append-only transaction-audit pattern; do not invent additional audit fields or access-logging rules here. + +### NFR derivation + +- **Tenant security:** Applicable to tenant-scoped access in this FR; enforce verified membership/context before tenant data access, RLS isolation, and fail-closed authorization (NFR-SEC-001, `DEC-021`). +- **Platform availability/recovery:** This capability inherits the approved service targets in NFR-OPS-001 (`BRD-NFR-011`, `DEC-006`). +- **Capacity/performance:** Apply NFR-CAP-001 only where this FR participates in the stated tenant/user/load envelope or 50,000-row report validation; use an explicit FR-specific business response-time target only when present in this FR or source BRD. +- **Privacy:** If this FR processes personal data, apply applicable purpose, minimization, access, retention and legal-hold rules from `BRD-FR-047`–`BRD-FR-051`, `BRD-NFR-009`/`014`; do not supply unapproved legal bases or retention durations (`AMB-006`). + +## SRS-TENANTSECURITYAUDIT-003 — Immutable Transaction Audit Logging + +- **parent_fr:** `FR-TENANTSECURITYAUDIT-003` +- **parent_uc:** `UC-017` +- **Source:** ``BRD-FR-041`` +- **FR basis:** 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. + +### Screen-to-system mapping + +- **Surface:** Architecture & Security workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **System action:** The screen or initiating service presents the FR inputs, invokes the corresponding `Immutable Transaction Audit Logging` operation, and displays the recorded/computed outcome and any validation result. Exact route and field-level screen layout remain for Stage 11. + +### API requirement + +- **Resource / operation:** `Immutable Transaction Audit Logging`; operation semantics follow the FR basis above. The path, HTTP verb, pagination shape, and OpenAPI schema are assigned during Stage 9. +- **Request:** Accept only the FR-defined inputs and source-listed fields below; do not accept a client-supplied tenant selector as proof of access. Authenticated APIs resolve the verified tenant context before tenant data access, per approved Stage 7 patterns. +- **Response:** Return the FR-defined state, calculated result, or source-listed data required for the workflow; do not expose another tenant’s records. +- **Failure behavior:** Reject unauthenticated/unauthorized, invalid-state, and invalid-input requests without applying a partial business mutation. Return a stable validation/authorization error contract to be detailed in Stage 9. + +### Data requirement + +- **FR-defined attributes:** Audit Trail Log ID, Document Type, Document Name, Modified By, Modified Timestamp, Field Diff JSON. +- **Constraints:** Preserve the units, enumerations, state names, formulas, and numeric boundaries stated in the FR basis and validation rules. Tenant-owned records use the approved transaction-local tenant context and PostgreSQL RLS; storage types and indexes are Stage 9 design. + +### Integration requirement + +- **External integration:** No external connector is explicitly required by this FR. Do not infer a weighbridge, payment, messaging, or other provider integration from manual capture or internal workflow language. + +### Validation and error handling + +- **Source validations/invariants:** Audit history cannot be deleted or modified through normal application operations. +- **Source validations/invariants:** The system enforces the source-defined validation rules: Audit history cannot be deleted or modified through normal application operations. +- **Failure atomicity:** A rejected command or failed transaction leaves no partial governed business state. + +### Audit requirement + +- Preserve the FR-defined actor, timestamp, reason, previous/new values, approval, or evidence fields as applicable. Use append-only governed-mutation audit under the approved Stage 7 pattern; precise event schema is Stage 9 design. + +### NFR derivation + +- **Tenant security:** Applicable to tenant-scoped access in this FR; enforce verified membership/context before tenant data access, RLS isolation, and fail-closed authorization (NFR-SEC-001, `DEC-021`). +- **Platform availability/recovery:** This capability inherits the approved service targets in NFR-OPS-001 (`BRD-NFR-011`, `DEC-006`). +- **Capacity/performance:** Apply NFR-CAP-001 only where this FR participates in the stated tenant/user/load envelope or 50,000-row report validation; use an explicit FR-specific business response-time target only when present in this FR or source BRD. +- **Privacy:** If this FR processes personal data, apply applicable purpose, minimization, access, retention and legal-hold rules from `BRD-FR-047`–`BRD-FR-051`, `BRD-NFR-009`/`014`; do not supply unapproved legal bases or retention durations (`AMB-006`). + +## SRS-TENANTLIFECYCLE-001 — Tenant Provisioning and Lifecycle Management + +- **parent_fr:** `FR-TENANTLIFECYCLE-001` +- **parent_uc:** `UC-018` +- **Source:** ``BRD-FR-042`` +- **FR basis:** 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. + +### Screen-to-system mapping + +- **Surface:** Platform Administration workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **System action:** The screen or initiating service presents the FR inputs, invokes the corresponding `Tenant Provisioning and Lifecycle Management` operation, and displays the recorded/computed outcome and any validation result. Exact route and field-level screen layout remain for Stage 11. + +### API requirement + +- **Resource / operation:** `Tenant Provisioning and Lifecycle Management`; operation semantics follow the FR basis above. The path, HTTP verb, pagination shape, and OpenAPI schema are assigned during Stage 9. +- **Request:** Accept only the FR-defined inputs and source-listed fields below; do not accept a client-supplied tenant selector as proof of access. Authenticated APIs resolve the verified tenant context before tenant data access, per approved Stage 7 patterns. +- **Response:** Return the FR-defined state, calculated result, or source-listed data required for the workflow; do not expose another tenant’s records. +- **Failure behavior:** Reject unauthenticated/unauthorized, invalid-state, and invalid-input requests without applying a partial business mutation. Return a stable validation/authorization error contract to be detailed in Stage 9. + +### Data requirement + +- **FR-defined attributes:** Tenant ID, Tenant Name, Lifecycle Status, Created/Updated Timestamps, Tenant Administrator, Lifecycle Actor and Reason. +- **Constraints:** Preserve the units, enumerations, state names, formulas, and numeric boundaries stated in the FR basis and validation rules. Tenant-owned records use the approved transaction-local tenant context and PostgreSQL RLS; storage types and indexes are Stage 9 design. + +### Integration requirement + +- **External integration:** No external connector is explicitly required by this FR. Do not infer a weighbridge, payment, messaging, or other provider integration from manual capture or internal workflow language. + +### Validation and error handling + +- **Source validations/invariants:** 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. +- **Failure atomicity:** A rejected command or failed transaction leaves no partial governed business state. + +### Audit requirement + +- This FR does not define a feature-specific audit record. Any governed mutation still uses the approved Stage 7 append-only transaction-audit pattern; do not invent additional audit fields or access-logging rules here. + +### NFR derivation + +- **Tenant security:** Applicable to tenant-scoped access in this FR; enforce verified membership/context before tenant data access, RLS isolation, and fail-closed authorization (NFR-SEC-001, `DEC-021`). +- **Platform availability/recovery:** This capability inherits the approved service targets in NFR-OPS-001 (`BRD-NFR-011`, `DEC-006`). +- **Capacity/performance:** Apply NFR-CAP-001 only where this FR participates in the stated tenant/user/load envelope or 50,000-row report validation; use an explicit FR-specific business response-time target only when present in this FR or source BRD. +- **Privacy:** If this FR processes personal data, apply applicable purpose, minimization, access, retention and legal-hold rules from `BRD-FR-047`–`BRD-FR-051`, `BRD-NFR-009`/`014`; do not supply unapproved legal bases or retention durations (`AMB-006`). + +## SRS-TENANTMEMBERSHIPCONTEXT-001 — Tenant Membership and Role Administration + +- **parent_fr:** `FR-TENANTMEMBERSHIPCONTEXT-001` +- **parent_uc:** `UC-019` +- **Source:** ``BRD-FR-043`` +- **FR basis:** 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. + +### Screen-to-system mapping + +- **Surface:** Identity & Access Management workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **System action:** The screen or initiating service presents the FR inputs, invokes the corresponding `Tenant Membership and Role Administration` operation, and displays the recorded/computed outcome and any validation result. Exact route and field-level screen layout remain for Stage 11. + +### API requirement + +- **Resource / operation:** `Tenant Membership and Role Administration`; operation semantics follow the FR basis above. The path, HTTP verb, pagination shape, and OpenAPI schema are assigned during Stage 9. +- **Request:** Accept only the FR-defined inputs and source-listed fields below; do not accept a client-supplied tenant selector as proof of access. Authenticated APIs resolve the verified tenant context before tenant data access, per approved Stage 7 patterns. +- **Response:** Return the FR-defined state, calculated result, or source-listed data required for the workflow; do not expose another tenant’s records. +- **Failure behavior:** Reject unauthenticated/unauthorized, invalid-state, and invalid-input requests without applying a partial business mutation. Return a stable validation/authorization error contract to be detailed in Stage 9. + +### Data requirement + +- **FR-defined attributes:** User ID, Tenant ID, Membership Status, Role Assignments, Changed By, Changed At. +- **Constraints:** Preserve the units, enumerations, state names, formulas, and numeric boundaries stated in the FR basis and validation rules. Tenant-owned records use the approved transaction-local tenant context and PostgreSQL RLS; storage types and indexes are Stage 9 design. + +### Integration requirement + +- **External integration:** No external connector is explicitly required by this FR. Do not infer a weighbridge, payment, messaging, or other provider integration from manual capture or internal workflow language. + +### Validation and error handling + +- **Source validations/invariants:** 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. +- **Failure atomicity:** A rejected command or failed transaction leaves no partial governed business state. + +### Audit requirement + +- Preserve the FR-defined actor, timestamp, reason, previous/new values, approval, or evidence fields as applicable. Use append-only governed-mutation audit under the approved Stage 7 pattern; precise event schema is Stage 9 design. + +### NFR derivation + +- **Tenant security:** Applicable to tenant-scoped access in this FR; enforce verified membership/context before tenant data access, RLS isolation, and fail-closed authorization (NFR-SEC-001, `DEC-021`). +- **Platform availability/recovery:** This capability inherits the approved service targets in NFR-OPS-001 (`BRD-NFR-011`, `DEC-006`). +- **Capacity/performance:** Apply NFR-CAP-001 only where this FR participates in the stated tenant/user/load envelope or 50,000-row report validation; use an explicit FR-specific business response-time target only when present in this FR or source BRD. +- **Privacy:** If this FR processes personal data, apply applicable purpose, minimization, access, retention and legal-hold rules from `BRD-FR-047`–`BRD-FR-051`, `BRD-NFR-009`/`014`; do not supply unapproved legal bases or retention durations (`AMB-006`). + +## SRS-TENANTMEMBERSHIPCONTEXT-002 — Verified Tenant Context for Every Operation + +- **parent_fr:** `FR-TENANTMEMBERSHIPCONTEXT-002` +- **parent_uc:** `UC-019` +- **Source:** ``BRD-FR-044`` +- **FR basis:** 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. + +### Screen-to-system mapping + +- **Surface:** Identity & Access Management workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **System action:** The screen or initiating service presents the FR inputs, invokes the corresponding `Verified Tenant Context for Every Operation` operation, and displays the recorded/computed outcome and any validation result. Exact route and field-level screen layout remain for Stage 11. + +### API requirement + +- **Resource / operation:** `Verified Tenant Context for Every Operation`; operation semantics follow the FR basis above. The path, HTTP verb, pagination shape, and OpenAPI schema are assigned during Stage 9. +- **Request:** Accept only the FR-defined inputs and source-listed fields below; do not accept a client-supplied tenant selector as proof of access. Authenticated APIs resolve the verified tenant context before tenant data access, per approved Stage 7 patterns. +- **Response:** Return the FR-defined state, calculated result, or source-listed data required for the workflow; do not expose another tenant’s records. +- **Failure behavior:** Reject unauthenticated/unauthorized, invalid-state, and invalid-input requests without applying a partial business mutation. Return a stable validation/authorization error contract to be detailed in Stage 9. + +### Data requirement + +- **FR-defined attributes:** Authenticated Subject, Effective Tenant ID, Membership, Role Claims, Request/Correlation ID. +- **Constraints:** Preserve the units, enumerations, state names, formulas, and numeric boundaries stated in the FR basis and validation rules. Tenant-owned records use the approved transaction-local tenant context and PostgreSQL RLS; storage types and indexes are Stage 9 design. + +### Integration requirement + +- **External integration:** No external connector is explicitly required by this FR. Do not infer a weighbridge, payment, messaging, or other provider integration from manual capture or internal workflow language. + +### Validation and error handling + +- **Source validations/invariants:** 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. +- **Failure atomicity:** A rejected command or failed transaction leaves no partial governed business state. + +### Audit requirement + +- This FR does not define a feature-specific audit record. Any governed mutation still uses the approved Stage 7 append-only transaction-audit pattern; do not invent additional audit fields or access-logging rules here. + +### NFR derivation + +- **Tenant security:** Applicable to tenant-scoped access in this FR; enforce verified membership/context before tenant data access, RLS isolation, and fail-closed authorization (NFR-SEC-001, `DEC-021`). +- **Platform availability/recovery:** This capability inherits the approved service targets in NFR-OPS-001 (`BRD-NFR-011`, `DEC-006`). +- **Capacity/performance:** Apply NFR-CAP-001 only where this FR participates in the stated tenant/user/load envelope or 50,000-row report validation; use an explicit FR-specific business response-time target only when present in this FR or source BRD. +- **Privacy:** If this FR processes personal data, apply applicable purpose, minimization, access, retention and legal-hold rules from `BRD-FR-047`–`BRD-FR-051`, `BRD-NFR-009`/`014`; do not supply unapproved legal bases or retention durations (`AMB-006`). + +## SRS-TENANTSUPPORTSECURITY-001 — End-to-End Tenant Resource Isolation + +- **parent_fr:** `FR-TENANTSUPPORTSECURITY-001` +- **parent_uc:** `UC-020` +- **Source:** ``BRD-FR-045`` +- **FR basis:** 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. + +### Screen-to-system mapping + +- **Surface:** Platform Security workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **System action:** The screen or initiating service presents the FR inputs, invokes the corresponding `End-to-End Tenant Resource Isolation` operation, and displays the recorded/computed outcome and any validation result. Exact route and field-level screen layout remain for Stage 11. + +### API requirement + +- **Resource / operation:** `End-to-End Tenant Resource Isolation`; operation semantics follow the FR basis above. The path, HTTP verb, pagination shape, and OpenAPI schema are assigned during Stage 9. +- **Request:** Accept only the FR-defined inputs and source-listed fields below; do not accept a client-supplied tenant selector as proof of access. Authenticated APIs resolve the verified tenant context before tenant data access, per approved Stage 7 patterns. +- **Response:** Return the FR-defined state, calculated result, or source-listed data required for the workflow; do not expose another tenant’s records. +- **Failure behavior:** Reject unauthenticated/unauthorized, invalid-state, and invalid-input requests without applying a partial business mutation. Return a stable validation/authorization error contract to be detailed in Stage 9. + +### Data requirement + +- **FR-defined attributes:** Tenant ID on tenant-owned resources; resource owner; access decision; actor; timestamp; correlation ID. +- **Constraints:** Preserve the units, enumerations, state names, formulas, and numeric boundaries stated in the FR basis and validation rules. Tenant-owned records use the approved transaction-local tenant context and PostgreSQL RLS; storage types and indexes are Stage 9 design. + +### Integration requirement + +- **External integration:** No external connector is explicitly required by this FR. Do not infer a weighbridge, payment, messaging, or other provider integration from manual capture or internal workflow language. + +### Validation and error handling + +- **Source validations/invariants:** 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. +- **Failure atomicity:** A rejected command or failed transaction leaves no partial governed business state. + +### Audit requirement + +- This FR does not define a feature-specific audit record. Any governed mutation still uses the approved Stage 7 append-only transaction-audit pattern; do not invent additional audit fields or access-logging rules here. + +### NFR derivation + +- **Tenant security:** Applicable to tenant-scoped access in this FR; enforce verified membership/context before tenant data access, RLS isolation, and fail-closed authorization (NFR-SEC-001, `DEC-021`). +- **Platform availability/recovery:** This capability inherits the approved service targets in NFR-OPS-001 (`BRD-NFR-011`, `DEC-006`). +- **Capacity/performance:** Apply NFR-CAP-001 only where this FR participates in the stated tenant/user/load envelope or 50,000-row report validation; use an explicit FR-specific business response-time target only when present in this FR or source BRD. +- **Privacy:** If this FR processes personal data, apply applicable purpose, minimization, access, retention and legal-hold rules from `BRD-FR-047`–`BRD-FR-051`, `BRD-NFR-009`/`014`; do not supply unapproved legal bases or retention durations (`AMB-006`). + +## SRS-TENANTSUPPORTSECURITY-002 — Controlled Privileged Support Access + +- **parent_fr:** `FR-TENANTSUPPORTSECURITY-002` +- **parent_uc:** `UC-020` +- **Source:** ``BRD-FR-046`` +- **FR basis:** 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. + +### Screen-to-system mapping + +- **Surface:** Platform Security workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **System action:** The screen or initiating service presents the FR inputs, invokes the corresponding `Controlled Privileged Support Access` operation, and displays the recorded/computed outcome and any validation result. Exact route and field-level screen layout remain for Stage 11. + +### API requirement + +- **Resource / operation:** `Controlled Privileged Support Access`; operation semantics follow the FR basis above. The path, HTTP verb, pagination shape, and OpenAPI schema are assigned during Stage 9. +- **Request:** Accept only the FR-defined inputs and source-listed fields below; do not accept a client-supplied tenant selector as proof of access. Authenticated APIs resolve the verified tenant context before tenant data access, per approved Stage 7 patterns. +- **Response:** Return the FR-defined state, calculated result, or source-listed data required for the workflow; do not expose another tenant’s records. +- **Failure behavior:** Reject unauthenticated/unauthorized, invalid-state, and invalid-input requests without applying a partial business mutation. Return a stable validation/authorization error contract to be detailed in Stage 9. + +### Data requirement + +- **FR-defined attributes:** Support Actor, Tenant ID, Reason/Case Reference, Approval, Start/End Time, Resources Accessed, Audit Event. +- **Constraints:** Preserve the units, enumerations, state names, formulas, and numeric boundaries stated in the FR basis and validation rules. Tenant-owned records use the approved transaction-local tenant context and PostgreSQL RLS; storage types and indexes are Stage 9 design. + +### Integration requirement + +- **External integration:** No external connector is explicitly required by this FR. Do not infer a weighbridge, payment, messaging, or other provider integration from manual capture or internal workflow language. + +### Validation and error handling + +- **Source validations/invariants:** 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. +- **Failure atomicity:** A rejected command or failed transaction leaves no partial governed business state. + +### Audit requirement + +- Preserve the FR-defined actor, timestamp, reason, previous/new values, approval, or evidence fields as applicable. Use append-only governed-mutation audit under the approved Stage 7 pattern; precise event schema is Stage 9 design. + +### NFR derivation + +- **Tenant security:** Applicable to tenant-scoped access in this FR; enforce verified membership/context before tenant data access, RLS isolation, and fail-closed authorization (NFR-SEC-001, `DEC-021`). +- **Platform availability/recovery:** This capability inherits the approved service targets in NFR-OPS-001 (`BRD-NFR-011`, `DEC-006`). +- **Capacity/performance:** Apply NFR-CAP-001 only where this FR participates in the stated tenant/user/load envelope or 50,000-row report validation; use an explicit FR-specific business response-time target only when present in this FR or source BRD. +- **Privacy:** If this FR processes personal data, apply applicable purpose, minimization, access, retention and legal-hold rules from `BRD-FR-047`–`BRD-FR-051`, `BRD-NFR-009`/`014`; do not supply unapproved legal bases or retention durations (`AMB-006`). + +## SRS-PRIVACYPURPOSECONSENT-001 — Personal Data Purpose, Notice & Consent Records + +- **parent_fr:** `FR-PRIVACYPURPOSECONSENT-001` +- **parent_uc:** `UC-021` +- **Source:** ``BRD-FR-047`` +- **FR basis:** 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. + +### Screen-to-system mapping + +- **Surface:** Privacy Operations workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **System action:** The screen or initiating service presents the FR inputs, invokes the corresponding `Personal Data Purpose, Notice & Consent Records` operation, and displays the recorded/computed outcome and any validation result. Exact route and field-level screen layout remain for Stage 11. + +### API requirement + +- **Resource / operation:** `Personal Data Purpose, Notice & Consent Records`; operation semantics follow the FR basis above. The path, HTTP verb, pagination shape, and OpenAPI schema are assigned during Stage 9. +- **Request:** Accept only the FR-defined inputs and source-listed fields below; do not accept a client-supplied tenant selector as proof of access. Authenticated APIs resolve the verified tenant context before tenant data access, per approved Stage 7 patterns. +- **Response:** Return the FR-defined state, calculated result, or source-listed data required for the workflow; do not expose another tenant’s records. +- **Failure behavior:** Reject unauthenticated/unauthorized, invalid-state, and invalid-input requests without applying a partial business mutation. Return a stable validation/authorization error contract to be detailed in Stage 9. + +### Data requirement + +- **FR-defined attributes:** Processing Purpose ID, Data Category, Responsible Entity/Role, Processing Basis, Notice Version, Consent Status and Timestamp, Withdrawal Timestamp, Contact. +- **Constraints:** Preserve the units, enumerations, state names, formulas, and numeric boundaries stated in the FR basis and validation rules. Tenant-owned records use the approved transaction-local tenant context and PostgreSQL RLS; storage types and indexes are Stage 9 design. + +### Integration requirement + +- **External integration:** No external connector is explicitly required by this FR. Do not infer a weighbridge, payment, messaging, or other provider integration from manual capture or internal workflow language. + +### Validation and error handling + +- **Source validations/invariants:** The FR specifies no additional numeric or state validation beyond its FR basis; reject malformed/missing required input and leave all business decisions outside that basis unspecified. +- **Failure atomicity:** A rejected command or failed transaction leaves no partial governed business state. + +### Audit requirement + +- This FR does not define a feature-specific audit record. Any governed mutation still uses the approved Stage 7 append-only transaction-audit pattern; do not invent additional audit fields or access-logging rules here. + +### NFR derivation + +- **Tenant security:** Applicable to tenant-scoped access in this FR; enforce verified membership/context before tenant data access, RLS isolation, and fail-closed authorization (NFR-SEC-001, `DEC-021`). +- **Platform availability/recovery:** This capability inherits the approved service targets in NFR-OPS-001 (`BRD-NFR-011`, `DEC-006`). +- **Capacity/performance:** Apply NFR-CAP-001 only where this FR participates in the stated tenant/user/load envelope or 50,000-row report validation; use an explicit FR-specific business response-time target only when present in this FR or source BRD. +- **Privacy:** If this FR processes personal data, apply applicable purpose, minimization, access, retention and legal-hold rules from `BRD-FR-047`–`BRD-FR-051`, `BRD-NFR-009`/`014`; do not supply unapproved legal bases or retention durations (`AMB-006`). + +## SRS-DATAPRINCIPALRIGHTS-001 — Data Principal Rights & Grievance Case Management + +- **parent_fr:** `FR-DATAPRINCIPALRIGHTS-001` +- **parent_uc:** `UC-022` +- **Source:** ``BRD-FR-048`` +- **FR basis:** 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. + +### Screen-to-system mapping + +- **Surface:** Privacy Operations workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **System action:** The screen or initiating service presents the FR inputs, invokes the corresponding `Data Principal Rights & Grievance Case Management` operation, and displays the recorded/computed outcome and any validation result. Exact route and field-level screen layout remain for Stage 11. + +### API requirement + +- **Resource / operation:** `Data Principal Rights & Grievance Case Management`; operation semantics follow the FR basis above. The path, HTTP verb, pagination shape, and OpenAPI schema are assigned during Stage 9. +- **Request:** Accept only the FR-defined inputs and source-listed fields below; do not accept a client-supplied tenant selector as proof of access. Authenticated APIs resolve the verified tenant context before tenant data access, per approved Stage 7 patterns. +- **Response:** Return the FR-defined state, calculated result, or source-listed data required for the workflow; do not expose another tenant’s records. +- **Failure behavior:** Reject unauthenticated/unauthorized, invalid-state, and invalid-input requests without applying a partial business mutation. Return a stable validation/authorization error contract to be detailed in Stage 9. + +### Data requirement + +- **FR-defined attributes:** Request ID, Data Principal Identifier, Tenant/Platform Scope, Request Type, Verification Evidence, Responsible Fiduciary, Received/Due/Resolved Timestamps, Disposition, Response Evidence. +- **Constraints:** Preserve the units, enumerations, state names, formulas, and numeric boundaries stated in the FR basis and validation rules. Tenant-owned records use the approved transaction-local tenant context and PostgreSQL RLS; storage types and indexes are Stage 9 design. + +### Integration requirement + +- **External integration:** No external connector is explicitly required by this FR. Do not infer a weighbridge, payment, messaging, or other provider integration from manual capture or internal workflow language. + +### Validation and error handling + +- **Source validations/invariants:** 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. +- **Failure atomicity:** A rejected command or failed transaction leaves no partial governed business state. + +### Audit requirement + +- This FR does not define a feature-specific audit record. Any governed mutation still uses the approved Stage 7 append-only transaction-audit pattern; do not invent additional audit fields or access-logging rules here. + +### NFR derivation + +- **Tenant security:** Applicable to tenant-scoped access in this FR; enforce verified membership/context before tenant data access, RLS isolation, and fail-closed authorization (NFR-SEC-001, `DEC-021`). +- **Platform availability/recovery:** This capability inherits the approved service targets in NFR-OPS-001 (`BRD-NFR-011`, `DEC-006`). +- **Capacity/performance:** Apply NFR-CAP-001 only where this FR participates in the stated tenant/user/load envelope or 50,000-row report validation; use an explicit FR-specific business response-time target only when present in this FR or source BRD. +- **Privacy:** If this FR processes personal data, apply applicable purpose, minimization, access, retention and legal-hold rules from `BRD-FR-047`–`BRD-FR-051`, `BRD-NFR-009`/`014`; do not supply unapproved legal bases or retention durations (`AMB-006`). + +## SRS-PRIVACYBREACHRESPONSE-001 — Personal Data Breach Response Coordination + +- **parent_fr:** `FR-PRIVACYBREACHRESPONSE-001` +- **parent_uc:** `UC-023` +- **Source:** ``BRD-FR-049`` +- **FR basis:** 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. + +### Screen-to-system mapping + +- **Surface:** Privacy Operations & Security Operations workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **System action:** The screen or initiating service presents the FR inputs, invokes the corresponding `Personal Data Breach Response Coordination` operation, and displays the recorded/computed outcome and any validation result. Exact route and field-level screen layout remain for Stage 11. + +### API requirement + +- **Resource / operation:** `Personal Data Breach Response Coordination`; operation semantics follow the FR basis above. The path, HTTP verb, pagination shape, and OpenAPI schema are assigned during Stage 9. +- **Request:** Accept only the FR-defined inputs and source-listed fields below; do not accept a client-supplied tenant selector as proof of access. Authenticated APIs resolve the verified tenant context before tenant data access, per approved Stage 7 patterns. +- **Response:** Return the FR-defined state, calculated result, or source-listed data required for the workflow; do not expose another tenant’s records. +- **Failure behavior:** Reject unauthenticated/unauthorized, invalid-state, and invalid-input requests without applying a partial business mutation. Return a stable validation/authorization error contract to be detailed in Stage 9. + +### Data requirement + +- **FR-defined attributes:** Incident ID, Detection Time, Affected Data/Tenants/Principals, Processor/Fiduciary Roles, Severity, Timeline, Evidence, Mitigation, Notifications and Delivery Status. +- **Constraints:** Preserve the units, enumerations, state names, formulas, and numeric boundaries stated in the FR basis and validation rules. Tenant-owned records use the approved transaction-local tenant context and PostgreSQL RLS; storage types and indexes are Stage 9 design. + +### Integration requirement + +- **External integration:** No external connector is explicitly required by this FR. Do not infer a weighbridge, payment, messaging, or other provider integration from manual capture or internal workflow language. + +### Validation and error handling + +- **Source validations/invariants:** 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. +- **Failure atomicity:** A rejected command or failed transaction leaves no partial governed business state. + +### Audit requirement + +- Preserve the FR-defined actor, timestamp, reason, previous/new values, approval, or evidence fields as applicable. Use append-only governed-mutation audit under the approved Stage 7 pattern; precise event schema is Stage 9 design. + +### NFR derivation + +- **Tenant security:** Applicable to tenant-scoped access in this FR; enforce verified membership/context before tenant data access, RLS isolation, and fail-closed authorization (NFR-SEC-001, `DEC-021`). +- **Platform availability/recovery:** This capability inherits the approved service targets in NFR-OPS-001 (`BRD-NFR-011`, `DEC-006`). +- **Capacity/performance:** Apply NFR-CAP-001 only where this FR participates in the stated tenant/user/load envelope or 50,000-row report validation; use an explicit FR-specific business response-time target only when present in this FR or source BRD. +- **Privacy:** If this FR processes personal data, apply applicable purpose, minimization, access, retention and legal-hold rules from `BRD-FR-047`–`BRD-FR-051`, `BRD-NFR-009`/`014`; do not supply unapproved legal bases or retention durations (`AMB-006`). + +## SRS-RETENTIONERASURE-001 — Purpose-Aware Retention, Erasure & Legal Hold + +- **parent_fr:** `FR-RETENTIONERASURE-001` +- **parent_uc:** `UC-024` +- **Source:** ``BRD-FR-050`` +- **FR basis:** 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. + +### Screen-to-system mapping + +- **Surface:** Privacy Operations & Data Governance workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **System action:** The screen or initiating service presents the FR inputs, invokes the corresponding `Purpose-Aware Retention, Erasure & Legal Hold` operation, and displays the recorded/computed outcome and any validation result. Exact route and field-level screen layout remain for Stage 11. + +### API requirement + +- **Resource / operation:** `Purpose-Aware Retention, Erasure & Legal Hold`; operation semantics follow the FR basis above. The path, HTTP verb, pagination shape, and OpenAPI schema are assigned during Stage 9. +- **Request:** Accept only the FR-defined inputs and source-listed fields below; do not accept a client-supplied tenant selector as proof of access. Authenticated APIs resolve the verified tenant context before tenant data access, per approved Stage 7 patterns. +- **Response:** Return the FR-defined state, calculated result, or source-listed data required for the workflow; do not expose another tenant’s records. +- **Failure behavior:** Reject unauthenticated/unauthorized, invalid-state, and invalid-input requests without applying a partial business mutation. Return a stable validation/authorization error contract to be detailed in Stage 9. + +### Data requirement + +- **FR-defined attributes:** Data Category, Purpose, Responsible Fiduciary, Retention Rule, Trigger Date, Legal Basis/Exception, Hold Status, Erasure/De-identification Evidence, Processor Completion. +- **Constraints:** Preserve the units, enumerations, state names, formulas, and numeric boundaries stated in the FR basis and validation rules. Tenant-owned records use the approved transaction-local tenant context and PostgreSQL RLS; storage types and indexes are Stage 9 design. + +### Integration requirement + +- **External integration:** No external connector is explicitly required by this FR. Do not infer a weighbridge, payment, messaging, or other provider integration from manual capture or internal workflow language. + +### Validation and error handling + +- **Source validations/invariants:** 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. +- **Failure atomicity:** A rejected command or failed transaction leaves no partial governed business state. + +### Audit requirement + +- This FR does not define a feature-specific audit record. Any governed mutation still uses the approved Stage 7 append-only transaction-audit pattern; do not invent additional audit fields or access-logging rules here. + +### NFR derivation + +- **Tenant security:** Applicable to tenant-scoped access in this FR; enforce verified membership/context before tenant data access, RLS isolation, and fail-closed authorization (NFR-SEC-001, `DEC-021`). +- **Platform availability/recovery:** This capability inherits the approved service targets in NFR-OPS-001 (`BRD-NFR-011`, `DEC-006`). +- **Capacity/performance:** Apply NFR-CAP-001 only where this FR participates in the stated tenant/user/load envelope or 50,000-row report validation; use an explicit FR-specific business response-time target only when present in this FR or source BRD. +- **Privacy:** If this FR processes personal data, apply applicable purpose, minimization, access, retention and legal-hold rules from `BRD-FR-047`–`BRD-FR-051`, `BRD-NFR-009`/`014`; do not supply unapproved legal bases or retention durations (`AMB-006`). + +## SRS-PROCESSORGOVERNANCE-001 — Data Processor & Subprocessor Governance + +- **parent_fr:** `FR-PROCESSORGOVERNANCE-001` +- **parent_uc:** `UC-025` +- **Source:** ``BRD-FR-051`` +- **FR basis:** 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. + +### Screen-to-system mapping + +- **Surface:** Platform Governance workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **System action:** The screen or initiating service presents the FR inputs, invokes the corresponding `Data Processor & Subprocessor Governance` operation, and displays the recorded/computed outcome and any validation result. Exact route and field-level screen layout remain for Stage 11. + +### API requirement + +- **Resource / operation:** `Data Processor & Subprocessor Governance`; operation semantics follow the FR basis above. The path, HTTP verb, pagination shape, and OpenAPI schema are assigned during Stage 9. +- **Request:** Accept only the FR-defined inputs and source-listed fields below; do not accept a client-supplied tenant selector as proof of access. Authenticated APIs resolve the verified tenant context before tenant data access, per approved Stage 7 patterns. +- **Response:** Return the FR-defined state, calculated result, or source-listed data required for the workflow; do not expose another tenant’s records. +- **Failure behavior:** Reject unauthenticated/unauthorized, invalid-state, and invalid-input requests without applying a partial business mutation. Return a stable validation/authorization error contract to be detailed in Stage 9. + +### Data requirement + +- **FR-defined attributes:** Processor/Subprocessor, Processing Purpose, Data Categories, Processing Location, Contract/Safeguard Reference, Due-Diligence Status, Incident/Request Assistance Record. +- **Constraints:** Preserve the units, enumerations, state names, formulas, and numeric boundaries stated in the FR basis and validation rules. Tenant-owned records use the approved transaction-local tenant context and PostgreSQL RLS; storage types and indexes are Stage 9 design. + +### Integration requirement + +- **External integration:** No external connector is explicitly required by this FR. Do not infer a weighbridge, payment, messaging, or other provider integration from manual capture or internal workflow language. + +### Validation and error handling + +- **Source validations/invariants:** The FR specifies no additional numeric or state validation beyond its FR basis; reject malformed/missing required input and leave all business decisions outside that basis unspecified. +- **Failure atomicity:** A rejected command or failed transaction leaves no partial governed business state. + +### Audit requirement + +- This FR does not define a feature-specific audit record. Any governed mutation still uses the approved Stage 7 append-only transaction-audit pattern; do not invent additional audit fields or access-logging rules here. + +### NFR derivation + +- **Tenant security:** Applicable to tenant-scoped access in this FR; enforce verified membership/context before tenant data access, RLS isolation, and fail-closed authorization (NFR-SEC-001, `DEC-021`). +- **Platform availability/recovery:** This capability inherits the approved service targets in NFR-OPS-001 (`BRD-NFR-011`, `DEC-006`). +- **Capacity/performance:** Apply NFR-CAP-001 only where this FR participates in the stated tenant/user/load envelope or 50,000-row report validation; use an explicit FR-specific business response-time target only when present in this FR or source BRD. +- **Privacy:** If this FR processes personal data, apply applicable purpose, minimization, access, retention and legal-hold rules from `BRD-FR-047`–`BRD-FR-051`, `BRD-NFR-009`/`014`; do not supply unapproved legal bases or retention durations (`AMB-006`). + +## SRS-TENANTOPERATINGPOLICIES-001 — Tenant Operating Policy Configuration & Audit + +- **parent_fr:** `FR-TENANTOPERATINGPOLICIES-001` +- **parent_uc:** `UC-026` +- **Source:** ``BRD-FR-052`` +- **FR basis:** 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. + +### Screen-to-system mapping + +- **Surface:** Tenant Business Administration workflow screen(s) — route(s) to be specified during Stage 11 screen design +- **System action:** The screen or initiating service presents the FR inputs, invokes the corresponding `Tenant Operating Policy Configuration & Audit` operation, and displays the recorded/computed outcome and any validation result. Exact route and field-level screen layout remain for Stage 11. + +### API requirement + +- **Resource / operation:** `Tenant Operating Policy Configuration & Audit`; operation semantics follow the FR basis above. The path, HTTP verb, pagination shape, and OpenAPI schema are assigned during Stage 9. +- **Request:** Accept only the FR-defined inputs and source-listed fields below; do not accept a client-supplied tenant selector as proof of access. Authenticated APIs resolve the verified tenant context before tenant data access, per approved Stage 7 patterns. +- **Response:** Return the FR-defined state, calculated result, or source-listed data required for the workflow; do not expose another tenant’s records. +- **Failure behavior:** Reject unauthenticated/unauthorized, invalid-state, and invalid-input requests without applying a partial business mutation. Return a stable validation/authorization error contract to be detailed in Stage 9. + +### Data requirement + +- **FR-defined attributes:** Tenant ID, Policy Type, Scope (Commodity/Grade/Contract), Value, Unit, Effective From/To, Changed By/At, Reason, Prior Value. +- **Constraints:** Preserve the units, enumerations, state names, formulas, and numeric boundaries stated in the FR basis and validation rules. Tenant-owned records use the approved transaction-local tenant context and PostgreSQL RLS; storage types and indexes are Stage 9 design. + +### Integration requirement + +- **External integration:** No external connector is explicitly required by this FR. Do not infer a weighbridge, payment, messaging, or other provider integration from manual capture or internal workflow language. + +### Validation and error handling + +- **Source validations/invariants:** 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. +- **Failure atomicity:** A rejected command or failed transaction leaves no partial governed business state. + +### Audit requirement + +- Preserve the FR-defined actor, timestamp, reason, previous/new values, approval, or evidence fields as applicable. Use append-only governed-mutation audit under the approved Stage 7 pattern; precise event schema is Stage 9 design. + +### NFR derivation + +- **Tenant security:** Applicable to tenant-scoped access in this FR; enforce verified membership/context before tenant data access, RLS isolation, and fail-closed authorization (NFR-SEC-001, `DEC-021`). +- **Platform availability/recovery:** This capability inherits the approved service targets in NFR-OPS-001 (`BRD-NFR-011`, `DEC-006`). +- **Capacity/performance:** Apply NFR-CAP-001 only where this FR participates in the stated tenant/user/load envelope or 50,000-row report validation; use an explicit FR-specific business response-time target only when present in this FR or source BRD. +- **Privacy:** If this FR processes personal data, apply applicable purpose, minimization, access, retention and legal-hold rules from `BRD-FR-047`–`BRD-FR-051`, `BRD-NFR-009`/`014`; do not supply unapproved legal bases or retention durations (`AMB-006`). + +## 2. Cross-Cutting NFRs + +### NFR-SEC-001 — Verified Tenant Isolation + +- **parent_fr:** `cross-cutting` +- **Scope (explicit parent FR set):** `FR-AUTH-001`, `FR-AUTH-002`, `FR-AUTH-003`, `FR-MKT-001`, `FR-MKT-002`, `FR-MARKETTRENDANALYTICS-001`, `FR-PROCUREMENTCONTRACTS-001`, `FR-PROCUREMENTCONTRACTS-002`, `FR-PROCUREMENTCONTRACTS-003`, `FR-PROCUREMENTCONTRACTS-004`, `FR-INWARDRECEIVING-001`, `FR-INWARDRECEIVING-002`, `FR-INWARDRECEIVING-003`, `FR-INWARDRECEIVING-004`, `FR-INWARDRECEIVING-005`, `FR-INWARDRECEIVING-006`, `FR-QUALITYANDLOTCONTROL-001`, `FR-QUALITYANDLOTCONTROL-002`, `FR-QUALITYANDLOTCONTROL-003`, `FR-QUALITYANDLOTCONTROL-004`, `FR-WAREHOUSEINVENTORY-001`, `FR-WAREHOUSEINVENTORY-002`, `FR-WAREHOUSEINVENTORY-003`, `FR-SALESCONTRACTS-001`, `FR-SALESCONTRACTS-002`, `FR-SALESCONTRACTS-003`, `FR-DISPATCHDELIVERY-001`, `FR-DISPATCHDELIVERY-002`, `FR-DISPATCHDELIVERY-003`, `FR-FLEETREGISTRY-001`, `FR-CUSTOMERRECEIVABLES-001`, `FR-CUSTOMERRECEIVABLES-002`, `FR-CUSTOMERRECEIVABLES-003`, `FR-CUSTOMERRECEIVABLES-004`, `FR-SUPPLIERPAYABLES-001`, `FR-OPERATINGEXPENSES-001`, `FR-OPERATIONALALERTS-001`, `FR-EXECUTIVEREPORTING-001`, `FR-EXECUTIVEREPORTING-002`, `FR-MASTERDATA-001`, `FR-MASTERDATA-002`, `FR-TENANTSECURITYAUDIT-001`, `FR-TENANTSECURITYAUDIT-003`, `FR-TENANTLIFECYCLE-001`, `FR-TENANTMEMBERSHIPCONTEXT-001`, `FR-TENANTMEMBERSHIPCONTEXT-002`, `FR-TENANTSUPPORTSECURITY-001`, `FR-TENANTSUPPORTSECURITY-002`, `FR-PRIVACYPURPOSECONSENT-001`, `FR-DATAPRINCIPALRIGHTS-001`, `FR-PRIVACYBREACHRESPONSE-001`, `FR-RETENTIONERASURE-001`, `FR-PROCESSORGOVERNANCE-001`, `FR-TENANTOPERATINGPOLICIES-001` +- **Requirement:** Before any tenant data read or mutation through API, worker, export, cache, file reference, or background job, resolve the effective tenant from authenticated identity and active membership; establish the approved transaction-local PostgreSQL tenant context and enforce RLS. Invalid or absent context is denied. Application roles must not bypass RLS. Tenant identifiers supplied by a client are selectors only and never grant access. +- **Source:** Approved Stage 7 architecture baseline (`DEC-021`), `FR-TENANTMEMBERSHIPCONTEXT-002`, `FR-TENANTSECURITYAUDIT-001`, `FR-TENANTSUPPORTSECURITY-001`. + +### NFR-AUDIT-001 — Append-Only Governed Mutation Audit + +- **parent_fr:** `cross-cutting` +- **Scope (explicit parent FR set):** `FR-AUTH-001`, `FR-AUTH-002`, `FR-AUTH-003`, `FR-MKT-001`, `FR-MKT-002`, `FR-MARKETTRENDANALYTICS-001`, `FR-PROCUREMENTCONTRACTS-001`, `FR-PROCUREMENTCONTRACTS-002`, `FR-PROCUREMENTCONTRACTS-003`, `FR-PROCUREMENTCONTRACTS-004`, `FR-INWARDRECEIVING-001`, `FR-INWARDRECEIVING-002`, `FR-INWARDRECEIVING-003`, `FR-INWARDRECEIVING-004`, `FR-INWARDRECEIVING-005`, `FR-INWARDRECEIVING-006`, `FR-QUALITYANDLOTCONTROL-001`, `FR-QUALITYANDLOTCONTROL-002`, `FR-QUALITYANDLOTCONTROL-003`, `FR-QUALITYANDLOTCONTROL-004`, `FR-WAREHOUSEINVENTORY-001`, `FR-WAREHOUSEINVENTORY-002`, `FR-WAREHOUSEINVENTORY-003`, `FR-SALESCONTRACTS-001`, `FR-SALESCONTRACTS-002`, `FR-SALESCONTRACTS-003`, `FR-DISPATCHDELIVERY-001`, `FR-DISPATCHDELIVERY-002`, `FR-DISPATCHDELIVERY-003`, `FR-FLEETREGISTRY-001`, `FR-CUSTOMERRECEIVABLES-001`, `FR-CUSTOMERRECEIVABLES-002`, `FR-CUSTOMERRECEIVABLES-003`, `FR-CUSTOMERRECEIVABLES-004`, `FR-SUPPLIERPAYABLES-001`, `FR-OPERATINGEXPENSES-001`, `FR-OPERATIONALALERTS-001`, `FR-EXECUTIVEREPORTING-001`, `FR-EXECUTIVEREPORTING-002`, `FR-MASTERDATA-001`, `FR-MASTERDATA-002`, `FR-TENANTSECURITYAUDIT-001`, `FR-TENANTSECURITYAUDIT-003`, `FR-TENANTLIFECYCLE-001`, `FR-TENANTMEMBERSHIPCONTEXT-001`, `FR-TENANTMEMBERSHIPCONTEXT-002`, `FR-TENANTSUPPORTSECURITY-001`, `FR-TENANTSUPPORTSECURITY-002`, `FR-PRIVACYPURPOSECONSENT-001`, `FR-DATAPRINCIPALRIGHTS-001`, `FR-PRIVACYBREACHRESPONSE-001`, `FR-RETENTIONERASURE-001`, `FR-PROCESSORGOVERNANCE-001`, `FR-TENANTOPERATINGPOLICIES-001` +- **Requirement:** A governed business mutation commits its immutable audit record in the same transaction as the mutation, with the applicable actor, tenant, action/resource, timestamp, correlation, and FR-defined reason/approval/value details. Failed commands must not create a successful mutation audit record. Audit storage and access must prevent ordinary update/delete. +- **Source:** Approved Stage 7 architecture baseline (`DEC-021`), `FR-TENANTSECURITYAUDIT-003`; exact per-entity fields remain specified by each FR. + +### NFR-OPS-001 — Availability and Recovery + +- **parent_fr:** `cross-cutting` +- **Scope (explicit parent FR set):** `FR-AUTH-001`, `FR-AUTH-002`, `FR-AUTH-003`, `FR-MKT-001`, `FR-MKT-002`, `FR-MARKETTRENDANALYTICS-001`, `FR-PROCUREMENTCONTRACTS-001`, `FR-PROCUREMENTCONTRACTS-002`, `FR-PROCUREMENTCONTRACTS-003`, `FR-PROCUREMENTCONTRACTS-004`, `FR-INWARDRECEIVING-001`, `FR-INWARDRECEIVING-002`, `FR-INWARDRECEIVING-003`, `FR-INWARDRECEIVING-004`, `FR-INWARDRECEIVING-005`, `FR-INWARDRECEIVING-006`, `FR-QUALITYANDLOTCONTROL-001`, `FR-QUALITYANDLOTCONTROL-002`, `FR-QUALITYANDLOTCONTROL-003`, `FR-QUALITYANDLOTCONTROL-004`, `FR-WAREHOUSEINVENTORY-001`, `FR-WAREHOUSEINVENTORY-002`, `FR-WAREHOUSEINVENTORY-003`, `FR-SALESCONTRACTS-001`, `FR-SALESCONTRACTS-002`, `FR-SALESCONTRACTS-003`, `FR-DISPATCHDELIVERY-001`, `FR-DISPATCHDELIVERY-002`, `FR-DISPATCHDELIVERY-003`, `FR-FLEETREGISTRY-001`, `FR-CUSTOMERRECEIVABLES-001`, `FR-CUSTOMERRECEIVABLES-002`, `FR-CUSTOMERRECEIVABLES-003`, `FR-CUSTOMERRECEIVABLES-004`, `FR-SUPPLIERPAYABLES-001`, `FR-OPERATINGEXPENSES-001`, `FR-OPERATIONALALERTS-001`, `FR-EXECUTIVEREPORTING-001`, `FR-EXECUTIVEREPORTING-002`, `FR-MASTERDATA-001`, `FR-MASTERDATA-002`, `FR-TENANTSECURITYAUDIT-001`, `FR-TENANTSECURITYAUDIT-003`, `FR-TENANTLIFECYCLE-001`, `FR-TENANTMEMBERSHIPCONTEXT-001`, `FR-TENANTMEMBERSHIPCONTEXT-002`, `FR-TENANTSUPPORTSECURITY-001`, `FR-TENANTSUPPORTSECURITY-002`, `FR-PRIVACYPURPOSECONSENT-001`, `FR-DATAPRINCIPALRIGHTS-001`, `FR-PRIVACYBREACHRESPONSE-001`, `FR-RETENTIONERASURE-001`, `FR-PROCESSORGOVERNANCE-001`, `FR-TENANTOPERATINGPOLICIES-001` +- **Requirement:** Production service availability is at least 99.9% monthly measured 24/7; RTO is at most 4 hours; RPO is at most 15 minutes; backups are encrypted daily with point-in-time recovery and retained 35 days; restore exercises occur quarterly. Production deployment and operations must provide evidence against these targets. +- **Source:** `BRD-NFR-011`, `DEC-006`. + +### NFR-CAP-001 — Approved Capacity and Load Envelope + +- **parent_fr:** `cross-cutting` +- **Scope (explicit parent FR set):** `FR-AUTH-001`, `FR-AUTH-002`, `FR-AUTH-003`, `FR-MKT-001`, `FR-MKT-002`, `FR-MARKETTRENDANALYTICS-001`, `FR-PROCUREMENTCONTRACTS-001`, `FR-PROCUREMENTCONTRACTS-002`, `FR-PROCUREMENTCONTRACTS-003`, `FR-PROCUREMENTCONTRACTS-004`, `FR-INWARDRECEIVING-001`, `FR-INWARDRECEIVING-002`, `FR-INWARDRECEIVING-003`, `FR-INWARDRECEIVING-004`, `FR-INWARDRECEIVING-005`, `FR-INWARDRECEIVING-006`, `FR-QUALITYANDLOTCONTROL-001`, `FR-QUALITYANDLOTCONTROL-002`, `FR-QUALITYANDLOTCONTROL-003`, `FR-QUALITYANDLOTCONTROL-004`, `FR-WAREHOUSEINVENTORY-001`, `FR-WAREHOUSEINVENTORY-002`, `FR-WAREHOUSEINVENTORY-003`, `FR-SALESCONTRACTS-001`, `FR-SALESCONTRACTS-002`, `FR-SALESCONTRACTS-003`, `FR-DISPATCHDELIVERY-001`, `FR-DISPATCHDELIVERY-002`, `FR-DISPATCHDELIVERY-003`, `FR-FLEETREGISTRY-001`, `FR-CUSTOMERRECEIVABLES-001`, `FR-CUSTOMERRECEIVABLES-002`, `FR-CUSTOMERRECEIVABLES-003`, `FR-CUSTOMERRECEIVABLES-004`, `FR-SUPPLIERPAYABLES-001`, `FR-OPERATINGEXPENSES-001`, `FR-OPERATIONALALERTS-001`, `FR-EXECUTIVEREPORTING-001`, `FR-EXECUTIVEREPORTING-002`, `FR-MASTERDATA-001`, `FR-MASTERDATA-002`, `FR-TENANTSECURITYAUDIT-001`, `FR-TENANTSECURITYAUDIT-003`, `FR-TENANTLIFECYCLE-001`, `FR-TENANTMEMBERSHIPCONTEXT-001`, `FR-TENANTMEMBERSHIPCONTEXT-002`, `FR-TENANTSUPPORTSECURITY-001`, `FR-TENANTSUPPORTSECURITY-002`, `FR-PRIVACYPURPOSECONSENT-001`, `FR-DATAPRINCIPALRIGHTS-001`, `FR-PRIVACYBREACHRESPONSE-001`, `FR-RETENTIONERASURE-001`, `FR-PROCESSORGOVERNANCE-001`, `FR-TENANTOPERATINGPOLICIES-001` +- **Requirement:** Validate the platform against 50 tenant firms, up to 25 named users per tenant, and 250 concurrent active users service-wide. Validate report behavior with at least 50,000 ledger rows per tenant and use the accepted provisional load-test scenario of 200 core business documents per tenant per operating day with a 5× peak-hour burst. Do not convert the scenario into a customer quota. Protect core transactions; derive fair-share warning thresholds and report/export backpressure from load-test evidence. +- **Source:** `BRD-NFR-004`, `BRD-NFR-012`, `DEC-007`–`DEC-009`; numeric fair-share thresholds remain open under `AMB-008`. + +## 3. Open Design and Evidence Items + +- Stage 9 must assign endpoint paths/verbs/contracts, detailed entity schema, indexes, error codes, and service ownership while preserving these FR-derived semantics. +- Stage 11 will define actual screen routes and field-level interaction behavior from the screen mappings. +- Exact authentication/session/logout semantics, identity-provider failure behavior beyond fail-closed, and production provider/storage choices remain open under `AMB-009`. +- Legal retention durations, other applicable India-specific obligations, and approved lawful-basis details remain open under `AMB-006`; do not invent values. +- Numeric fair-share budgets and alert thresholds remain open under `AMB-008`; numeric improvement targets remain open under `AMB-001`. +- This SRS catalog is a Stage 8 derivation, not implementation, runtime, or Gate 9.1 evidence. diff --git a/04_generated_documentation/04_architecture_design/architecture_spike_report.md b/04_generated_documentation/04_architecture_design/architecture_spike_report.md index 0317253..dfd7b71 100644 --- a/04_generated_documentation/04_architecture_design/architecture_spike_report.md +++ b/04_generated_documentation/04_architecture_design/architecture_spike_report.md @@ -1,7 +1,7 @@ --- id: ARCH-SPIKE-001 version: 1.0.0 -status: Draft — Stage 7 design review pending human-lead sign-off +status: Reviewed — Stage 7 design baseline approved by human lead; runtime validation pending last_cr: none --- @@ -14,7 +14,7 @@ last_cr: none | **Risk register** | `00_process_control/architecture_risk_register.md` v2.0.0 | | **Stage 5 gate** | Passed with 0 Critical; 2 documented Major source-parser warnings on FR-AUTH-001/003 (`new — not in BRD`) | | **Stage 6** | Scored all 26 UCs; 16 meet the high/critical dimension rule | -| **Stage 7 status** | Design-level walking-skeleton analysis drafted; human lead sign-off and runtime proof pending | +| **Stage 7 status** | Candidate design baseline approved by human lead on 2026-10-11; runtime proof remains pending | ## 1. Spike Selection @@ -78,20 +78,20 @@ Domain modules depend on application ports; HTTP, SQLAlchemy, Keycloak and Valke ## 5. Invalidated Assumptions and Open Decisions -CR-001 removed sample-only RS256, 15-minute token lifetime, Valkey blacklist, 500 ms revocation target, and cross-tenant super-admin scope; none is restored by this architecture spike. Candidate choices now awaiting lead decision are: +CR-001 removed sample-only RS256, 15-minute token lifetime, Valkey blacklist, 500 ms revocation target, and cross-tenant super-admin scope; none is restored by this architecture spike. The baseline patterns below were approved by `DEC-021`; implementation detail and validation remain open: -1. Whether to adopt transaction-local PostgreSQL tenant context + RLS wrapper exactly as LLD-002 proposes, including application role privileges and support access separation. -2. Whether to adopt a DB transactional outbox with Valkey Streams as delivery transport and idempotent workers. +1. Implement and verify transaction-local PostgreSQL tenant context + RLS, application-role privileges, and support-access separation as specified in LLD-002. +2. Implement and verify the approved DB transactional outbox with Valkey Streams as delivery transport and idempotent workers. 3. How the production identity/session/logout contract should translate to Keycloak operations without adding unapproved token timing requirements. 4. Which provider-neutral deployment controls satisfy NFR availability/recovery and where private user-uploaded documents reside. -5. Confirmation that Stage 7 design-only evidence is sufficient to proceed to Stage 8, with runtime proof deferred to implementation, or whether a runnable prototype is required first. +5. Runtime proof of the approved reference patterns remains an implementation/environment evidence requirement; Stage 7 approval does not claim runtime validation. -These are recorded as AMB-009 for human-lead review. No new decision is recorded as accepted in the decision log. +Human lead approved the candidate patterns as the Stage 7 design baseline on 2026-10-11 (`DEC-021`). Exact identity/session/logout behavior, hosting/storage provider choices, and runtime/load evidence remain open under AMB-009 and related evidence gates. ## 6. Recommendation and Sign-Off -**Recommendation:** approve the modular-monolith boundaries, verified-membership-before-RLS flow, transaction-local tenant context, append-only financial/audit history, and durable-outbox pattern as candidate reference patterns, subject to security and deployment decisions above. Continue design for all requirements only after lead sign-off. Keep high-assurance runtime and load validation as explicit construction/production evidence gates. +**Human-lead disposition:** Approved as the Stage 7 design baseline on 2026-10-11 (`DEC-021`). Proceed to Stage 8 SRS derivation and then Stage 9 full-breadth design. Keep high-assurance runtime and load validation as explicit construction/production evidence gates. -- Human lead: ____________________ -- Disposition: Approve / Approve with changes / Defer -- Date and notes: ____________________ +- Human lead: User (approval recorded in session) +- Disposition: Approve for Stage 7 and proceed +- Date and notes: 2026-10-11; design baseline approval, not runtime validation. diff --git a/04_generated_documentation/04_architecture_design/deployment_spike.md b/04_generated_documentation/04_architecture_design/deployment_spike.md index 251151c..a59da3e 100644 --- a/04_generated_documentation/04_architecture_design/deployment_spike.md +++ b/04_generated_documentation/04_architecture_design/deployment_spike.md @@ -1,7 +1,7 @@ --- id: DEPLOYMENT-SPIKE version: 1.0.0 -status: Draft — provider-neutral; human-lead review pending +status: Reviewed — Stage 7 design baseline; runtime validation pending last_cr: none --- diff --git a/04_generated_documentation/04_architecture_design/hld.md b/04_generated_documentation/04_architecture_design/hld.md index b3cc216..56ca3ce 100644 --- a/04_generated_documentation/04_architecture_design/hld.md +++ b/04_generated_documentation/04_architecture_design/hld.md @@ -1,7 +1,7 @@ --- id: HLD-ATB version: 2.0.0 -status: Draft — Stage 7 spike; human-lead review pending +status: Reviewed — Stage 7 design baseline; runtime validation pending last_cr: CR-001 --- @@ -12,7 +12,7 @@ last_cr: CR-001 | **System** | Agriculture Trading Backoffice (ATB) | | **Pattern** | FastAPI modular monolith, tenant isolation through PostgreSQL RLS | | **Technology authority** | `tech-profile.yaml` | -| **Architecture status** | Candidate walking-skeleton design; not production-baselined | +| **Architecture status** | Stage 7 design baseline approved; runtime and production operations proof remain pending | | **Stage 7 focus** | UC-001, UC-005, UC-006, UC-007, UC-011, UC-014, UC-017, UC-019, UC-020 | ## 1. Logical Architecture 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 677b16c..a19fae4 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 @@ -1,7 +1,7 @@ --- id: LLD-001 version: 2.0.0 -status: Draft — Stage 7 spike; human-lead review pending +status: Reviewed — Stage 7 design baseline; runtime validation pending last_cr: CR-001 --- diff --git a/04_generated_documentation/04_architecture_design/lld/LLD-002_tenant_context_and_isolation.md b/04_generated_documentation/04_architecture_design/lld/LLD-002_tenant_context_and_isolation.md index d181a32..66930c3 100644 --- a/04_generated_documentation/04_architecture_design/lld/LLD-002_tenant_context_and_isolation.md +++ b/04_generated_documentation/04_architecture_design/lld/LLD-002_tenant_context_and_isolation.md @@ -1,7 +1,7 @@ --- id: LLD-002 version: 1.0.0 -status: Draft — Stage 7 spike; human-lead review pending +status: Reviewed — Stage 7 design baseline; runtime validation pending last_cr: none --- @@ -11,7 +11,7 @@ last_cr: none |---|---| | **Parent UCs** | UC-001, UC-017, UC-018, UC-019, UC-020 | | **Parent FRs** | FR-AUTH-001, FR-AUTH-002, FR-AUTH-003; FR-TENANTSECURITYAUDIT-001, FR-TENANTSECURITYAUDIT-003; FR-TENANTLIFECYCLE-001; FR-TENANTMEMBERSHIPCONTEXT-001, FR-TENANTMEMBERSHIPCONTEXT-002; FR-TENANTSUPPORTSECURITY-001, FR-TENANTSUPPORTSECURITY-002 | -| **Status** | Candidate; design review pending | +| **Status** | Stage 7 reference pattern approved for detailed design; runtime validation pending | ## 1. Request Authentication and Context Resolution diff --git a/04_generated_documentation/04_architecture_design/lld/LLD-003_receiving_quality_inventory.md b/04_generated_documentation/04_architecture_design/lld/LLD-003_receiving_quality_inventory.md index 4b00d18..fc767c9 100644 --- a/04_generated_documentation/04_architecture_design/lld/LLD-003_receiving_quality_inventory.md +++ b/04_generated_documentation/04_architecture_design/lld/LLD-003_receiving_quality_inventory.md @@ -1,7 +1,7 @@ --- id: LLD-003 version: 1.0.0 -status: Draft — Stage 7 spike; human-lead review pending +status: Reviewed — Stage 7 design baseline; runtime validation pending last_cr: none --- diff --git a/04_generated_documentation/04_architecture_design/lld/LLD-004_financial_controls.md b/04_generated_documentation/04_architecture_design/lld/LLD-004_financial_controls.md index fcf09aa..04a5dfd 100644 --- a/04_generated_documentation/04_architecture_design/lld/LLD-004_financial_controls.md +++ b/04_generated_documentation/04_architecture_design/lld/LLD-004_financial_controls.md @@ -1,7 +1,7 @@ --- id: LLD-004 version: 1.0.0 -status: Draft — Stage 7 spike; human-lead review pending +status: Reviewed — Stage 7 design baseline; runtime validation pending last_cr: none --- diff --git a/04_generated_documentation/04_architecture_design/lld/LLD-005_reporting_and_events.md b/04_generated_documentation/04_architecture_design/lld/LLD-005_reporting_and_events.md index 50c2bf5..b0fd798 100644 --- a/04_generated_documentation/04_architecture_design/lld/LLD-005_reporting_and_events.md +++ b/04_generated_documentation/04_architecture_design/lld/LLD-005_reporting_and_events.md @@ -1,7 +1,7 @@ --- id: LLD-005 version: 1.0.0 -status: Draft — Stage 7 spike; human-lead review pending +status: Reviewed — Stage 7 design baseline; runtime validation pending last_cr: none --- diff --git a/04_generated_documentation/04_architecture_design/lld/LLD-006_privacy_lifecycle.md b/04_generated_documentation/04_architecture_design/lld/LLD-006_privacy_lifecycle.md index c2399f7..bec1041 100644 --- a/04_generated_documentation/04_architecture_design/lld/LLD-006_privacy_lifecycle.md +++ b/04_generated_documentation/04_architecture_design/lld/LLD-006_privacy_lifecycle.md @@ -1,7 +1,7 @@ --- id: LLD-006 version: 1.0.0 -status: Draft — Stage 7 spike; human-lead review pending +status: Reviewed — Stage 7 design baseline; runtime validation pending last_cr: none --- diff --git a/prompts/20261011T074829Z-session-greenfield-bootstrap.md b/prompts/20261011T074829Z-session-greenfield-bootstrap.md index b27e3f0..629d855 100644 --- a/prompts/20261011T074829Z-session-greenfield-bootstrap.md +++ b/prompts/20261011T074829Z-session-greenfield-bootstrap.md @@ -359,3 +359,19 @@ Invoked up-arch-risk-spike and supplied the canonical Stage 6–7 skill instruct ## 2026-10-11T10:56:49Z — Assistant — Action summary Verified CKPT-011, re-ran Gate 5.1 (zero Critical; two documented Major source-parser warnings), confirmed 26 UCs/54 FRs, and reviewed the active technology profile and all use cases. Replaced the incomplete risk register with scores/ranks/rationales for all 26 UCs; 16 score 4–5 on at least one dimension. Drafted a candidate ATB HLD, updated UC-001 identity LLD plus five focused LLDs, provider-neutral deployment view, and architecture spike report. The report walks through tenant-scoped GRN-to-QC-to-stock-to-alert and payment-bounce reversal plus failure cases. This is design-level consistency analysis only: no product app/runtime harness exists, so runtime and load validation were not claimed or run. Logged proposed patterns for human-lead decision as AMB-009 and saved CKPT-012. Next action: human review of the spike; if approved, proceed to Stage 8 SRS derivation. Risk-matrix validation passed (26 unique UCs, five scores, totals/ranks/significance consistent); `git diff --check` passed. No tests run. + +## 2026-10-11T13:28:49Z — User + +Invoked `/up-srs-derive` and supplied the Stage 8 procedure. + +## 2026-10-11T13:28:49Z — Assistant — Gate check + +Reviewed the canonical Stage 8 skill, process rules, AMB-009, master context, and CKPT-012. Stage 8 prerequisite is not met: Stage 7 candidate architecture remains pending human-lead disposition; no architecture decisions have been accepted. Did not derive SRS items or edit requirements. Confirmed CKPT-012 names the exact next action: human lead reviews `architecture_spike_report.md` and records Approve / Approve with changes / Defer in AMB-009. Read-only validation did not alter repository artifacts. Initial final validation script was corrected after a checker-format mistake; the subsequent risk-matrix and `git diff --check` validation passed in the prior action. + +## 2026-10-11T13:37:52Z — User + +Approved Stage 7 and asked to proceed. + +## 2026-10-11T13:37:52Z — Assistant — Action summary + +Recorded the Stage 7 human-lead approval as DEC-021 and updated AMB-009 to partially resolved. Marked the Stage 7 architecture report and candidate design artifacts reviewed as the design baseline while retaining runtime/load and provider/session details as open evidence/design items. Derived `04_generated_documentation/03_requirements/SRS-001_stage8_system_requirements.md` with one unique SRS record per each of the 54 FRs, mandatory `parent_fr` and `parent_uc`, and four cross-cutting NFRs whose `parent_fr: cross-cutting` scopes explicitly enumerate all 54 FRs. Updated the single traceability graph, traceability index, master context, checkpoint index, and created CKPT-013. Validation passed for 54/54 unique FR↔SRS mappings, parent links, NFR scopes, and graph links; `git diff --check` passed. Gate 9.1 was not run because Stage 9 HLD/LLD fan-out is the next stage and the gate follows Stage 9. No product code, runtime, or load tests were run.