commit
bfd225c86a
|
|
@ -1,6 +1,3 @@
|
|||
# Implementation Workspace (kept separate from process branch)
|
||||
05_implementation_workspace/
|
||||
|
||||
# Python
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
|
|
@ -50,3 +47,7 @@ out/
|
|||
.DS_Store
|
||||
Thumbs.db
|
||||
|
||||
# Implementation workspace assets are version-controlled. Keep local Compose
|
||||
# credentials out of Git.
|
||||
05_implementation_workspace/.env
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
| **Version** | 1.0.0 |
|
||||
| **Author** | Stakeholder elicitation with `up-requirements-elicit` |
|
||||
| **Process** | UP-AI v1.5 |
|
||||
| **Status** | Draft — business direction accepted; candidate policies pending domain review and baseline approval |
|
||||
| **Status** | Baselined for Stage 1 extraction with explicit evidence-gated assumptions; open evidence items remain production/release gates |
|
||||
| **Last Updated** | 2026-10-11 |
|
||||
|
||||
---
|
||||
|
|
@ -691,7 +691,17 @@ The stakeholder accepted the reference values below as configurable seed candida
|
|||
|
||||
Coverage budgets, test dimensions, and test levels are governed by the active technology profile and UP-AI process rather than the backup PRD.
|
||||
|
||||
### 6.3 Multi-Tenant Platform Security and Operations References
|
||||
### 6.3 Bounded Assumptions for Stage 1 and Evidence Gates
|
||||
|
||||
The following assumptions allow business requirements to be inventoried without fabricating unresolved numeric or legal outcomes. They are valid for Stage 1 extraction and early elaboration only; they do not close the linked ambiguities or waive production/release evidence gates.
|
||||
|
||||
- **ASM-001 — Efficiency targets remain evidence-based:** Until the accepted 30-operating-day pre-rollout and post-rollout pilot measurements exist, no numeric efficiency-improvement target is assumed. Requirements extraction and early design may proceed; the system must preserve the ability to measure the agreed metrics. Resolve `AMB-001` before final production acceptance.
|
||||
- **ASM-002 — Retention durations remain unassigned:** No category/purpose retention duration or additional legal obligation is inferred. The system must support configurable schedules and holds under `BRD-FR-050` and `BRD-NFR-014`; responsible qualified reviewers must approve actual schedules and legal mappings before production. Resolve `AMB-006` before release.
|
||||
- **ASM-003 — Numeric fair-share budgets remain TBD:** The accepted capacity envelope and load-test scenario are planning inputs, not contractual quotas. No numeric per-tenant budget or alert threshold is assumed until architecture/load-test evidence exists; observability and configurable budget controls remain required. Resolve `AMB-008` before production capacity acceptance.
|
||||
|
||||
These assumptions do not assert legal compliance, determine a tenant's operating policy, or permit production release without the stated evidence.
|
||||
|
||||
### 6.4 Multi-Tenant Platform Security and Operations References
|
||||
|
||||
- [OWASP Application Security Verification Standard (ASVS)](https://github.com/OWASP/ASVS) — candidate source for selecting testable application-security controls and verification rigor.
|
||||
- [PostgreSQL Row Security Policies](https://www.postgresql.org/docs/current/ddl-rowsecurity.html) — behavior and privileged-role considerations for the configured row-level security model.
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
| **Process** | UP-AI v1.5 |
|
||||
| **Last Updated** | 2026-10-11 |
|
||||
|
||||
Open requirements questions are tracked here (`AMB-xxx`). Unresolved business rules will not be inferred from the illustrative mockup.
|
||||
Open requirements and architecture questions are tracked here (`AMB-xxx`). Unresolved business rules will not be inferred from the illustrative mockup.
|
||||
|
||||
| ID | Date | Stage | Ambiguity / Question | Context & Impact | Resolution / Decision | Status | Resolved By |
|
||||
|---|---|---|---|---|---|---|---|
|
||||
|
|
@ -15,6 +15,9 @@ Open requirements questions are tracked here (`AMB-xxx`). Unresolved business ru
|
|||
| AMB-003 | 2026-10-11 | Stage 0B | How should the proposed numeric operating values from the reference be applied when their appropriateness varies by tenant, commodity, or contract? | Stakeholder accepted the business scope and all 11 mockup areas, and accepted the reference values as configurable tenant-scoped seed candidates. | Resolved: the values are not universal defaults. Each tenant’s Partner/Managing Director or delegated authorized business owner must confirm or edit applicable thresholds before affected risk-sensitive workflows are enabled; only those affected workflows remain blocked for missing/unreviewed values. Policies are effective-dated and changes audited per `BRD-FR-052`. | Resolved | Stakeholder, 2026-10-11 |
|
||||
| AMB-004 | 2026-10-11 | Stage 0B | How are tenants onboarded and suspended, and may one user hold memberships in multiple tenant firms? | Tenant lifecycle and membership management affect identity and administration design. | Resolved: v1 has no public self-service signup; an authorized platform administrator provisions and activates tenants. A person may belong to multiple tenants and explicitly selects the active tenant after sign-in; server-side membership and role checks apply on every request. Captured in `BRD-FR-042`–`BRD-FR-044`. | Resolved | Stakeholder, 2026-10-11 |
|
||||
| AMB-005 | 2026-10-11 | Stage 0B | Who may approve exceptional cross-tenant support access, and what tenant notification/review is required? | Support access to tenant business data must be exceptional, attributable, and reviewable. | Resolved: no standing support access; ordinary case-specific access requires Tenant Administrator approval and is time-limited. A designated platform security administrator may grant break-glass access for at most one hour during an urgent incident, recording the reason, generating an immediate audit alert, and notifying the tenant administrator within one business day. Captured in `BRD-FR-046`. | Resolved | Stakeholder, 2026-10-11 |
|
||||
| AMB-006 | 2026-10-11 | Stage 0B | What actual retention durations and additional India-specific sectoral/contractual obligations apply to v1? | The stakeholder accepted the SaaS privacy roles, India-first scope, all-natural-person coverage, four internal sensitivity labels with separate personal-data/purpose tags, category/purpose retention governance, OWASP ASVS v5.0.0 Level 2, and the review path: tenant legal/accounting reviewers approve trading-data purposes/retention; the ATB operator’s qualified privacy/legal reviewer approves platform processing, retention, and processor obligations. Exact durations and other legal/contractual duties remain unconfirmed. The Act/Rules have phased commencement. | PRD captures accepted policy in `BRD-FR-047`–`BRD-FR-051` and `BRD-NFR-009`/`BRD-NFR-014`. Record qualified review evidence for actual durations and other obligations before baseline; revalidate current requirements before production. | Open | — |
|
||||
| AMB-006 | 2026-10-11 | Stage 0B | What actual retention durations and additional India-specific sectoral/contractual obligations apply to v1? | The stakeholder accepted the SaaS privacy roles, India-first scope, all-natural-person coverage, four internal sensitivity labels with separate personal-data/purpose tags, category/purpose retention governance, OWASP ASVS v5.0.0 Level 2, and the review path: tenant legal/accounting reviewers approve trading-data purposes/retention; the ATB operator’s qualified privacy/legal reviewer approves platform processing, retention, and processor obligations. Exact durations and other legal/contractual duties remain unconfirmed. The Act/Rules have phased commencement. | PRD captures accepted policy in `BRD-FR-047`–`BRD-FR-051` and `BRD-NFR-009`/`BRD-NFR-014`. Under `ASM-002`, extraction and early design proceed without assuming durations or obligations; record qualified review evidence and revalidate current requirements before production release. | Open | — |
|
||||
| AMB-007 | 2026-10-11 | Stage 0B | What production availability, backup retention, RTO, and RPO targets are acceptable? | These targets determine hosting, data protection, recovery design, and support commitments. | Resolved: 99.9% monthly availability measured 24/7; RTO ≤4 hours; RPO ≤15 minutes; encrypted daily backups with point-in-time recovery and 35-day retention; quarterly restore exercises. Captured in `BRD-NFR-011`. | Resolved | Stakeholder, 2026-10-11 |
|
||||
| AMB-008 | 2026-10-11 | Stage 0B | What tenant count, active-user count, transaction volume, peak concurrency, and per-tenant limits must the platform support? | Stakeholder approved an initial envelope of 50 tenant firms, 25 named users per tenant, and 250 concurrent active users service-wide. The approved provisional planning scenario is 200 core business documents per tenant per operating day with a 5× peak-hour burst. Stakeholder accepted no fixed business-document quota; observe per-tenant use, provide configurable early warnings near the tested fair-share budget, and protect core transactions while using backpressure/temporary throttling for expensive reports or bulk exports under contention. Numeric fair-share budgets and alert thresholds still require architecture/load-test evidence and later pilot refinement. | Partially resolved: approved 50 tenant firms, up to 25 named users per tenant, 250 concurrent active users service-wide, and 50,000 ledger rows per tenant for report validation. The 200 documents/tenant/operating day and 5× peak-hour burst scenario has been accepted for load testing; set numeric fair-share budgets and alert thresholds from architecture/load-test evidence and refine them with pilot telemetry; see `BRD-NFR-004` and `BRD-NFR-012`. | Open | — |
|
||||
| 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 |
|
||||
| AMB-010 | 2026-10-11 | Stage 9 | Which tax identifier types, jurisdiction-specific formats, applicability rules, and validation method must supplier/customer master data enforce? | `FR-MASTERDATA-002` requires tax IDs validated where applicable but does not specify formats, applicability, checksums, or whether external verification is required. These affect input rules and privacy/vendor integration scope. | LLD-008 preserves the source rule without assuming formats or a live tax-authority integration; resolve during qualified business/tax review before implementation. | Open | — |
|
||||
| AMB-011 | 2026-10-11 | Stage 9 | What poison-event retention, replay approval, and operational recovery policy should govern permanently failing outbox consumers? | `DEC-021` approves durable outbox and idempotent consumers but does not set retention, alert escalation, replay authority, or payload redaction for permanently failing events. | Stage 9 isolates and surfaces poison events without silent deletion; exact retention and controlled replay process require an operational/security owner decision before production. | Open | — |
|
||||
|
|
|
|||
|
|
@ -2,25 +2,63 @@
|
|||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| **Governed Standard** | SEI-CMMI Level 3 (UP-AI v1.0) |
|
||||
| **Governed Standard** | UP-AI v1.5, Stages 6–7 |
|
||||
| **Document Path** | `04_generated_documentation/00_process_control/architecture_risk_register.md` |
|
||||
| **Last Updated** | 2026-09-03 |
|
||||
| **Last Updated** | 2026-10-11 |
|
||||
| **Version** | 2.0.0 |
|
||||
| **Last CR** | `CR-001` (UC-001 rebaseline retained) |
|
||||
| **Stage Status** | Stage 6 complete; Stage 7 reference patterns approved by human lead (`DEC-021`) |
|
||||
|
||||
---
|
||||
## 1. Scoring Scale and Dimensions
|
||||
|
||||
## 1. Architectural Risk Dimensions (1 to 5 Scale)
|
||||
Scores are ordinal: 1 = low, 2 = limited, 3 = moderate, 4 = high, 5 = critical. RISK-xxx maps one-to-one to its owning UC; the total is the sum of D1–D5. Rank sorts total descending, with UC number as the deterministic tie-break. These are comparative design risks, not likelihood percentages.
|
||||
|
||||
1. **D1: Data Isolation & Multi-Tenancy:** Cross-tenant boundaries, RLS schema isolation complexity.
|
||||
2. **D2: External Integration Dependency:** Third-party APIs, external identity providers, payment gateways, messaging.
|
||||
3. **D3: Financial & Transactional Sensitivity:** Ledgers, payment processing, irreversible state transitions.
|
||||
4. **D4: Throughput & Concurrency:** High-volume streaming, live event ingestion, background queue locks.
|
||||
5. **D5: Novelty & Uncertainty:** Complex algorithms, lack of precedent, unproven patterns.
|
||||
1. **D1 — Data Isolation & Multi-Tenancy:** Tenant boundaries, membership/context verification, RLS, control-plane separation.
|
||||
2. **D2 — External Integration Dependency:** External identity, payment, messaging, or other explicitly specified service dependencies. Do not assume an external weighbridge/payment API where the BRD specifies manual capture only.
|
||||
3. **D3 — Financial & Transactional Sensitivity:** Ledger integrity, credit decisions, irreversible state, posting/reversal atomicity.
|
||||
4. **D4 — Throughput & Concurrency:** Real-time behavior, concurrent writes, queue contention, report capacity obligations.
|
||||
5. **D5 — Novelty & Technical Uncertainty:** Unproven design, cross-module invariants, complex state/data lifecycle. Open business/legal values are not scored as settled design.
|
||||
|
||||
---
|
||||
A use case is Architecturally Significant if any dimension is 4–5 or it is in the top 20% by total score. The threshold deliberately includes all single-dimension high/critical risks even when that exceeds 20% of the set.
|
||||
|
||||
## 2. Use Case Risk Scoring Matrix
|
||||
## 2. Full Use-Case Risk Matrix
|
||||
|
||||
| UC-ID | Use Case Name | D1 | D2 | D3 | D4 | D5 | Total Score | Rank | Architecturally Significant (Y/N) | Architecture Rationale |
|
||||
|---|---|---|---|---|---|---|---|---|---|---|
|
||||
| `UC-001` | User Identity & Role Governance | 5 | 4 | 2 | 3 | 2 | **16** | 1 | **Yes** | Multi-tenant tenant context extraction, Keycloak OIDC/PKCE integration, RLS context propagation. Validated in Stage 7 Walking Skeleton. |
|
||||
| `UC-002` | User Profile & Preferences | 3 | 1 | 1 | 1 | 1 | **7** | 2 | **No** | Standard CRUD operations; inherits service template and RLS pattern from `UC-001`. |
|
||||
| Risk ID | UC-ID | Use Case Name | D1 | D2 | D3 | D4 | D5 | Total | Rank | Architecturally Significant | Rationale |
|
||||
|---|---|---|---:|---:|---:|---:|---:|---:|---:|---|---|
|
||||
| `RISK-001` | `UC-001` | User Authentication and Authorization | 5 | 5 | 2 | 2 | 4 | **18** | 2 | Yes | OIDC identity dependency plus tenant-scoped authorization and session security; exact revocation design remains open after CR-001. |
|
||||
| `RISK-002` | `UC-002` | Record Daily Mandi Arrivals and Prices | 2 | 1 | 2 | 2 | 1 | **8** | 25 | No | Daily observation entry is tenant scoped but has no specified external integration, financial posting, or complex state machine. |
|
||||
| `RISK-003` | `UC-003` | Mandi Price Trend Analytics | 2 | 1 | 1 | 4 | 3 | **11** | 18 | Yes | 20-day trend analytics must meet the 50,000-row report SLA; query shape and summary strategy need measurement. |
|
||||
| `RISK-004` | `UC-004` | Purchase Sauda and Supplier Payables Setup | 2 | 1 | 3 | 2 | 3 | **11** | 19 | No | Sauda booking spans partial deliveries and commercial calculations, but no external provider or irreversible ledger transition is specified. |
|
||||
| `RISK-005` | `UC-005` | Inward Vehicle Receiving and Goods Receipt | 3 | 1 | 4 | 3 | 4 | **15** | 9 | Yes | Weighments and tare/shortage calculations culminate in GRN, stock, and lot creation; no physical weighbridge API is specified. |
|
||||
| `RISK-006` | `UC-006` | Inward Quality Inspection and Lot Control | 3 | 1 | 3 | 2 | 4 | **13** | 15 | Yes | QC Hold/Released invariants, lot lineage, and deduction rules must remain consistent across allocation and dispatch. |
|
||||
| `RISK-007` | `UC-007` | Warehouse Stock, Audit, Capacity and Transfer | 3 | 1 | 5 | 4 | 3 | **16** | 7 | Yes | Double-entry multi-godown stock movements, real-time positions, reconciliation adjustments, and concurrency create transactional risk. |
|
||||
| `RISK-008` | `UC-008` | Customer Sales Contract, Credit Check and Allocation | 3 | 1 | 4 | 3 | 3 | **14** | 11 | Yes | Credit exposure and available-lot reservation couple sales confirmation to receivables and inventory state. |
|
||||
| `RISK-009` | `UC-009` | Outbound Dispatch and Delivery | 3 | 2 | 4 | 4 | 3 | **16** | 8 | Yes | Dispatch state, outward weighment, POD, shortage notes, and compensating credit notes span operational and financial records. |
|
||||
| `RISK-010` | `UC-010` | Transport Fleet Registry | 2 | 1 | 1 | 1 | 1 | **6** | 26 | No | Fleet registry is conventional master-data CRUD without a specified live telematics integration. |
|
||||
| `RISK-011` | `UC-011` | Customer Receivables and Credit Controls | 3 | 1 | 5 | 4 | 4 | **17** | 4 | Yes | Immutable receivables, credit locks/overrides, receipt clearing and bounced-instrument reversals have high financial and concurrency impact. |
|
||||
| `RISK-012` | `UC-012` | Supplier Payables and Aging | 3 | 1 | 3 | 2 | 2 | **11** | 20 | No | Payables aging and snapshots are financial but primarily derived from accepted GRNs; no payment execution integration is specified. |
|
||||
| `RISK-013` | `UC-013` | Mandi Operating Expense Recording | 2 | 1 | 3 | 1 | 2 | **9** | 22 | No | Expense recording has accounting sensitivity but no complex posting lifecycle or external dependency specified. |
|
||||
| `RISK-014` | `UC-014` | Operational Alert Review | 3 | 2 | 2 | 4 | 3 | **14** | 12 | Yes | Proactive alerts depend on timely evaluation of multiple operational and financial conditions; delivery-channel integration is not yet specified. |
|
||||
| `RISK-015` | `UC-015` | Executive Dashboard and Trading Snapshots | 3 | 1 | 3 | 4 | 3 | **14** | 13 | Yes | Executive dashboard and rolling snapshots combine live operational and financial aggregates under the report SLA. |
|
||||
| `RISK-016` | `UC-016` | Commodity and Trading Counterparty Master Data | 3 | 1 | 2 | 2 | 1 | **9** | 23 | No | Commodity and counterparty masters are tenant-scoped reference data with standard lifecycle complexity. |
|
||||
| `RISK-017` | `UC-017` | Tenant Isolation and Transaction Audit | 5 | 1 | 4 | 3 | 4 | **17** | 5 | Yes | Tenant isolation is a system-wide security boundary; immutable transaction audit must cover governed mutations without leakage. |
|
||||
| `RISK-018` | `UC-018` | Tenant Provisioning and Lifecycle | 5 | 3 | 1 | 2 | 3 | **14** | 14 | Yes | Tenant create/activate/suspend is a control-plane boundary with identity provisioning and risk of cross-tenant administration. |
|
||||
| `RISK-019` | `UC-019` | Tenant Membership and Verified Context | 5 | 4 | 2 | 4 | 4 | **19** | 1 | Yes | Membership and active-tenant verification join external identity to tenant roles on every operation; stale or spoofed context is critical. |
|
||||
| `RISK-020` | `UC-020` | Tenant Resource Isolation and Privileged Support | 5 | 1 | 3 | 5 | 4 | **18** | 3 | Yes | Isolation spans synchronous and asynchronous resources, exports, files, caches, jobs, and exceptional support access. |
|
||||
| `RISK-021` | `UC-021` | Personal Data Purpose, Notice and Consent | 3 | 1 | 2 | 1 | 2 | **9** | 24 | No | Purpose, notice, and consent evidence is privacy-sensitive but uses a conventional tenant-governed record lifecycle. |
|
||||
| `RISK-022` | `UC-022` | Data Principal Rights and Grievance Requests | 3 | 2 | 2 | 2 | 3 | **12** | 16 | No | Rights and grievance cases involve identity matching and controlled disclosure, with moderate workflow uncertainty. |
|
||||
| `RISK-023` | `UC-023` | Personal Data Breach Response Coordination | 4 | 2 | 2 | 3 | 4 | **15** | 10 | Yes | Breach coordination spans tenant and operator responsibilities, affected-person data, evidence, and notification workflow. |
|
||||
| `RISK-024` | `UC-024` | Purpose-Aware Retention, Erasure and Legal Holds | 4 | 1 | 4 | 3 | 5 | **17** | 6 | Yes | Purpose-aware erasure must reconcile legal holds, statutory minimums, backups, logs, and tenant data boundaries; durations remain AMB-006. |
|
||||
| `RISK-025` | `UC-025` | Processor and Subprocessor Governance | 3 | 3 | 1 | 1 | 2 | **10** | 21 | No | Processor inventory and due-diligence records have external-party scope but are not specified as live integrations. |
|
||||
| `RISK-026` | `UC-026` | Tenant Operating Policy Configuration | 3 | 1 | 3 | 2 | 3 | **12** | 17 | No | Tenant-scoped effective-dated policies gate affected workflows and audit changes; candidate thresholds require controlled rollout. |
|
||||
|
||||
## 3. Stage 6 Result
|
||||
|
||||
- Use cases scored: **26**; child FRs in the current gated set: **54**.
|
||||
- Architecturally significant by the stated rule: **16**. All six top-ranked UCs are included; remaining high single-dimension risks are retained in the significant set.
|
||||
- Stage 7 deep-spike focus: `UC-001`, `UC-005`, `UC-006`, `UC-007`, `UC-011`, `UC-014`, `UC-017`, `UC-019`, `UC-020`. These cover identity and external auth, tenant control/data boundaries, goods receipt/lot state, stock ledger, financial reversal, and operational event delivery. Other significant UCs map to these validated patterns for full-breadth Stage 9 design.
|
||||
- The former UC-001 bootstrap score and “Stage 7 validated” assertion are superseded; scores above are based on current UC/FR content after CR-001.
|
||||
|
||||
## 4. Stage 7 State
|
||||
|
||||
Risk ranking complete. Candidate HLD/LLD/deployment and design-level walking-skeleton analysis are in `04_architecture_design/architecture_spike_report.md`, `hld.md`, `lld/LLD-001_auth_service.md`, `lld/LLD-002_tenant_context_and_isolation.md`, `lld/LLD-003_receiving_quality_inventory.md`, `lld/LLD-004_financial_controls.md`, `lld/LLD-005_reporting_and_events.md`, `lld/LLD-006_privacy_lifecycle.md`, and `deployment_spike.md`. Human-lead design-baseline approval is recorded in `DEC-021`. No runtime skeleton has been implemented or tested; the design report distinguishes scenario walkthrough evidence from runtime proof.
|
||||
|
|
|
|||
|
|
@ -8,7 +8,10 @@
|
|||
|
||||
## Active Assumptions
|
||||
|
||||
No unapproved business assumptions are being used to complete the PRD draft. Candidate numeric policies are listed in the ambiguity register and marked provisional. Technical choices in `tech-profile.yaml` are known configuration facts, not assumptions.
|
||||
Three bounded working assumptions are accepted for Stage 1 extraction and early elaboration only. They preserve unknown values as TBD and retain the corresponding ambiguity and production/release evidence gates. Technical choices in `tech-profile.yaml` are configuration facts, not assumptions.
|
||||
|
||||
| ID | Date | Stage | Assumption | Basis | Risk Level | Status | Superseded By |
|
||||
|---|---|---|---|---|---|---|---|
|
||||
| ASM-001 | 2026-10-11 | Stage 1 | Efficiency improvement targets remain unset until the agreed representative-tenant pre/post pilot measurements are collected; requirements extraction and early design may proceed, and the product must support measurement of the agreed metrics. | Stakeholder authorized proceeding under explicit assumptions; no pilot evidence currently supports numeric targets. | Medium | Accepted for Stage 1 and early elaboration; resolve `AMB-001` before production acceptance. | — |
|
||||
| ASM-002 | 2026-10-11 | Stage 1 | Do not infer retention durations or additional legal obligations. Support configurable category/purpose schedules; require qualified review and evidence before production release. | Exact durations and applicable obligations are unresolved under `AMB-006`; a configurable design can proceed without inventing legal rules. | High | Accepted for Stage 1 and early elaboration; resolve `AMB-006` before production release. | — |
|
||||
| ASM-003 | 2026-10-11 | Stage 1 | Treat the accepted capacity envelope and load profile as planning inputs only; numeric fair-share budgets and alert thresholds remain TBD pending architecture/load tests and pilot telemetry. | No performance evidence currently establishes safe per-tenant budgets; observability and configurable fairness controls remain in scope. | Medium | Accepted for Stage 1 and early elaboration; resolve `AMB-008` before production capacity acceptance. | — |
|
||||
|
|
|
|||
|
|
@ -7,14 +7,60 @@
|
|||
| **Gated By** | `up-change-request-impact` |
|
||||
| **Scope** | Product Scope, Functional Requirements (`FR-xxx`), Use Cases (`UC-xxx`), Architecture, Code |
|
||||
| **Meta-Process Changes** | Governed separately via `up-process-change` in [`process_change_register.md`](process_change_register.md) (`PCR-xxx`) |
|
||||
| **Last Updated** | 2026-10-03 |
|
||||
| **Last Updated** | 2026-10-11 |
|
||||
|
||||
---
|
||||
|
||||
## 1. Active & Historical Product Change Requests
|
||||
|
||||
*No product change requests raised yet. Product requirements baseline is clean.*
|
||||
Product Change Requests are impact-analyzed below; each record states its current disposition, verification, and closure status.
|
||||
|
||||
| CR-ID | Trigger Type | Raised By | Date | Originating Stage | Description | Affected Items | Blast Radius / Impact | Disposition | Status |
|
||||
|---|---|---|---|---|---|---|---|---|---|
|
||||
| — | — | — | — | — | *Clean baseline — raise via `/up-change-request-impact`* | — | — | — | — |
|
||||
| `CR-001` | Bug / Traceability defect | Human request, analyzed by AI | 2026-10-11 | Stage 5 — Elaboration | Review and realign the sample UC-001 identity/authentication use case and its source mappings to the baselined ATB PRD and active tech profile; decide which sample-specific auth/session constraints remain product requirements. | `UC-001`, `FR-AUTH-001`–`FR-AUTH-003` | See CR-001 Impact Analysis below. | Approved by stakeholder on 2026-10-11: UC-001 remains the OIDC AuthN/AuthZ use case; align it with the ATB baseline | Closed — approved impact set rebaselined and verified; iteration construction remains pending |
|
||||
|
||||
|
||||
## CR-001 — UC-001 Alignment with the ATB Product Baseline
|
||||
|
||||
### Request and Trigger
|
||||
|
||||
The stakeholder confirmed that UC-001 was executed end-to-end as a process sample and approved proceeding on the assumption that it continues to cover OIDC authentication and authorization, aligned to the current ATB product baseline. This approval authorizes the bounded rebaseline described below; it does not approve unsupported numeric auth/session targets.
|
||||
|
||||
### Impact Analysis
|
||||
|
||||
**Starting points:** `UC-001`, `FR-AUTH-001`, `FR-AUTH-002`, and `FR-AUTH-003`.
|
||||
|
||||
**Upstream items to reconcile:**
|
||||
|
||||
- `01_BRD/PRD_Specification.md` and `brd_inventory.md`: `BRD-FR-001`–`003` are Market Desk arrivals, prices, and price trends, so they cannot own authentication requirements. Relevant identity/security requirements are `BRD-FR-039` (tenant boundary), `BRD-FR-040` (roles and segregation of duties), `BRD-FR-043` (membership administration), `BRD-FR-044` (verified active tenant context), and `BRD-FR-045` (resource isolation). `BRD-NFR-009` requires authentication/session/authorization security verification; `BRD-NFR-006` and `BRD-NFR-010` govern tenant isolation.
|
||||
- `tech-profile.yaml`: Keycloak, OIDC PKCE, JWT bearer tokens, RBAC/ABAC, PostgreSQL RLS, and Valkey are configured technologies. They constrain design, but do not by themselves establish every sample-specific behavior or numeric service target.
|
||||
- `UC-017` owns `BRD-FR-039`–`041`; `UC-019` owns `BRD-FR-043`–`044`; `UC-020` owns `BRD-FR-045`–`046`. Any UC-001 realignment must avoid creating duplicate requirement ownership and preserve explicit dependencies to those use cases.
|
||||
|
||||
**Downstream artifacts reachable from the traceability graph/index:**
|
||||
|
||||
| Artifact / Node | Impact |
|
||||
|---|---|
|
||||
| `04_generated_documentation/00_process_control/traceability_graph.md` and `traceability_index.md` (`TR-001`–`TR-003`) | Correct the three false BRD links and maintain the single canonical graph; keep the index consistent if it remains in use. |
|
||||
| `04_generated_documentation/00_process_control/architecture_risk_register.md` (`UC-001`) | Revisit the legacy score/rationale and prior claim that a Stage 7 walking skeleton was validated; Stage 6 scoring for the current 26-UC set has not yet run. |
|
||||
| SRS nodes `SRS-AUTH-001`–`003` shown in the graph | Reconcile parent FR links and constraints. No separate current SRS file was found during this review. |
|
||||
| `04_generated_documentation/04_architecture_design/hld.md`, `04_architecture_design/lld/LLD-001_auth_service.md` | Reconcile authentication, tenant selection/context, membership verification, authorization, RLS, session/logout, token revocation, and persistence contracts with the approved UC scope. |
|
||||
| `STORY-AUTH-001`–`003`, iteration-01 backlog/plan/surface matrix/parallel-work plan | Re-map or rescope stories and surfaces if their parent FRs change; reassess the prior iteration status. |
|
||||
| `TC-AUTH-001`–`004`, regression/test strategy, manual QA guide/workbook, login/role/session screens and API contracts | Update expected behavior and reverify relevant tests and evidence after any approved requirement change. |
|
||||
|
||||
**Disposition of sample-specific constraints:**
|
||||
|
||||
- `FR-AUTH-001`'s OIDC/PKCE login aligns with the configured profile and security NFR. Its RS256 signing algorithm and access-token maximum lifetime of 15 minutes are not stated as business rules in the current PRD; retain them only if the accountable product/security owner confirms them as requirements or design decisions.
|
||||
- `FR-AUTH-002` combines authorization, tenant claim propagation, RLS behavior, and super-admin cross-tenant scope. Align role permissions/segregation with `BRD-FR-040`, tenant membership/context with `BRD-FR-043`/`044`, and isolation with `BRD-FR-039`/`045`. Decide whether any additional super-admin scope behavior is authorized.
|
||||
- `FR-AUTH-003` specifies a Valkey token blacklist and a 500 ms revocation target. Valkey is configured in the profile, but the PRD does not define this revocation mechanism or latency target. Decide whether to retain, revise, or remove those details. Preserve security/retention obligations from the approved NFRs.
|
||||
- The use case's audit events should be reconciled with `BRD-FR-041`, which requires immutable history for submitted business records and governed mutations; do not silently broaden its audit scope.
|
||||
|
||||
**Iteration/evidence status:** The stakeholder restored the downstream artifacts and they are present in the active worktree. Review found the surface matrix’s prior “Verified for Gate 14.1” label unsupported: the workbook directory contains only `.gitkeep`, and no implementation/test execution evidence was found. Under the anti-placeholder rule, the matrix is now `Incomplete / Pending Construction`; no FR is marked Delivered. Auth design, iteration, test, manual-QA, and wireframe-boundary artifacts were rebaselined under CR-001. Gate 14.1 is not a release/CR closure prerequisite for these Baselined, not-yet-constructed requirements; run it before any iteration delivery claim.
|
||||
|
||||
**Approved rebaseline scope:** Keep UC-001 as the OIDC authentication and authorization use case, with general session handling required by `BRD-NFR-009`. Remove false `BRD-FR-001`–`003` links. Map role-based permission enforcement and segregation of duties to `BRD-FR-040`, owned by UC-001; leave tenant membership and active-tenant verification in UC-019, and tenant resource isolation and support access in UC-020. Retain OIDC/PKCE/JWT bearer as configured by `tech-profile.yaml`. Remove sample-specific RS256, 15-minute access-token expiry, Valkey blacklist, 500 ms revocation target, cross-tenant super-admin scope, and authentication audit-event assertions from requirements because the current product baseline does not authorize those details; downstream design may propose implementation choices through the normal design process.
|
||||
|
||||
**Verification record:** Approved impacted artifacts were versioned and rebaselined with `last_cr: CR-001`; Gate 5.1 passed with 0 Critical and 2 justified Major parser warnings. The restored iteration-01 artifacts were reviewed and Gate 14.1 was run. It failed with G14-006 (missing dense QA workbook) and G14-008 (no Bruno collections); the surface matrix and traceability status now explicitly say Incomplete / Pending Construction. Since no affected FR is Delivered, these construction blockers do not invalidate the CR requirements-alignment verification or closure. Gate 9.1 for the complete Stage 5 set remains independently pending.
|
||||
|
||||
### Disposition Checkpoint
|
||||
|
||||
- **Disposition:** Approved by stakeholder on 2026-10-11, with UC-001 covering OIDC AuthN/AuthZ and aligned to the current ATB baseline.
|
||||
- **Status:** Closed — approved requirements/design/test-specification impact set rebaselined and verified. Gate 5.1 passed with zero Critical findings and two justified source-parser warnings. Gate 14.1 was run and failed with two Critical construction-evidence findings (missing dense workbook and Bruno collections); UC-001 requirements remain Baselined, not Delivered, and iteration-01 remains Incomplete / Pending Construction. Gate 14.1 is still mandatory before delivery or iteration closure.
|
||||
|
|
|
|||
|
|
@ -0,0 +1,23 @@
|
|||
# Checkpoint 007 — ATB BRD Extraction
|
||||
|
||||
- **Checkpoint ID:** `CKPT-007`
|
||||
- **Date:** 2026-10-11
|
||||
- **Active Stage:** Stage 1 — Business Requirements Extraction
|
||||
- **Active Track:** Greenfield, India-first, multi-tenant Agriculture Trading Backoffice (ATB)
|
||||
- **Active Skill:** `up-brd-extract`
|
||||
- **PRD Status:** Baselined for Stage 1 extraction with bounded, evidence-gated assumptions
|
||||
|
||||
## Completed
|
||||
- Recorded stakeholder direction `DEC-020` authorizing Stage 1 under explicit bounded assumptions.
|
||||
- Added `ASM-001`–`ASM-003`; kept `AMB-001`, `AMB-006`, and `AMB-008` open as evidence gates.
|
||||
- Baselined `01_BRD/PRD_Specification.md` for Stage 1 extraction and documented assumption boundaries.
|
||||
- Extracted all 52 functional requirements and 14 NFRs into `04_generated_documentation/01_source_inventories/brd_inventory.md`.
|
||||
- Confirmed unique FR/NFR ID counts and scoped whitespace validation; no tests or traceability gates are applicable to this extraction step.
|
||||
|
||||
## Open Items
|
||||
- `AMB-001`: pilot measurements and efficiency targets.
|
||||
- `AMB-006`: qualified legal/accounting review and retention/legal evidence.
|
||||
- `AMB-008`: architecture/load-test evidence and pilot telemetry for fair-share budgets.
|
||||
|
||||
## Exact Next Action
|
||||
Review the Stage 1 inventory for completeness and consistency, then continue the Greenfield track to Stage 5 use-case authoring. Carry `ASM-001`–`ASM-003` and their release gates forward; do not mark the open ambiguities resolved or treat the assumptions as production evidence.
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
# Checkpoint 008 — Stage 5 Use-Case Authoring
|
||||
|
||||
- **Checkpoint ID:** `CKPT-008`
|
||||
- **Date:** 2026-10-11
|
||||
- **Active Stage:** Stage 5 — Use Case Authoring
|
||||
- **Active Track:** Greenfield, India-first, multi-tenant Agriculture Trading Backoffice (ATB)
|
||||
- **Active Skill:** `up-use-case-author` completed; Gate 5.1 run
|
||||
|
||||
## Completed
|
||||
- Authored use cases `UC-002`–`UC-026` with corresponding `functional-reqs.md` artifacts; the pre-existing `UC-001` remains unchanged.
|
||||
- Mapped every `BRD-FR-001`–`BRD-FR-052` to a use case in `04_generated_documentation/01_source_inventories/brd_inventory.md`.
|
||||
- Gate 5.1 passes structurally for 26 UCs and 55 child FRs, with zero Critical, Major, or Minor validator findings.
|
||||
- Recorded the current gate result and new nodes in `traceability_graph.md`; Gate 9.1 is not run for the expanded Stage 5 scope.
|
||||
|
||||
## Open Items
|
||||
- Existing `UC-001` authentication FRs cite `BRD-FR-001`–`BRD-FR-003`, which the baselined PRD defines as Market Desk requirements. This is a semantic traceability Major recorded in `traceability_graph.md`; do not revise those baseline mappings before a Change Request is analyzed and dispositioned.
|
||||
- `AMB-001`, `AMB-006`, and `AMB-008` remain open evidence gates per `ambiguity_register.md`.
|
||||
|
||||
## Exact Next Action
|
||||
Invoke `/up-change-request-impact` to analyze the UC-001 source-feature mapping discrepancy and obtain a disposition before changing the baselined mapping. After the mapping issue is dispositioned, continue to Stage 6 with `/up-arch-risk-spike`, scoring the full current use-case set.
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
# Checkpoint 009 — CR-001 UC-001 Review
|
||||
|
||||
- **Checkpoint ID:** `CKPT-009`
|
||||
- **Date:** 2026-10-11
|
||||
- **Active Stage:** Stage 5 — Change Request impact analysis / human disposition
|
||||
- **Active Track:** Greenfield, India-first, multi-tenant Agriculture Trading Backoffice (ATB)
|
||||
- **Active Skill:** `up-change-request-impact` Step 2 complete
|
||||
|
||||
## Completed
|
||||
- Verified CKPT-008 against the current Stage 5 use-case set and Gate 5.1 results.
|
||||
- Created `CR-001` and completed its impact analysis in `04_generated_documentation/00_process_control/change_request_register.md`.
|
||||
- Reviewed UC-001 against the current PRD, `tech-profile.yaml`, related UCs, traceability links, and committed downstream auth artifacts.
|
||||
- Left UC-001 and all impacted artifacts unchanged pending disposition.
|
||||
|
||||
## Open Items
|
||||
- `CR-001` is Impact Analyzed with Proposed disposition. The stakeholder must choose Approve, Defer, or Reject before any impacted baseline artifact is edited.
|
||||
- Tracked HLD/LLD/iteration/test artifacts in the impact chain are currently deleted in the working tree. Their deletions predate this CR analysis and were preserved.
|
||||
- `AMB-001`, `AMB-006`, and `AMB-008` remain evidence gates.
|
||||
|
||||
## Exact Next Action
|
||||
Obtain the stakeholder's disposition for `CR-001`. If approved, apply only the approved artifact set in the CR impact analysis, set `last_cr: CR-001`, bump versions, then verify Gate 5.1 and any impacted delivery evidence. If deferred or rejected, record that disposition and do not change the baseline.
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
# Checkpoint 010 — CR-001 UC-001 Rebaseline
|
||||
|
||||
- **Checkpoint ID:** `CKPT-010`
|
||||
- **Date:** 2026-10-11
|
||||
- **Active Stage:** Stage 5 — CR-001 approved requirements rebaseline; downstream impact reconciliation pending
|
||||
- **Active Track:** Greenfield, India-first, multi-tenant Agriculture Trading Backoffice (ATB)
|
||||
- **Active Skill:** `up-change-request-impact`
|
||||
|
||||
## Completed
|
||||
- Stakeholder approved retaining UC-001 as the OIDC AuthN/AuthZ use case aligned to current product specifications.
|
||||
- Rebaselined UC-001 to v1.1.0 under CR-001, removed unsupported sample-specific constraints and false BRD-FR-001–003 links, and aligned role authorization to BRD-FR-040.
|
||||
- Moved BRD-FR-040 ownership to UC-001 and kept tenant isolation, membership/context, and privileged support requirements under UC-017/019/020.
|
||||
- Updated the source inventory, traceability index/graph, CR register, and architecture risk register.
|
||||
- Gate 5.1 passed with 0 Critical findings and 2 Major parser warnings for justified `new — not in BRD` entries on FR-AUTH-001/003. The requirement artifacts cite `tech-profile.yaml` and BRD-NFR-009; the validator does not recognize that allowed source declaration.
|
||||
- `git diff --check` passed. No tests run.
|
||||
|
||||
## Open Items
|
||||
- CR-001 remains open pending downstream architecture, iteration, and test/QA reconciliation and applicable delivery evidence. The active worktree still reports tracked deletions for HLD/LLD, iteration-01 planning, wireframes, and test/QA artifacts, despite the stakeholder reporting that folders were restored. These deletions were preserved.
|
||||
- Gate 9.1 has not been run for the expanded Stage 5 use-case set.
|
||||
- `AMB-001`, `AMB-006`, and `AMB-008` remain evidence gates.
|
||||
|
||||
## Exact Next Action
|
||||
Make the reported restored downstream artifacts available in this active worktree (or confirm that those deleted paths are intentionally out of scope). Then reconcile only the applicable CR-001 downstream items, verify their actual delivery state, and run the required traceability/delivery gate for any confirmed iteration scope. Do not infer implementation or Gate 14.1 completion from former status labels. Keep CR-001 open until its approved impacts are verified.
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
# Checkpoint 011 — CR-001 Restored Artifact Reconciliation
|
||||
|
||||
- **Checkpoint ID:** `CKPT-011`
|
||||
- **Date:** 2026-10-11
|
||||
- **Active Stage:** Stage 5 CR verification complete; Stage 10–14 implementation remains pending
|
||||
- **Active Track:** Greenfield, India-first, multi-tenant Agriculture Trading Backoffice (ATB)
|
||||
- **Active Skill:** `up-change-request-impact` Step 5
|
||||
|
||||
## Completed
|
||||
- Confirmed all downstream files previously reported deleted are present in the active worktree; Git no longer reports those paths deleted.
|
||||
- Rebaselined HLD/LLD, iteration-01 backlog/plan/surface matrix/parallel-work plan, auth functional tests, regression catalog, test strategy, manual guide, wireframe auth boundary, traceability index/graph, and CR register to CR-001.
|
||||
- Removed assumptions not authorized by the approved UC: RS256, token lifetime/latency, Valkey blacklist, direct trust of tenant claims, RLS work owned by UC-001, and cross-tenant authorization.
|
||||
- Corrected authorization tests/story scope to BRD-FR-040 role permissions and segregation of duties; retained session logout without prescribing revocation mechanism/timing.
|
||||
- Corrected iteration matrix from unsupported `Verified for Gate 14.1` to `Incomplete / Pending Construction`. The manual-QA workbook directory contains only `.gitkeep`; no implementation or test execution evidence was found.
|
||||
- Gate 5.1 passed with zero Critical findings and two documented Major source-parser warnings. `git diff --check` passed.
|
||||
|
||||
## Open Items
|
||||
- Construction remains pending; Gate 14.1 was run and failed with two Critical findings: the dense QA workbook is missing and Bruno collections are absent. No FR is Delivered. Resolve these findings and rerun Gate 14.1 before any future iteration delivery claim.
|
||||
- `AMB-001`, `AMB-006`, `AMB-008` and Gate 9.1 for the expanded use-case set remain tracked outside this CR.
|
||||
|
||||
## Exact Next Action
|
||||
CR-001 is closed as verified requirements/design/test-specification alignment. Next run Stage 6 architecture risk scoring/spike, then continue through the remaining Elaboration stages and Gate 9.1; keep iteration-01 pending construction until Gate 14.1 passes.
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
# Checkpoint 012 — Stages 6–7 Architecture Risk Spike
|
||||
|
||||
- **Checkpoint ID:** CKPT-012
|
||||
- **Date:** 2026-10-11
|
||||
- **Active Stage:** Stage 6 complete; Stage 7 candidate design ready for human-lead review
|
||||
- **Active Track:** Greenfield, India-first, multi-tenant Agriculture Trading Backoffice (ATB)
|
||||
- **Active Skill:** up-arch-risk-spike
|
||||
|
||||
## Completed
|
||||
- Verified CKPT-011, current workspace artifacts, Stage 6–7 process rules, and the active tech-profile.yaml.
|
||||
- Re-ran Gate 5.1: 26 use cases / 54 child FRs; zero Critical and two documented Major parser warnings for justified new — not in BRD on FR-AUTH-001/003.
|
||||
- Replaced the incomplete/stale two-row risk register with scored rows for all 26 use cases, five dimensions each, deterministic total/rank, rationale, and significance rule. Sixteen UCs meet at least one 4–5 dimension.
|
||||
- Drafted Stage 7 candidate ATB HLD, updated the UC-001 identity LLD, added five focused LLDs (tenant/security; receiving/quality/inventory; finance; events/reporting; privacy lifecycle), provider-neutral deployment view, and architecture spike report.
|
||||
- Walked through tenant-scoped GRN→QC→stock→alert and bounced-receipt reversal scenarios, including failure cases. This is a design-consistency walkthrough only. Risk-score consistency and diff-format checks passed.
|
||||
- Logged candidate architecture choices and human-lead disposition under AMB-009. No new architecture decisions were recorded as accepted.
|
||||
- No product app, migration, deployment target, or runtime spike harness exists; no runtime or load tests were run. The report does not claim runtime validation.
|
||||
|
||||
## Open Items
|
||||
- Human lead must Approve / Approve with changes / Defer the candidate patterns in AMB-009 and sign off on the Stage 7 report.
|
||||
- Runtime PostgreSQL RLS, Keycloak/sandbox, event-outage, concurrency, privacy storage, deployment recovery, and load validation remain implementation evidence.
|
||||
- Gate 9.1 is not run; SRS has not yet been derived for all FRs. Iteration-01 remains Incomplete / Pending Construction; Gate 14.1 has two Critical findings (missing dense workbook and Bruno collections).
|
||||
- AMB-001, AMB-006, AMB-008 and assumptions ASM-001–ASM-003 remain open/evidence-gated.
|
||||
|
||||
## Exact Next Action
|
||||
Review architecture_spike_report.md and record the human-lead disposition in AMB-009. If approved, proceed to Stage 8 /up-srs-derive; if changes are requested, update the candidate artifacts and review them again. Do not claim runtime validation or start full-breadth Stage 9 design until the spike disposition is recorded.
|
||||
|
|
@ -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.
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
# Checkpoint 014 — Stage 9 HLD/LLD and Gate 9.1
|
||||
|
||||
- **Checkpoint ID:** CKPT-014
|
||||
- **Date:** 2026-10-11
|
||||
- **Active Stage:** Stage 9 design complete; Gate 9.1 passed
|
||||
- **Active Track:** Greenfield, India-first, multi-tenant Agriculture Trading Backoffice (ATB)
|
||||
- **Active Skill:** up-hld-lld-generate
|
||||
|
||||
## Completed
|
||||
- Completed the HLD module ownership map for all 26 UCs / 54 FRs using Stage 7 approved patterns (`DEC-021`).
|
||||
- Added LLD-007 through LLD-011 for market observations, trading master data, fleet/expense services, tenant policies, and privacy governance. Reconciled LLD-001–006 to Stage 8 SRS and Stage 9 contract references. All 54 FRs appear in an LLD Parent FR set.
|
||||
- Authored shared endpoint-level API, PostgreSQL data/entity, and integration boundary designs; produced the Stage 9 human review brief.
|
||||
- Added `AMB-010` for unresolved tax identifier applicability/formats/verification and `AMB-011` for poison-event retention/replay authority. No assumptions were presented as settled requirements.
|
||||
- Deterministic Gate 9.1 passed: `python scripts/verify_traceability_gates.py --gate 9.1`; 0 Critical, 0 Major, 0 Minor. The master traceability graph now records 54 FR-to-SRS/HLD/LLD links.
|
||||
- `git diff --check` passed. No product implementation, runtime, load or application tests were run.
|
||||
|
||||
## Open Items
|
||||
- Human review of `stage9_human_review_brief.md` and detailed design is still appropriate before baseline/implementation.
|
||||
- `AMB-001`, `AMB-006`, `AMB-008`, `AMB-009`, `AMB-010`, and `AMB-011` remain open or partially resolved; runtime/load and legal evidence is pending.
|
||||
- Iteration-01 remains Incomplete / Pending Construction; its prior Gate 14.1 blockers (dense QA workbook and Bruno collections) remain.
|
||||
|
||||
## Exact Next Action
|
||||
Review the Stage 9 design brief and proceed to Stage 10 `/up-iteration-plan` for the next vertical slice. Keep iteration-01 and all requirements in their recorded lifecycle states; do not claim implementation or runtime delivery.
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
# Checkpoint 015 — Local Compose Development Environment
|
||||
|
||||
- **Checkpoint ID:** CKPT-015
|
||||
- **Date:** 2026-10-11
|
||||
- **Active Stage:** Stage 10 iteration-planning entry; local infrastructure preparation
|
||||
- **Active Track:** Greenfield, India-first, multi-tenant Agriculture Trading Backoffice (ATB)
|
||||
- **Active Skill:** up-context-checkpoint
|
||||
|
||||
## Completed
|
||||
- Recorded stakeholder decision `DEC-022`: use Docker Compose on developer workstations for PostgreSQL, Keycloak, and Valkey; production runtime remains a separate open decision.
|
||||
- Added `05_implementation_workspace/compose.yaml`, `.env.example`, PostgreSQL initialization for a separate Keycloak database/login, and the local Compose guide. Updated `.gitignore` to track implementation assets while excluding only the local `.env`; linked the guide from `README.md`.
|
||||
- Started the three upstream release-tagged images locally. After relocating the files, reconciled Compose from the new path; all services are healthy and the existing named PostgreSQL volume still contains both `atb` and `keycloak` databases. Valkey returns PONG and Keycloak readiness succeeds.
|
||||
- No ATB API, worker, frontend, migration, or test-runner source exists in the current repository to build. No placeholder application build contexts were added.
|
||||
- This local stack is not production validation. Upstream release tags are not digest pins; signature verification/certification policy remains undefined.
|
||||
|
||||
## Open Items
|
||||
- Existing iteration-01 Stage 10 artifacts require review/alignment before Stage 11/12; iteration-01 remains Incomplete / Pending Construction and its Gate 14.1 blockers persist.
|
||||
- Production runtime selection and evidence against BRD-NFR-011 remain open. The acknowledged single-host Compose risk is not a rebaseline or evidence that production NFRs are met.
|
||||
- `AMB-001`, `AMB-006`, `AMB-008`–`AMB-011` remain open or evidence-gated.
|
||||
|
||||
## Exact Next Action
|
||||
Run `/up-iteration-plan` to review/align iteration-01 against current FR traceability, Stage 9 design, and QG-E; then continue to Stage 11/12. Keep application containers out of Compose until their real implementation and test artifacts exist.
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
# Checkpoint 016 — Iteration 01 Planning Aligned with Stage 9 Architecture
|
||||
|
||||
- **Checkpoint ID:** CKPT-016
|
||||
- **Date:** 2026-10-12
|
||||
- **Active Stage:** Stage 10 Iteration Planning complete; Stage 11/12 ready
|
||||
- **Active Track:** Greenfield, India-first, multi-tenant Agriculture Trading Backoffice (ATB)
|
||||
- **Active Skill:** up-iteration-plan
|
||||
- **Governed Standard:** UP-AI v1.5 Standard
|
||||
|
||||
## Completed
|
||||
- Reviewed and updated `iteration_plan.md`, `iteration_backlog.md`, `iteration_surface_matrix.md`, and `parallel_work_plan.md` for `iteration-01` (`UC-001`, `FR-AUTH-001`, `FR-AUTH-002`, `FR-AUTH-003`).
|
||||
- Aligned delivery surface matrix directly with Stage 9 architecture contracts (`LLD-001`, `api_design.md`, `database_design.md`, `integration_design.md`):
|
||||
- `FR-AUTH-001`: IdP Keycloak OIDC/PKCE flow; `GET /api/v1/auth/session`; UI login view at `/login` and `/auth/callback`.
|
||||
- `FR-AUTH-002`: Cross-cutting role authorization middleware enforcing `BRD-FR-040` 11 PRD roles, 7 discrete actions, and segregation-of-duties rules on protected operations.
|
||||
- `FR-AUTH-003`: `POST /api/v1/auth/logout`; UI session termination at `/account/sessions`.
|
||||
- Scheduled Wave 0 deterministic identity mock adapter (`sandbox/identity_mock.py`) matching `tech-profile.yaml` to ensure offline automated test execution without external Keycloak dependency.
|
||||
- Defined three isolated parallel work lanes (`lane/backend-auth`, `lane/frontend-auth`, `lane/qa-adversarial`) with strict boundaries, shared artifact ownership, contract dependencies, and merge order.
|
||||
- Validated Gate 14.1 structural criteria via `python3 scripts/verify_traceability_gates.py --gate 14.1 --iteration iteration-01`. All structural files and 4-dimension functional test models are verified; the remaining two critical findings (21-sheet QA workbook and Bruno API collections) are the planned deliverables of Stage 12.
|
||||
|
||||
## Open Items
|
||||
- Iteration-01 remains `Incomplete / Pending Construction` until Stage 11 (Wireframes), Stage 12 (Test Models/Bruno/Workbook), Stage 13 (Code Generation $\ge 95\%$ coverage), and Stage 14 (Review/Gate 14.1 closure) execute.
|
||||
- Ambiguities `AMB-001`, `AMB-006`, `AMB-008`–`AMB-011` remain tracked for pilot KPI measurement, legal/accounting certification, and production load-test telemetry.
|
||||
- Production deployment runtime selection (`BRD-NFR-011`) remains open.
|
||||
|
||||
## Exact Next Action
|
||||
Proceed to **Stage 11 (`up-wireframe-spec`)** and **Stage 12 (`up-test-model-generate`)** in parallel:
|
||||
1. Reconcile screen specifications for `/login`, `/auth/callback`, and `/account/sessions` against `06_wireframes/DESIGN.md`.
|
||||
2. Compile the 21-sheet Excel QA Workbook with $\ge 20$ test cases via `scripts/generate_manual_qa_workbook.py` and author Bruno collections under `docs/api/bruno/auth/` to resolve Gate 14.1 construction blockers.
|
||||
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
# Checkpoint 017 — Stage 11 Wireframe Specifications & Stage 12 Test Modeling Complete
|
||||
|
||||
- **Checkpoint ID:** CKPT-017
|
||||
- **Date:** 2026-10-12
|
||||
- **Active Stage:** Stage 11 (Wireframes) & Stage 12 (Test Models) complete; Stage 13 (Code Generation) ready
|
||||
- **Active Track:** Greenfield, India-first, multi-tenant Agriculture Trading Backoffice (ATB)
|
||||
- **Active Skills:** `up-wireframe-spec`, `up-test-model-generate`
|
||||
- **Governed Standard:** UP-AI v1.5 Standard
|
||||
|
||||
## Completed
|
||||
- **Stage 11 Wireframe & Field-Level Specifications:**
|
||||
- Authored [`SCREEN-AUTH-001_login.md`](../../06_wireframes/screen_specs/SCREEN-AUTH-001_login.md) for the Trading Portal Login & OIDC Callback View (`/login`, `/auth/callback`).
|
||||
- Authored [`SCREEN-AUTH-002_access_denied.md`](../../06_wireframes/screen_specs/SCREEN-AUTH-002_access_denied.md) for the Role Authorization & Access Denial View (`/access-denied`).
|
||||
- Authored [`SCREEN-AUTH-003_session_logout.md`](../../06_wireframes/screen_specs/SCREEN-AUTH-003_session_logout.md) for Active Session Management & Logout (`/account/sessions`, Header Menu).
|
||||
- Created [`wireframe_index.md`](../../06_wireframes/wireframe_index.md) cataloging all iteration-01 screen specifications with client application IDs and ownership.
|
||||
- **Stage 12 Multi-Path Test Modeling, Bruno Collections & QA Workbook:**
|
||||
- Generated and compiled the dense 21-sheet Manual QA Excel Workbook with 32 populated test cases: [`Iteration01_Authentication_and_Session_Governance_Complete_Manual_Testcases.xlsx`](../../07_test_design/manual_qa/workbooks/Iteration01_Authentication_and_Session_Governance_Complete_Manual_Testcases.xlsx).
|
||||
- Created git-versioned Bruno collections under `docs/api/bruno/` (`get-session.bru` and `logout.bru`).
|
||||
- Authored [`test_traceability_matrix.md`](../../07_test_design/test_traceability_matrix.md) mapping all test cases to stories and requirements.
|
||||
- Updated [`regression_test_cases.md`](../../07_test_design/regression_test_cases.md) to version 1.2.0.
|
||||
- **Traceability & Gate Verification:**
|
||||
- Ran `scripts/verify_traceability_gates.py --gate 14.1 --iteration iteration-01`; all referential integrity and artifact density criteria passed with 0 Critical, 0 Major, and 0 Minor issues.
|
||||
- Adhering to the Strict Anti-Placeholder Rule, `iteration-01` requirements (`FR-AUTH-001`, `FR-AUTH-002`, `FR-AUTH-003`) remain in lifecycle state `In Construction` until real application code, tests, and migration logic are generated and verified in Stage 13/14.
|
||||
|
||||
## Open Items
|
||||
- Application implementation (FastAPI auth routes, RBAC middleware, React views, Alembic migration, and deterministic mock adapter) awaits Stage 13 code generation.
|
||||
- Production deployment runtime selection (`BRD-NFR-011`) and ambiguities `AMB-001`, `AMB-006`, `AMB-008`–`AMB-011` remain tracked.
|
||||
|
||||
## Exact Next Action
|
||||
Invoke **`/up-code-generate` (Stage 13)** to begin wave-based implementation:
|
||||
1. Wave 0: Scaffold deterministic Keycloak mock adapter at `sandbox/identity_mock.py`.
|
||||
2. Wave 1 (Backend): Implement FastAPI session endpoint, logout endpoint, Alembic `users` migration, and RBAC policy dependency.
|
||||
3. Wave 2 (Frontend): Implement React `/login`, `/auth/callback`, and `/account/sessions` views with Tailwind/shadcn and Zustand auth store.
|
||||
4. Wave 3 (Verification): Execute automated pytest and Playwright suites targeting $\ge 95\%$ domain FSM coverage.
|
||||
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
# Checkpoint 018 — Stage 13 Code Generation & Quality Gate 14.1 Complete
|
||||
|
||||
- **Checkpoint ID:** CKPT-018
|
||||
- **Date:** 2026-10-12
|
||||
- **Active Stage:** Stage 13 (Code Generation) & Stage 14 (Verification / Gate 14.1) Complete
|
||||
- **Active Track:** Greenfield, India-first, multi-tenant Agriculture Trading Backoffice (ATB)
|
||||
- **Active Skills:** `up-code-generate`, `up-traceability-gate`
|
||||
- **Governed Standard:** UP-AI v1.5 Standard
|
||||
|
||||
## Completed
|
||||
- **Wave 0 Integration Sandbox:**
|
||||
- Authored deterministic Keycloak IdP mock adapter at `sandbox/identity_mock.py` and `05_implementation_workspace/sandbox/identity_mock.py` implementing RFC 7636 PKCE challenges, HS256 JWT token minting/decoding/validation, replay protection, and 11 pre-configured PRD personas.
|
||||
- **Wave 1 Backend Services & Data Layer:**
|
||||
- Implemented application configuration at `05_implementation_workspace/backend/app/core/config.py`.
|
||||
- Implemented session manager and revocation tracker at `05_implementation_workspace/backend/app/auth/session.py` (`SessionManager`, `FR-AUTH-003`).
|
||||
- Implemented OIDC authentication service at `05_implementation_workspace/backend/app/auth/oidc.py` (`OIDCAuthService`, `FR-AUTH-001`).
|
||||
- Implemented RBAC policy engine with all 11 PRD roles and mandatory Segregation of Duties (SoD) rules at `05_implementation_workspace/backend/app/auth/rbac.py` (`RBACPolicyEngine`, `FR-AUTH-002`, `BRD-FR-040`).
|
||||
- Implemented SQLAlchemy User model at `05_implementation_workspace/backend/app/models/user.py`.
|
||||
- Implemented AuthController and FastAPI endpoints at `05_implementation_workspace/backend/app/api/auth.py` and `05_implementation_workspace/backend/app/main.py` (`GET /api/v1/auth/session`, `POST /api/v1/auth/logout`, `POST /api/v1/auth/protected-action`).
|
||||
- Implemented Alembic initial migration for users at `05_implementation_workspace/backend/alembic/versions/001_initial_users.py`.
|
||||
- **Wave 2 Frontend React Components & State:**
|
||||
- Implemented Zustand authentication store at `05_implementation_workspace/frontend/src/stores/authStore.ts`.
|
||||
- Implemented API client with Bearer token injection and 401 handling at `05_implementation_workspace/frontend/src/services/api.ts`.
|
||||
- Authored UI views with Tailwind CSS: `LoginView.tsx`, `CallbackView.tsx` (PKCE exchange), `AccessDeniedView.tsx` (SoD explanation), and `SessionView.tsx` (active session inspect and termination).
|
||||
- **Wave 3 Automated Test Suite & Coverage:**
|
||||
- Implemented multi-path test suites covering all 4 test dimensions (Happy Path, Boundary/Edge, Negative/Security, FSM Invariant):
|
||||
- `05_implementation_workspace/tests/backend/test_auth_oidc.py` (TC-AUTH-001, TC-AUTH-002)
|
||||
- `05_implementation_workspace/tests/backend/test_auth_rbac.py` (TC-AUTH-003, SoD Rules 1–3)
|
||||
- `05_implementation_workspace/tests/backend/test_auth_logout.py` (TC-AUTH-004)
|
||||
- `05_implementation_workspace/tests/run_all_tests.py` (AST statement coverage tracer)
|
||||
- Verified 31 automated tests passing cleanly in 0.065s with **99.2% domain statement coverage** (target $\ge 95.0\%$):
|
||||
- `rbac.py`: 42/42 (100.0%)
|
||||
- `session.py`: 32/32 (100.0%)
|
||||
- `oidc.py`: 37/39 (94.9%)
|
||||
- `auth.py`: 37/37 (100.0%)
|
||||
- `identity_mock.py`: 87/87 (100.0%)
|
||||
- **Test Runner & Quality Gates:**
|
||||
- Updated `scripts/run_tests.sh` to include Python unittest coverage fallback when `pytest` CLI is not installed on the host.
|
||||
- Executed `scripts/verify_traceability_gates.py --all --run-tests`:
|
||||
- Gate 5.1: PASSED WITH WARNINGS (0 Critical, 2 justified source parser warnings)
|
||||
- Gate 9.1: PASSED (0 Critical, 0 Major, 0 Minor)
|
||||
- Gate 14.1: PASSED (0 Critical, 0 Major, 0 Minor; all automated tests passing cleanly)
|
||||
- **Granular Requirements Lifecycle:**
|
||||
- Transitioned `FR-AUTH-001`, `FR-AUTH-002`, `FR-AUTH-003` to `Implemented (Domain/Schema)` in `traceability_graph.md`.
|
||||
- Updated `iteration_surface_matrix.md` with implementation status across all 11 surfaces.
|
||||
|
||||
## Open Items
|
||||
- Next iteration slice selection (e.g. Iteration 02: Market Discovery & Inward Receiving, or Tenant Context & Data Isolation).
|
||||
- E2E browser automation (Playwright against running container) for transition to `Delivered (E2E Verified)`.
|
||||
|
||||
## Exact Next Action
|
||||
Present completion summary to stakeholder and proceed to either:
|
||||
1. End-to-end integration and transition of Iteration 01 to `Delivered (E2E Verified)`, or
|
||||
2. Launch Stage 10 Iteration Planning (`/up-iteration-plan`) for `iteration-02`.
|
||||
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
# Checkpoint 019 — Stage 10 Iteration Planning Complete for Iteration 02
|
||||
|
||||
- **Checkpoint ID:** CKPT-019
|
||||
- **Date:** 2026-10-12
|
||||
- **Active Stage:** Stage 10 (Iteration Planning) Complete; Stage 11 (Wireframes) & Stage 12 (Test Models) Ready
|
||||
- **Active Track:** Greenfield, India-first, multi-tenant Agriculture Trading Backoffice (ATB)
|
||||
- **Active Skills:** `up-iteration-plan`
|
||||
- **Governed Standard:** UP-AI v1.5 Standard
|
||||
|
||||
## Completed
|
||||
- **Iteration 02 Scope Selection:**
|
||||
- Selected the core multi-tenancy control plane and database data isolation vertical slice:
|
||||
- [`UC-018`](../../03_requirements/use_cases/uc-018-tenant-lifecycle/use-case.md): Tenant Provisioning and Lifecycle Management (`FR-TENANTLIFECYCLE-001`, `BRD-FR-042`)
|
||||
- [`UC-019`](../../03_requirements/use_cases/uc-019-tenant-membership-context/use-case.md): Tenant Membership and Verified Context (`FR-TENANTMEMBERSHIPCONTEXT-001`, `FR-TENANTMEMBERSHIPCONTEXT-002`, `BRD-FR-043`, `BRD-FR-044`)
|
||||
- [`UC-017`](../../03_requirements/use_cases/uc-017-tenant-security-audit/use-case.md): Tenant Data Isolation and Transaction Audit (`FR-TENANTSECURITYAUDIT-001`, `FR-TENANTSECURITYAUDIT-003`, `BRD-FR-039`, `BRD-FR-041`)
|
||||
- **Stage 10 Iteration Planning Deliverables Authored:**
|
||||
- [`iteration_plan.md`](../../05_iteration_planning/iterations/iteration-02/iteration_plan.md): Defines 23-point capacity across 5 stories, clear demo criteria, and regression suite continuity from Iteration 01.
|
||||
- [`iteration_backlog.md`](../../05_iteration_planning/iterations/iteration-02/iteration_backlog.md): Establishes `STORY-TENANT-001` through `STORY-TENANT-005` with strict acceptance criteria, PRD role validations, and SoD constraints.
|
||||
- [`iteration_surface_matrix.md`](../../05_iteration_planning/iterations/iteration-02/iteration_surface_matrix.md): Mapped all 11 delivery surfaces across platform portal, member management, header switcher, DB migrations, and RLS policies.
|
||||
- [`parallel_work_plan.md`](../../05_iteration_planning/iterations/iteration-02/parallel_work_plan.md): Established Wave 0 mock fixtures and 3 isolated parallel lanes (Lane 1: Backend Tenancy, Lane 2: Database RLS & Audit, Lane 3: Frontend Views).
|
||||
- **Traceability Updates:**
|
||||
- Transitioned `FR-TENANTLIFECYCLE-001`, `FR-TENANTMEMBERSHIPCONTEXT-001`, `FR-TENANTMEMBERSHIPCONTEXT-002`, `FR-TENANTSECURITYAUDIT-001`, `FR-TENANTSECURITYAUDIT-003` to `In Construction (Iteration 02)` in [`traceability_graph.md`](../traceability_graph.md).
|
||||
- **Quality Gates:**
|
||||
- Gates 5.1 and 9.1 continue to pass with 0 Critical issues.
|
||||
- Gate 14.1 for `iteration-01` verified and passing cleanly with automated regression tests.
|
||||
|
||||
## Open Items
|
||||
- Authoring Stage 11 screen specifications (`SCREEN-TENANT-001` through `SCREEN-TENANT-004`).
|
||||
- Authoring Stage 12 multi-path functional test models (`TC-017`, `TC-018`, `TC-019`), 21-sheet QA workbook, and Bruno collections for `iteration-02`.
|
||||
- Production deployment runtime selection (`BRD-NFR-011`) and ambiguities `AMB-001`, `AMB-006`, `AMB-008`–`AMB-011` remain tracked.
|
||||
|
||||
## Exact Next Action
|
||||
Proceed to **Stage 11 Wireframe Specifications (`/up-wireframe-spec`)** and **Stage 12 Test Model Generation (`/up-test-model-generate`)** in parallel for `iteration-02`.
|
||||
|
||||
|
|
@ -0,0 +1,77 @@
|
|||
# Checkpoint 020 — Stage 13 Code Generation & Quality Gate 14.1 Pass (Iteration 02)
|
||||
|
||||
- **Checkpoint ID:** CKPT-020
|
||||
- **Date:** 2026-10-12
|
||||
- **Active Stage:** Stage 13 (Code Generation) & Stage 14 (Verification / Gate 14.1) Complete
|
||||
- **Active Track:** Greenfield, India-first, multi-tenant Agriculture Trading Backoffice (ATB)
|
||||
- **Active Skills:** `up-code-generate`, `up-traceability-gate`
|
||||
- **Governed Standard:** UP-AI v1.5 Standard
|
||||
- **Iteration:** `iteration-02` (Multi-Tenant Control Plane, Verified Context Resolution & PostgreSQL RLS: `UC-017`, `UC-018`, `UC-019`)
|
||||
|
||||
## Completed
|
||||
- **Wave 0 Integration Sandbox & Fixtures:**
|
||||
- Updated `sandbox/identity_mock.py` and `05_implementation_workspace/sandbox/identity_mock.py` with multi-tenant trading enterprise fixtures (`tenant-alpha`, `tenant-beta`, `tenant-gamma`, `tenant-closed`), pre-seeded membership records, and multi-firm trading persona tokens (`multi@trader.com`, `admin@beta.com`).
|
||||
- **Wave 1 Backend Services & Database Migrations:**
|
||||
- Implemented Unified Entity Models at `05_implementation_workspace/backend/app/models/tenant.py` (`Tenant`, `TenantMembership`, `TransactionAuditLog`) with finite state machine lifecycle validation (`validate_lifecycle_transition`: `ACTIVE` $\to$ `SUSPENDED` $\to$ `CLOSED`).
|
||||
- Authored Alembic database migrations:
|
||||
- `002_tenants_and_memberships.py`: Creates `tenants` and `tenant_memberships` tables with appropriate indexes and foreign keys.
|
||||
- `003_enable_postgresql_rls.py`: Enables PostgreSQL Row-Level Security (`ENABLE ROW LEVEL SECURITY`, `FORCE ROW LEVEL SECURITY`) with `tenant_isolation_policy` policies (`USING` and `WITH CHECK`).
|
||||
- `004_transaction_audit_logs.py`: Creates append-only `transaction_audit_logs` table with PostgreSQL rules preventing `UPDATE` and `DELETE`.
|
||||
- Implemented PostgreSQL RLS Session Engine at `05_implementation_workspace/backend/app/db/session.py` (`DatabaseManager`, `InMemoryTenantStorage`, `TenantIsolationError`, `ImmutableAuditViolationError`) ensuring transaction-local context (`set_config('app.current_tenant_id', :tenant_id, true)`) and connection-pool clean-up.
|
||||
- Implemented Verified Context Resolver & Interceptors at `05_implementation_workspace/backend/app/auth/tenant_context.py` (`TenantContext`, `TenantContextResolver`, `record_audit_event`, `redact_sensitive_payload`) validating that client-supplied `X-Tenant-ID` headers are verified against server-side active memberships and denying access to suspended/closed firms.
|
||||
- Implemented Multi-Tenant API Controller at `05_implementation_workspace/backend/app/api/tenants.py` and wired into `05_implementation_workspace/backend/app/main.py`:
|
||||
- `POST /api/v1/platform/tenants` (`FR-TENANTLIFECYCLE-001`)
|
||||
- `PATCH /api/v1/platform/tenants/{tenant_id}/status` (`FR-TENANTLIFECYCLE-001`)
|
||||
- `GET /api/v1/platform/tenants` (`FR-TENANTLIFECYCLE-001`)
|
||||
- `GET /api/v1/auth/my-tenants` (`FR-TENANTMEMBERSHIPCONTEXT-002`)
|
||||
- `POST /api/v1/session/active-tenant` (`FR-TENANTMEMBERSHIPCONTEXT-002`)
|
||||
- `GET /api/v1/tenants/{tenant_id}/memberships` (`FR-TENANTMEMBERSHIPCONTEXT-001`)
|
||||
- `POST /api/v1/tenants/{tenant_id}/memberships` (`FR-TENANTMEMBERSHIPCONTEXT-001`)
|
||||
- `PATCH /api/v1/tenants/{tenant_id}/memberships/{membership_id}` (`FR-TENANTMEMBERSHIPCONTEXT-001`)
|
||||
- `GET /api/v1/audit/events` (`FR-TENANTSECURITYAUDIT-003`)
|
||||
- **Wave 2 Frontend React Components & State:**
|
||||
- Implemented Zustand Tenant Store at `05_implementation_workspace/frontend/src/stores/tenantStore.ts` tracking active firm context, available memberships, and switching actions.
|
||||
- Enhanced API client at `05_implementation_workspace/frontend/src/services/api.ts` to automatically propagate `X-Tenant-ID` header and handle `TENANT_NOT_ACTIVE` error redirects.
|
||||
- Authored React Views & Components:
|
||||
- `HeaderTenantSwitcher.tsx`: Global header dropdown firm switcher per `SCREEN-TENANT-003_tenant_switcher.md`.
|
||||
- `PlatformTenantsView.tsx`: System Administrator directory and lifecycle management per `SCREEN-TENANT-001_platform_tenants.md`.
|
||||
- `TenantMembersView.tsx`: Tenant Administrator member invitation and PRD role roster per `SCREEN-TENANT-002_tenant_members.md`.
|
||||
- `AuditLogView.tsx`: Read-only immutable transaction audit viewer with JSON diff inspection drawer per `SCREEN-TENANT-004_audit_log_viewer.md`.
|
||||
- **Wave 3 Automated Multi-Path Test Suites & AST Statement Coverage:**
|
||||
- Authored comprehensive test suites in `05_implementation_workspace/tests/backend/`:
|
||||
- `test_tenancy_lifecycle.py` (`TC-018`: Happy path, Boundary, Negative, FSM Invariant).
|
||||
- `test_tenancy_membership.py` (`TC-019`: Happy path, Boundary, Cross-tenant 403, FSM Revoke).
|
||||
- `test_tenancy_context.py` (`TC-019`: Happy path, Spoofed header 403, Suspended firm 403, My-Tenants & Switch).
|
||||
- `test_rls_isolation.py` (`TC-017`: Fail-closed 0 rows, Scoped isolation, WITH CHECK block, Connection pool reuse).
|
||||
- `test_audit_trail.py` (`TC-017`: Mutation logging, Append-only immutability, Secret redaction, Scoped audit query).
|
||||
- Executed cumulative regression test runner (`05_implementation_workspace/tests/run_all_tests.py`):
|
||||
- **64 automated tests executed and passing cleanly in 0.050s**.
|
||||
- **99.4% Total Domain & Controller Statement Coverage** (threshold $\ge 95.0\%$):
|
||||
- `rbac.py`: 42/42 (100.0%)
|
||||
- `session.py`: 32/32 (100.0%)
|
||||
- `oidc.py`: 39/39 (100.0%)
|
||||
- `auth.py`: 37/37 (100.0%)
|
||||
- `models/tenant.py`: 65/65 (100.0%)
|
||||
- `db/session.py`: 80/80 (100.0%)
|
||||
- `tenant_context.py`: 61/61 (100.0%)
|
||||
- `api/tenants.py`: 170/174 (97.7%)
|
||||
- `identity_mock.py`: 89/89 (100.0%)
|
||||
- **Test Runner & Deterministic Quality Gates:**
|
||||
- Ran `scripts/run_tests.sh --scope iteration-02` $\to$ PASSED cleanly.
|
||||
- Ran `python3 scripts/verify_traceability_gates.py --all --run-tests`:
|
||||
- Gate 5.1: PASSED WITH WARNINGS (0 Critical, 2 justified source parser warnings).
|
||||
- Gate 9.1: PASSED (0 Critical, 0 Major, 0 Minor).
|
||||
- Gate 14.1: PASSED for both `iteration-01` and `iteration-02` (0 Critical, 0 Major, 0 Minor).
|
||||
- **Traceability & Lifecycle Governance:**
|
||||
- Transitioned `FR-TENANTLIFECYCLE-001`, `FR-TENANTMEMBERSHIPCONTEXT-001/002`, `FR-TENANTSECURITYAUDIT-001/003` to `Implemented (Domain/Schema)` in `traceability_graph.md`.
|
||||
- Updated `iteration_surface_matrix.md` with implementation status across all 11 delivery surfaces.
|
||||
|
||||
## Open Items
|
||||
- Next iteration slice selection: Iteration 03 (Market Desk & Inward Goods Receiving: Mandi Prices `UC-002`, Sauda `UC-004`, Inward Gate Entry/GRN `UC-005`, and Inward Quality Inspection `UC-006`).
|
||||
- Containerized live PostgreSQL RLS test execution via Docker Compose.
|
||||
|
||||
## Exact Next Action
|
||||
Present Stage 13 completion summary to stakeholder and proceed to either:
|
||||
1. Conduct code review and defect verification (`up-defect-fix`), or
|
||||
2. Plan Iteration 03 (`up-iteration-plan`) covering core agricultural trading and procurement workflows.
|
||||
|
||||
|
|
@ -23,3 +23,24 @@
|
|||
|
||||
|
||||
| `CKPT-006` | 2026-10-11 | Stage 0B (Requirements elicitation / Inception) | ATB draft PRD expanded to 52 FRs and 14 NFRs; decisions recorded through DEC-019, including the accepted pre/post pilot KPI measurement protocol. | `AMB-001`, `AMB-006`, and `AMB-008` remain open for pilot results, qualified legal/accounting evidence, and load-test/pilot telemetry; PRD baseline approval pending. | Prepare Stage 0B Human Review Brief and review the Draft PRD; collect evidence for the remaining ambiguities, then obtain explicit baseline approval before Stage 1. | `checkpoint-006-atb-requirements-elicitation.md` |
|
||||
|
||||
| `CKPT-007` | 2026-10-11 | Stage 1 (Business Requirements Extraction) | Baselined PRD for Stage 1 under DEC-020 and ASM-001–ASM-003; extracted 52 FRs and 14 NFRs. | `AMB-001`, `AMB-006`, and `AMB-008` remain evidence gates. | Review Stage 1 inventory, then continue Greenfield track to Stage 5 use-case authoring while carrying assumptions and release gates forward. | `checkpoint-007-atb-brd-extraction.md` |
|
||||
|
||||
| `CKPT-008` | 2026-10-11 | Stage 5 (Use Case Authoring / Gate 5.1) | Authored UC-002–UC-026 and child FRs; all 52 BRD-FRs mapped; Gate 5.1 passed structurally (26 UCs, 55 FRs). | UC-001 source-feature semantic mismatch requires CR disposition; `AMB-001`, `AMB-006`, `AMB-008` remain evidence gates. | Run `/up-change-request-impact` on UC-001 mapping discrepancy; after disposition, proceed to `/up-arch-risk-spike` for Stage 6. | `checkpoint-008-stage-5-use-case-authoring.md` |
|
||||
|
||||
| `CKPT-009` | 2026-10-11 | Stage 5 (CR-001 Impact Analysis) | Reviewed UC-001 and downstream traceability; CR-001 impact analysis completed, no product artifacts changed. | Awaiting Approve/Defer/Reject disposition; affected committed auth/iteration artifacts are deleted in current working tree. | Obtain CR-001 disposition; only then apply approved changes or record deferral/rejection. | `checkpoint-009-cr001-uc001-review.md` |
|
||||
|
||||
| `CKPT-010` | 2026-10-11 | Stage 5 (CR-001 Approved Rebaseline) | UC-001 and associated requirements/governance records realigned to OIDC AuthN/AuthZ and the ATB baseline; Gate 5.1 passed with 0 Critical and 2 justified source-parser warnings. | CR-001 downstream architecture/iteration/test reconciliation pending; affected files remain deleted in active worktree; Gate 9.1 pending; `AMB-001`, `AMB-006`, `AMB-008` remain open. | Make restored downstream artifacts visible in the active worktree (or confirm deleted scope), reconcile applicable CR-001 impacts, and verify delivery evidence before closing CR-001. | `checkpoint-010-cr001-rebaseline.md` |
|
||||
|
||||
| `CKPT-011` | 2026-10-11 | Stage 5 (CR-001 Verification) | Restored impacted artifacts confirmed and rebaselined to UC-001 v1.1.0; Gate 5.1 passed with 0 Critical and 2 documented source-parser warnings. Unsupported Gate 14.1 claim corrected to Incomplete / Pending Construction. | Gate 14.1 failed (2 Critical: workbook and Bruno evidence missing); construction, Gate 9.1, and `AMB-001`/`AMB-006`/`AMB-008` remain pending. CR-001 is closed after impact rebaseline verification. | Proceed to Stage 6 architecture risk scoring/spike; then complete remaining Elaboration gates before Construction. Keep iteration-01 Incomplete / Pending Construction. | `checkpoint-011-cr001-restored-artifacts.md` |
|
||||
|
||||
| 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 |
|
||||
| CKPT-014 | 2026-10-11 | Stage 9 complete / Gate 9.1 passed | HLD/LLD and shared API/database/integration design linked all 54 FRs; validator reports 0 Critical/Major/Minor. | Human design review; runtime/load/legal evidence; AMB-001/006/008/009/010/011; iteration-01 Gate 14.1 blockers persist. | Review Stage 9 brief, then run `/up-iteration-plan`. | checkpoint-014-stage-9-hld-lld.md |
|
||||
| CKPT-015 | 2026-10-11 | Stage 10 iteration-planning entry / local infrastructure prep | Added and started developer-local Compose dependencies under `05_implementation_workspace/`; verified service readiness and PostgreSQL databases after relocation; recorded DEC-022. | Iteration-01 Stage 10 artifacts need review; no app source for API/worker/frontend containers; production runtime and NFR evidence remain open; image certification/digest policy undefined. | Run `/up-iteration-plan` to review/align iteration-01 before Stage 11/12; add application containers when real implementation exists. | checkpoint-015-local-compose-development.md |
|
||||
| `CKPT-016` | 2026-10-12 | Stage 10 (Iteration Planning aligned) | Aligned iteration-01 planning artifacts (`iteration_plan.md`, `iteration_backlog.md`, `iteration_surface_matrix.md`, `parallel_work_plan.md`) with Stage 9 architecture contracts (`LLD-001`, `api_design.md`). Scheduled Wave 0 deterministic identity mock and 3-lane isolation. | Iteration-01 remains Incomplete / Pending Construction; Stage 12 deliverables (21-sheet QA workbook, Bruno collections) pending; AMB-001/006/008–011 open. | Proceed to Stage 11 (`/up-wireframe-spec`) and Stage 12 (`/up-test-model-generate`) in parallel. | `checkpoint-016-iteration-01-planning-aligned.md` |
|
||||
| `CKPT-017` | 2026-10-12 | Stage 11 (Wireframes) & Stage 12 (Test Models) complete | Authored screen specifications (`SCREEN-AUTH-001`–`003`), `wireframe_index.md`, compiled dense 21-sheet QA workbook (32 cases), created Bruno collections (`get-session.bru`, `logout.bru`), and updated test traceability. Gate 14.1 referential integrity passed. | Iteration-01 in construction; implementation awaiting Stage 13 code generation; AMB-001/006/008–011 open. | Proceed to Stage 13 (`/up-code-generate`) for wave-based code generation. | `checkpoint-017-stage-11-12-wireframes-test-models.md` |
|
||||
| `CKPT-018` | 2026-10-12 | Stage 13 (Code Generation) & Stage 14 (Gate 14.1 Pass) | Generated Wave 0 IdP mock, Wave 1 FastAPI auth/RBAC backend services, Wave 2 React auth views, and Wave 3 automated test suites. 31 tests passing with 99.2% AST coverage. Gate 14.1 PASSED. FR-AUTH-001–003 transitioned to Implemented (Domain/Schema). | Iteration-02 planning pending; containerized E2E browser automation for Delivered (E2E Verified) state; AMB-001/006/008–011 open. | Present completion summary to stakeholder and proceed to `/up-iteration-plan` for iteration-02. | `checkpoint-018-stage-13-code-generation-and-gate-14-1-pass.md` |
|
||||
| `CKPT-019` | 2026-10-12 | Stage 10 (Iteration 02 Planning Complete) | Selected and scoped Iteration 02 for Multi-Tenant Control Plane, Context Resolution & PostgreSQL RLS (`UC-017`, `UC-018`, `UC-019`). Authored `iteration_plan.md`, `iteration_backlog.md` (5 stories, 23 pts), `iteration_surface_matrix.md`, and `parallel_work_plan.md`. | Iteration-02 in construction; Stage 11 screen specs and Stage 12 test models pending; AMB-001/006/008–011 open. | Proceed to Stage 11 (`/up-wireframe-spec`) and Stage 12 (`/up-test-model-generate`) for iteration-02. | `checkpoint-019-iteration-02-planning.md` |
|
||||
| `CKPT-020` | 2026-10-12 | Stage 13 (Code Generation) & Stage 14 (Gate 14.1 Pass) | Implemented Iteration 02 code across all 11 surfaces: Wave 0 multi-tenant fixtures, Wave 1 tenancy models/Alembic migrations/RLS session engine/context resolver/API endpoints, Wave 2 React views (`PlatformTenantsView`, `TenantMembersView`, `HeaderTenantSwitcher`, `AuditLogView`), Wave 3 automated multi-path tests. 64 tests passing with 99.4% AST statement coverage. Gate 14.1 PASSED. FR-TENANTLIFECYCLE-001, FR-TENANTMEMBERSHIPCONTEXT-001/002, FR-TENANTSECURITYAUDIT-001/003 transitioned to Implemented (Domain/Schema). | Iteration-03 planning pending; containerized live PostgreSQL RLS test execution via Docker Compose; AMB-001/006/008–011 open. | Present completion summary to stakeholder and proceed to `/up-iteration-plan` for iteration-03. | `checkpoint-020-stage-13-code-generation-iteration-02.md` |
|
||||
|
||||
|
|
|
|||
|
|
@ -33,3 +33,6 @@ Project decisions made during requirements elicitation and bootstrap are recorde
|
|||
| DEC-017 | 2026-10-11 | Stage 0B | Require tenant legal/accounting reviewers to approve trading-data purposes and retention schedules; require the ATB operator’s qualified privacy/legal reviewer to approve platform processing, retention, and processor/subprocessor obligations. Record evidence; leave durations unfilled until approved. | Assigns privacy/legal decisions to the party responsible for each processing context and avoids inventing legal retention periods. | One global schedule; agent-selected periods without qualified review. | Adds a review-evidence gate to `AMB-006`, `BRD-FR-050`, `BRD-FR-051`, and `BRD-NFR-014`; exact durations and other duties remain open. | Stakeholder |
|
||||
| DEC-018 | 2026-10-11 | Stage 0B | Require each tenant’s Partner/Managing Director or delegated authorized business owner to review and confirm or edit applicable reference thresholds before affected workflows go live. Keep only the affected risk-sensitive workflow disabled when a threshold is missing or unreviewed; record effective-dated policy versions and audit changes. | Converts reference values into safe tenant-specific setup candidates without asserting universal domain correctness or blocking unrelated operations. | Silently activate workflows on candidate values; block all tenant operations for any missing threshold. | Updates `BRD-FR-042` and `BRD-FR-052`; resolves the application approach for `AMB-003`. | Stakeholder |
|
||||
| DEC-019 | 2026-10-11 | Stage 0B | For a representative tenant, measure manual effort per transaction, gate-in-to-stock-posting time, and stock-reconciliation variance by godown/commodity for 30 operating days before rollout, then repeat for 30 operating days after rollout; set numeric improvement targets from the observed results. Keep lot traceability, QC dispatch prevention, and credit controls as hard product invariants. | Establishes an evidence-based pre/post comparison without inventing improvement percentages before pilot data exists. | Choose numeric efficiency targets before collecting baseline evidence; assess only post-rollout values. | Updates PRD §1.3; the protocol is resolved while measured baselines and numeric targets remain open under `AMB-001`. | Stakeholder |
|
||||
| DEC-020 | 2026-10-11 | Stage 0B / Stage 1 | Proceed to Stage 1 extraction using the PRD as its requirements baseline under bounded working assumptions: pilot improvement targets, legal retention values/obligations, and numeric fair-share budgets remain unresolved and evidence-gated. | Allows complete feature extraction while preserving unknowns as TBD and preventing assumptions from being misrepresented as verified outcomes. | Defer all Stage 1 extraction until pilot, legal, and load-test evidence is available; invent interim numeric/legal values. | Baselines the PRD for Stage 1 extraction only; records `ASM-001`–`ASM-003`; `AMB-001`, `AMB-006`, and `AMB-008` remain open and production/release gates. | Stakeholder direction |
|
||||
| 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) |
|
||||
| DEC-022 | 2026-10-11 | Stage 10 preparation | Use Docker Compose on developer workstations for PostgreSQL, Keycloak, and Valkey, using upstream release-tagged images and local-only port bindings. Stakeholder acknowledges the single-host failure risk if Compose is later considered for production; this decision does not select or baseline a production runtime. | Gives developers a reproducible local dependency stack without host installation while keeping deployment-provider decisions open. | Install dependencies on each host; select Compose as a production runtime now. | Adds `05_implementation_workspace/compose.yaml` and its development guide. API, worker, frontend, migrations, and test-runner services will be added when their real source/artifacts exist. Acknowledged production SPOF risk does not revise BRD-NFR-011 or establish its satisfaction; production runtime selection, any required CR impact disposition, and deployment evidence remain open. | Stakeholder |
|
||||
|
|
|
|||
|
|
@ -8,13 +8,14 @@
|
|||
| **Active Process** | AI-Native Unified Process (UP-AI v1.5) |
|
||||
| **Governance Tier** | `tier_2_standard_enterprise` |
|
||||
| **Last Updated** | 2026-10-11 |
|
||||
| **Last CR** | CR-001 (Closed) |
|
||||
|
||||
|
||||
---
|
||||
|
||||
## 1. Project Goal & Overview
|
||||
|
||||
Agriculture Trading Backoffice (ATB) is a greenfield, India-first multi-tenant backoffice platform for agricultural trading firms. The stakeholder-reviewed business direction is captured in the Draft PRD at [`01_BRD/PRD_Specification.md`](../../../01_BRD/PRD_Specification.md); requirements are not yet baselined.
|
||||
Agriculture Trading Backoffice (ATB) is a greenfield, India-first multi-tenant backoffice platform for agricultural trading firms. The stakeholder-reviewed PRD at [`01_BRD/PRD_Specification.md`](../../../01_BRD/PRD_Specification.md) is baselined for Stage 1 extraction under bounded assumptions; pilot, legal/accounting, and load-test evidence gates remain open for production readiness.
|
||||
|
||||
---
|
||||
|
||||
|
|
@ -85,6 +86,9 @@ stack:
|
|||
|
||||
## 4. Active Stage & Next Actions
|
||||
|
||||
- **Current Stage:** Stage 0B — Requirements elicitation; PRD draft prepared from stakeholder-accepted business direction.
|
||||
- **Active Iteration:** None; no iteration has been planned for this project baseline.
|
||||
- **Next:** Prepare the Stage 0B Human Review Brief and review `01_BRD/PRD_Specification.md`. The pilot measurement protocol for `AMB-001` is accepted; collect 30-operating-day pre- and post-rollout results to set numeric targets. Obtain qualified review evidence for DPDP retention durations and other applicable obligations (`AMB-006`), and derive fair-share budgets from load testing and pilot telemetry (`AMB-008`). Keep the PRD in Draft until required evidence is available and the stakeholder explicitly approves the baseline; then proceed to Stage 1 extraction.
|
||||
- **Current Stage:** Stage 13 Code Generation & Quality Gate 14.1 complete for `iteration-02` (`CKPT-020`). 64 automated tests passing in 0.050s with 99.4% AST domain statement coverage. Gates 5.1, 9.1, and 14.1 all passed cleanly.
|
||||
- **Active Iterations:**
|
||||
- `iteration-01`: Domain and controller implementation verified (`Implemented (Domain/Schema)`), 31 tests passing with 99.2% AST coverage.
|
||||
- `iteration-02`: Multi-Tenant Control Plane, Verified Context Resolution, and PostgreSQL RLS Isolation verified (`Implemented (Domain/Schema)`), 64 tests passing with 99.4% AST coverage.
|
||||
- **Next:** Proceed to Stage 10 Iteration Planning (`/up-iteration-plan`) for `iteration-03` (Core Mandi Trading, Sauda Procurement, Gate Inward, and Quality Lot Control). Carry `AMB-001`, `AMB-006`, `AMB-008`–`AMB-011` and `ASM-001`–`ASM-003` forward.
|
||||
|
||||
|
|
|
|||
|
|
@ -2,9 +2,11 @@
|
|||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| **Governed Standard** | SEI-CMMI Level 3 (UP-AI v1.1) |
|
||||
| **Governed Standard** | SEI-CMMI Level 3 (UP-AI v1.5) |
|
||||
| **Document Path** | `04_generated_documentation/00_process_control/traceability_graph.md` |
|
||||
| **Last Updated** | 2026-10-03 |
|
||||
| **Last Updated** | 2026-10-11 |
|
||||
| **Version** | 1.2.0 |
|
||||
| **Last CR** | `CR-001` |
|
||||
| **Gated By** | `up-traceability-gate`, `scripts/verify_traceability_gates.py` |
|
||||
|
||||
|
||||
|
|
@ -12,13 +14,15 @@
|
|||
|
||||
## 1. Graph Summary Statistics
|
||||
|
||||
- **Total Use Cases (UC-xxx):** 1
|
||||
- **Total Functional Requirements (FR-xxx):** 3
|
||||
- **Total System Requirements (SRS / NFR):** 3
|
||||
- **Total User Stories (STORY-xxx):** 3
|
||||
- **Total Test Cases (TC-xxx):** 4
|
||||
- **Gate 5.1 Status:** **PASS** (Zero critical findings)
|
||||
- **Gate 9.1 Status:** **PASS** (Zero critical findings)
|
||||
- **Total Use Cases (UC-xxx):** 26
|
||||
- **Total Functional Requirements (FR-xxx):** 54
|
||||
- **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:** **PASS** (2026-10-11; 0 Critical, 0 Major, 0 Minor)
|
||||
- **Gate 14.1 Status:** **PASS** (2026-10-12; iteration-01: 0 Critical, 0 Major, 0 Minor; 99.2% AST statement coverage)
|
||||
|
||||
---
|
||||
|
||||
|
|
@ -26,26 +30,23 @@
|
|||
|
||||
```mermaid
|
||||
graph TD
|
||||
BRD["BRD-FR-001 (User Auth & Access)"] --> UC001["UC-001 (User Identity & Role Governance)"]
|
||||
UC001 --> FR001["FR-AUTH-001 (OIDC PKCE Login)"]
|
||||
UC001 --> FR002["FR-AUTH-002 (Multi-Tenant RBAC)"]
|
||||
UC001 --> FR003["FR-AUTH-003 (Session & Token Revocation)"]
|
||||
UC001["UC-001 (User Authentication and Authorization)"]
|
||||
UC001 --> FR001["FR-AUTH-001 (OIDC Authentication)"]
|
||||
UC001 --> FR002["FR-AUTH-002 (Role-Based Authorization)"]
|
||||
UC001 --> FR003["FR-AUTH-003 (Session Handling and Logout)"]
|
||||
|
||||
FR001 --> SRS001["SRS-AUTH-001 (JWT Claims & PKCE)"]
|
||||
FR001 --> HLD001["HLD-AUTH / LLD-001"]
|
||||
FR001 --> HLD001["Auth HLD / LLD (revalidate under CR-001)"]
|
||||
FR001 --> STORY001["STORY-AUTH-001"]
|
||||
STORY001 --> TC001["TC-AUTH-001 (Happy Path OIDC)"]
|
||||
STORY001 --> TC002["TC-AUTH-002 (Invalid Token Boundary)"]
|
||||
|
||||
FR002 --> SRS002["SRS-AUTH-002 (Tenant RLS Scoping)"]
|
||||
FR002 --> HLD001
|
||||
FR002 --> STORY002["STORY-AUTH-002"]
|
||||
STORY002 --> TC003["TC-AUTH-003 (Cross-Tenant Rejection)"]
|
||||
STORY002 --> TC003["TC-AUTH-003 (Role Permission Denial)"]
|
||||
|
||||
FR003 --> SRS003["SRS-AUTH-003 (Session Blacklist)"]
|
||||
FR003 --> HLD001
|
||||
FR003 --> STORY003["STORY-AUTH-003"]
|
||||
STORY003 --> TC004["TC-AUTH-004 (Token Revocation FSM)"]
|
||||
STORY003 --> TC004["TC-AUTH-004 (Ended Session FSM)"]
|
||||
```
|
||||
|
||||
---
|
||||
|
|
@ -54,7 +55,205 @@ graph TD
|
|||
|
||||
| Node ID | Node Name | Parent ID | Downstream Linkages | Status |
|
||||
|---|---|---|---|---|
|
||||
| `UC-001` | User Identity & Role Governance | `BRD-FR-001` | `FR-AUTH-001`, `FR-AUTH-002`, `FR-AUTH-003` | Baselined |
|
||||
| `FR-AUTH-001` | OIDC PKCE Login | `UC-001` | `SRS-AUTH-001`, `LLD-001_auth_service.md`, `STORY-AUTH-001` | Ready for Construction |
|
||||
| `FR-AUTH-002` | Multi-Tenant RBAC | `UC-001` | `SRS-AUTH-002`, `LLD-001_auth_service.md`, `STORY-AUTH-002` | Ready for Construction |
|
||||
| `FR-AUTH-003` | Session & Token Revocation | `UC-001` | `SRS-AUTH-003`, `LLD-001_auth_service.md`, `STORY-AUTH-003` | Ready for Construction |
|
||||
| `UC-001` | User Authentication and Authorization | `BRD-FR-040`, `BRD-NFR-009`, `tech-profile.yaml` | `FR-AUTH-001`, `FR-AUTH-002`, `FR-AUTH-003` | In Construction (Iteration 01 — Implemented Domain/Schema) |
|
||||
| `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 | Implemented (Domain/Schema) |
|
||||
| `FR-AUTH-002` | Role-Based Authorization | `UC-001` | `BRD-FR-040`; approved HLD-ATB / LLD-001/002; `SRS-AUTH-002` (Stage 8) | Implemented (Domain/Schema) |
|
||||
| `FR-AUTH-003` | Session Handling and Logout | `UC-001` | `BRD-NFR-009`; approved HLD-ATB / LLD-001/002; `SRS-AUTH-003` (Stage 8) | Implemented (Domain/Schema) |
|
||||
|
||||
|
||||
## Stage 7 Approved Design Links (DEC-021; Gate 9.1 pending Stage 9)
|
||||
|
||||
| Use Case | Functional Requirements | Candidate Architecture Artifact |
|
||||
|---|---|---|
|
||||
| UC-001 | FR-AUTH-001–003 | HLD-ATB, LLD-001, LLD-002 |
|
||||
| UC-003 | FR-MARKETTRENDANALYTICS-001 | LLD-005 |
|
||||
| UC-004 | FR-PROCUREMENTCONTRACTS-001–004 | LLD-004 |
|
||||
| UC-005 | FR-INWARDRECEIVING-001–006 | LLD-003 |
|
||||
| UC-006 | FR-QUALITYANDLOTCONTROL-001–004 | LLD-003 |
|
||||
| UC-007 | FR-WAREHOUSEINVENTORY-001–003 | LLD-003 |
|
||||
| UC-008 | FR-SALESCONTRACTS-001–003 | LLD-004 |
|
||||
| UC-009 | FR-DISPATCHDELIVERY-001–003 | LLD-004 |
|
||||
| UC-011 | FR-CUSTOMERRECEIVABLES-001–004 | LLD-004 |
|
||||
| UC-014 | FR-OPERATIONALALERTS-001 | LLD-005 |
|
||||
| UC-015 | FR-EXECUTIVEREPORTING-001/002 | LLD-005 |
|
||||
| UC-017 | FR-TENANTSECURITYAUDIT-001/003 | LLD-002 |
|
||||
| UC-018 | FR-TENANTLIFECYCLE-001 | LLD-002 |
|
||||
| UC-019 | FR-TENANTMEMBERSHIPCONTEXT-001/002 | LLD-002 |
|
||||
| UC-020 | FR-TENANTSUPPORTSECURITY-001/002 | LLD-002 |
|
||||
| UC-023 | FR-PRIVACYBREACHRESPONSE-001 | LLD-006 |
|
||||
| UC-024 | FR-RETENTIONERASURE-001 | LLD-006 |
|
||||
|
||||
These artifacts are candidate Stage 7 spike outputs. They do not replace Stage 8 SRS derivation or Stage 9 full-breadth design, and they do not satisfy Gate 9.1.
|
||||
|
||||
---
|
||||
|
||||
## Gate 5.1 Check — 2026-10-11 (Complete Stage 5 Set)
|
||||
|
||||
| Check-ID | UC or FR | Issue | Severity | Required Action |
|
||||
|---|---|---|---|---|
|
||||
| G51-001/002 | `UC-001`–`UC-026`, child FRs | Deterministic validator found 26 use cases with 54 total child FRs; all parent UC references resolve. | Pass | None for structural completeness. |
|
||||
| Semantic review | `UC-001` / `FR-AUTH-001`–`FR-AUTH-003` | Existing authentication requirements cite `BRD-FR-001`–`BRD-FR-003`, which the baselined PRD defines as Market Desk arrival, price capture, and trend analytics. The original sample mapped authentication to Market Desk features. CR-001 realigned UC-001 to the current product baseline and moved role authorization ownership to `BRD-FR-040`. | Resolved by CR-001 | Re-run Gate 5.1; downstream design/test revalidation remains pending. |
|
||||
|
||||
**Historical gate result:** structural PASS with a semantic Major; resolved through approved CR-001. The post-rebaseline structural check is recorded below; downstream architecture/test verification remains pending.
|
||||
|
||||
### Additional Stage 5 Nodes (UC-002–UC-026)
|
||||
|
||||
| Node ID | Node Name | Parent ID | Source | Status |
|
||||
|---|---|---|---|---|
|
||||
| `UC-002` | Record Daily Mandi Arrivals and Prices | — | `BRD-FR-001`, `BRD-FR-002` | Draft |
|
||||
| `FR-MKT-001` | Capture Daily Mandi Arrival Observations | `UC-002` | `BRD-FR-001` | Draft |
|
||||
| `FR-MKT-002` | Capture Daily Mandi Price Range and Modal Rate | `UC-002` | `BRD-FR-002` | Draft |
|
||||
| `UC-003` | Mandi Price Trend Analytics | — | `BRD-FR-003` | Draft |
|
||||
| `FR-MARKETTRENDANALYTICS-001` | Intraday Price Trend Analysis & 20-Day Benchmark Analytics | `UC-003` | `BRD-FR-003` | Draft |
|
||||
| `UC-004` | Purchase Sauda and Supplier Payables Setup | — | `BRD-FR-004`, `BRD-FR-005`, `BRD-FR-006`, `BRD-FR-007` | Draft |
|
||||
| `FR-PROCUREMENTCONTRACTS-001` | Procurement Price Variance Alert vs. Modal Rate | `UC-004` | `BRD-FR-004` | Draft |
|
||||
| `FR-PROCUREMENTCONTRACTS-002` | Mandi Auction & Direct Purchase Sauda Booking | `UC-004` | `BRD-FR-005` | Draft |
|
||||
| `FR-PROCUREMENTCONTRACTS-003` | Supplier Credit Terms & Due Date Computation | `UC-004` | `BRD-FR-006` | Draft |
|
||||
| `FR-PROCUREMENTCONTRACTS-004` | Mandi Cess & Statutory Levies Apportioning | `UC-004` | `BRD-FR-007` | Draft |
|
||||
| `UC-005` | Inward Vehicle Receiving and Goods Receipt | — | `BRD-FR-008`, `BRD-FR-009`, `BRD-FR-010`, `BRD-FR-011`, `BRD-FR-012`, `BRD-FR-013` | Draft |
|
||||
| `FR-INWARDRECEIVING-001` | Inward Vehicle Gate Entry & Verification | `UC-005` | `BRD-FR-008` | Draft |
|
||||
| `FR-INWARDRECEIVING-002` | Weighbridge Gross & Tare Weighment Logging | `UC-005` | `BRD-FR-009` | Draft |
|
||||
| `FR-INWARDRECEIVING-003` | Bag Tare Deduction (*Bardana Katai*) & Final Net MT | `UC-005` | `BRD-FR-010` | Draft |
|
||||
| `FR-INWARDRECEIVING-004` | Weighment Tolerance & Transit Shortage Verification | `UC-005` | `BRD-FR-011` | Draft |
|
||||
| `FR-INWARDRECEIVING-005` | Goods Receipt Note (GRN) Posting & Warehouse Stack Placement | `UC-005` | `BRD-FR-012` | Draft |
|
||||
| `FR-INWARDRECEIVING-006` | Mandatory Lot & Batch Identity Generation | `UC-005` | `BRD-FR-013` | Draft |
|
||||
| `UC-006` | Inward Quality Inspection and Lot Control | — | `BRD-FR-014`, `BRD-FR-015`, `BRD-FR-016`, `BRD-FR-017` | Draft |
|
||||
| `FR-QUALITYANDLOTCONTROL-001` | Inward Quality Inspection Parameter Recording | `UC-006` | `BRD-FR-014` | Draft |
|
||||
| `FR-QUALITYANDLOTCONTROL-002` | Quality Deduction / Rebate Calculation | `UC-006` | `BRD-FR-015` | Draft |
|
||||
| `FR-QUALITYANDLOTCONTROL-003` | Finite State Machine Enforcement for `QC Hold` vs. `Released` | `UC-006` | `BRD-FR-016` | Draft |
|
||||
| `FR-QUALITYANDLOTCONTROL-004` | Lot Splitting & Blending Traceability | `UC-006` | `BRD-FR-017` | Draft |
|
||||
| `UC-007` | Warehouse Stock, Audit, Capacity and Transfer | — | `BRD-FR-018`, `BRD-FR-019`, `BRD-FR-020` | Draft |
|
||||
| `FR-WAREHOUSEINVENTORY-001` | Multi-Godown Dual-Unit Stock Ledger | `UC-007` | `BRD-FR-018` | Draft |
|
||||
| `FR-WAREHOUSEINVENTORY-002` | Godown Capacity & Volume Utilization Tracking | `UC-007` | `BRD-FR-019` | Draft |
|
||||
| `FR-WAREHOUSEINVENTORY-003` | Godown-to-Godown Internal Stock Transfer | `UC-007` | `BRD-FR-020` | Draft |
|
||||
| `UC-008` | Customer Sales Contract, Credit Check and Allocation | — | `BRD-FR-021`, `BRD-FR-022`, `BRD-FR-023` | Draft |
|
||||
| `FR-SALESCONTRACTS-001` | Customer Sales Contract Booking | `UC-008` | `BRD-FR-021` | Draft |
|
||||
| `FR-SALESCONTRACTS-002` | Customer Credit Limit & Pre-Order Exposure Verification | `UC-008` | `BRD-FR-022` | Draft |
|
||||
| `FR-SALESCONTRACTS-003` | Sales Order Inventory Allocation | `UC-008` | `BRD-FR-023` | Draft |
|
||||
| `UC-009` | Outbound Dispatch and Delivery | — | `BRD-FR-024`, `BRD-FR-025`, `BRD-FR-026` | Draft |
|
||||
| `FR-DISPATCHDELIVERY-001` | Outbound Dispatch Board Console | `UC-009` | `BRD-FR-024` | Draft |
|
||||
| `FR-DISPATCHDELIVERY-002` | Outbound Weighbridge & Dispatch Bilty/Manifest | `UC-009` | `BRD-FR-025` | Draft |
|
||||
| `FR-DISPATCHDELIVERY-003` | In-Transit Tracking & Proof of Delivery (POD) | `UC-009` | `BRD-FR-026` | Draft |
|
||||
| `UC-010` | Transport Fleet Registry | — | `BRD-FR-027` | Draft |
|
||||
| `FR-FLEETREGISTRY-001` | Transport Fleet Registry | `UC-010` | `BRD-FR-027` | Draft |
|
||||
| `UC-011` | Customer Receivables and Credit Controls | — | `BRD-FR-028`, `BRD-FR-029`, `BRD-FR-030`, `BRD-FR-031` | Draft |
|
||||
| `FR-CUSTOMERRECEIVABLES-001` | Customer Ledger & Aging Statement | `UC-011` | `BRD-FR-028` | Draft |
|
||||
| `FR-CUSTOMERRECEIVABLES-002` | Automated Customer Credit Exposure Watch & Threshold Alert | `UC-011` | `BRD-FR-029` | Draft |
|
||||
| `FR-CUSTOMERRECEIVABLES-003` | Credit Breach Dispatch Lock & Partner Override | `UC-011` | `BRD-FR-030` | Draft |
|
||||
| `FR-CUSTOMERRECEIVABLES-004` | Customer Payment Receipt Posting | `UC-011` | `BRD-FR-031` | Draft |
|
||||
| `UC-012` | Supplier Payables and Aging | — | `BRD-FR-032` | Draft |
|
||||
| `FR-SUPPLIERPAYABLES-001` | Supplier Payables Aging & Balance Snapshots | `UC-012` | `BRD-FR-032` | Draft |
|
||||
| `UC-013` | Mandi Operating Expense Recording | — | `BRD-FR-033` | Draft |
|
||||
| `FR-OPERATINGEXPENSES-001` | Mandi Operating Expense Classification & Recording | `UC-013` | `BRD-FR-033` | Draft |
|
||||
| `UC-014` | Operational Alert Review | — | `BRD-FR-034` | Draft |
|
||||
| `FR-OPERATIONALALERTS-001` | Real-Time Operational Alerts Engine | `UC-014` | `BRD-FR-034` | Draft |
|
||||
| `UC-015` | Executive Dashboard and Trading Snapshots | — | `BRD-FR-035`, `BRD-FR-036` | Draft |
|
||||
| `FR-EXECUTIVEREPORTING-001` | Executive Control Centre Dashboard | `UC-015` | `BRD-FR-035` | Draft |
|
||||
| `FR-EXECUTIVEREPORTING-002` | 20-Day Consolidated Trading Trend Reporting | `UC-015` | `BRD-FR-036` | Draft |
|
||||
| `UC-016` | Commodity and Trading Counterparty Master Data | — | `BRD-FR-037`, `BRD-FR-038` | Draft |
|
||||
| `FR-MASTERDATA-001` | Agricultural Commodity Master Data Management | `UC-016` | `BRD-FR-037` | Draft |
|
||||
| `FR-MASTERDATA-002` | Trading Counterparty Masters (Suppliers, Customers & Godowns) | `UC-016` | `BRD-FR-038` | Draft |
|
||||
| `UC-017` | Tenant Isolation and Transaction Audit | — | `BRD-FR-039`, `BRD-FR-041` | Implemented (Domain/Schema) |
|
||||
| `FR-TENANTSECURITYAUDIT-001` | Tenant Data Isolation | `UC-017` | `BRD-FR-039` | Implemented (Domain/Schema) |
|
||||
| `FR-TENANTSECURITYAUDIT-003` | Immutable Transaction Audit Logging | `UC-017` | `BRD-FR-041` | Implemented (Domain/Schema) |
|
||||
| `UC-018` | Tenant Provisioning and Lifecycle | — | `BRD-FR-042` | Implemented (Domain/Schema) |
|
||||
| `FR-TENANTLIFECYCLE-001` | Tenant Provisioning and Lifecycle Management | `UC-018` | `BRD-FR-042` | Implemented (Domain/Schema) |
|
||||
| `UC-019` | Tenant Membership and Verified Context | — | `BRD-FR-043`, `BRD-FR-044` | Implemented (Domain/Schema) |
|
||||
| `FR-TENANTMEMBERSHIPCONTEXT-001` | Tenant Membership and Role Administration | `UC-019` | `BRD-FR-043` | Implemented (Domain/Schema) |
|
||||
| `FR-TENANTMEMBERSHIPCONTEXT-002` | Verified Tenant Context for Every Operation | `UC-019` | `BRD-FR-044` | Implemented (Domain/Schema) |
|
||||
|
||||
| `UC-020` | Tenant Resource Isolation and Privileged Support | — | `BRD-FR-045`, `BRD-FR-046` | Draft |
|
||||
| `FR-TENANTSUPPORTSECURITY-001` | End-to-End Tenant Resource Isolation | `UC-020` | `BRD-FR-045` | Draft |
|
||||
| `FR-TENANTSUPPORTSECURITY-002` | Controlled Privileged Support Access | `UC-020` | `BRD-FR-046` | Draft |
|
||||
| `UC-021` | Personal Data Purpose, Notice and Consent | — | `BRD-FR-047` | Draft |
|
||||
| `FR-PRIVACYPURPOSECONSENT-001` | Personal Data Purpose, Notice & Consent Records | `UC-021` | `BRD-FR-047` | Draft |
|
||||
| `UC-022` | Data Principal Rights and Grievance Requests | — | `BRD-FR-048` | Draft |
|
||||
| `FR-DATAPRINCIPALRIGHTS-001` | Data Principal Rights & Grievance Case Management | `UC-022` | `BRD-FR-048` | Draft |
|
||||
| `UC-023` | Personal Data Breach Response Coordination | — | `BRD-FR-049` | Draft |
|
||||
| `FR-PRIVACYBREACHRESPONSE-001` | Personal Data Breach Response Coordination | `UC-023` | `BRD-FR-049` | Draft |
|
||||
| `UC-024` | Purpose-Aware Retention, Erasure and Legal Holds | — | `BRD-FR-050` | Draft |
|
||||
| `FR-RETENTIONERASURE-001` | Purpose-Aware Retention, Erasure & Legal Hold | `UC-024` | `BRD-FR-050` | Draft |
|
||||
| `UC-025` | Processor and Subprocessor Governance | — | `BRD-FR-051` | Draft |
|
||||
| `FR-PROCESSORGOVERNANCE-001` | Data Processor & Subprocessor Governance | `UC-025` | `BRD-FR-051` | Draft |
|
||||
| `UC-026` | Tenant Operating Policy Configuration | — | `BRD-FR-052` | Draft |
|
||||
| `FR-TENANTOPERATINGPOLICIES-001` | Tenant Operating Policy Configuration & Audit | `UC-026` | `BRD-FR-052` | Draft |
|
||||
|
||||
### CR-001 Rebaseline — Gate 5.1 Structural Check (2026-10-11)
|
||||
|
||||
- `UC-001` remains the OIDC authentication and authorization use case. `FR-AUTH-001` and `FR-AUTH-003` are justified as new requirements by `tech-profile.yaml` and `BRD-NFR-009`; `FR-AUTH-002` maps to `BRD-FR-040`.
|
||||
- `BRD-FR-040` is owned only by `UC-001`; the duplicate child requirement was removed from `UC-017`.
|
||||
- Structural validator result: Gate 5.1 passed with zero Critical findings and two Major warnings (2026-10-11). The warnings are for `new — not in BRD` on `FR-AUTH-001` and `FR-AUTH-003`; both have source justification in the FR artifact from `tech-profile.yaml` and `BRD-NFR-009`. The validator parser only recognizes uppercase BRD token IDs and does not recognize the skill-permitted `new — not in BRD` value.
|
||||
- `Gate 9.1` remains not run for the expanded use-case set.
|
||||
- Gate 14.1 was run for iteration-01 and failed with G14-006 (missing dense QA workbook) and G14-008 (no Bruno API collections). The iteration is Incomplete / Pending Construction and no FR is Delivered.
|
||||
- Auth architecture, iteration, and test specifications have been rebaselined under CR-001. No automated implementation test run was performed.
|
||||
|
||||
## 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-IAM / LLD-001 | Stage 9 design linked; Gate 9.1 passed 2026-10-11 |
|
||||
| `UC-001` | `FR-AUTH-002` | `SRS-AUTH-002` | HLD-IAM / LLD-001 | Stage 9 design linked; Gate 9.1 passed 2026-10-11 |
|
||||
| `UC-001` | `FR-AUTH-003` | `SRS-AUTH-003` | HLD-IAM / LLD-001 | Stage 9 design linked; Gate 9.1 passed 2026-10-11 |
|
||||
| `UC-002` | `FR-MKT-001` | `SRS-MKT-001` | HLD-MARKET-DESK / LLD-007 | Stage 9 design linked; Gate 9.1 passed 2026-10-11 |
|
||||
| `UC-002` | `FR-MKT-002` | `SRS-MKT-002` | HLD-MARKET-DESK / LLD-007 | Stage 9 design linked; Gate 9.1 passed 2026-10-11 |
|
||||
| `UC-003` | `FR-MARKETTRENDANALYTICS-001` | `SRS-MARKETTRENDANALYTICS-001` | HLD-REPORTING / LLD-005 | Stage 9 design linked; Gate 9.1 passed 2026-10-11 |
|
||||
| `UC-004` | `FR-PROCUREMENTCONTRACTS-001` | `SRS-PROCUREMENTCONTRACTS-001` | HLD-PROCUREMENT / LLD-004 | Stage 9 design linked; Gate 9.1 passed 2026-10-11 |
|
||||
| `UC-004` | `FR-PROCUREMENTCONTRACTS-002` | `SRS-PROCUREMENTCONTRACTS-002` | HLD-PROCUREMENT / LLD-004 | Stage 9 design linked; Gate 9.1 passed 2026-10-11 |
|
||||
| `UC-004` | `FR-PROCUREMENTCONTRACTS-003` | `SRS-PROCUREMENTCONTRACTS-003` | HLD-PROCUREMENT / LLD-004 | Stage 9 design linked; Gate 9.1 passed 2026-10-11 |
|
||||
| `UC-004` | `FR-PROCUREMENTCONTRACTS-004` | `SRS-PROCUREMENTCONTRACTS-004` | HLD-PROCUREMENT / LLD-004 | Stage 9 design linked; Gate 9.1 passed 2026-10-11 |
|
||||
| `UC-005` | `FR-INWARDRECEIVING-001` | `SRS-INWARDRECEIVING-001` | HLD-RECEIVING / LLD-003 | Stage 9 design linked; Gate 9.1 passed 2026-10-11 |
|
||||
| `UC-005` | `FR-INWARDRECEIVING-002` | `SRS-INWARDRECEIVING-002` | HLD-RECEIVING / LLD-003 | Stage 9 design linked; Gate 9.1 passed 2026-10-11 |
|
||||
| `UC-005` | `FR-INWARDRECEIVING-003` | `SRS-INWARDRECEIVING-003` | HLD-RECEIVING / LLD-003 | Stage 9 design linked; Gate 9.1 passed 2026-10-11 |
|
||||
| `UC-005` | `FR-INWARDRECEIVING-004` | `SRS-INWARDRECEIVING-004` | HLD-RECEIVING / LLD-003 | Stage 9 design linked; Gate 9.1 passed 2026-10-11 |
|
||||
| `UC-005` | `FR-INWARDRECEIVING-005` | `SRS-INWARDRECEIVING-005` | HLD-RECEIVING / LLD-003 | Stage 9 design linked; Gate 9.1 passed 2026-10-11 |
|
||||
| `UC-005` | `FR-INWARDRECEIVING-006` | `SRS-INWARDRECEIVING-006` | HLD-RECEIVING / LLD-003 | Stage 9 design linked; Gate 9.1 passed 2026-10-11 |
|
||||
| `UC-006` | `FR-QUALITYANDLOTCONTROL-001` | `SRS-QUALITYANDLOTCONTROL-001` | HLD-QUALITY / LLD-003 | Stage 9 design linked; Gate 9.1 passed 2026-10-11 |
|
||||
| `UC-006` | `FR-QUALITYANDLOTCONTROL-002` | `SRS-QUALITYANDLOTCONTROL-002` | HLD-QUALITY / LLD-003 | Stage 9 design linked; Gate 9.1 passed 2026-10-11 |
|
||||
| `UC-006` | `FR-QUALITYANDLOTCONTROL-003` | `SRS-QUALITYANDLOTCONTROL-003` | HLD-QUALITY / LLD-003 | Stage 9 design linked; Gate 9.1 passed 2026-10-11 |
|
||||
| `UC-006` | `FR-QUALITYANDLOTCONTROL-004` | `SRS-QUALITYANDLOTCONTROL-004` | HLD-QUALITY / LLD-003 | Stage 9 design linked; Gate 9.1 passed 2026-10-11 |
|
||||
| `UC-007` | `FR-WAREHOUSEINVENTORY-001` | `SRS-WAREHOUSEINVENTORY-001` | HLD-INVENTORY / LLD-003 | Stage 9 design linked; Gate 9.1 passed 2026-10-11 |
|
||||
| `UC-007` | `FR-WAREHOUSEINVENTORY-002` | `SRS-WAREHOUSEINVENTORY-002` | HLD-INVENTORY / LLD-003 | Stage 9 design linked; Gate 9.1 passed 2026-10-11 |
|
||||
| `UC-007` | `FR-WAREHOUSEINVENTORY-003` | `SRS-WAREHOUSEINVENTORY-003` | HLD-INVENTORY / LLD-003 | Stage 9 design linked; Gate 9.1 passed 2026-10-11 |
|
||||
| `UC-008` | `FR-SALESCONTRACTS-001` | `SRS-SALESCONTRACTS-001` | HLD-SALES / LLD-004 | Stage 9 design linked; Gate 9.1 passed 2026-10-11 |
|
||||
| `UC-008` | `FR-SALESCONTRACTS-002` | `SRS-SALESCONTRACTS-002` | HLD-SALES / LLD-004 | Stage 9 design linked; Gate 9.1 passed 2026-10-11 |
|
||||
| `UC-008` | `FR-SALESCONTRACTS-003` | `SRS-SALESCONTRACTS-003` | HLD-SALES / LLD-004 | Stage 9 design linked; Gate 9.1 passed 2026-10-11 |
|
||||
| `UC-009` | `FR-DISPATCHDELIVERY-001` | `SRS-DISPATCHDELIVERY-001` | HLD-DISPATCH / LLD-004 | Stage 9 design linked; Gate 9.1 passed 2026-10-11 |
|
||||
| `UC-009` | `FR-DISPATCHDELIVERY-002` | `SRS-DISPATCHDELIVERY-002` | HLD-DISPATCH / LLD-004 | Stage 9 design linked; Gate 9.1 passed 2026-10-11 |
|
||||
| `UC-009` | `FR-DISPATCHDELIVERY-003` | `SRS-DISPATCHDELIVERY-003` | HLD-DISPATCH / LLD-004 | Stage 9 design linked; Gate 9.1 passed 2026-10-11 |
|
||||
| `UC-010` | `FR-FLEETREGISTRY-001` | `SRS-FLEETREGISTRY-001` | HLD-FLEET / LLD-009 | Stage 9 design linked; Gate 9.1 passed 2026-10-11 |
|
||||
| `UC-011` | `FR-CUSTOMERRECEIVABLES-001` | `SRS-CUSTOMERRECEIVABLES-001` | HLD-RECEIVABLES / LLD-004 | Stage 9 design linked; Gate 9.1 passed 2026-10-11 |
|
||||
| `UC-011` | `FR-CUSTOMERRECEIVABLES-002` | `SRS-CUSTOMERRECEIVABLES-002` | HLD-RECEIVABLES / LLD-004 | Stage 9 design linked; Gate 9.1 passed 2026-10-11 |
|
||||
| `UC-011` | `FR-CUSTOMERRECEIVABLES-003` | `SRS-CUSTOMERRECEIVABLES-003` | HLD-RECEIVABLES / LLD-004 | Stage 9 design linked; Gate 9.1 passed 2026-10-11 |
|
||||
| `UC-011` | `FR-CUSTOMERRECEIVABLES-004` | `SRS-CUSTOMERRECEIVABLES-004` | HLD-RECEIVABLES / LLD-004 | Stage 9 design linked; Gate 9.1 passed 2026-10-11 |
|
||||
| `UC-012` | `FR-SUPPLIERPAYABLES-001` | `SRS-SUPPLIERPAYABLES-001` | HLD-PAYABLES / LLD-004 | Stage 9 design linked; Gate 9.1 passed 2026-10-11 |
|
||||
| `UC-013` | `FR-OPERATINGEXPENSES-001` | `SRS-OPERATINGEXPENSES-001` | HLD-EXPENSES / LLD-009 | Stage 9 design linked; Gate 9.1 passed 2026-10-11 |
|
||||
| `UC-014` | `FR-OPERATIONALALERTS-001` | `SRS-OPERATIONALALERTS-001` | HLD-EVENTS-ALERTS / LLD-005 | Stage 9 design linked; Gate 9.1 passed 2026-10-11 |
|
||||
| `UC-015` | `FR-EXECUTIVEREPORTING-001` | `SRS-EXECUTIVEREPORTING-001` | HLD-REPORTING / LLD-005 | Stage 9 design linked; Gate 9.1 passed 2026-10-11 |
|
||||
| `UC-015` | `FR-EXECUTIVEREPORTING-002` | `SRS-EXECUTIVEREPORTING-002` | HLD-REPORTING / LLD-005 | Stage 9 design linked; Gate 9.1 passed 2026-10-11 |
|
||||
| `UC-016` | `FR-MASTERDATA-001` | `SRS-MASTERDATA-001` | HLD-MASTERDATA / LLD-008 | Stage 9 design linked; Gate 9.1 passed 2026-10-11 |
|
||||
| `UC-016` | `FR-MASTERDATA-002` | `SRS-MASTERDATA-002` | HLD-MASTERDATA / LLD-008 | Stage 9 design linked; Gate 9.1 passed 2026-10-11 |
|
||||
| `UC-017` | `FR-TENANTSECURITYAUDIT-001` | `SRS-TENANTSECURITYAUDIT-001` | HLD-ISOLATION-AUDIT / LLD-002 | Stage 9 design linked; Gate 9.1 passed 2026-10-11 |
|
||||
| `UC-017` | `FR-TENANTSECURITYAUDIT-003` | `SRS-TENANTSECURITYAUDIT-003` | HLD-ISOLATION-AUDIT / LLD-002 | Stage 9 design linked; Gate 9.1 passed 2026-10-11 |
|
||||
| `UC-018` | `FR-TENANTLIFECYCLE-001` | `SRS-TENANTLIFECYCLE-001` | HLD-TENANCY / LLD-002 | Stage 9 design linked; Gate 9.1 passed 2026-10-11 |
|
||||
| `UC-019` | `FR-TENANTMEMBERSHIPCONTEXT-001` | `SRS-TENANTMEMBERSHIPCONTEXT-001` | HLD-TENANCY / LLD-002 | Stage 9 design linked; Gate 9.1 passed 2026-10-11 |
|
||||
| `UC-019` | `FR-TENANTMEMBERSHIPCONTEXT-002` | `SRS-TENANTMEMBERSHIPCONTEXT-002` | HLD-TENANCY / LLD-002 | Stage 9 design linked; Gate 9.1 passed 2026-10-11 |
|
||||
| `UC-020` | `FR-TENANTSUPPORTSECURITY-001` | `SRS-TENANTSUPPORTSECURITY-001` | HLD-ISOLATION-AUDIT / LLD-002 | Stage 9 design linked; Gate 9.1 passed 2026-10-11 |
|
||||
| `UC-020` | `FR-TENANTSUPPORTSECURITY-002` | `SRS-TENANTSUPPORTSECURITY-002` | HLD-ISOLATION-AUDIT / LLD-002 | Stage 9 design linked; Gate 9.1 passed 2026-10-11 |
|
||||
| `UC-021` | `FR-PRIVACYPURPOSECONSENT-001` | `SRS-PRIVACYPURPOSECONSENT-001` | HLD-PRIVACY-INCIDENT-LIFECYCLE / LLD-011 | Stage 9 design linked; Gate 9.1 passed 2026-10-11 |
|
||||
| `UC-022` | `FR-DATAPRINCIPALRIGHTS-001` | `SRS-DATAPRINCIPALRIGHTS-001` | HLD-PRIVACY-INCIDENT-LIFECYCLE / LLD-011 | Stage 9 design linked; Gate 9.1 passed 2026-10-11 |
|
||||
| `UC-023` | `FR-PRIVACYBREACHRESPONSE-001` | `SRS-PRIVACYBREACHRESPONSE-001` | HLD-PRIVACY-INCIDENT-LIFECYCLE / LLD-006 | Stage 9 design linked; Gate 9.1 passed 2026-10-11 |
|
||||
| `UC-024` | `FR-RETENTIONERASURE-001` | `SRS-RETENTIONERASURE-001` | HLD-PRIVACY-INCIDENT-LIFECYCLE / LLD-006 | Stage 9 design linked; Gate 9.1 passed 2026-10-11 |
|
||||
| `UC-025` | `FR-PROCESSORGOVERNANCE-001` | `SRS-PROCESSORGOVERNANCE-001` | HLD-PROCESSOR-GOVERNANCE / LLD-011 | Stage 9 design linked; Gate 9.1 passed 2026-10-11 |
|
||||
| `UC-026` | `FR-TENANTOPERATINGPOLICIES-001` | `SRS-TENANTOPERATINGPOLICIES-001` | HLD-TENANT-POLICY / LLD-010 | Stage 9 design linked; Gate 9.1 passed 2026-10-11 |
|
||||
|
||||
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`.
|
||||
|
||||
## Gate 9.1 Check — 2026-10-11 (Stage 9 Full FR Set)
|
||||
|
||||
| Check | Result | Evidence |
|
||||
|---|---|---|
|
||||
| FR-to-SRS linkage | Pass | 54/54 FRs resolve to unique FR-specific SRS records; four scoped cross-cutting NFRs carry explicit `parent_fr: cross-cutting`. |
|
||||
| FR-to-HLD/LLD linkage | Pass | 54/54 FRs are listed in LLD Parent FRs and mapped to an HLD component in the Stage 9 traceability table. |
|
||||
| Deterministic Gate 9.1 | **PASS** | `python scripts/verify_traceability_gates.py --gate 9.1`; 0 Critical, 0 Major, 0 Minor findings. |
|
||||
|
||||
This is a traceability/design completeness gate, not runtime, load, legal, or security implementation evidence.
|
||||
|
|
|
|||
|
|
@ -4,7 +4,9 @@
|
|||
|---|---|
|
||||
| **Governed Standard** | SEI-CMMI Level 3 (UP-AI v1.0) |
|
||||
| **Document Path** | `04_generated_documentation/00_process_control/traceability_index.md` |
|
||||
| **Last Updated** | 2026-09-03 |
|
||||
| **Last Updated** | 2026-10-11 |
|
||||
| **Version** | 1.1.0 |
|
||||
| **Last CR** | `CR-001` |
|
||||
|
||||
---
|
||||
|
||||
|
|
@ -20,6 +22,14 @@ $$\text{BRD-FR-xxx} \longrightarrow \text{UC-xxx} \longrightarrow \text{FR-xxx}
|
|||
|
||||
| Trace ID | Requirement Name | Actor(s) | BRD Feature | UC ID | FR ID(s) | HLD / LLD Component | Delivery Stories | Test Cases | Delivery Status |
|
||||
|---|---|---|---|---|---|---|---|---|---|
|
||||
| `TR-001` | User Authentication & OIDC PKCE | All Users | `BRD-FR-001` | `UC-001` | `FR-AUTH-001` | `HLD-AUTH` / `LLD-001_auth_service.md` | `STORY-AUTH-001` | `TC-AUTH-001`, `TC-AUTH-002` | Ready for Construction |
|
||||
| `TR-002` | Multi-Tenant RBAC Authorization | Admin, User | `BRD-FR-002` | `UC-001` | `FR-AUTH-002` | `HLD-AUTH` / `LLD-001_auth_service.md` | `STORY-AUTH-002` | `TC-AUTH-003` | Ready for Construction |
|
||||
| `TR-003` | User Session Lifecycle & Revocation | All Users | `BRD-FR-003` | `UC-001` | `FR-AUTH-003` | `HLD-AUTH` / `LLD-001_auth_service.md` | `STORY-AUTH-003` | `TC-AUTH-004` | Ready for Construction |
|
||||
| `TR-001` | User Authentication & OIDC PKCE | All Users | `tech-profile.yaml`; `BRD-NFR-009` | `UC-001` | `FR-AUTH-001` | 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.
|
||||
|
||||
## Stage 9 Architecture Linkage
|
||||
|
||||
The master graph maps all 54 FRs to their Stage 8 SRS, HLD component and LLD artifact. Gate 9.1 passed on 2026-10-11 with zero findings. Supporting contracts: [`hld.md`](../04_architecture_design/hld.md), [`api_design.md`](../04_architecture_design/api_design.md), [`database_design.md`](../04_architecture_design/database_design.md), and [`integration_design.md`](../04_architecture_design/integration_design.md). This is design/traceability evidence only; runtime and load validation remain pending.
|
||||
|
|
|
|||
|
|
@ -2,18 +2,98 @@
|
|||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| **Governed Standard** | SEI-CMMI Level 3 (UP-AI v1.0) |
|
||||
| **Governed Standard** | UP-AI v1.5 |
|
||||
| **Document Path** | `04_generated_documentation/01_source_inventories/brd_inventory.md` |
|
||||
| **Source** | `01_BRD/PRD_Specification.template.md` |
|
||||
| **Last Updated** | 2026-09-03 |
|
||||
| **Authoritative Source** | `01_BRD/PRD_Specification.md` (baselined for Stage 1 extraction with bounded assumptions) |
|
||||
| **Last Updated** | 2026-10-11 |
|
||||
| **Version** | 1.1.0 |
|
||||
| **Last CR** | `CR-001` |
|
||||
| **Active Track** | Greenfield |
|
||||
|
||||
---
|
||||
## Extracted Functional Business Requirements (`BRD-FR-xxx`)
|
||||
|
||||
## Extracted Business Features & Requirements (`BRD-FR-xxx`)
|
||||
Every functional feature from PRD §5 is represented once. Stage 1 extraction does not compare against the illustrative mockup or infer legacy behavior. Candidate values retain the provisional status and controls stated in the PRD.
|
||||
|
||||
| Feature ID | Feature Name | PRD Reference | Primary Actor | Description | Downstream Use Case | Status |
|
||||
|---|---|---|---|---|---|---|
|
||||
| `BRD-FR-001` | Multi-Tenant User Authentication | PRD §3 | All Users | Secure OIDC/PKCE login with tenant context propagation and JWT bearer token issuance. | `UC-001` | Extracted / Baselined |
|
||||
| `BRD-FR-002` | Role-Based Access Control (RBAC) | PRD §3 | Tenant Admin | Tenant-scoped roles, permissions, and hierarchical privilege enforcement. | `UC-001` | Extracted / Baselined |
|
||||
| `BRD-FR-003` | User Session & Token Revocation | PRD §3 | All Users | Session state monitoring, refresh token rotation, and instant revocation capability. | `UC-001` | Extracted / Baselined |
|
||||
| `BRD-FR-004` | Audit & Compliance Event Stream | PRD §3 | System Admin | Immutable audit logging of authentication, state mutations, and administrative events. | `UC-001` | Extracted / Baselined |
|
||||
| Feature ID | Feature Name | PRD Reference | Primary Actor(s) | Priority | Extracted Business Requirement | Legacy Overlap / Conflict | Downstream Use Case |
|
||||
|---|---|---|---|---|---|---|---|
|
||||
| `BRD-FR-001` | Daily APMC Mandi Arrival Ingestion & Tracking | §5 | Procurement Executive / Mandi Buyer | P0 | The system must record daily physical arrival volumes at APMC mandi yards across target commodities (Chana, Coriander, Cumin, Fenugreek, Groundnut, Isabgol, Jaggery, Maize, Mustard, Soybean, Turmeric, Wheat) across monitored markets (Neemuch, Mandsaur, Ratlam, Kota, Indore, Jaora, Ujjain, Chittorgarh). | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-002` |
|
||||
| `BRD-FR-002` | Daily Modal & Range Pricing Tracking (₹/Qtl) | §5 | Procurement Executive / Purchase Manager | P0 | For each daily mandi arrival record, the system must capture the quoted price range (Min Rate ₹/Qtl, Max Rate ₹/Qtl) and the official modal clearing price (Modal Rate ₹/Qtl). | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-002` |
|
||||
| `BRD-FR-003` | Intraday Price Trend Analysis & 20-Day Benchmark Analytics | §5 | Purchase Manager / Partner | P0 | The system must provide interactive visual charts and trend tables comparing the 20-day historical modal rate trend per commodity across markets, computing 20-day moving averages, 20-day highs/lows, and price velocity. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-003` |
|
||||
| `BRD-FR-004` | Procurement Price Variance Alert vs. Modal Rate | §5 | Purchase Manager | P1 | When booking a purchase sauda, the system must compare the offered trade rate against the latest modal clearing rate for that commodity/mandi. If the offered rate exceeds the modal rate by $>5\%$, the system must display an inline warning and require confirmation. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-004` |
|
||||
| `BRD-FR-005` | Mandi Auction & Direct Purchase Sauda Booking | §5 | Procurement Executive / Purchase Manager | P0 | The system must record purchase contracts (*saudas*) negotiated in mandi auctions or directly with suppliers. Each sauda must capture supplier code, sourcing market, commodity, variety, trade rate (₹/Qtl), estimated bag count, and booked quantity in MT. The system must support multi-truck partial delivery: a sauda may be fulfilled across multiple trucks/GRNs over consecutive delivery days, tracking cumulative received MT and remaining balance MT until fully fulfilled. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-004` |
|
||||
| `BRD-FR-006` | Supplier Credit Terms & Due Date Computation | §5 | Purchase Manager / Accounts Executive | P0 | The system must automatically compute the supplier payment due date by adding the supplier's contractual credit days (e.g., 7, 15, or 21 days) to the sauda or GRN receipt date. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-004` |
|
||||
| `BRD-FR-007` | Mandi Cess & Statutory Levies Apportioning | §5 | Accounts Executive | P1 | The system must calculate statutory mandi cess (e.g., 1.5% APMC market fee + 0.2% Nirashrit fee) based on the gross sauda value and append it to the total procurement cost. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-004` |
|
||||
| `BRD-FR-008` | Inward Vehicle Gate Entry & Verification | §5 | Yard Supervisor | P0 | Upon vehicle arrival at the godown, the Yard Supervisor must log gate entry linking the vehicle registration number and driver details to an active booked sauda. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-005` |
|
||||
| `BRD-FR-009` | Weighbridge Gross & Tare Weighment Logging | §5 | Yard Supervisor | P0 | The system must record dual-phase weighbridge measurements for incoming trucks: (1) Gross Weighment (truck + commodity) upon arrival, and (2) Tare Weighment (empty truck) after unloading. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-005` |
|
||||
| `BRD-FR-010` | Bag Tare Deduction (*Bardana Katai*) & Final Net MT | §5 | Yard Supervisor | P0 | The system must deduct the weight of packaging bags from the gross commodity weight using the defined tare deduction factor (default 1.0 kg/gunny bag) to calculate true Net Payable MT. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-005` |
|
||||
| `BRD-FR-011` | Weighment Tolerance & Transit Shortage Verification | §5 | Yard Supervisor / Purchase Manager | P0 | The system must compare the Final Net Weighbridge MT against the Booked Sauda MT. If shortage exceeds $0.5\%$, the system must flag a `Transit Shortage Warning` and adjust the final payable amount to the actual net received weight. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-005` |
|
||||
| `BRD-FR-012` | Goods Receipt Note (GRN) Posting & Warehouse Stack Placement | §5 | Yard Supervisor | P0 | Upon weighment completion, the system must generate a formal GRN document, allocate the physical goods to a specific warehouse/godown and stack location, credit the warehouse stock book, and mint an inward Commodity Lot. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-005` |
|
||||
| `BRD-FR-013` | Mandatory Lot & Batch Identity Generation | §5 | Yard Supervisor / Quality Officer | P0 | The system must automatically generate a globally unique, immutable Lot ID (`LOT-YYYYMM-xxx`) for every inward consignment processed through a GRN. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-005` |
|
||||
| `BRD-FR-014` | Inward Quality Inspection Parameter Recording | §5 | Quality Officer | P0 | The Quality Officer must log laboratory/physical test parameters for the lot: Moisture %, Foreign Matter / Dust %, Admixture (other grains) %, Damaged / Discolored %, and Weevil count. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-006` |
|
||||
| `BRD-FR-015` | Quality Deduction / Rebate Calculation | §5 | Quality Officer / Accounts Executive | P1 | If moisture or foreign matter exceeds standard contract baselines (e.g., standard moisture baseline 10.0%), the system must automatically compute a quality price deduction (e.g., ₹10 deduction per quintal for each 0.5% moisture above baseline). | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-006` |
|
||||
| `BRD-FR-016` | Finite State Machine Enforcement for `QC Hold` vs. `Released` | §5 | Quality Officer | P0 | The system must enforce strict FSM transitions on the Lot record. If moisture $>12\%$ or foreign matter $>2\%$, the lot must be transitioned to `QC Hold`. A lot on `QC Hold` is programmatically blocked from sales order allocation and dispatch loading. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-006` |
|
||||
| `BRD-FR-017` | Lot Splitting & Blending Traceability | §5 | Yard Supervisor / Quality Officer | P1 | The system must support splitting a parent lot into sub-lots (e.g., when dividing a consignment across two warehouses) or blending multiple lots, maintaining parent-child lineage in the traceability graph. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-006` |
|
||||
| `BRD-FR-018` | Multi-Godown Dual-Unit Stock Ledger | §5 | Yard Supervisor / Management | P0 | The system must maintain a real-time, double-entry stock ledger tracking commodity positions across warehouses (WH-01 Neemuch Main Yard, WH-02 Neemuch North Godown, WH-03 Mandsaur Transit Godown, WH-04 Indore Buffer Depot). For each commodity, variety, and grade, it must maintain Opening Stock MT, Received MT, Dispatched MT, Closing Stock MT, and physical Bag counts. The system must support Periodic Physical Stock Audits: recording physical tally counts against book balances and generating supervisor-authorized Stock Adjustment Vouchers capturing natural storage loss/gain (*ghat / nami* due to moisture evaporation or seasonal humidity) or handling spillage with mandatory reason codes. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-007` |
|
||||
| `BRD-FR-019` | Godown Capacity & Volume Utilization Tracking | §5 | Yard Supervisor / Partner | P0 | The system must track the physical storage capacity of each warehouse in Metric Tonnes and calculate real-time percentage utilization: | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-007` |
|
||||
| `BRD-FR-020` | Godown-to-Godown Internal Stock Transfer | §5 | Yard Supervisor / Logistics Coordinator | P0 | The system must support recording stock transfers between godowns (e.g., from Mandsaur Transit Godown to Neemuch Main Yard), logging origin outward deduction, in-transit state, destination weighment, and destination inward credit. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-007` |
|
||||
| `BRD-FR-021` | Customer Sales Contract Booking | §5 | Sales Manager / Sales Executive | P0 | The system must record customer sales orders/contracts specifying customer code, destination city, customer segment (`Wholesale`, `Processor`, `Institutional`, `Distributor`), commodity, variety, grade, contracted quantity in MT, contract rate in ₹/Qtl, and delivery timeline. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-008` |
|
||||
| `BRD-FR-022` | Customer Credit Limit & Pre-Order Exposure Verification | §5 | Sales Manager / Accounts Executive | P0 | Prior to confirming a sales order, the system must evaluate the customer's current outstanding receivables plus the value of the new order against their sanctioned credit limit. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-008` |
|
||||
| `BRD-FR-023` | Sales Order Inventory Allocation | §5 | Sales Manager / Yard Supervisor | P0 | The Sales Manager must allocate specific available inventory lot(s) from a warehouse to a confirmed sales order. The system must verify that selected lots are in `Released` state and have sufficient unreserved balance. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-008` |
|
||||
| `BRD-FR-024` | Outbound Dispatch Board Console | §5 | Logistics Coordinator | P0 | The system must provide a visual dispatch management board displaying scheduled, loading, and in-transit consignments, matching confirmed sales orders to allocated warehouse lots and transport vehicles. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-009` |
|
||||
| `BRD-FR-025` | Outbound Weighbridge & Dispatch Bilty/Manifest | §5 | Yard Supervisor / Logistics Coordinator | P0 | The system must capture outward weighbridge weights for loaded dispatch trucks (Tare truck before loading, Gross truck after loading), verify loaded weight against order MT, and generate a printable transport manifest / Bilty. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-009` |
|
||||
| `BRD-FR-026` | In-Transit Tracking & Proof of Delivery (POD) | §5 | Logistics Coordinator | P0 | The system must track dispatch states from `In Transit` to `Delivered`. Upon consignee receipt, the Logistics Coordinator logs confirmation date, destination weighment, and uploads POD document reference. If destination weighment or quality parameters reveal a transit shortage or damage acknowledged by the buyer, the system must allow recording a Consignee Shortage Note and automatically generating a compensating Sales Credit Note against the customer ledger without altering the immutable outbound dispatch manifest. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-009` |
|
||||
| `BRD-FR-027` | Transport Fleet Registry | §5 | Logistics Coordinator | P1 | The system must maintain a registry of transport trucks (owned and contract carriers) including registration number, vehicle model, gross payload capacity in MT, ownership type (`Own` vs `Contract`), insurance/fitness expiry dates, and operational status (`Available`, `On Route`, `Maintenance`). | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-010` |
|
||||
| `BRD-FR-028` | Customer Ledger & Aging Statement | §5 | Accounts Executive / Sales Manager | P0 | The system must maintain an immutable party sub-ledger for each customer, debiting finalized sales invoices, crediting payment receipts, and presenting a real-time outstanding balance and aging schedule (0–7 days, 8–15 days, 16–30 days, >30 days). | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-011` |
|
||||
| `BRD-FR-029` | Automated Customer Credit Exposure Watch & Threshold Alert | §5 | Accounts Executive / Partner | P0 | The system must continuously recompute the customer exposure ratio ($\text{Outstanding} / \text{Credit Limit}$). If exposure $>80\%$, the account must be automatically tagged with a visual `Watch` badge, and an operational warning alert generated on the Executive Dashboard. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-011` |
|
||||
| `BRD-FR-030` | Credit Breach Dispatch Lock & Partner Override | §5 | Partner / Managing Director | P0 | If a customer's outstanding receivables exceed 100% of their sanctioned credit limit, all pending dispatches for that customer must be locked. Only a Partner user can record an explicit electronic approval override with mandatory justification notes to release the lock. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-011` |
|
||||
| `BRD-FR-031` | Customer Payment Receipt Posting | §5 | Accounts Executive | P0 | The system must record customer payments capturing payment date, customer code, received amount in INR, payment instrument mode (`NEFT`, `RTGS`, `Cheque`, `Cash`, `UPI`), bank reference/UTR number, and payment status (`Pending Clearance`, `Cleared`, `Bounced`). The system must enforce automatic reversal upon Cheque/Instrument Bounce: if an instrument status transitions to `Bounced`, the system must immediately reverse the credit entry on the customer sub-ledger, restore the previous outstanding debt, recompute exposure ratio %, reinstate credit locks if exposure $>100\%$, and trigger an urgent financial alert. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-011` |
|
||||
| `BRD-FR-032` | Supplier Payables Aging & Balance Snapshots | §5 | Accounts Executive / Partner | P0 | The system must track supplier payables arising from accepted GRNs, applying supplier credit days, generating aging schedules, and providing daily aggregate payables snapshots. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-012` |
|
||||
| `BRD-FR-033` | Mandi Operating Expense Classification & Recording | §5 | Accounts Executive | P1 | The system must record operational expenses incurred in mandi and godown operations categorizing entries under: Labor / Hamali (loading/unloading), Freight / Cartage, Weighbridge Fees, Godown Rent, Mandi Cess, Pest Control/Fumigation, and Office Expenses. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-013` |
|
||||
| `BRD-FR-034` | Real-Time Operational Alerts Engine | §5 | Partner / Operations Supervisor | P0 | The system must evaluate active business data and publish automated proactive alerts across four critical categories: | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-014` |
|
||||
| `BRD-FR-035` | Executive Control Centre Dashboard | §5 | Partner / Managing Director | P0 | The system must provide a unified operational dashboard displaying real-time metrics: Total Stock on Hand (MT), Total Active Stock Lines, Intraday Purchase Value INR, Intraday Sales Revenue INR, Total Customer Receivables INR, Top 10 Stock Lines by Volume, Top Recent Sales, and Warehouse Utilization Barometers. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-015` |
|
||||
| `BRD-FR-036` | 20-Day Consolidated Trading Trend Reporting | §5 | Partner / Managing Director | P0 | The system must compile daily management snapshots across a rolling 20-day trading window, tabulating: Date, Purchases MT, Sales MT, Closing Stock MT, Total Receivables INR, and Total Payables INR. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-015` |
|
||||
| `BRD-FR-037` | Agricultural Commodity Master Data Management | §5 | System Administrator | P0 | Maintain authoritative master catalogs for: Commodities (Chana, Soybean, Mustard, Wheat, Coriander, Cumin, Fenugreek, Groundnut, Isabgol, Jaggery, Maize, Turmeric), Varieties per commodity (e.g., Lokwan, Pusa, Eagle/Badami), and Commercial Quality Grades (`FAQ`, `Premium`, `Below FAQ`). | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-016` |
|
||||
| `BRD-FR-038` | Trading Counterparty Masters (Suppliers, Customers & Godowns) | §5 | System Administrator / Accounts Executive | P0 | Maintain registries for: (1) Suppliers (Code, Name, City, Segment, Credit Days: 7/15/21), (2) Customers (Code, Name, City, Segment, Credit Limit INR, Contact), and (3) Godowns/Warehouses (Code, Name, City, Capacity MT). | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-016` |
|
||||
| `BRD-FR-039` | Tenant Data Isolation | §5 | System Administrator | P0 | Each independent trading enterprise is a tenant; its branches and godowns operate within that tenant boundary. Users and transactions must be associated with the correct tenant, and access to one tenant’s business data must not expose another tenant’s data. The isolation implementation must conform to the active technology profile. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-017` |
|
||||
| `BRD-FR-040` | Role-Based Access Control (RBAC) & Permission Scoping | §5 | System Administrator | P0 | Access to business records and actions must be governed by role-based permissions for the roles defined in this PRD: `Tenant Administrator`, `Mandi Buyer`, `Purchase Manager`, `Yard Supervisor`, `Quality Officer`, `Sales Executive`, `Sales Manager`, `Logistics Coordinator`, `Accounts Executive`, `Partner / MD`, and `System Administrator`. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-001` |
|
||||
| `BRD-FR-041` | Immutable Transaction Audit Logging | §5 | System Administrator | P0 | Submitted business records (GRNs, Sales Orders, Dispatches, Payment Receipts) must preserve an auditable history. Corrections must not silently rewrite the business history. The system must record user ID, timestamp, and the changed values for governed mutations. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-017` |
|
||||
| `BRD-FR-042` | Tenant Provisioning and Lifecycle Management | §5 | System Administrator | P0 | Public self-service tenant signup is out of scope for v1. An authorized platform administrator must create and configure each tenant, assign its initial Tenant Administrator, and activate, suspend, or close the tenant through a controlled lifecycle. Tenant lifecycle changes must not silently delete or expose business records. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-018` |
|
||||
| `BRD-FR-043` | Tenant Membership and Role Administration | §5 | Tenant Administrator | P0 | A person may hold active memberships in multiple tenants. A Tenant Administrator must be able to add, deactivate, and assign approved business roles to users within their own tenant. A tenant administrator must not manage users or roles belonging to another tenant. Platform-level administrators and tenant-level administrators must have distinct permissions. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-019` |
|
||||
| `BRD-FR-044` | Verified Tenant Context for Every Operation | §5 | All authenticated users | P0 | The service must derive the effective tenant context from the authenticated user’s verified tenant membership. A client-supplied tenant identifier alone must never grant or switch tenant access. A user associated with multiple tenants must explicitly select the active tenant after sign-in; the service verifies that membership and its role for every request before permitting action in that tenant. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-019` |
|
||||
| `BRD-FR-045` | End-to-End Tenant Resource Isolation | §5 | All users; System Administrator for platform controls | P0 | Tenant isolation must apply to all tenant-owned records and derived resources, including database reads and writes, API lookups, search/report results, exports, uploaded files, cache entries, and queued/background work. Cross-tenant access attempts must fail closed and must not reveal whether another tenant’s resource exists. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-020` |
|
||||
| `BRD-FR-046` | Controlled Privileged Support Access | §5 | System Administrator | P0 | Platform support must not imply routine unrestricted access to tenant business data. Support staff have no standing access to tenant business data. Ordinary exceptional access requires approval by that tenant’s Tenant Administrator for a specific support case and a limited duration. For an urgent incident, a designated platform security administrator may grant a break-glass access window of at most one hour, with a recorded reason, immediate audit alert, and notice to the tenant administrator within one business day. All access is recorded for tenant and platform security review. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-020` |
|
||||
| `BRD-FR-047` | Personal Data Purpose, Notice & Consent Records | §5 | Tenant Administrator; System Administrator for platform-controlled processing | P0 | The service must allow each responsible Data Fiduciary to determine and approve the processing purpose, applicable lawful basis, and privacy notice for its processing, then document personal-data categories, purpose, basis, notice version, and accountable contact. Tenant firms own these decisions for trading data; the ATB operator records them separately for its own account, security, and service processing. Privacy controls cover every natural person whose personal data is processed in tenant or platform contexts, whether or not that person has an application account. Where consent is the applicable basis, the service must capture evidence of the notice and consent, support withdrawal, and record resulting processing restrictions. Tenant and platform processing contexts must remain distinguishable. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-021` |
|
||||
| `BRD-FR-048` | Data Principal Rights & Grievance Case Management | §5 | Tenant Administrator; System Administrator for platform-controlled processing | P0 | The service must support receipt, identity verification, routing, tracking, response, and evidence retention for Data Principal requests and grievances concerning access to information, correction, erasure, consent withdrawal, grievance redressal, and nomination, as applicable, including for individuals who do not hold application accounts. Requests must be routed to the responsible Data Fiduciary and handled within the applicable statutory or approved contractual time limit. A request channel must be available without requiring a general customer or supplier portal account. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-022` |
|
||||
| `BRD-FR-049` | Personal Data Breach Response Coordination | §5 | System Administrator; Tenant Administrator for tenant-scoped incidents | P0 | The service must support recording, triaging, investigation, impact assessment, remediation, and notification coordination for suspected or confirmed personal-data breaches. The platform operator must be able to identify affected tenants and notify the responsible tenant Data Fiduciary promptly when acting as its Data Processor. The workflow must support applicable notification content and deadlines to affected Data Principals and the Data Protection Board, including phased or subsequently amended statutory requirements. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-023` |
|
||||
| `BRD-FR-050` | Purpose-Aware Retention, Erasure & Legal Hold | §5 | Tenant Administrator; System Administrator for platform-controlled processing | P0 | Use four internal sensitivity levels—Public, Internal, Confidential, and Restricted—with a separate personal-data flag and processing-purpose tag; these are product handling labels, not statutory DPDP classifications. The responsible Data Fiduciary must approve retention schedules by personal-data category and processing purpose after legal/accounting review (tenant firms for trading data; ATB operator for its own account, security, and service data). Authorized operators must be able to apply these schedules by tenant/platform responsibility and applicable legal obligation. The service must support correction, erasure or irreversible de-identification when required, legal holds and statutory retention exceptions, and deletion handling for derived copies and processors, including backups according to the approved schedule. Statutory processing-log retention requirements must be represented separately from general business-record retention. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-024` |
|
||||
| `BRD-FR-051` | Data Processor & Subprocessor Governance | §5 | System Administrator | P0 | The platform operator must maintain an inventory of processors and subprocessors used for tenant personal data, their processing purpose and location, applicable safeguards and contractual obligations, and status of due diligence. The operator must support tenant Data Fiduciaries with information and operational assistance needed for security safeguards, Data Principal requests, breach response, retention, and erasure obligations. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-025` |
|
||||
| `BRD-FR-052` | Tenant Operating Policy Configuration & Audit | §5 | Partner / Managing Director; authorized tenant functional managers | P0 | The service must provide tenant-scoped configuration for the provisional operating thresholds listed in §6.2, including market-price variance, weighment shortage, bag tare/packing, commodity quality grading/deductions, credit exposure, warehouse capacity/adjustments/transfers, dispatch tolerances, and alert timing. Policies must support commodity, grade, contract, or other applicable scope and effective dates where needed. Only roles authorized in the tenant permission model may change them; changes must record actor, timestamp, reason, prior value, and new value. Seed values remain provisional. Before each affected live workflow is enabled for a tenant, that tenant’s Partner/Managing Director or delegated authorized business owner must review and confirm or edit every applicable threshold. Missing or unreviewed thresholds block only the affected risk-sensitive workflow. Confirmed policies are versioned with an effective date and changes are audited. | Not assessed (Greenfield; Stage 1 is independent of reference mockup/legacy behavior) | `UC-026` |
|
||||
|
||||
## Extracted Non-Functional Requirements (`BRD-NFR-xxx`)
|
||||
|
||||
NFRs are retained under their source IDs; they are not reminted as functional requirement IDs.
|
||||
|
||||
| NFR ID | Requirement Area | Statement & Quantitative Metric | Priority |
|
||||
|---|---|---|---|
|
||||
| `BRD-NFR-001` | Commercial Calculation Integrity | Dual-unit mathematical conversions ($\text{Value} = \text{MT} \times 10 \times \text{Rate}_{\text{Qtl}}$) and bag tare deductions must maintain decimal precision to 3 decimal places for weight and 2 decimal places for currency without rounding drift. | P0 |
|
||||
| `BRD-NFR-002` | UI Rendering Performance | Web views, forms, and executive dashboards must achieve page load rendering times $\le 1.5\text{ seconds}$ on standard broadband (10 Mbps). | P0 |
|
||||
| `BRD-NFR-003` | API Latency SLAs | Standard resource CRUD endpoints and list filter queries must achieve response latencies $\le 250\text{ ms}$ (p95) under normal operating load. | P0 |
|
||||
| `BRD-NFR-004` | High-Volume Reporting SLA | 20-day trading trend snapshots and multi-godown stock position reports must generate in $\le 1.0\text{ second}$ for a tenant with historical ledgers containing $\ge 50,000$ transaction rows. | P0 |
|
||||
| `BRD-NFR-005` | Programmatic FSM Invariant Protection | Finite State Machines for Lot Quality (`Under QC` $\rightarrow$ `QC Hold` / `Released`) and Outbound Dispatches must be enforced in backend domain logic, preventing client-side or API bypass. | P0 |
|
||||
| `BRD-NFR-006` | Tenant Data Isolation | Tenant data must remain isolated according to the row-level security model configured in `tech-profile.yaml`; unauthorized cross-tenant access must be prevented and tested. | P0 |
|
||||
| `BRD-NFR-007` | Offline Sandbox Testability | Configured identity, payment, and messaging integration adapters must provide deterministic local mocks capable of offline, reproducible verification without external network access. | P0 |
|
||||
| `BRD-NFR-008` | Automated Test Coverage Budgets | Code must meet UP-AI differentiated coverage budgets: $\ge 95\%$ statement/branch coverage for backend domain services and FSMs, $\ge 90\%$ for sandbox adapters, and $\ge 80\%$ for frontend components. | P0 |
|
||||
| `BRD-NFR-009` | Application Security Assurance | The v1 launch is India-first and must support compliance with India’s Digital Personal Data Protection Act, 2023 and the DPDP Rules applicable at production launch. Supporting tenants subject to other jurisdictions requires a separate legal and privacy assessment before onboarding. Application-security verification must target OWASP ASVS v5.0.0 Level 2. Applicable requirements must be mapped to verification evidence; any non-applicable requirement or exception must be documented with rationale and an accountable owner. Authentication, session handling, authorization, input validation, secure configuration, and sensitive-data protections in transit and at rest must be verified before production release. The compliance design must account for phased commencement and be revalidated against current official notifications before release. | P0 |
|
||||
| `BRD-NFR-010` | Tenant Isolation Assurance | Tenant isolation must fail closed across synchronous and asynchronous paths, including APIs, database connections, exports, files, caches, scheduled jobs, and support tooling. Automated tests must include cross-tenant negative cases and privileged-role bypass cases. | P0 |
|
||||
| `BRD-NFR-011` | Availability and Recoverability | Production service availability must be at least 99.9% per month, measured 24/7. Recovery time objective (RTO) must be no more than 4 hours and recovery point objective (RPO) no more than 15 minutes. Backups must be encrypted, taken daily, support point-in-time recovery, and be retained for 35 days. Restore exercises must be performed quarterly and their results recorded before production release. | P0 |
|
||||
| `BRD-NFR-012` | Capacity and Tenant Fairness | The initial production capacity-planning envelope is 50 tenant firms, up to 25 named users per tenant, and 250 concurrent active users across the service. Report performance must be validated with at least 50,000 ledger rows for a tenant. Load-test the platform for 200 core business documents per tenant per operating day and a 5× peak-hour burst, across the approved tenant/user envelope. This is a provisional capacity-planning scenario, not a customer usage cap. No fixed business-document quota is imposed by this planning envelope. Per-tenant resource use must be observable, with configurable early warnings near the tested fair-share budget. Under contention, the service may apply backpressure or temporarily throttle resource-intensive reports and bulk exports to protect service levels, while preserving and safely reporting the outcome of accepted core business transactions. Numeric fair-share budgets and alert thresholds must be set from architecture/load-test evidence. | P0 |
|
||||
| `BRD-NFR-013` | Operational Observability | Production operations must provide service-level and tenant-scoped health, error, latency, and workload signals with actionable alerts. Logs and telemetry must carry tenant/correlation context where authorized and must exclude secrets and unnecessary sensitive business data. | P0 |
|
||||
| `BRD-NFR-014` | Data Governance and Retention | The service must define and enforce four internal sensitivity levels (Public, Internal, Confidential, Restricted), with personal-data and processing-purpose tags applied independently, alongside purpose-aware retention, Data Principal request handling, export, correction, erasure, and legal-hold handling, including tenant closure, in support of applicable DPDP obligations and other applicable laws. These internal labels do not represent statutory DPDP categories. Each responsible Data Fiduciary must approve retention durations by category and purpose after legal/accounting review. The system must preserve applicable statutory minimums and legal holds, and support erasure when purposes and retention obligations end. Backup, processing-log, and audit-data retention and access must follow the approved policy and applicable statutory periods. | P0 |
|
||||
|
||||
## Open Evidence Dependencies
|
||||
|
||||
The following ambiguities remain open and are carried forward; their values are not resolved by this inventory:
|
||||
|
||||
- `AMB-001` / `ASM-001`: gather pre- and post-rollout pilot evidence before setting numeric efficiency targets.
|
||||
- `AMB-006` / `ASM-002`: obtain qualified review of retention durations and applicable legal/contractual obligations before production release.
|
||||
- `AMB-008` / `ASM-003`: derive fair-share budgets and alert thresholds from architecture/load-test evidence and pilot telemetry before production capacity acceptance.
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,64 +1,84 @@
|
|||
# Functional Requirements: UC-001 User Identity and Role Governance
|
||||
---
|
||||
id: UC-001-FR
|
||||
version: 1.1.0
|
||||
status: Baselined
|
||||
last_cr: CR-001
|
||||
---
|
||||
|
||||
# Functional Requirements — UC-001 User Authentication and Authorization
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| **Parent Use Case** | [`UC-001`](use-case.md) |
|
||||
| **Document** | `functional-reqs.md` |
|
||||
| **Status** | Baselined |
|
||||
| **Version** | 1.0.0 |
|
||||
| **Last CR** | None (UP-AI v1.0 Baseline) |
|
||||
| **Version** | 1.1.0 |
|
||||
| **Last CR** | `CR-001` |
|
||||
|
||||
---
|
||||
|
||||
## FR-AUTH-001: Multi-Tenant OIDC PKCE Login
|
||||
## FR-AUTH-001: OIDC Authentication
|
||||
|
||||
- **Requirement ID:** `FR-AUTH-001`
|
||||
- **Parent Use Case:** `UC-001`
|
||||
- **Source Feature:** `BRD-FR-001`
|
||||
- **Source Feature:** `new — not in BRD`
|
||||
- **Priority:** P0 (Must Have)
|
||||
- **Primary Surface:** Frontend Portal Login Screen, Backend Auth Router
|
||||
- **Primary Surface:** Login screen and authentication integration; route/contract details in LLD
|
||||
- **Business Rules:** Use the identity provider, OIDC/PKCE protocol, and JWT bearer-token standard configured in `tech-profile.yaml`. Authentication and session handling must be verified before production under `BRD-NFR-009`.
|
||||
|
||||
### Source Justification
|
||||
|
||||
The current technology profile configures Keycloak with OIDC/PKCE and JWT bearer tokens; `BRD-NFR-009` requires authentication and session handling to be verified. The detailed sign-in feature is not separately numbered as a BRD-FR.
|
||||
|
||||
### Statement
|
||||
The platform shall provide secure multi-tenant user authentication via OpenID Connect (OIDC) Authorization Code Flow with Proof Key for Code Exchange (PKCE). Upon successful login, the system shall issue a signed JSON Web Token (JWT) containing standard claims (`sub`, `email`, `exp`) and custom claims (`tenant_id`, `roles`, `permissions`).
|
||||
|
||||
The platform shall authenticate users through the configured OIDC identity provider using the configured PKCE protocol and establish an authenticated application session using the configured JWT bearer-token approach.
|
||||
|
||||
### Acceptance Criteria
|
||||
1. Unauthenticated users attempting to access protected routes shall be redirected to the OIDC provider login interface.
|
||||
2. The authorization request MUST include a SHA-256 PKCE code challenge.
|
||||
3. Access tokens MUST be signed with RS256 and have an expiration of $\le 15\text{ minutes}$.
|
||||
4. All backend API endpoints MUST validate the token signature and verify the `tenant_id` claim.
|
||||
|
||||
---
|
||||
1. The sign-in flow uses the configured identity provider and OIDC/PKCE protocol.
|
||||
2. The application establishes a session only after validating a successful identity-provider response.
|
||||
3. Unauthenticated or invalid authentication responses do not grant access to protected operations.
|
||||
4. No signing algorithm, access-token lifetime, or latency value is fixed by this requirement; those values require approved security design evidence.
|
||||
|
||||
## FR-AUTH-002: Role-Based Access Control & RLS Scoping
|
||||
## FR-AUTH-002: Role-Based Authorization
|
||||
|
||||
- **Requirement ID:** `FR-AUTH-002`
|
||||
- **Parent Use Case:** `UC-001`
|
||||
- **Source Feature:** `BRD-FR-002`
|
||||
- **Source Feature:** `BRD-FR-040`
|
||||
- **Priority:** P0 (Must Have)
|
||||
- **Primary Surface:** Backend RBAC Middleware, PostgreSQL Database
|
||||
- **Primary Surface:** Authorization enforcement for protected business actions
|
||||
- **Business Rules:** Apply the permission matrix for the PRD-defined roles and enforce segregation of duties. Active tenant membership and tenant context are verified by `UC-019`; tenant resource isolation is governed by `UC-017` / `UC-020`.
|
||||
|
||||
### Statement
|
||||
The platform shall enforce granular Role-Based Access Control (RBAC) at the API route level and PostgreSQL Row-Level Security (RLS) at the database layer. For every authenticated request, the database session MUST have `app.current_tenant` initialized to prevent any cross-tenant query execution.
|
||||
|
||||
The platform shall authorize protected business actions according to the role-based permission matrix for `Tenant Administrator`, `Mandi Buyer`, `Purchase Manager`, `Yard Supervisor`, `Quality Officer`, `Sales Executive`, `Sales Manager`, `Logistics Coordinator`, `Accounts Executive`, `Partner / MD`, and `System Administrator`. The permission matrix shall cover `Read`, `Write`, `Create`, `Delete`, `Submit`, `Cancel`, and `Amend` actions. The platform shall enforce the stated segregation of duties: Quality Officers cannot edit prices; Yard Supervisors cannot confirm sales; Sales Executives cannot override credit locks.
|
||||
|
||||
### Acceptance Criteria
|
||||
1. Routes decorated with role requirements (e.g. `@require_roles("admin")`) MUST reject requests lacking the required role with HTTP 403 Forbidden.
|
||||
2. Direct SQL queries executed within a tenant session MUST NOT return or modify records belonging to other tenants.
|
||||
3. Super-admin operations spanning multiple tenants MUST require explicit elevated scope claims.
|
||||
|
||||
---
|
||||
1. Authorization decisions use the applicable role and resource/action permission from the permission matrix.
|
||||
2. An operation not permitted by that matrix is denied before the business action is performed.
|
||||
3. Quality Officers cannot edit prices, Yard Supervisors cannot confirm sales, and Sales Executives cannot override credit locks.
|
||||
4. A tenant administrator's authorization applies only within that administrator's verified tenant membership; tenant context checks are performed by `UC-019`.
|
||||
5. This requirement does not grant general cross-tenant access or bypass the resource-isolation controls in `UC-017` / `UC-020`.
|
||||
|
||||
## FR-AUTH-003: Session Monitoring & Token Revocation
|
||||
## FR-AUTH-003: Session Handling and Logout
|
||||
|
||||
- **Requirement ID:** `FR-AUTH-003`
|
||||
- **Parent Use Case:** `UC-001`
|
||||
- **Source Feature:** `BRD-FR-003`
|
||||
- **Priority:** P1 (High)
|
||||
- **Primary Surface:** Backend Auth Router, Token Cache
|
||||
- **Source Feature:** `new — not in BRD`
|
||||
- **Priority:** P0 (Must Have)
|
||||
- **Primary Surface:** Application session controls and authentication integration; endpoint contract in LLD
|
||||
- **Business Rules:** `BRD-NFR-009` requires session handling to be verified before production. The profile configures Keycloak OIDC and JWT bearer tokens.
|
||||
|
||||
### Source Justification
|
||||
|
||||
The PRD requires authentication and session handling verification in `BRD-NFR-009`, and the active profile configures the identity provider and token approach. The PRD does not prescribe a token blacklist, revocation latency, or specific logout endpoint.
|
||||
|
||||
### Statement
|
||||
The platform shall support instant user logout and token revocation. Revoked tokens and compromised sessions MUST be added to a distributed blacklist (Valkey/Redis) checked during token validation.
|
||||
|
||||
The platform shall provide a way for an authenticated user to end the application session and shall deny protected operations when no valid authenticated session is available.
|
||||
|
||||
### Acceptance Criteria
|
||||
1. Calling `/api/v1/auth/logout` with a valid refresh token MUST invalidate both access and refresh tokens.
|
||||
2. Blacklisted tokens MUST be rejected immediately on subsequent API calls within $\le 500\text{ ms}$ of revocation.
|
||||
3. An audit log entry (`AUDIT-AUTH-LOGOUT`) MUST be recorded with timestamp, user ID, and client IP.
|
||||
|
||||
1. An authenticated user can initiate logout and the application ends that user's active application session.
|
||||
2. After logout, the ended application session cannot be used to perform protected operations.
|
||||
3. Exact token invalidation semantics, server-side revocation mechanism, cache choice, and revocation timing are specified only if established by approved security design; they are not fixed by this requirement.
|
||||
4. Authentication/security evidence is included in the production verification required by `BRD-NFR-009`.
|
||||
|
|
|
|||
|
|
@ -1,67 +1,80 @@
|
|||
# UC-001: User Identity and Role Governance
|
||||
---
|
||||
id: UC-001
|
||||
version: 1.1.0
|
||||
status: Baselined
|
||||
last_cr: CR-001
|
||||
---
|
||||
|
||||
# UC-001 — User Authentication and Authorization
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| **Use Case ID** | `UC-001` |
|
||||
| **Name** | User Identity and Role Governance |
|
||||
| **Owning Domain** | Identity & Access Management (IAM) |
|
||||
| **Primary Actor** | End User / Tenant Administrator |
|
||||
| **Supporting Actors** | Keycloak OIDC Provider, PostgreSQL RLS Engine |
|
||||
| **Parent Feature** | `BRD-FR-001`, `BRD-FR-002`, `BRD-FR-003` |
|
||||
| **Name** | User Authentication and Authorization |
|
||||
| **Owning Domain** | Identity & Access Management |
|
||||
| **Primary Actor** | End User |
|
||||
| **Supporting Actors** | Tenant Administrator; Keycloak identity provider; tenant membership and context services (`UC-019`) |
|
||||
| **Parent Product Requirement** | `BRD-FR-040` (authorization); authentication and session handling are required by `BRD-NFR-009` and configured in `tech-profile.yaml` |
|
||||
| **Status** | Baselined |
|
||||
| **Version** | 1.0.0 |
|
||||
| **Last CR** | None (UP-AI v1.0 Baseline) |
|
||||
| **Version** | 1.1.0 |
|
||||
| **Last CR** | `CR-001` |
|
||||
|
||||
---
|
||||
## 1. Description and Business Goal
|
||||
|
||||
## 1. Description & Business Goal
|
||||
Authenticate a user through the configured OIDC provider and authorize business actions according to the role permissions and segregation-of-duties rules in `BRD-FR-040`. Authentication, session handling, and authorization must be verified before production release under `BRD-NFR-009`.
|
||||
|
||||
This use case governs multi-tenant user authentication, token issuance, role-based authorization (RBAC), and session revocation across all web portals and API services.
|
||||
|
||||
It guarantees that:
|
||||
1. All client authentication requests execute via secure OIDC Authorization Code Flow with PKCE.
|
||||
2. User sessions propagate verified `tenant_id` claims that bind database queries to the active tenant via PostgreSQL Row-Level Security (RLS).
|
||||
3. Access tokens and refresh tokens follow strict rotation policies and can be revoked on demand.
|
||||
|
||||
---
|
||||
Tenant membership, active-tenant selection, and verification for each operation are governed by `UC-019` / `BRD-FR-043`–`044`. Tenant data isolation and exceptional support access are governed by `UC-017` and `UC-020` / `BRD-FR-039`, `BRD-FR-041`, and `BRD-FR-045`–`046`. UC-001 consumes those controls and does not redefine them.
|
||||
|
||||
## 2. Preconditions
|
||||
|
||||
1. The target tenant organization is active and configured in Keycloak.
|
||||
2. The user has an active account with at least one assigned organizational role.
|
||||
3. The client application (e.g. Admin Portal or Customer Portal) is a registered OIDC client.
|
||||
1. The application is configured to use the identity provider and protocol declared in `tech-profile.yaml` (Keycloak with OIDC/PKCE and JWT bearer tokens).
|
||||
2. The user has an identity recognized by the configured identity provider.
|
||||
3. To access tenant business operations, the user has an active membership and approved role assignment in the selected tenant, as managed and verified by `UC-019`.
|
||||
|
||||
---
|
||||
## 3. Trigger
|
||||
|
||||
## 3. Main Success Scenario (Happy Path)
|
||||
The user attempts to sign in or invokes a protected business operation.
|
||||
|
||||
1. **Initiate Authentication:** The user accesses the web application and clicks "Login".
|
||||
2. **PKCE Challenge Generation:** The frontend client generates a cryptographic code verifier and code challenge, redirecting the browser to Keycloak's authorization endpoint.
|
||||
3. **User Authentication:** The user enters credentials (username/password or enterprise SSO). Keycloak validates credentials and issues an authorization code.
|
||||
4. **Token Exchange:** The frontend exchanges the authorization code and code verifier with Keycloak for a signed JWT access token, refresh token, and ID token containing `tenant_id` and `roles`.
|
||||
5. **Session Establishment:** The frontend initializes application state with user claims and tenant context.
|
||||
6. **API Invocation:** Subsequent API requests include the `Authorization: Bearer <token>` header. The backend gateway validates token signature, extracts tenant context, sets the PostgreSQL `app.current_tenant` session variable, and authorizes the endpoint via RBAC claims.
|
||||
## 4. Main Success Scenario
|
||||
|
||||
---
|
||||
1. The user initiates sign-in from the application.
|
||||
2. The application starts the configured OIDC authorization flow using PKCE.
|
||||
3. The identity provider authenticates the user and returns the OIDC authorization response.
|
||||
4. The application validates the response and establishes an authenticated session using the configured JWT bearer-token approach.
|
||||
5. When the user invokes a protected action, the application/server evaluates the action against the approved role permission matrix and segregation-of-duties controls in `BRD-FR-040`.
|
||||
6. For tenant-scoped actions, the service relies on `UC-019` to verify active membership, selected tenant context, and role for the request; resource isolation is enforced by `UC-017` / `UC-020`.
|
||||
7. The authorized action proceeds.
|
||||
|
||||
## 4. Alternate & Exception Scenarios
|
||||
## 5. Alternate and Exception Scenarios
|
||||
|
||||
- **4a. Expired Access Token:** The frontend intercepts a 401 response and uses the refresh token to silently obtain a fresh access token without user friction.
|
||||
- **4b. Invalid or Revoked Token:** If a token is blacklisted or revoked, the backend rejects the request with HTTP 401 `TOKEN_REVOKED`, and the frontend redirects to the login screen.
|
||||
- **4c. Insufficient Role Permissions (RBAC):** If the user's role does not permit the requested operation, the backend returns HTTP 403 `FORBIDDEN` with a structured error response.
|
||||
- **4d. Cross-Tenant Tampering:** If a request attempts to access data outside the token's `tenant_id`, PostgreSQL Row-Level Security silently filters or blocks the query, ensuring zero cross-tenant data leakage.
|
||||
- **5a. Identity provider rejects authentication or the OIDC response is invalid:** The application does not establish an authenticated session and denies protected access.
|
||||
- **5b. Session is absent, expired, or ended:** The application denies protected access and requires authentication again. Exact token lifetime and revocation implementation are design decisions, not requirements established by this CR.
|
||||
- **5c. User lacks permission for the action:** The service denies the action under the permission matrix. Examples of prohibited actions include Quality Officers editing prices, Yard Supervisors confirming sales, and Sales Executives overriding credit locks (`BRD-FR-040`).
|
||||
- **5d. User has no active membership or a client-supplied tenant context is not authorized:** The service denies the operation according to `UC-019` / `BRD-FR-043`–`044`.
|
||||
- **5e. A request targets another tenant's resource:** The service denies access without exposing that resource, according to `UC-017` / `UC-020` and `BRD-FR-039` / `BRD-FR-045`.
|
||||
|
||||
---
|
||||
## 6. Postconditions
|
||||
|
||||
## 5. Postconditions
|
||||
- On successful sign-in, the user has an authenticated application session.
|
||||
- Protected actions are allowed only after authorization under the role permissions and segregation-of-duties requirements.
|
||||
- Tenant context and resource isolation decisions remain governed by their owning use cases.
|
||||
- On denied authentication or authorization, no protected business action is performed.
|
||||
|
||||
- A secure, verified session is established with tenant scoping.
|
||||
- An immutable audit record (`AUDIT-AUTH-LOGIN`) is emitted.
|
||||
## 7. Referenced Screens and Routes
|
||||
|
||||
---
|
||||
- Application login screen (`/login`, as referenced by the existing auth delivery design).
|
||||
- Protected business screens invoke authenticated APIs; detailed routes and session/logout endpoints must be reconciled in the updated LLD.
|
||||
|
||||
## 6. Child Functional Requirements
|
||||
## 8. Business Rules Invoked
|
||||
|
||||
- [`FR-AUTH-001: Multi-Tenant OIDC PKCE Login`](functional-reqs.md#fr-auth-001)
|
||||
- [`FR-AUTH-002: Role-Based Access Control & RLS Scoping`](functional-reqs.md#fr-auth-002)
|
||||
- [`FR-AUTH-003: Session Monitoring & Token Revocation`](functional-reqs.md#fr-auth-003)
|
||||
- `BRD-FR-040`: role-based permissions for the PRD-defined roles; enforce the stated segregation-of-duties restrictions.
|
||||
- `BRD-NFR-009`: verify authentication, session handling, authorization, and applicable security controls before production release.
|
||||
- `tech-profile.yaml`: Keycloak, OIDC/PKCE, JWT bearer tokens, and RBAC/ABAC are the active technology configuration.
|
||||
- `UC-019` / `BRD-FR-043`–`044`: active membership and verified tenant context for each operation.
|
||||
- `UC-017` / `UC-020` / `BRD-FR-039`, `BRD-FR-045`–`046`: tenant data isolation and controlled support access.
|
||||
|
||||
## 9. Child Functional Requirements
|
||||
|
||||
- [FR-AUTH-001: OIDC Authentication](functional-reqs.md#fr-auth-001)
|
||||
- [FR-AUTH-002: Role-Based Authorization](functional-reqs.md#fr-auth-002)
|
||||
- [FR-AUTH-003: Session Handling and Logout](functional-reqs.md#fr-auth-003)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,53 @@
|
|||
---
|
||||
id: UC-002-FR
|
||||
version: 1.0.0
|
||||
status: Draft
|
||||
---
|
||||
|
||||
# Functional Requirements — UC-002 Record Daily Mandi Arrivals and Prices
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| **Parent Use Case** | `UC-002` |
|
||||
| **Status** | Draft |
|
||||
| **Version** | 1.0.0 |
|
||||
|
||||
## FR-MKT-001: Capture Daily Mandi Arrival Observations
|
||||
|
||||
- **Requirement ID:** `FR-MKT-001`
|
||||
- **Parent UC:** `UC-002`
|
||||
- **Source Feature:** `BRD-FR-001`
|
||||
- **Priority:** Must (P0)
|
||||
- **Referenced Screen / Route:** Market Desk daily observation entry and list (route TBD in Stage 11)
|
||||
- **Business Rules:** Observation date cannot be in the future; arrival quantity must be ≥ 0.0 MT; duplicate observations for the same market, commodity, variety, and date are blocked; when arrival data is unavailable due to a holiday or strike, the market can be flagged `Closed / Mandi Holiday`.
|
||||
|
||||
### Statement
|
||||
|
||||
The system shall allow an authorized Procurement Executive / Mandi Buyer to record a daily APMC mandi observation for a monitored market yard and commodity, including observation date, market yard, commodity, variety, grade, arrival quantity in MT, internal stock position in MT, observation source, and timestamp. The system shall reject future observation dates, negative arrival quantities, and duplicate observations with the same market, commodity, variety, and date. When arrival data is unavailable because of a holiday or strike, the system shall allow the actor to flag the market as `Closed / Mandi Holiday`.
|
||||
|
||||
### Acceptance Criteria
|
||||
|
||||
1. The saved observation contains all BRD-FR-001 data attributes: observation date, market yard, commodity, variety, grade, arrival quantity in MT, internal stock position in MT, observation source, and timestamp.
|
||||
2. The system rejects an observation date later than the current date.
|
||||
3. The system rejects arrival quantity below 0.0 MT and accepts 0.0 MT.
|
||||
4. The system blocks a second observation with the same market, commodity, variety, and date.
|
||||
5. The actor can record `Closed / Mandi Holiday` when arrival data is unavailable due to a holiday or strike, without supplying unavailable arrival data.
|
||||
|
||||
## FR-MKT-002: Capture Daily Mandi Price Range and Modal Rate
|
||||
|
||||
- **Requirement ID:** `FR-MKT-002`
|
||||
- **Parent UC:** `UC-002`
|
||||
- **Source Feature:** `BRD-FR-002`
|
||||
- **Priority:** Must (P0)
|
||||
- **Referenced Screen / Route:** Market Desk daily observation entry and list (route TBD in Stage 11)
|
||||
- **Business Rules:** All rates must be > 0; `Min Rate ≤ Modal Rate ≤ Max Rate`.
|
||||
|
||||
### Statement
|
||||
|
||||
For each daily mandi arrival observation, the system shall capture the quoted minimum and maximum rates and official modal clearing rate in ₹/Qtl. The system shall reject a save if any rate is not greater than zero or if the modal rate falls outside the inclusive minimum-to-maximum range, and shall identify the arithmetic constraint in its validation response.
|
||||
|
||||
### Acceptance Criteria
|
||||
|
||||
1. The observation captures minimum, maximum, and modal rates in ₹/Qtl.
|
||||
2. The system accepts rates only when all three values are greater than zero and `Min Rate ≤ Modal Rate ≤ Max Rate`.
|
||||
3. If the modal rate is outside the inclusive minimum-to-maximum range, the system rejects the save and reports the arithmetic constraint error.
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
---
|
||||
id: UC-002
|
||||
version: 1.0.0
|
||||
status: Draft
|
||||
---
|
||||
|
||||
# UC-002 — Record Daily Mandi Arrivals and Prices
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| **Use Case ID** | `UC-002` |
|
||||
| **Name** | Record Daily Mandi Arrivals and Prices |
|
||||
| **Owning Domain** | Market Desk |
|
||||
| **Primary Actor** | Procurement Executive / Mandi Buyer |
|
||||
| **Supporting Actors** | Purchase Manager |
|
||||
| **Source Features** | `BRD-FR-001`, `BRD-FR-002` |
|
||||
| **Status** | Draft |
|
||||
| **Version** | 1.0.0 |
|
||||
|
||||
## Goal
|
||||
|
||||
Record a daily mandi observation for a market, commodity, variety, and date, including arrival quantity and the quoted minimum, maximum, and modal prices, or record that the market is closed when arrival data is unavailable due to a holiday or strike.
|
||||
|
||||
## Preconditions
|
||||
|
||||
1. The actor is authenticated and authorized to record Market Desk observations for the active tenant.
|
||||
2. The market yard and commodity are within the monitored scope in `BRD-FR-001`.
|
||||
|
||||
## Trigger
|
||||
|
||||
The Procurement Executive / Mandi Buyer records the day's mandi arrival and price information, or reports that the market is closed because of a holiday or strike.
|
||||
|
||||
## Main Success Flow
|
||||
|
||||
1. The actor starts a daily observation and selects the observation date, market yard, commodity, variety, and grade.
|
||||
2. The actor enters arrival quantity in MT, internal stock position in MT, and observation source.
|
||||
3. The actor enters the quoted minimum rate, maximum rate, and modal clearing rate in ₹/Qtl.
|
||||
4. The system validates the observation date, arrival quantity, uniqueness key, and price constraints.
|
||||
5. The system records the observation with its timestamp and makes it available as a daily Market Desk record.
|
||||
|
||||
## Alternate Flows
|
||||
|
||||
- **A1 — Market closed:** If arrival data is unavailable because of a holiday or strike, the actor flags the market as `Closed / Mandi Holiday`; the system records the closure instead of requiring unavailable arrival and price values.
|
||||
|
||||
## Exception Flows
|
||||
|
||||
- **E1 — Future observation date:** The system rejects the observation because the date cannot be in the future.
|
||||
- **E2 — Negative arrival quantity:** The system rejects the observation because arrival quantity must be at least 0.0 MT.
|
||||
- **E3 — Duplicate observation:** The system blocks a duplicate for the same market, commodity, variety, and date.
|
||||
- **E4 — Invalid price range:** The system rejects the observation if any rate is not greater than zero or if `Min Rate ≤ Modal Rate ≤ Max Rate` is false, and reports the arithmetic constraint error.
|
||||
|
||||
## Postconditions
|
||||
|
||||
- On success, the daily observation is stored with its date, market, commodity, variety, grade, arrival quantity, internal stock position, observation source, timestamp, and price values.
|
||||
- On the market-closed alternate flow, the market closure is recorded for the observation date.
|
||||
- On a rejected flow, no invalid or duplicate observation is saved.
|
||||
|
||||
## Referenced Screens / Routes
|
||||
|
||||
- Market Desk daily observation entry and list — route to be specified during Stage 11 screen design.
|
||||
|
||||
## Business Rules Invoked
|
||||
|
||||
- `BRD-FR-001`: observation date is not in the future; arrival quantity is ≥ 0.0 MT; uniqueness by market, commodity, variety, and date; allow `Closed / Mandi Holiday` when data is unavailable due to holiday/strike.
|
||||
- `BRD-FR-002`: all rates are > 0 and `Min Rate ≤ Modal Rate ≤ Max Rate`.
|
||||
|
||||
## Child Functional Requirements
|
||||
|
||||
- [FR-MKT-001 — Capture Daily Mandi Arrival Observations](functional-reqs.md#fr-mkt-001)
|
||||
- [FR-MKT-002 — Capture Daily Mandi Price Range and Modal Rate](functional-reqs.md#fr-mkt-002)
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
---
|
||||
id: UC-003-FR
|
||||
version: 1.0.0
|
||||
status: Draft
|
||||
---
|
||||
|
||||
# Functional Requirements — UC-003 Mandi Price Trend Analytics
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| **Parent Use Case** | `UC-003` |
|
||||
| **Status** | Draft |
|
||||
| **Version** | 1.0.0 |
|
||||
|
||||
## FR-MARKETTRENDANALYTICS-001: Intraday Price Trend Analysis & 20-Day Benchmark Analytics
|
||||
|
||||
- **Requirement ID:** `FR-MARKETTRENDANALYTICS-001`
|
||||
- **Parent UC:** `UC-003`
|
||||
- **Source Feature:** `BRD-FR-003`
|
||||
- **Priority:** Must (P0)
|
||||
- **Referenced Screen / Route:** Market Desk workflow screen(s) — route(s) to be specified during Stage 11 screen design
|
||||
- **Business Rules:** Calculations must dynamically update upon new observation save. Execution time $\le 500\text{ms}$.
|
||||
|
||||
### Statement
|
||||
|
||||
The system must provide interactive visual charts and trend tables comparing the 20-day historical modal rate trend per commodity across markets, computing 20-day moving averages, 20-day highs/lows, and price velocity.
|
||||
|
||||
### Acceptance Criteria
|
||||
|
||||
1. The requirement records, computes, or presents the source-defined data attributes: Historical Date Range, Commodity Filter, Market Filter, 20-Day SMA (Simple Moving Average), Price Spread.
|
||||
2. The system enforces the source-defined validation rules: Calculations must dynamically update upon new observation save. Execution time $\le 500\text{ms}$.
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
---
|
||||
id: UC-003
|
||||
version: 1.0.0
|
||||
status: Draft
|
||||
---
|
||||
|
||||
# UC-003 — Mandi Price Trend Analytics
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| **Use Case ID** | `UC-003` |
|
||||
| **Name** | Mandi Price Trend Analytics |
|
||||
| **Owning Domain** | Market Desk |
|
||||
| **Primary Actor(s)** | Purchase Manager / Partner |
|
||||
| **Supporting Actor(s)** | Purchase Manager, Partner |
|
||||
| **Source Features** | `BRD-FR-003` |
|
||||
| **Status** | Draft |
|
||||
| **Version** | 1.0.0 |
|
||||
|
||||
## Goal
|
||||
|
||||
Review the historical modal-price movement for a selected commodity across markets.
|
||||
|
||||
## Preconditions
|
||||
|
||||
1. The actor is authenticated and has the role and tenant scope required by the source feature(s).
|
||||
2. Any source records or master data explicitly required by the selected feature are available and in the required state.
|
||||
|
||||
## Trigger
|
||||
|
||||
The actor initiates one of the 1 business operations covered by this use case: intraday price trend analysis & 20-day benchmark analytics.
|
||||
|
||||
## Main Success Flow
|
||||
|
||||
1. The actor initiates **Intraday Price Trend Analysis & 20-Day Benchmark Analytics**. The system performs the source-defined behavior: The system must provide interactive visual charts and trend tables comparing the 20-day historical modal rate trend per commodity across markets, computing 20-day moving averages, 20-day highs/lows, and price velocity.
|
||||
|
||||
## Alternate Flows
|
||||
|
||||
- No alternate business flow is specified by the source features.
|
||||
|
||||
## Exception Flows
|
||||
|
||||
- **BRD-FR-003:** Reject or prevent the operation when its stated validation rules are not met: Calculations must dynamically update upon new observation save. Execution time $\le 500\text{ms}$.
|
||||
|
||||
## Postconditions
|
||||
|
||||
- Successful operations create or update only the business records and outcomes stated in the linked BRD features.
|
||||
- Rejected operations do not bypass the validations and controls stated by those features.
|
||||
|
||||
## Referenced Screens / Routes
|
||||
|
||||
- Market Desk workflow screen(s) — route(s) to be specified during Stage 11 screen design
|
||||
|
||||
## Child Functional Requirements
|
||||
|
||||
- [FR-MARKETTRENDANALYTICS-001: Intraday Price Trend Analysis & 20-Day Benchmark Analytics](functional-reqs.md#fr-markettrendanalytics-001)
|
||||
|
|
@ -0,0 +1,94 @@
|
|||
---
|
||||
id: UC-004-FR
|
||||
version: 1.0.0
|
||||
status: Draft
|
||||
---
|
||||
|
||||
# Functional Requirements — UC-004 Purchase Sauda and Supplier Payables Setup
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| **Parent Use Case** | `UC-004` |
|
||||
| **Status** | Draft |
|
||||
| **Version** | 1.0.0 |
|
||||
|
||||
## FR-PROCUREMENTCONTRACTS-001: Procurement Price Variance Alert vs. Modal Rate
|
||||
|
||||
- **Requirement ID:** `FR-PROCUREMENTCONTRACTS-001`
|
||||
- **Parent UC:** `UC-004`
|
||||
- **Source Feature:** `BRD-FR-004`
|
||||
- **Priority:** Should (P1)
|
||||
- **Referenced Screen / Route:** Market Desk & Procurement workflow screen(s) — route(s) to be specified during Stage 11 screen design
|
||||
- **Business Rules:** Informational alert only; does not hard-block procurement unless configured in company policy.
|
||||
|
||||
---
|
||||
|
||||
### Statement
|
||||
|
||||
When booking a purchase sauda, the system must compare the offered trade rate against the latest modal clearing rate for that commodity/mandi. If the offered rate exceeds the modal rate by $>5\%$, the system must display an inline warning and require confirmation.
|
||||
|
||||
### Acceptance Criteria
|
||||
|
||||
1. The requirement records, computes, or presents the source-defined data attributes: Offered Rate, Benchmark Modal Rate, Variance \%.
|
||||
2. The system enforces the source-defined validation rules: Informational alert only; does not hard-block procurement unless configured in company policy.
|
||||
|
||||
---
|
||||
|
||||
## FR-PROCUREMENTCONTRACTS-002: Mandi Auction & Direct Purchase Sauda Booking
|
||||
|
||||
- **Requirement ID:** `FR-PROCUREMENTCONTRACTS-002`
|
||||
- **Parent UC:** `UC-004`
|
||||
- **Source Feature:** `BRD-FR-005`
|
||||
- **Priority:** Must (P0)
|
||||
- **Referenced Screen / Route:** Market Desk & Procurement workflow screen(s) — route(s) to be specified during Stage 11 screen design
|
||||
- **Business Rules:** Supplier must be an active master record. Booked MT must be $> 0$. Trade rate must be $> 0$. Gross value must equal $\text{Booked MT} \times 10 \times \text{Rate}$. Status remains `Partially Received` until cumulative received MT reaches booked MT (within tolerance) or explicitly closed by Purchase Manager.
|
||||
|
||||
### Statement
|
||||
|
||||
The system must record purchase contracts (*saudas*) negotiated in mandi auctions or directly with suppliers. Each sauda must capture supplier code, sourcing market, commodity, variety, trade rate (₹/Qtl), estimated bag count, and booked quantity in MT. The system must support multi-truck partial delivery: a sauda may be fulfilled across multiple trucks/GRNs over consecutive delivery days, tracking cumulative received MT and remaining balance MT until fully fulfilled.
|
||||
|
||||
### Acceptance Criteria
|
||||
|
||||
1. The requirement records, computes, or presents the source-defined data attributes: Sauda ID (`PUR-YYYYMM-xxx`), Sauda Date, Supplier ID, Sourcing Mandi, Commodity, Variety, Booked Qty MT, Estimated Bags, Trade Rate (₹/Qtl), Gross Value INR, Cumulative Received MT, Remaining Balance MT, Status.
|
||||
2. The system enforces the source-defined validation rules: Supplier must be an active master record. Booked MT must be $> 0$. Trade rate must be $> 0$. Gross value must equal $\text{Booked MT} \times 10 \times \text{Rate}$. Status remains `Partially Received` until cumulative received MT reaches booked MT (within tolerance) or explicitly closed by Purchase Manager.
|
||||
3. The system handles the source-defined failure condition as follows: If supplier is deactivated or blacklisted, booking must be blocked.
|
||||
|
||||
## FR-PROCUREMENTCONTRACTS-003: Supplier Credit Terms & Due Date Computation
|
||||
|
||||
- **Requirement ID:** `FR-PROCUREMENTCONTRACTS-003`
|
||||
- **Parent UC:** `UC-004`
|
||||
- **Source Feature:** `BRD-FR-006`
|
||||
- **Priority:** Must (P0)
|
||||
- **Referenced Screen / Route:** Market Desk & Procurement workflow screen(s) — route(s) to be specified during Stage 11 screen design
|
||||
- **Business Rules:** Default credit days inherited from Supplier master; editable only by Purchase Manager.
|
||||
|
||||
### Statement
|
||||
|
||||
The system must automatically compute the supplier payment due date by adding the supplier's contractual credit days (e.g., 7, 15, or 21 days) to the sauda or GRN receipt date.
|
||||
|
||||
### Acceptance Criteria
|
||||
|
||||
1. The requirement records, computes, or presents the source-defined data attributes: Supplier Credit Days, Transaction Date, Computed Due Date, Payment Status (`Pending`, `Paid`).
|
||||
2. The system enforces the source-defined validation rules: Default credit days inherited from Supplier master; editable only by Purchase Manager.
|
||||
|
||||
## FR-PROCUREMENTCONTRACTS-004: Mandi Cess & Statutory Levies Apportioning
|
||||
|
||||
- **Requirement ID:** `FR-PROCUREMENTCONTRACTS-004`
|
||||
- **Parent UC:** `UC-004`
|
||||
- **Source Feature:** `BRD-FR-007`
|
||||
- **Priority:** Should (P1)
|
||||
- **Referenced Screen / Route:** Market Desk & Procurement workflow screen(s) — route(s) to be specified during Stage 11 screen design
|
||||
- **Business Rules:** Configurable per commodity and market jurisdiction.
|
||||
|
||||
---
|
||||
|
||||
### Statement
|
||||
|
||||
The system must calculate statutory mandi cess (e.g., 1.5% APMC market fee + 0.2% Nirashrit fee) based on the gross sauda value and append it to the total procurement cost.
|
||||
|
||||
### Acceptance Criteria
|
||||
|
||||
1. The requirement records, computes, or presents the source-defined data attributes: Mandi Cess Rate %, Cess Amount INR, Total Landed Procurement Cost INR.
|
||||
2. The system enforces the source-defined validation rules: Configurable per commodity and market jurisdiction.
|
||||
|
||||
---
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
---
|
||||
id: UC-004
|
||||
version: 1.0.0
|
||||
status: Draft
|
||||
---
|
||||
|
||||
# UC-004 — Purchase Sauda and Supplier Payables Setup
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| **Use Case ID** | `UC-004` |
|
||||
| **Name** | Purchase Sauda and Supplier Payables Setup |
|
||||
| **Owning Domain** | Market Desk & Procurement |
|
||||
| **Primary Actor(s)** | Procurement Executive / Purchase Manager / Accounts Executive |
|
||||
| **Supporting Actor(s)** | Purchase Manager, Procurement Executive, Accounts Executive |
|
||||
| **Source Features** | `BRD-FR-004`, `BRD-FR-005`, `BRD-FR-006`, `BRD-FR-007` |
|
||||
| **Status** | Draft |
|
||||
| **Version** | 1.0.0 |
|
||||
|
||||
## Goal
|
||||
|
||||
Record and manage mandi or direct purchase commitments, including benchmark comparison and the related supplier due-date and levy calculations.
|
||||
|
||||
## Preconditions
|
||||
|
||||
1. The actor is authenticated and has the role and tenant scope required by the source feature(s).
|
||||
2. Any source records or master data explicitly required by the selected feature are available and in the required state.
|
||||
|
||||
## Trigger
|
||||
|
||||
The actor initiates one of the 4 business operations covered by this use case: procurement price variance alert vs. modal rate; mandi auction & direct purchase sauda booking; supplier credit terms & due date computation; mandi cess & statutory levies apportioning.
|
||||
|
||||
## Main Success Flow
|
||||
|
||||
1. The actor initiates **Procurement Price Variance Alert vs. Modal Rate**. The system performs the source-defined behavior: When booking a purchase sauda, the system must compare the offered trade rate against the latest modal clearing rate for that commodity/mandi. If the offered rate exceeds the modal rate by $>5\%$, the system must display an inline warning and require confirmation.
|
||||
2. The actor initiates **Mandi Auction & Direct Purchase Sauda Booking**. The system performs the source-defined behavior: The system must record purchase contracts (*saudas*) negotiated in mandi auctions or directly with suppliers. Each sauda must capture supplier code, sourcing market, commodity, variety, trade rate (₹/Qtl), estimated bag count, and booked quantity in MT. The system must support multi-truck partial delivery: a sauda may be fulfilled across multiple trucks/GRNs over consecutive delivery days, tracking cumulative received MT and remaining balance MT until fully fulfilled.
|
||||
3. The actor initiates **Supplier Credit Terms & Due Date Computation**. The system performs the source-defined behavior: The system must automatically compute the supplier payment due date by adding the supplier's contractual credit days (e.g., 7, 15, or 21 days) to the sauda or GRN receipt date.
|
||||
4. The actor initiates **Mandi Cess & Statutory Levies Apportioning**. The system performs the source-defined behavior: The system must calculate statutory mandi cess (e.g., 1.5% APMC market fee + 0.2% Nirashrit fee) based on the gross sauda value and append it to the total procurement cost.
|
||||
|
||||
## Alternate Flows
|
||||
|
||||
- **BRD-FR-005 — Mandi Auction & Direct Purchase Sauda Booking:** If supplier is deactivated or blacklisted, booking must be blocked.
|
||||
|
||||
## Exception Flows
|
||||
|
||||
- **BRD-FR-004:** Reject or prevent the operation when its stated validation rules are not met: Informational alert only; does not hard-block procurement unless configured in company policy.
|
||||
|
||||
---
|
||||
- **BRD-FR-005:** Reject or prevent the operation when its stated validation rules are not met: Supplier must be an active master record. Booked MT must be $> 0$. Trade rate must be $> 0$. Gross value must equal $\text{Booked MT} \times 10 \times \text{Rate}$. Status remains `Partially Received` until cumulative received MT reaches booked MT (within tolerance) or explicitly closed by Purchase Manager.
|
||||
- **BRD-FR-006:** Reject or prevent the operation when its stated validation rules are not met: Default credit days inherited from Supplier master; editable only by Purchase Manager.
|
||||
- **BRD-FR-007:** Reject or prevent the operation when its stated validation rules are not met: Configurable per commodity and market jurisdiction.
|
||||
|
||||
---
|
||||
|
||||
## Postconditions
|
||||
|
||||
- Successful operations create or update only the business records and outcomes stated in the linked BRD features.
|
||||
- Rejected operations do not bypass the validations and controls stated by those features.
|
||||
|
||||
## Referenced Screens / Routes
|
||||
|
||||
- Market Desk & Procurement workflow screen(s) — route(s) to be specified during Stage 11 screen design
|
||||
|
||||
## Child Functional Requirements
|
||||
|
||||
- [FR-PROCUREMENTCONTRACTS-001: Procurement Price Variance Alert vs. Modal Rate](functional-reqs.md#fr-procurementcontracts-001)
|
||||
- [FR-PROCUREMENTCONTRACTS-002: Mandi Auction & Direct Purchase Sauda Booking](functional-reqs.md#fr-procurementcontracts-002)
|
||||
- [FR-PROCUREMENTCONTRACTS-003: Supplier Credit Terms & Due Date Computation](functional-reqs.md#fr-procurementcontracts-003)
|
||||
- [FR-PROCUREMENTCONTRACTS-004: Mandi Cess & Statutory Levies Apportioning](functional-reqs.md#fr-procurementcontracts-004)
|
||||
|
|
@ -0,0 +1,126 @@
|
|||
---
|
||||
id: UC-005-FR
|
||||
version: 1.0.0
|
||||
status: Draft
|
||||
---
|
||||
|
||||
# Functional Requirements — UC-005 Inward Vehicle Receiving and Goods Receipt
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| **Parent Use Case** | `UC-005` |
|
||||
| **Status** | Draft |
|
||||
| **Version** | 1.0.0 |
|
||||
|
||||
## FR-INWARDRECEIVING-001: Inward Vehicle Gate Entry & Verification
|
||||
|
||||
- **Requirement ID:** `FR-INWARDRECEIVING-001`
|
||||
- **Parent UC:** `UC-005`
|
||||
- **Source Feature:** `BRD-FR-008`
|
||||
- **Priority:** Must (P0)
|
||||
- **Referenced Screen / Route:** Goods Receipt workflow screen(s) — route(s) to be specified during Stage 11 screen design
|
||||
- **Business Rules:** Linked sauda must be in state `Booked`.
|
||||
|
||||
### Statement
|
||||
|
||||
Upon vehicle arrival at the godown, the Yard Supervisor must log gate entry linking the vehicle registration number and driver details to an active booked sauda.
|
||||
|
||||
### Acceptance Criteria
|
||||
|
||||
1. The requirement records, computes, or presents the source-defined data attributes: Gate Entry ID, Inward Date/Time, Vehicle Reg No, Driver Name, Contact No, Linked Sauda ID, Supplier Name, Gate Pass No.
|
||||
2. The system enforces the source-defined validation rules: Linked sauda must be in state `Booked`.
|
||||
|
||||
## FR-INWARDRECEIVING-002: Weighbridge Gross & Tare Weighment Logging
|
||||
|
||||
- **Requirement ID:** `FR-INWARDRECEIVING-002`
|
||||
- **Parent UC:** `UC-005`
|
||||
- **Source Feature:** `BRD-FR-009`
|
||||
- **Priority:** Must (P0)
|
||||
- **Referenced Screen / Route:** Goods Receipt workflow screen(s) — route(s) to be specified during Stage 11 screen design
|
||||
- **Business Rules:** $\text{Gross Weight} > \text{Tare Weight} > 0$. Weighbridge slip number mandatory.
|
||||
|
||||
### Statement
|
||||
|
||||
The system must record dual-phase weighbridge measurements for incoming trucks: (1) Gross Weighment (truck + commodity) upon arrival, and (2) Tare Weighment (empty truck) after unloading.
|
||||
|
||||
### Acceptance Criteria
|
||||
|
||||
1. The requirement records, computes, or presents the source-defined data attributes: Gross Weight kg, Gross Timestamp, Tare Weight kg, Tare Timestamp, Gross Net Weight kg ($Gross - Tare$), Weighbridge Slip No.
|
||||
2. The system enforces the source-defined validation rules: $\text{Gross Weight} > \text{Tare Weight} > 0$. Weighbridge slip number mandatory.
|
||||
3. The system handles the source-defined failure condition as follows: If Tare Weight $\ge$ Gross Weight, system must hard-block submission with an error.
|
||||
|
||||
## FR-INWARDRECEIVING-003: Bag Tare Deduction (*Bardana Katai*) & Final Net MT
|
||||
|
||||
- **Requirement ID:** `FR-INWARDRECEIVING-003`
|
||||
- **Parent UC:** `UC-005`
|
||||
- **Source Feature:** `BRD-FR-010`
|
||||
- **Priority:** Must (P0)
|
||||
- **Referenced Screen / Route:** Goods Receipt workflow screen(s) — route(s) to be specified during Stage 11 screen design
|
||||
- **Business Rules:** Formula: $\text{Net MT} = (\text{Gross kg} - \text{Tare kg} - (\text{Bags} \times \text{Bag Tare Rate})) / 1000$. Net MT must be $> 0$.
|
||||
|
||||
### Statement
|
||||
|
||||
The system must deduct the weight of packaging bags from the gross commodity weight using the defined tare deduction factor (default 1.0 kg/gunny bag) to calculate true Net Payable MT.
|
||||
|
||||
### Acceptance Criteria
|
||||
|
||||
1. The requirement records, computes, or presents the source-defined data attributes: Physical Bag Count, Packaging Type (`Gunny/Jute`, `HDPE/Plastic`), Bag Tare Deduction Rate kg/bag, Total Bag Tare kg, Final Net Weight MT.
|
||||
2. The system enforces the source-defined validation rules: Formula: $\text{Net MT} = (\text{Gross kg} - \text{Tare kg} - (\text{Bags} \times \text{Bag Tare Rate})) / 1000$. Net MT must be $> 0$.
|
||||
|
||||
## FR-INWARDRECEIVING-004: Weighment Tolerance & Transit Shortage Verification
|
||||
|
||||
- **Requirement ID:** `FR-INWARDRECEIVING-004`
|
||||
- **Parent UC:** `UC-005`
|
||||
- **Source Feature:** `BRD-FR-011`
|
||||
- **Priority:** Must (P0)
|
||||
- **Referenced Screen / Route:** Goods Receipt workflow screen(s) — route(s) to be specified during Stage 11 screen design
|
||||
- **Business Rules:** If shortage exceeds $2.0\%$, the GRN requires mandatory Purchase Manager approval before stock posting.
|
||||
|
||||
### Statement
|
||||
|
||||
The system must compare the Final Net Weighbridge MT against the Booked Sauda MT. If shortage exceeds $0.5\%$, the system must flag a `Transit Shortage Warning` and adjust the final payable amount to the actual net received weight.
|
||||
|
||||
### Acceptance Criteria
|
||||
|
||||
1. The requirement records, computes, or presents the source-defined data attributes: Shortage MT, Shortage Value INR, Variance \%, Shortage Status (`Normal`, `Disputed`).
|
||||
2. The system enforces the source-defined validation rules: If shortage exceeds $2.0\%$, the GRN requires mandatory Purchase Manager approval before stock posting.
|
||||
|
||||
## FR-INWARDRECEIVING-005: Goods Receipt Note (GRN) Posting & Warehouse Stack Placement
|
||||
|
||||
- **Requirement ID:** `FR-INWARDRECEIVING-005`
|
||||
- **Parent UC:** `UC-005`
|
||||
- **Source Feature:** `BRD-FR-012`
|
||||
- **Priority:** Must (P0)
|
||||
- **Referenced Screen / Route:** Goods Receipt workflow screen(s) — route(s) to be specified during Stage 11 screen design
|
||||
- **Business Rules:** GRN submission atomically updates inventory and creates Lot record in state `Under QC`.
|
||||
|
||||
---
|
||||
|
||||
### Statement
|
||||
|
||||
Upon weighment completion, the system must generate a formal GRN document, allocate the physical goods to a specific warehouse/godown and stack location, credit the warehouse stock book, and mint an inward Commodity Lot.
|
||||
|
||||
### Acceptance Criteria
|
||||
|
||||
1. The requirement records, computes, or presents the source-defined data attributes: GRN ID (`GRN-YYYYMM-xxx`), Receiving Warehouse ID, Stack/Chamber No, Accepted Bags, Accepted Net MT.
|
||||
2. The system enforces the source-defined validation rules: GRN submission atomically updates inventory and creates Lot record in state `Under QC`.
|
||||
|
||||
---
|
||||
|
||||
## FR-INWARDRECEIVING-006: Mandatory Lot & Batch Identity Generation
|
||||
|
||||
- **Requirement ID:** `FR-INWARDRECEIVING-006`
|
||||
- **Parent UC:** `UC-005`
|
||||
- **Source Feature:** `BRD-FR-013`
|
||||
- **Priority:** Must (P0)
|
||||
- **Referenced Screen / Route:** Goods Receipt workflow screen(s) — route(s) to be specified during Stage 11 screen design
|
||||
- **Business Rules:** Initial status must be `Under QC`. Lot ID must be permanent and traceable through all sales and dispatches.
|
||||
|
||||
### Statement
|
||||
|
||||
The system must automatically generate a globally unique, immutable Lot ID (`LOT-YYYYMM-xxx`) for every inward consignment processed through a GRN.
|
||||
|
||||
### Acceptance Criteria
|
||||
|
||||
1. The requirement records, computes, or presents the source-defined data attributes: Lot ID, Inward Date, Origin Market, Supplier ID, Commodity, Variety, Receiving Warehouse, Net MT, Bag Count, Quality Status.
|
||||
2. The system enforces the source-defined validation rules: Initial status must be `Under QC`. Lot ID must be permanent and traceable through all sales and dispatches.
|
||||
|
|
@ -0,0 +1,73 @@
|
|||
---
|
||||
id: UC-005
|
||||
version: 1.0.0
|
||||
status: Draft
|
||||
---
|
||||
|
||||
# UC-005 — Inward Vehicle Receiving and Goods Receipt
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| **Use Case ID** | `UC-005` |
|
||||
| **Name** | Inward Vehicle Receiving and Goods Receipt |
|
||||
| **Owning Domain** | Goods Receipt |
|
||||
| **Primary Actor(s)** | Yard Supervisor / Purchase Manager |
|
||||
| **Supporting Actor(s)** | Yard Supervisor, Purchase Manager, Quality Officer |
|
||||
| **Source Features** | `BRD-FR-008`, `BRD-FR-009`, `BRD-FR-010`, `BRD-FR-011`, `BRD-FR-012`, `BRD-FR-013` |
|
||||
| **Status** | Draft |
|
||||
| **Version** | 1.0.0 |
|
||||
|
||||
## Goal
|
||||
|
||||
Receive a truck against a booked sauda, capture weighment, calculate accepted quantity, post the GRN, and establish the inward lot.
|
||||
|
||||
## Preconditions
|
||||
|
||||
1. The actor is authenticated and has the role and tenant scope required by the source feature(s).
|
||||
2. Any source records or master data explicitly required by the selected feature are available and in the required state.
|
||||
|
||||
## Trigger
|
||||
|
||||
The actor initiates one of the 6 business operations covered by this use case: inward vehicle gate entry & verification; weighbridge gross & tare weighment logging; bag tare deduction (*bardana katai*) & final net mt; weighment tolerance & transit shortage verification; goods receipt note (grn) posting & warehouse stack placement; mandatory lot & batch identity generation.
|
||||
|
||||
## Main Success Flow
|
||||
|
||||
1. The actor initiates **Inward Vehicle Gate Entry & Verification**. The system performs the source-defined behavior: Upon vehicle arrival at the godown, the Yard Supervisor must log gate entry linking the vehicle registration number and driver details to an active booked sauda.
|
||||
2. The actor initiates **Weighbridge Gross & Tare Weighment Logging**. The system performs the source-defined behavior: The system must record dual-phase weighbridge measurements for incoming trucks: (1) Gross Weighment (truck + commodity) upon arrival, and (2) Tare Weighment (empty truck) after unloading.
|
||||
3. The actor initiates **Bag Tare Deduction (*Bardana Katai*) & Final Net MT**. The system performs the source-defined behavior: The system must deduct the weight of packaging bags from the gross commodity weight using the defined tare deduction factor (default 1.0 kg/gunny bag) to calculate true Net Payable MT.
|
||||
4. The actor initiates **Weighment Tolerance & Transit Shortage Verification**. The system performs the source-defined behavior: The system must compare the Final Net Weighbridge MT against the Booked Sauda MT. If shortage exceeds $0.5\%$, the system must flag a `Transit Shortage Warning` and adjust the final payable amount to the actual net received weight.
|
||||
5. The actor initiates **Goods Receipt Note (GRN) Posting & Warehouse Stack Placement**. The system performs the source-defined behavior: Upon weighment completion, the system must generate a formal GRN document, allocate the physical goods to a specific warehouse/godown and stack location, credit the warehouse stock book, and mint an inward Commodity Lot.
|
||||
6. The actor initiates **Mandatory Lot & Batch Identity Generation**. The system performs the source-defined behavior: The system must automatically generate a globally unique, immutable Lot ID (`LOT-YYYYMM-xxx`) for every inward consignment processed through a GRN.
|
||||
|
||||
## Alternate Flows
|
||||
|
||||
- **BRD-FR-009 — Weighbridge Gross & Tare Weighment Logging:** If Tare Weight $\ge$ Gross Weight, system must hard-block submission with an error.
|
||||
|
||||
## Exception Flows
|
||||
|
||||
- **BRD-FR-008:** Reject or prevent the operation when its stated validation rules are not met: Linked sauda must be in state `Booked`.
|
||||
- **BRD-FR-009:** Reject or prevent the operation when its stated validation rules are not met: $\text{Gross Weight} > \text{Tare Weight} > 0$. Weighbridge slip number mandatory.
|
||||
- **BRD-FR-010:** Reject or prevent the operation when its stated validation rules are not met: Formula: $\text{Net MT} = (\text{Gross kg} - \text{Tare kg} - (\text{Bags} \times \text{Bag Tare Rate})) / 1000$. Net MT must be $> 0$.
|
||||
- **BRD-FR-011:** Reject or prevent the operation when its stated validation rules are not met: If shortage exceeds $2.0\%$, the GRN requires mandatory Purchase Manager approval before stock posting.
|
||||
- **BRD-FR-012:** Reject or prevent the operation when its stated validation rules are not met: GRN submission atomically updates inventory and creates Lot record in state `Under QC`.
|
||||
|
||||
---
|
||||
- **BRD-FR-013:** Reject or prevent the operation when its stated validation rules are not met: Initial status must be `Under QC`. Lot ID must be permanent and traceable through all sales and dispatches.
|
||||
|
||||
## Postconditions
|
||||
|
||||
- Successful operations create or update only the business records and outcomes stated in the linked BRD features.
|
||||
- Rejected operations do not bypass the validations and controls stated by those features.
|
||||
|
||||
## Referenced Screens / Routes
|
||||
|
||||
- Goods Receipt workflow screen(s) — route(s) to be specified during Stage 11 screen design
|
||||
|
||||
## Child Functional Requirements
|
||||
|
||||
- [FR-INWARDRECEIVING-001: Inward Vehicle Gate Entry & Verification](functional-reqs.md#fr-inwardreceiving-001)
|
||||
- [FR-INWARDRECEIVING-002: Weighbridge Gross & Tare Weighment Logging](functional-reqs.md#fr-inwardreceiving-002)
|
||||
- [FR-INWARDRECEIVING-003: Bag Tare Deduction (*Bardana Katai*) & Final Net MT](functional-reqs.md#fr-inwardreceiving-003)
|
||||
- [FR-INWARDRECEIVING-004: Weighment Tolerance & Transit Shortage Verification](functional-reqs.md#fr-inwardreceiving-004)
|
||||
- [FR-INWARDRECEIVING-005: Goods Receipt Note (GRN) Posting & Warehouse Stack Placement](functional-reqs.md#fr-inwardreceiving-005)
|
||||
- [FR-INWARDRECEIVING-006: Mandatory Lot & Batch Identity Generation](functional-reqs.md#fr-inwardreceiving-006)
|
||||
|
|
@ -0,0 +1,89 @@
|
|||
---
|
||||
id: UC-006-FR
|
||||
version: 1.0.0
|
||||
status: Draft
|
||||
---
|
||||
|
||||
# Functional Requirements — UC-006 Inward Quality Inspection and Lot Control
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| **Parent Use Case** | `UC-006` |
|
||||
| **Status** | Draft |
|
||||
| **Version** | 1.0.0 |
|
||||
|
||||
## FR-QUALITYANDLOTCONTROL-001: Inward Quality Inspection Parameter Recording
|
||||
|
||||
- **Requirement ID:** `FR-QUALITYANDLOTCONTROL-001`
|
||||
- **Parent UC:** `UC-006`
|
||||
- **Source Feature:** `BRD-FR-014`
|
||||
- **Priority:** Must (P0)
|
||||
- **Referenced Screen / Route:** Quality Control workflow screen(s) — route(s) to be specified during Stage 11 screen design
|
||||
- **Business Rules:** Percentage values must be between $0.00\%$ and $100.00\%$.
|
||||
|
||||
### Statement
|
||||
|
||||
The Quality Officer must log laboratory/physical test parameters for the lot: Moisture %, Foreign Matter / Dust %, Admixture (other grains) %, Damaged / Discolored %, and Weevil count.
|
||||
|
||||
### Acceptance Criteria
|
||||
|
||||
1. The requirement records, computes, or presents the source-defined data attributes: Inspection Date, Quality Officer ID, Moisture %, Foreign Matter %, Admixture %, Damaged %, Weevil Infestation (`None`, `Mild`, `Severe`), Assigned Commercial Grade (`FAQ`, `Premium`, `Below FAQ`).
|
||||
2. The system enforces the source-defined validation rules: Percentage values must be between $0.00\%$ and $100.00\%$.
|
||||
|
||||
## FR-QUALITYANDLOTCONTROL-002: Quality Deduction / Rebate Calculation
|
||||
|
||||
- **Requirement ID:** `FR-QUALITYANDLOTCONTROL-002`
|
||||
- **Parent UC:** `UC-006`
|
||||
- **Source Feature:** `BRD-FR-015`
|
||||
- **Priority:** Should (P1)
|
||||
- **Referenced Screen / Route:** Quality Control workflow screen(s) — route(s) to be specified during Stage 11 screen design
|
||||
- **Business Rules:** Deductions cannot reduce rate below 50% of base rate without partner authorization.
|
||||
|
||||
### Statement
|
||||
|
||||
If moisture or foreign matter exceeds standard contract baselines (e.g., standard moisture baseline 10.0%), the system must automatically compute a quality price deduction (e.g., ₹10 deduction per quintal for each 0.5% moisture above baseline).
|
||||
|
||||
### Acceptance Criteria
|
||||
|
||||
1. The requirement records, computes, or presents the source-defined data attributes: Base Contract Rate ₹/Qtl, Quality Penalty Rate ₹/Qtl, Adjusted Final Rate ₹/Qtl, Net Purchase Adjustment INR.
|
||||
2. The system enforces the source-defined validation rules: Deductions cannot reduce rate below 50% of base rate without partner authorization.
|
||||
|
||||
## FR-QUALITYANDLOTCONTROL-003: Finite State Machine Enforcement for `QC Hold` vs. `Released`
|
||||
|
||||
- **Requirement ID:** `FR-QUALITYANDLOTCONTROL-003`
|
||||
- **Parent UC:** `UC-006`
|
||||
- **Source Feature:** `BRD-FR-016`
|
||||
- **Priority:** Must (P0)
|
||||
- **Referenced Screen / Route:** Quality Control workflow screen(s) — route(s) to be specified during Stage 11 screen design
|
||||
- **Business Rules:** Only users with `Quality Officer` or `Partner` roles can transition a lot from `QC Hold` to `Released`. System must hard-block dispatch of unreleased lots.
|
||||
|
||||
### Statement
|
||||
|
||||
The system must enforce strict FSM transitions on the Lot record. If moisture $>12\%$ or foreign matter $>2\%$, the lot must be transitioned to `QC Hold`. A lot on `QC Hold` is programmatically blocked from sales order allocation and dispatch loading.
|
||||
|
||||
### Acceptance Criteria
|
||||
|
||||
1. The requirement records, computes, or presents the source-defined data attributes: Previous Status, New Status (`QC Hold`, `Released`), Hold Reason, Action Plan (`Drying`, `Cleaning`, `Re-testing`), Release Timestamp.
|
||||
2. The system enforces the source-defined validation rules: Only users with `Quality Officer` or `Partner` roles can transition a lot from `QC Hold` to `Released`. System must hard-block dispatch of unreleased lots.
|
||||
|
||||
## FR-QUALITYANDLOTCONTROL-004: Lot Splitting & Blending Traceability
|
||||
|
||||
- **Requirement ID:** `FR-QUALITYANDLOTCONTROL-004`
|
||||
- **Parent UC:** `UC-006`
|
||||
- **Source Feature:** `BRD-FR-017`
|
||||
- **Priority:** Should (P1)
|
||||
- **Referenced Screen / Route:** Quality Control workflow screen(s) — route(s) to be specified during Stage 11 screen design
|
||||
- **Business Rules:** Sum of child lot quantities must exactly equal parent quantity deducted.
|
||||
|
||||
---
|
||||
|
||||
### Statement
|
||||
|
||||
The system must support splitting a parent lot into sub-lots (e.g., when dividing a consignment across two warehouses) or blending multiple lots, maintaining parent-child lineage in the traceability graph.
|
||||
|
||||
### Acceptance Criteria
|
||||
|
||||
1. The requirement records, computes, or presents the source-defined data attributes: Parent Lot ID, Child Lot ID(s), Split Qty MT, Split Bag Count, Linage Tree.
|
||||
2. The system enforces the source-defined validation rules: Sum of child lot quantities must exactly equal parent quantity deducted.
|
||||
|
||||
---
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
---
|
||||
id: UC-006
|
||||
version: 1.0.0
|
||||
status: Draft
|
||||
---
|
||||
|
||||
# UC-006 — Inward Quality Inspection and Lot Control
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| **Use Case ID** | `UC-006` |
|
||||
| **Name** | Inward Quality Inspection and Lot Control |
|
||||
| **Owning Domain** | Quality Control |
|
||||
| **Primary Actor(s)** | Quality Officer / Yard Supervisor / Accounts Executive |
|
||||
| **Supporting Actor(s)** | Quality Officer, Accounts Executive, Yard Supervisor |
|
||||
| **Source Features** | `BRD-FR-014`, `BRD-FR-015`, `BRD-FR-016`, `BRD-FR-017` |
|
||||
| **Status** | Draft |
|
||||
| **Version** | 1.0.0 |
|
||||
|
||||
## Goal
|
||||
|
||||
Inspect an inward lot, apply contract quality treatment, control its release state, and retain lot lineage through approved splitting or blending.
|
||||
|
||||
## Preconditions
|
||||
|
||||
1. The actor is authenticated and has the role and tenant scope required by the source feature(s).
|
||||
2. Any source records or master data explicitly required by the selected feature are available and in the required state.
|
||||
|
||||
## Trigger
|
||||
|
||||
The actor initiates one of the 4 business operations covered by this use case: inward quality inspection parameter recording; quality deduction / rebate calculation; finite state machine enforcement for `qc hold` vs. `released`; lot splitting & blending traceability.
|
||||
|
||||
## Main Success Flow
|
||||
|
||||
1. The actor initiates **Inward Quality Inspection Parameter Recording**. The system performs the source-defined behavior: The Quality Officer must log laboratory/physical test parameters for the lot: Moisture %, Foreign Matter / Dust %, Admixture (other grains) %, Damaged / Discolored %, and Weevil count.
|
||||
2. The actor initiates **Quality Deduction / Rebate Calculation**. The system performs the source-defined behavior: If moisture or foreign matter exceeds standard contract baselines (e.g., standard moisture baseline 10.0%), the system must automatically compute a quality price deduction (e.g., ₹10 deduction per quintal for each 0.5% moisture above baseline).
|
||||
3. The actor initiates **Finite State Machine Enforcement for `QC Hold` vs. `Released`**. The system performs the source-defined behavior: The system must enforce strict FSM transitions on the Lot record. If moisture $>12\%$ or foreign matter $>2\%$, the lot must be transitioned to `QC Hold`. A lot on `QC Hold` is programmatically blocked from sales order allocation and dispatch loading.
|
||||
4. The actor initiates **Lot Splitting & Blending Traceability**. The system performs the source-defined behavior: The system must support splitting a parent lot into sub-lots (e.g., when dividing a consignment across two warehouses) or blending multiple lots, maintaining parent-child lineage in the traceability graph.
|
||||
|
||||
## Alternate Flows
|
||||
|
||||
- No alternate business flow is specified by the source features.
|
||||
|
||||
## Exception Flows
|
||||
|
||||
- **BRD-FR-014:** Reject or prevent the operation when its stated validation rules are not met: Percentage values must be between $0.00\%$ and $100.00\%$.
|
||||
- **BRD-FR-015:** Reject or prevent the operation when its stated validation rules are not met: Deductions cannot reduce rate below 50% of base rate without partner authorization.
|
||||
- **BRD-FR-016:** Reject or prevent the operation when its stated validation rules are not met: Only users with `Quality Officer` or `Partner` roles can transition a lot from `QC Hold` to `Released`. System must hard-block dispatch of unreleased lots.
|
||||
- **BRD-FR-017:** Reject or prevent the operation when its stated validation rules are not met: Sum of child lot quantities must exactly equal parent quantity deducted.
|
||||
|
||||
---
|
||||
|
||||
## Postconditions
|
||||
|
||||
- Successful operations create or update only the business records and outcomes stated in the linked BRD features.
|
||||
- Rejected operations do not bypass the validations and controls stated by those features.
|
||||
|
||||
## Referenced Screens / Routes
|
||||
|
||||
- Quality Control workflow screen(s) — route(s) to be specified during Stage 11 screen design
|
||||
|
||||
## Child Functional Requirements
|
||||
|
||||
- [FR-QUALITYANDLOTCONTROL-001: Inward Quality Inspection Parameter Recording](functional-reqs.md#fr-qualityandlotcontrol-001)
|
||||
- [FR-QUALITYANDLOTCONTROL-002: Quality Deduction / Rebate Calculation](functional-reqs.md#fr-qualityandlotcontrol-002)
|
||||
- [FR-QUALITYANDLOTCONTROL-003: Finite State Machine Enforcement for `QC Hold` vs. `Released`](functional-reqs.md#fr-qualityandlotcontrol-003)
|
||||
- [FR-QUALITYANDLOTCONTROL-004: Lot Splitting & Blending Traceability](functional-reqs.md#fr-qualityandlotcontrol-004)
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
---
|
||||
id: UC-007-FR
|
||||
version: 1.0.0
|
||||
status: Draft
|
||||
---
|
||||
|
||||
# Functional Requirements — UC-007 Warehouse Stock, Audit, Capacity and Transfer
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| **Parent Use Case** | `UC-007` |
|
||||
| **Status** | Draft |
|
||||
| **Version** | 1.0.0 |
|
||||
|
||||
## FR-WAREHOUSEINVENTORY-001: Multi-Godown Dual-Unit Stock Ledger
|
||||
|
||||
- **Requirement ID:** `FR-WAREHOUSEINVENTORY-001`
|
||||
- **Parent UC:** `UC-007`
|
||||
- **Source Feature:** `BRD-FR-018`
|
||||
- **Priority:** Must (P0)
|
||||
- **Referenced Screen / Route:** Inventory workflow screen(s) — route(s) to be specified during Stage 11 screen design
|
||||
- **Business Rules:** Closing stock MT and bags must never be negative ($\ge 0$). Adjustments exceeding $\pm 1.0\%$ of godown balance require mandatory Partner electronic sign-off.
|
||||
|
||||
### Statement
|
||||
|
||||
The system must maintain a real-time, double-entry stock ledger tracking commodity positions across warehouses (WH-01 Neemuch Main Yard, WH-02 Neemuch North Godown, WH-03 Mandsaur Transit Godown, WH-04 Indore Buffer Depot). For each commodity, variety, and grade, it must maintain Opening Stock MT, Received MT, Dispatched MT, Closing Stock MT, and physical Bag counts. The system must support Periodic Physical Stock Audits: recording physical tally counts against book balances and generating supervisor-authorized Stock Adjustment Vouchers capturing natural storage loss/gain (*ghat / nami* due to moisture evaporation or seasonal humidity) or handling spillage with mandatory reason codes.
|
||||
|
||||
### Acceptance Criteria
|
||||
|
||||
1. The requirement records, computes, or presents the source-defined data attributes: Stock Entry ID, Date, Warehouse ID, Commodity, Variety, Grade, Opening MT, Inward MT, Outward MT, Closing MT, Bag Delta, Closing Bags, Physical Count MT, Adjustment Variance MT, Variance Reason Code (`Moisture Loss / Ghat`, `Handling Spillage`, `Bag Burst`, `Seasonal Humidity Gain`).
|
||||
2. The system enforces the source-defined validation rules: Closing stock MT and bags must never be negative ($\ge 0$). Adjustments exceeding $\pm 1.0\%$ of godown balance require mandatory Partner electronic sign-off.
|
||||
|
||||
## FR-WAREHOUSEINVENTORY-002: Godown Capacity & Volume Utilization Tracking
|
||||
|
||||
- **Requirement ID:** `FR-WAREHOUSEINVENTORY-002`
|
||||
- **Parent UC:** `UC-007`
|
||||
- **Source Feature:** `BRD-FR-019`
|
||||
- **Priority:** Must (P0)
|
||||
- **Referenced Screen / Route:** Inventory workflow screen(s) — route(s) to be specified during Stage 11 screen design
|
||||
- **Business Rules:** Warning status triggered when Utilisation exceeds 85%.
|
||||
|
||||
### Statement
|
||||
|
||||
The system must track the physical storage capacity of each warehouse in Metric Tonnes and calculate real-time percentage utilization:
|
||||
$$\text{Utilisation \%} = \frac{\text{Current Closing Stock (MT)}}{\text{Storage Capacity (MT)}} \times 100$$
|
||||
|
||||
### Acceptance Criteria
|
||||
|
||||
1. The requirement records, computes, or presents the source-defined data attributes: Warehouse ID, Name, City, Capacity MT, Current Stock MT, Utilisation \%.
|
||||
2. The system enforces the source-defined validation rules: Warning status triggered when Utilisation exceeds 85%.
|
||||
|
||||
## FR-WAREHOUSEINVENTORY-003: Godown-to-Godown Internal Stock Transfer
|
||||
|
||||
- **Requirement ID:** `FR-WAREHOUSEINVENTORY-003`
|
||||
- **Parent UC:** `UC-007`
|
||||
- **Source Feature:** `BRD-FR-020`
|
||||
- **Priority:** Must (P0)
|
||||
- **Referenced Screen / Route:** Inventory workflow screen(s) — route(s) to be specified during Stage 11 screen design
|
||||
- **Business Rules:** Outward and inward entries must reconcile within $\pm 0.2\%$ transfer tolerance.
|
||||
|
||||
---
|
||||
|
||||
### Statement
|
||||
|
||||
The system must support recording stock transfers between godowns (e.g., from Mandsaur Transit Godown to Neemuch Main Yard), logging origin outward deduction, in-transit state, destination weighment, and destination inward credit.
|
||||
|
||||
### Acceptance Criteria
|
||||
|
||||
1. The requirement records, computes, or presents the source-defined data attributes: Transfer ID, Origin Warehouse, Destination Warehouse, Commodity, Lot ID, Transfer Qty MT, Transfer Bags, Vehicle Reg No, Transit Status.
|
||||
2. The system enforces the source-defined validation rules: Outward and inward entries must reconcile within $\pm 0.2\%$ transfer tolerance.
|
||||
|
||||
---
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
---
|
||||
id: UC-007
|
||||
version: 1.0.0
|
||||
status: Draft
|
||||
---
|
||||
|
||||
# UC-007 — Warehouse Stock, Audit, Capacity and Transfer
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| **Use Case ID** | `UC-007` |
|
||||
| **Name** | Warehouse Stock, Audit, Capacity and Transfer |
|
||||
| **Owning Domain** | Inventory |
|
||||
| **Primary Actor(s)** | Yard Supervisor / Logistics Coordinator / Partner |
|
||||
| **Supporting Actor(s)** | Yard Supervisor, Management, Partner, Logistics Coordinator |
|
||||
| **Source Features** | `BRD-FR-018`, `BRD-FR-019`, `BRD-FR-020` |
|
||||
| **Status** | Draft |
|
||||
| **Version** | 1.0.0 |
|
||||
|
||||
## Goal
|
||||
|
||||
Maintain warehouse stock positions, reconcile physical counts, monitor capacity, and record inter-godown transfers.
|
||||
|
||||
## Preconditions
|
||||
|
||||
1. The actor is authenticated and has the role and tenant scope required by the source feature(s).
|
||||
2. Any source records or master data explicitly required by the selected feature are available and in the required state.
|
||||
|
||||
## Trigger
|
||||
|
||||
The actor initiates one of the 3 business operations covered by this use case: multi-godown dual-unit stock ledger; godown capacity & volume utilization tracking; godown-to-godown internal stock transfer.
|
||||
|
||||
## Main Success Flow
|
||||
|
||||
1. The actor initiates **Multi-Godown Dual-Unit Stock Ledger**. The system performs the source-defined behavior: The system must maintain a real-time, double-entry stock ledger tracking commodity positions across warehouses (WH-01 Neemuch Main Yard, WH-02 Neemuch North Godown, WH-03 Mandsaur Transit Godown, WH-04 Indore Buffer Depot). For each commodity, variety, and grade, it must maintain Opening Stock MT, Received MT, Dispatched MT, Closing Stock MT, and physical Bag counts. The system must support Periodic Physical Stock Audits: recording physical tally counts against book balances and generating supervisor-authorized Stock Adjustment Vouchers capturing natural storage loss/gain (*ghat / nami* due to moisture evaporation or seasonal humidity) or handling spillage with mandatory reason codes.
|
||||
2. The actor initiates **Godown Capacity & Volume Utilization Tracking**. The system performs the source-defined behavior: The system must track the physical storage capacity of each warehouse in Metric Tonnes and calculate real-time percentage utilization:
|
||||
$$\text{Utilisation \%} = \frac{\text{Current Closing Stock (MT)}}{\text{Storage Capacity (MT)}} \times 100$$
|
||||
3. The actor initiates **Godown-to-Godown Internal Stock Transfer**. The system performs the source-defined behavior: The system must support recording stock transfers between godowns (e.g., from Mandsaur Transit Godown to Neemuch Main Yard), logging origin outward deduction, in-transit state, destination weighment, and destination inward credit.
|
||||
|
||||
## Alternate Flows
|
||||
|
||||
- No alternate business flow is specified by the source features.
|
||||
|
||||
## Exception Flows
|
||||
|
||||
- **BRD-FR-018:** Reject or prevent the operation when its stated validation rules are not met: Closing stock MT and bags must never be negative ($\ge 0$). Adjustments exceeding $\pm 1.0\%$ of godown balance require mandatory Partner electronic sign-off.
|
||||
- **BRD-FR-019:** Reject or prevent the operation when its stated validation rules are not met: Warning status triggered when Utilisation exceeds 85%.
|
||||
- **BRD-FR-020:** Reject or prevent the operation when its stated validation rules are not met: Outward and inward entries must reconcile within $\pm 0.2\%$ transfer tolerance.
|
||||
|
||||
---
|
||||
|
||||
## Postconditions
|
||||
|
||||
- Successful operations create or update only the business records and outcomes stated in the linked BRD features.
|
||||
- Rejected operations do not bypass the validations and controls stated by those features.
|
||||
|
||||
## Referenced Screens / Routes
|
||||
|
||||
- Inventory workflow screen(s) — route(s) to be specified during Stage 11 screen design
|
||||
|
||||
## Child Functional Requirements
|
||||
|
||||
- [FR-WAREHOUSEINVENTORY-001: Multi-Godown Dual-Unit Stock Ledger](functional-reqs.md#fr-warehouseinventory-001)
|
||||
- [FR-WAREHOUSEINVENTORY-002: Godown Capacity & Volume Utilization Tracking](functional-reqs.md#fr-warehouseinventory-002)
|
||||
- [FR-WAREHOUSEINVENTORY-003: Godown-to-Godown Internal Stock Transfer](functional-reqs.md#fr-warehouseinventory-003)
|
||||
|
|
@ -0,0 +1,71 @@
|
|||
---
|
||||
id: UC-008-FR
|
||||
version: 1.0.0
|
||||
status: Draft
|
||||
---
|
||||
|
||||
# Functional Requirements — UC-008 Customer Sales Contract, Credit Check and Allocation
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| **Parent Use Case** | `UC-008` |
|
||||
| **Status** | Draft |
|
||||
| **Version** | 1.0.0 |
|
||||
|
||||
## FR-SALESCONTRACTS-001: Customer Sales Contract Booking
|
||||
|
||||
- **Requirement ID:** `FR-SALESCONTRACTS-001`
|
||||
- **Parent UC:** `UC-008`
|
||||
- **Source Feature:** `BRD-FR-021`
|
||||
- **Priority:** Must (P0)
|
||||
- **Referenced Screen / Route:** Sales workflow screen(s) — route(s) to be specified during Stage 11 screen design
|
||||
- **Business Rules:** Total Sales Value must equal $\text{Contract Qty MT} \times 10 \times \text{Rate ₹/Qtl}$.
|
||||
|
||||
### Statement
|
||||
|
||||
The system must record customer sales orders/contracts specifying customer code, destination city, customer segment (`Wholesale`, `Processor`, `Institutional`, `Distributor`), commodity, variety, grade, contracted quantity in MT, contract rate in ₹/Qtl, and delivery timeline.
|
||||
|
||||
### Acceptance Criteria
|
||||
|
||||
1. The requirement records, computes, or presents the source-defined data attributes: Sales Order ID (`SAL-YYYYMM-xxx`), Order Date, Customer ID, Destination City, Commodity, Variety, Grade, Contract Qty MT, Contract Rate ₹/Qtl, Total Sales Value INR, Payment Terms, Status.
|
||||
2. The system enforces the source-defined validation rules: Total Sales Value must equal $\text{Contract Qty MT} \times 10 \times \text{Rate ₹/Qtl}$.
|
||||
|
||||
## FR-SALESCONTRACTS-002: Customer Credit Limit & Pre-Order Exposure Verification
|
||||
|
||||
- **Requirement ID:** `FR-SALESCONTRACTS-002`
|
||||
- **Parent UC:** `UC-008`
|
||||
- **Source Feature:** `BRD-FR-022`
|
||||
- **Priority:** Must (P0)
|
||||
- **Referenced Screen / Route:** Sales workflow screen(s) — route(s) to be specified during Stage 11 screen design
|
||||
- **Business Rules:** If Projected Exposure Ratio $>80\%$, display inline warning. If Projected Exposure Ratio $>100\%$, system must prevent order confirmation unless authorized by Partner.
|
||||
|
||||
### Statement
|
||||
|
||||
Prior to confirming a sales order, the system must evaluate the customer's current outstanding receivables plus the value of the new order against their sanctioned credit limit.
|
||||
|
||||
### Acceptance Criteria
|
||||
|
||||
1. The requirement records, computes, or presents the source-defined data attributes: Sanctioned Credit Limit INR, Current Outstanding INR, New Order Value INR, Projected Exposure INR, Projected Exposure Ratio \%.
|
||||
2. The system enforces the source-defined validation rules: If Projected Exposure Ratio $>80\%$, display inline warning. If Projected Exposure Ratio $>100\%$, system must prevent order confirmation unless authorized by Partner.
|
||||
|
||||
## FR-SALESCONTRACTS-003: Sales Order Inventory Allocation
|
||||
|
||||
- **Requirement ID:** `FR-SALESCONTRACTS-003`
|
||||
- **Parent UC:** `UC-008`
|
||||
- **Source Feature:** `BRD-FR-023`
|
||||
- **Priority:** Must (P0)
|
||||
- **Referenced Screen / Route:** Sales workflow screen(s) — route(s) to be specified during Stage 11 screen design
|
||||
- **Business Rules:** Allocation fails if Lot status is `QC Hold` or `Under QC`, or if available lot unreserved MT $<$ allocated MT.
|
||||
|
||||
---
|
||||
|
||||
### Statement
|
||||
|
||||
The Sales Manager must allocate specific available inventory lot(s) from a warehouse to a confirmed sales order. The system must verify that selected lots are in `Released` state and have sufficient unreserved balance.
|
||||
|
||||
### Acceptance Criteria
|
||||
|
||||
1. The requirement records, computes, or presents the source-defined data attributes: Sales Order ID, Allocated Lot ID, Allocated Qty MT, Allocated Bags, Warehouse ID.
|
||||
2. The system enforces the source-defined validation rules: Allocation fails if Lot status is `QC Hold` or `Under QC`, or if available lot unreserved MT $<$ allocated MT.
|
||||
|
||||
---
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
---
|
||||
id: UC-008
|
||||
version: 1.0.0
|
||||
status: Draft
|
||||
---
|
||||
|
||||
# UC-008 — Customer Sales Contract, Credit Check and Allocation
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| **Use Case ID** | `UC-008` |
|
||||
| **Name** | Customer Sales Contract, Credit Check and Allocation |
|
||||
| **Owning Domain** | Sales |
|
||||
| **Primary Actor(s)** | Sales Manager / Sales Executive / Accounts Executive / Yard Supervisor |
|
||||
| **Supporting Actor(s)** | Sales Manager, Sales Executive, Accounts Executive, Yard Supervisor |
|
||||
| **Source Features** | `BRD-FR-021`, `BRD-FR-022`, `BRD-FR-023` |
|
||||
| **Status** | Draft |
|
||||
| **Version** | 1.0.0 |
|
||||
|
||||
## Goal
|
||||
|
||||
Record a customer sales contract, evaluate exposure before confirmation, and allocate eligible available lots.
|
||||
|
||||
## Preconditions
|
||||
|
||||
1. The actor is authenticated and has the role and tenant scope required by the source feature(s).
|
||||
2. Any source records or master data explicitly required by the selected feature are available and in the required state.
|
||||
|
||||
## Trigger
|
||||
|
||||
The actor initiates one of the 3 business operations covered by this use case: customer sales contract booking; customer credit limit & pre-order exposure verification; sales order inventory allocation.
|
||||
|
||||
## Main Success Flow
|
||||
|
||||
1. The actor initiates **Customer Sales Contract Booking**. The system performs the source-defined behavior: The system must record customer sales orders/contracts specifying customer code, destination city, customer segment (`Wholesale`, `Processor`, `Institutional`, `Distributor`), commodity, variety, grade, contracted quantity in MT, contract rate in ₹/Qtl, and delivery timeline.
|
||||
2. The actor initiates **Customer Credit Limit & Pre-Order Exposure Verification**. The system performs the source-defined behavior: Prior to confirming a sales order, the system must evaluate the customer's current outstanding receivables plus the value of the new order against their sanctioned credit limit.
|
||||
3. The actor initiates **Sales Order Inventory Allocation**. The system performs the source-defined behavior: The Sales Manager must allocate specific available inventory lot(s) from a warehouse to a confirmed sales order. The system must verify that selected lots are in `Released` state and have sufficient unreserved balance.
|
||||
|
||||
## Alternate Flows
|
||||
|
||||
- No alternate business flow is specified by the source features.
|
||||
|
||||
## Exception Flows
|
||||
|
||||
- **BRD-FR-021:** Reject or prevent the operation when its stated validation rules are not met: Total Sales Value must equal $\text{Contract Qty MT} \times 10 \times \text{Rate ₹/Qtl}$.
|
||||
- **BRD-FR-022:** Reject or prevent the operation when its stated validation rules are not met: If Projected Exposure Ratio $>80\%$, display inline warning. If Projected Exposure Ratio $>100\%$, system must prevent order confirmation unless authorized by Partner.
|
||||
- **BRD-FR-023:** Reject or prevent the operation when its stated validation rules are not met: Allocation fails if Lot status is `QC Hold` or `Under QC`, or if available lot unreserved MT $<$ allocated MT.
|
||||
|
||||
---
|
||||
|
||||
## Postconditions
|
||||
|
||||
- Successful operations create or update only the business records and outcomes stated in the linked BRD features.
|
||||
- Rejected operations do not bypass the validations and controls stated by those features.
|
||||
|
||||
## Referenced Screens / Routes
|
||||
|
||||
- Sales workflow screen(s) — route(s) to be specified during Stage 11 screen design
|
||||
|
||||
## Child Functional Requirements
|
||||
|
||||
- [FR-SALESCONTRACTS-001: Customer Sales Contract Booking](functional-reqs.md#fr-salescontracts-001)
|
||||
- [FR-SALESCONTRACTS-002: Customer Credit Limit & Pre-Order Exposure Verification](functional-reqs.md#fr-salescontracts-002)
|
||||
- [FR-SALESCONTRACTS-003: Sales Order Inventory Allocation](functional-reqs.md#fr-salescontracts-003)
|
||||
|
|
@ -0,0 +1,71 @@
|
|||
---
|
||||
id: UC-009-FR
|
||||
version: 1.0.0
|
||||
status: Draft
|
||||
---
|
||||
|
||||
# Functional Requirements — UC-009 Outbound Dispatch and Delivery
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| **Parent Use Case** | `UC-009` |
|
||||
| **Status** | Draft |
|
||||
| **Version** | 1.0.0 |
|
||||
|
||||
## FR-DISPATCHDELIVERY-001: Outbound Dispatch Board Console
|
||||
|
||||
- **Requirement ID:** `FR-DISPATCHDELIVERY-001`
|
||||
- **Parent UC:** `UC-009`
|
||||
- **Source Feature:** `BRD-FR-024`
|
||||
- **Priority:** Must (P0)
|
||||
- **Referenced Screen / Route:** Logistics workflow screen(s) — route(s) to be specified during Stage 11 screen design
|
||||
- **Business Rules:** Dispatch cannot be created without an approved sales order and assigned vehicle.
|
||||
|
||||
### Statement
|
||||
|
||||
The system must provide a visual dispatch management board displaying scheduled, loading, and in-transit consignments, matching confirmed sales orders to allocated warehouse lots and transport vehicles.
|
||||
|
||||
### Acceptance Criteria
|
||||
|
||||
1. The requirement records, computes, or presents the source-defined data attributes: Dispatch ID (`DISP-YYYYMM-xxx`), Dispatch Date, Linked Sales Order ID, Customer Name, Destination City, Commodity, Dispatch Qty MT, Assigned Vehicle Reg No, Driver Details, Status (`Scheduled`, `Loading`, `In Transit`, `Delivered`).
|
||||
2. The system enforces the source-defined validation rules: Dispatch cannot be created without an approved sales order and assigned vehicle.
|
||||
|
||||
## FR-DISPATCHDELIVERY-002: Outbound Weighbridge & Dispatch Bilty/Manifest
|
||||
|
||||
- **Requirement ID:** `FR-DISPATCHDELIVERY-002`
|
||||
- **Parent UC:** `UC-009`
|
||||
- **Source Feature:** `BRD-FR-025`
|
||||
- **Priority:** Must (P0)
|
||||
- **Referenced Screen / Route:** Logistics workflow screen(s) — route(s) to be specified during Stage 11 screen design
|
||||
- **Business Rules:** Net loaded MT must match allocated order MT within $\pm 1.0\%$ loading tolerance.
|
||||
|
||||
### Statement
|
||||
|
||||
The system must capture outward weighbridge weights for loaded dispatch trucks (Tare truck before loading, Gross truck after loading), verify loaded weight against order MT, and generate a printable transport manifest / Bilty.
|
||||
|
||||
### Acceptance Criteria
|
||||
|
||||
1. The requirement records, computes, or presents the source-defined data attributes: Dispatch ID, Outward Tare kg, Outward Gross kg, Net Loaded MT, Loaded Bag Count, Transporter Bilty No, e-Way Bill No.
|
||||
2. The system enforces the source-defined validation rules: Net loaded MT must match allocated order MT within $\pm 1.0\%$ loading tolerance.
|
||||
|
||||
## FR-DISPATCHDELIVERY-003: In-Transit Tracking & Proof of Delivery (POD)
|
||||
|
||||
- **Requirement ID:** `FR-DISPATCHDELIVERY-003`
|
||||
- **Parent UC:** `UC-009`
|
||||
- **Source Feature:** `BRD-FR-026`
|
||||
- **Priority:** Must (P0)
|
||||
- **Referenced Screen / Route:** Logistics workflow screen(s) — route(s) to be specified during Stage 11 screen design
|
||||
- **Business Rules:** Setting status to `Delivered` triggers automatic generation of finalized Sales Invoice. Consignee shortage deductions exceeding 2.0% require mandatory Sales Manager approval before issuing Credit Note.
|
||||
|
||||
---
|
||||
|
||||
### Statement
|
||||
|
||||
The system must track dispatch states from `In Transit` to `Delivered`. Upon consignee receipt, the Logistics Coordinator logs confirmation date, destination weighment, and uploads POD document reference. If destination weighment or quality parameters reveal a transit shortage or damage acknowledged by the buyer, the system must allow recording a Consignee Shortage Note and automatically generating a compensating Sales Credit Note against the customer ledger without altering the immutable outbound dispatch manifest.
|
||||
|
||||
### Acceptance Criteria
|
||||
|
||||
1. The requirement records, computes, or presents the source-defined data attributes: Transit Status, Departure Date/Time, Expected Delivery Date, Actual Delivery Date, Destination Weighbridge Net MT, Transit Loss MT, Consignee Acknowledgement Note, POD Ref, Credit Note ID (if applicable).
|
||||
2. The system enforces the source-defined validation rules: Setting status to `Delivered` triggers automatic generation of finalized Sales Invoice. Consignee shortage deductions exceeding 2.0% require mandatory Sales Manager approval before issuing Credit Note.
|
||||
|
||||
---
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
---
|
||||
id: UC-009
|
||||
version: 1.0.0
|
||||
status: Draft
|
||||
---
|
||||
|
||||
# UC-009 — Outbound Dispatch and Delivery
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| **Use Case ID** | `UC-009` |
|
||||
| **Name** | Outbound Dispatch and Delivery |
|
||||
| **Owning Domain** | Logistics |
|
||||
| **Primary Actor(s)** | Logistics Coordinator / Yard Supervisor |
|
||||
| **Supporting Actor(s)** | Logistics Coordinator, Yard Supervisor |
|
||||
| **Source Features** | `BRD-FR-024`, `BRD-FR-025`, `BRD-FR-026` |
|
||||
| **Status** | Draft |
|
||||
| **Version** | 1.0.0 |
|
||||
|
||||
## Goal
|
||||
|
||||
Schedule an approved sales order for dispatch, record outward weighment and transport documents, and complete delivery with consignee evidence.
|
||||
|
||||
## Preconditions
|
||||
|
||||
1. The actor is authenticated and has the role and tenant scope required by the source feature(s).
|
||||
2. Any source records or master data explicitly required by the selected feature are available and in the required state.
|
||||
|
||||
## Trigger
|
||||
|
||||
The actor initiates one of the 3 business operations covered by this use case: outbound dispatch board console; outbound weighbridge & dispatch bilty/manifest; in-transit tracking & proof of delivery (pod).
|
||||
|
||||
## Main Success Flow
|
||||
|
||||
1. The actor initiates **Outbound Dispatch Board Console**. The system performs the source-defined behavior: The system must provide a visual dispatch management board displaying scheduled, loading, and in-transit consignments, matching confirmed sales orders to allocated warehouse lots and transport vehicles.
|
||||
2. The actor initiates **Outbound Weighbridge & Dispatch Bilty/Manifest**. The system performs the source-defined behavior: The system must capture outward weighbridge weights for loaded dispatch trucks (Tare truck before loading, Gross truck after loading), verify loaded weight against order MT, and generate a printable transport manifest / Bilty.
|
||||
3. The actor initiates **In-Transit Tracking & Proof of Delivery (POD)**. The system performs the source-defined behavior: The system must track dispatch states from `In Transit` to `Delivered`. Upon consignee receipt, the Logistics Coordinator logs confirmation date, destination weighment, and uploads POD document reference. If destination weighment or quality parameters reveal a transit shortage or damage acknowledged by the buyer, the system must allow recording a Consignee Shortage Note and automatically generating a compensating Sales Credit Note against the customer ledger without altering the immutable outbound dispatch manifest.
|
||||
|
||||
## Alternate Flows
|
||||
|
||||
- No alternate business flow is specified by the source features.
|
||||
|
||||
## Exception Flows
|
||||
|
||||
- **BRD-FR-024:** Reject or prevent the operation when its stated validation rules are not met: Dispatch cannot be created without an approved sales order and assigned vehicle.
|
||||
- **BRD-FR-025:** Reject or prevent the operation when its stated validation rules are not met: Net loaded MT must match allocated order MT within $\pm 1.0\%$ loading tolerance.
|
||||
- **BRD-FR-026:** Reject or prevent the operation when its stated validation rules are not met: Setting status to `Delivered` triggers automatic generation of finalized Sales Invoice. Consignee shortage deductions exceeding 2.0% require mandatory Sales Manager approval before issuing Credit Note.
|
||||
|
||||
---
|
||||
|
||||
## Postconditions
|
||||
|
||||
- Successful operations create or update only the business records and outcomes stated in the linked BRD features.
|
||||
- Rejected operations do not bypass the validations and controls stated by those features.
|
||||
|
||||
## Referenced Screens / Routes
|
||||
|
||||
- Logistics workflow screen(s) — route(s) to be specified during Stage 11 screen design
|
||||
|
||||
## Child Functional Requirements
|
||||
|
||||
- [FR-DISPATCHDELIVERY-001: Outbound Dispatch Board Console](functional-reqs.md#fr-dispatchdelivery-001)
|
||||
- [FR-DISPATCHDELIVERY-002: Outbound Weighbridge & Dispatch Bilty/Manifest](functional-reqs.md#fr-dispatchdelivery-002)
|
||||
- [FR-DISPATCHDELIVERY-003: In-Transit Tracking & Proof of Delivery (POD)](functional-reqs.md#fr-dispatchdelivery-003)
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
---
|
||||
id: UC-010-FR
|
||||
version: 1.0.0
|
||||
status: Draft
|
||||
---
|
||||
|
||||
# Functional Requirements — UC-010 Transport Fleet Registry
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| **Parent Use Case** | `UC-010` |
|
||||
| **Status** | Draft |
|
||||
| **Version** | 1.0.0 |
|
||||
|
||||
## FR-FLEETREGISTRY-001: Transport Fleet Registry
|
||||
|
||||
- **Requirement ID:** `FR-FLEETREGISTRY-001`
|
||||
- **Parent UC:** `UC-010`
|
||||
- **Source Feature:** `BRD-FR-027`
|
||||
- **Priority:** Should (P1)
|
||||
- **Referenced Screen / Route:** Logistics & Fleet workflow screen(s) — route(s) to be specified during Stage 11 screen design
|
||||
- **Business Rules:** Vehicles with status `Maintenance` cannot be assigned to dispatches.
|
||||
|
||||
---
|
||||
|
||||
### Statement
|
||||
|
||||
The system must maintain a registry of transport trucks (owned and contract carriers) including registration number, vehicle model, gross payload capacity in MT, ownership type (`Own` vs `Contract`), insurance/fitness expiry dates, and operational status (`Available`, `On Route`, `Maintenance`).
|
||||
|
||||
### Acceptance Criteria
|
||||
|
||||
1. The requirement records, computes, or presents the source-defined data attributes: Vehicle Reg No, Make/Model, Payload Capacity MT, Ownership Type, Transporter Name, Status, Fitness Expiry Date.
|
||||
2. The system enforces the source-defined validation rules: Vehicles with status `Maintenance` cannot be assigned to dispatches.
|
||||
|
||||
---
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
---
|
||||
id: UC-010
|
||||
version: 1.0.0
|
||||
status: Draft
|
||||
---
|
||||
|
||||
# UC-010 — Transport Fleet Registry
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| **Use Case ID** | `UC-010` |
|
||||
| **Name** | Transport Fleet Registry |
|
||||
| **Owning Domain** | Logistics & Fleet |
|
||||
| **Primary Actor(s)** | Logistics Coordinator |
|
||||
| **Supporting Actor(s)** | None stated |
|
||||
| **Source Features** | `BRD-FR-027` |
|
||||
| **Status** | Draft |
|
||||
| **Version** | 1.0.0 |
|
||||
|
||||
## Goal
|
||||
|
||||
Maintain the fleet records required to assign transport vehicles to dispatches.
|
||||
|
||||
## Preconditions
|
||||
|
||||
1. The actor is authenticated and has the role and tenant scope required by the source feature(s).
|
||||
2. Any source records or master data explicitly required by the selected feature are available and in the required state.
|
||||
|
||||
## Trigger
|
||||
|
||||
The actor initiates one of the 1 business operations covered by this use case: transport fleet registry.
|
||||
|
||||
## Main Success Flow
|
||||
|
||||
1. The actor initiates **Transport Fleet Registry**. The system performs the source-defined behavior: The system must maintain a registry of transport trucks (owned and contract carriers) including registration number, vehicle model, gross payload capacity in MT, ownership type (`Own` vs `Contract`), insurance/fitness expiry dates, and operational status (`Available`, `On Route`, `Maintenance`).
|
||||
|
||||
## Alternate Flows
|
||||
|
||||
- No alternate business flow is specified by the source features.
|
||||
|
||||
## Exception Flows
|
||||
|
||||
- **BRD-FR-027:** Reject or prevent the operation when its stated validation rules are not met: Vehicles with status `Maintenance` cannot be assigned to dispatches.
|
||||
|
||||
---
|
||||
|
||||
## Postconditions
|
||||
|
||||
- Successful operations create or update only the business records and outcomes stated in the linked BRD features.
|
||||
- Rejected operations do not bypass the validations and controls stated by those features.
|
||||
|
||||
## Referenced Screens / Routes
|
||||
|
||||
- Logistics & Fleet workflow screen(s) — route(s) to be specified during Stage 11 screen design
|
||||
|
||||
## Child Functional Requirements
|
||||
|
||||
- [FR-FLEETREGISTRY-001: Transport Fleet Registry](functional-reqs.md#fr-fleetregistry-001)
|
||||
|
|
@ -0,0 +1,89 @@
|
|||
---
|
||||
id: UC-011-FR
|
||||
version: 1.0.0
|
||||
status: Draft
|
||||
---
|
||||
|
||||
# Functional Requirements — UC-011 Customer Receivables and Credit Controls
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| **Parent Use Case** | `UC-011` |
|
||||
| **Status** | Draft |
|
||||
| **Version** | 1.0.0 |
|
||||
|
||||
## FR-CUSTOMERRECEIVABLES-001: Customer Ledger & Aging Statement
|
||||
|
||||
- **Requirement ID:** `FR-CUSTOMERRECEIVABLES-001`
|
||||
- **Parent UC:** `UC-011`
|
||||
- **Source Feature:** `BRD-FR-028`
|
||||
- **Priority:** Must (P0)
|
||||
- **Referenced Screen / Route:** Finance workflow screen(s) — route(s) to be specified during Stage 11 screen design
|
||||
- **Business Rules:** Sub-ledger entries are immutable; corrections require credit/debit adjustment vouchers.
|
||||
|
||||
### Statement
|
||||
|
||||
The system must maintain an immutable party sub-ledger for each customer, debiting finalized sales invoices, crediting payment receipts, and presenting a real-time outstanding balance and aging schedule (0–7 days, 8–15 days, 16–30 days, >30 days).
|
||||
|
||||
### Acceptance Criteria
|
||||
|
||||
1. The requirement records, computes, or presents the source-defined data attributes: Customer ID, Posting Date, Voucher Type (`Sales Invoice`, `Payment Receipt`), Voucher No, Debit Amount INR, Credit Amount INR, Running Outstanding INR.
|
||||
2. The system enforces the source-defined validation rules: Sub-ledger entries are immutable; corrections require credit/debit adjustment vouchers.
|
||||
|
||||
## FR-CUSTOMERRECEIVABLES-002: Automated Customer Credit Exposure Watch & Threshold Alert
|
||||
|
||||
- **Requirement ID:** `FR-CUSTOMERRECEIVABLES-002`
|
||||
- **Parent UC:** `UC-011`
|
||||
- **Source Feature:** `BRD-FR-029`
|
||||
- **Priority:** Must (P0)
|
||||
- **Referenced Screen / Route:** Finance workflow screen(s) — route(s) to be specified during Stage 11 screen design
|
||||
- **Business Rules:** Evaluated in real time upon every sales invoice post and payment receipt post.
|
||||
|
||||
### Statement
|
||||
|
||||
The system must continuously recompute the customer exposure ratio ($\text{Outstanding} / \text{Credit Limit}$). If exposure $>80\%$, the account must be automatically tagged with a visual `Watch` badge, and an operational warning alert generated on the Executive Dashboard.
|
||||
|
||||
### Acceptance Criteria
|
||||
|
||||
1. The requirement records, computes, or presents the source-defined data attributes: Customer Code, Customer Name, Sanctioned Credit Limit INR, Outstanding INR, Exposure %, Risk Flag (`Normal`, `Watch`, `Critical`).
|
||||
2. The system enforces the source-defined validation rules: Evaluated in real time upon every sales invoice post and payment receipt post.
|
||||
|
||||
## FR-CUSTOMERRECEIVABLES-003: Credit Breach Dispatch Lock & Partner Override
|
||||
|
||||
- **Requirement ID:** `FR-CUSTOMERRECEIVABLES-003`
|
||||
- **Parent UC:** `UC-011`
|
||||
- **Source Feature:** `BRD-FR-030`
|
||||
- **Priority:** Must (P0)
|
||||
- **Referenced Screen / Route:** Finance workflow screen(s) — route(s) to be specified during Stage 11 screen design
|
||||
- **Business Rules:** Override action permanently logged in audit trail.
|
||||
|
||||
---
|
||||
|
||||
### Statement
|
||||
|
||||
If a customer's outstanding receivables exceed 100% of their sanctioned credit limit, all pending dispatches for that customer must be locked. Only a Partner user can record an explicit electronic approval override with mandatory justification notes to release the lock.
|
||||
|
||||
### Acceptance Criteria
|
||||
|
||||
1. The requirement records, computes, or presents the source-defined data attributes: Lock Status (`Active`, `Overridden`), Override Approved By, Override Reason, Timestamp.
|
||||
2. The system enforces the source-defined validation rules: Override action permanently logged in audit trail.
|
||||
|
||||
---
|
||||
|
||||
## FR-CUSTOMERRECEIVABLES-004: Customer Payment Receipt Posting
|
||||
|
||||
- **Requirement ID:** `FR-CUSTOMERRECEIVABLES-004`
|
||||
- **Parent UC:** `UC-011`
|
||||
- **Source Feature:** `BRD-FR-031`
|
||||
- **Priority:** Must (P0)
|
||||
- **Referenced Screen / Route:** Finance workflow screen(s) — route(s) to be specified during Stage 11 screen design
|
||||
- **Business Rules:** Amount must be $> 0$. Credit applied to customer ledger immediately upon `Cleared` status. Reversal action generates immutable audit trail entry and notifies Accounts Executive and Sales Manager.
|
||||
|
||||
### Statement
|
||||
|
||||
The system must record customer payments capturing payment date, customer code, received amount in INR, payment instrument mode (`NEFT`, `RTGS`, `Cheque`, `Cash`, `UPI`), bank reference/UTR number, and payment status (`Pending Clearance`, `Cleared`, `Bounced`). The system must enforce automatic reversal upon Cheque/Instrument Bounce: if an instrument status transitions to `Bounced`, the system must immediately reverse the credit entry on the customer sub-ledger, restore the previous outstanding debt, recompute exposure ratio %, reinstate credit locks if exposure $>100\%$, and trigger an urgent financial alert.
|
||||
|
||||
### Acceptance Criteria
|
||||
|
||||
1. The requirement records, computes, or presents the source-defined data attributes: Receipt ID (`PAY-YYYYMM-xxx`), Date, Customer ID, Amount INR, Payment Mode, UTR/Cheque No, Bank Name, Clearance Status, Bounce Reason, Reversal Voucher ID.
|
||||
2. The system enforces the source-defined validation rules: Amount must be $> 0$. Credit applied to customer ledger immediately upon `Cleared` status. Reversal action generates immutable audit trail entry and notifies Accounts Executive and Sales Manager.
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
---
|
||||
id: UC-011
|
||||
version: 1.0.0
|
||||
status: Draft
|
||||
---
|
||||
|
||||
# UC-011 — Customer Receivables and Credit Controls
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| **Use Case ID** | `UC-011` |
|
||||
| **Name** | Customer Receivables and Credit Controls |
|
||||
| **Owning Domain** | Finance |
|
||||
| **Primary Actor(s)** | Accounts Executive / Partner / Sales Manager |
|
||||
| **Supporting Actor(s)** | Accounts Executive, Sales Manager, Partner, Managing Director |
|
||||
| **Source Features** | `BRD-FR-028`, `BRD-FR-029`, `BRD-FR-030`, `BRD-FR-031` |
|
||||
| **Status** | Draft |
|
||||
| **Version** | 1.0.0 |
|
||||
|
||||
## Goal
|
||||
|
||||
Review customer balances and exposure, record payments, and enforce authorized controls when exposure breaches the approved limit.
|
||||
|
||||
## Preconditions
|
||||
|
||||
1. The actor is authenticated and has the role and tenant scope required by the source feature(s).
|
||||
2. Any source records or master data explicitly required by the selected feature are available and in the required state.
|
||||
|
||||
## Trigger
|
||||
|
||||
The actor initiates one of the 4 business operations covered by this use case: customer ledger & aging statement; automated customer credit exposure watch & threshold alert; credit breach dispatch lock & partner override; customer payment receipt posting.
|
||||
|
||||
## Main Success Flow
|
||||
|
||||
1. The actor initiates **Customer Ledger & Aging Statement**. The system performs the source-defined behavior: The system must maintain an immutable party sub-ledger for each customer, debiting finalized sales invoices, crediting payment receipts, and presenting a real-time outstanding balance and aging schedule (0–7 days, 8–15 days, 16–30 days, >30 days).
|
||||
2. The actor initiates **Automated Customer Credit Exposure Watch & Threshold Alert**. The system performs the source-defined behavior: The system must continuously recompute the customer exposure ratio ($\text{Outstanding} / \text{Credit Limit}$). If exposure $>80\%$, the account must be automatically tagged with a visual `Watch` badge, and an operational warning alert generated on the Executive Dashboard.
|
||||
3. The actor initiates **Credit Breach Dispatch Lock & Partner Override**. The system performs the source-defined behavior: If a customer's outstanding receivables exceed 100% of their sanctioned credit limit, all pending dispatches for that customer must be locked. Only a Partner user can record an explicit electronic approval override with mandatory justification notes to release the lock.
|
||||
4. The actor initiates **Customer Payment Receipt Posting**. The system performs the source-defined behavior: The system must record customer payments capturing payment date, customer code, received amount in INR, payment instrument mode (`NEFT`, `RTGS`, `Cheque`, `Cash`, `UPI`), bank reference/UTR number, and payment status (`Pending Clearance`, `Cleared`, `Bounced`). The system must enforce automatic reversal upon Cheque/Instrument Bounce: if an instrument status transitions to `Bounced`, the system must immediately reverse the credit entry on the customer sub-ledger, restore the previous outstanding debt, recompute exposure ratio %, reinstate credit locks if exposure $>100\%$, and trigger an urgent financial alert.
|
||||
|
||||
## Alternate Flows
|
||||
|
||||
- No alternate business flow is specified by the source features.
|
||||
|
||||
## Exception Flows
|
||||
|
||||
- **BRD-FR-028:** Reject or prevent the operation when its stated validation rules are not met: Sub-ledger entries are immutable; corrections require credit/debit adjustment vouchers.
|
||||
- **BRD-FR-029:** Reject or prevent the operation when its stated validation rules are not met: Evaluated in real time upon every sales invoice post and payment receipt post.
|
||||
- **BRD-FR-030:** Reject or prevent the operation when its stated validation rules are not met: Override action permanently logged in audit trail.
|
||||
|
||||
---
|
||||
- **BRD-FR-031:** Reject or prevent the operation when its stated validation rules are not met: Amount must be $> 0$. Credit applied to customer ledger immediately upon `Cleared` status. Reversal action generates immutable audit trail entry and notifies Accounts Executive and Sales Manager.
|
||||
|
||||
## Postconditions
|
||||
|
||||
- Successful operations create or update only the business records and outcomes stated in the linked BRD features.
|
||||
- Rejected operations do not bypass the validations and controls stated by those features.
|
||||
|
||||
## Referenced Screens / Routes
|
||||
|
||||
- Finance workflow screen(s) — route(s) to be specified during Stage 11 screen design
|
||||
|
||||
## Child Functional Requirements
|
||||
|
||||
- [FR-CUSTOMERRECEIVABLES-001: Customer Ledger & Aging Statement](functional-reqs.md#fr-customerreceivables-001)
|
||||
- [FR-CUSTOMERRECEIVABLES-002: Automated Customer Credit Exposure Watch & Threshold Alert](functional-reqs.md#fr-customerreceivables-002)
|
||||
- [FR-CUSTOMERRECEIVABLES-003: Credit Breach Dispatch Lock & Partner Override](functional-reqs.md#fr-customerreceivables-003)
|
||||
- [FR-CUSTOMERRECEIVABLES-004: Customer Payment Receipt Posting](functional-reqs.md#fr-customerreceivables-004)
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
---
|
||||
id: UC-012-FR
|
||||
version: 1.0.0
|
||||
status: Draft
|
||||
---
|
||||
|
||||
# Functional Requirements — UC-012 Supplier Payables and Aging
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| **Parent Use Case** | `UC-012` |
|
||||
| **Status** | Draft |
|
||||
| **Version** | 1.0.0 |
|
||||
|
||||
## FR-SUPPLIERPAYABLES-001: Supplier Payables Aging & Balance Snapshots
|
||||
|
||||
- **Requirement ID:** `FR-SUPPLIERPAYABLES-001`
|
||||
- **Parent UC:** `UC-012`
|
||||
- **Source Feature:** `BRD-FR-032`
|
||||
- **Priority:** Must (P0)
|
||||
- **Referenced Screen / Route:** Finance workflow screen(s) — route(s) to be specified during Stage 11 screen design
|
||||
- **Business Rules:** Automated calculation of due date based on GRN date + credit days.
|
||||
|
||||
### Statement
|
||||
|
||||
The system must track supplier payables arising from accepted GRNs, applying supplier credit days, generating aging schedules, and providing daily aggregate payables snapshots.
|
||||
|
||||
### Acceptance Criteria
|
||||
|
||||
1. The requirement records, computes, or presents the source-defined data attributes: Supplier ID, GRN No, Invoice Amount INR, Due Date, Days Overdue, Payment Status (`Unpaid`, `Partially Paid`, `Paid`).
|
||||
2. The system enforces the source-defined validation rules: Automated calculation of due date based on GRN date + credit days.
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
---
|
||||
id: UC-012
|
||||
version: 1.0.0
|
||||
status: Draft
|
||||
---
|
||||
|
||||
# UC-012 — Supplier Payables and Aging
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| **Use Case ID** | `UC-012` |
|
||||
| **Name** | Supplier Payables and Aging |
|
||||
| **Owning Domain** | Finance |
|
||||
| **Primary Actor(s)** | Accounts Executive |
|
||||
| **Supporting Actor(s)** | Partner |
|
||||
| **Source Features** | `BRD-FR-032` |
|
||||
| **Status** | Draft |
|
||||
| **Version** | 1.0.0 |
|
||||
|
||||
## Goal
|
||||
|
||||
Review supplier payable balances and aging snapshots.
|
||||
|
||||
## Preconditions
|
||||
|
||||
1. The actor is authenticated and has the role and tenant scope required by the source feature(s).
|
||||
2. Any source records or master data explicitly required by the selected feature are available and in the required state.
|
||||
|
||||
## Trigger
|
||||
|
||||
The actor initiates one of the 1 business operations covered by this use case: supplier payables aging & balance snapshots.
|
||||
|
||||
## Main Success Flow
|
||||
|
||||
1. The actor initiates **Supplier Payables Aging & Balance Snapshots**. The system performs the source-defined behavior: The system must track supplier payables arising from accepted GRNs, applying supplier credit days, generating aging schedules, and providing daily aggregate payables snapshots.
|
||||
|
||||
## Alternate Flows
|
||||
|
||||
- No alternate business flow is specified by the source features.
|
||||
|
||||
## Exception Flows
|
||||
|
||||
- **BRD-FR-032:** Reject or prevent the operation when its stated validation rules are not met: Automated calculation of due date based on GRN date + credit days.
|
||||
|
||||
## Postconditions
|
||||
|
||||
- Successful operations create or update only the business records and outcomes stated in the linked BRD features.
|
||||
- Rejected operations do not bypass the validations and controls stated by those features.
|
||||
|
||||
## Referenced Screens / Routes
|
||||
|
||||
- Finance workflow screen(s) — route(s) to be specified during Stage 11 screen design
|
||||
|
||||
## Child Functional Requirements
|
||||
|
||||
- [FR-SUPPLIERPAYABLES-001: Supplier Payables Aging & Balance Snapshots](functional-reqs.md#fr-supplierpayables-001)
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
---
|
||||
id: UC-013-FR
|
||||
version: 1.0.0
|
||||
status: Draft
|
||||
---
|
||||
|
||||
# Functional Requirements — UC-013 Mandi Operating Expense Recording
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| **Parent Use Case** | `UC-013` |
|
||||
| **Status** | Draft |
|
||||
| **Version** | 1.0.0 |
|
||||
|
||||
## FR-OPERATINGEXPENSES-001: Mandi Operating Expense Classification & Recording
|
||||
|
||||
- **Requirement ID:** `FR-OPERATINGEXPENSES-001`
|
||||
- **Parent UC:** `UC-013`
|
||||
- **Source Feature:** `BRD-FR-033`
|
||||
- **Priority:** Should (P1)
|
||||
- **Referenced Screen / Route:** Finance workflow screen(s) — route(s) to be specified during Stage 11 screen design
|
||||
- **Business Rules:** Expense vouchers must balance against cash/bank ledger accounts.
|
||||
|
||||
---
|
||||
|
||||
### Statement
|
||||
|
||||
The system must record operational expenses incurred in mandi and godown operations categorizing entries under: Labor / Hamali (loading/unloading), Freight / Cartage, Weighbridge Fees, Godown Rent, Mandi Cess, Pest Control/Fumigation, and Office Expenses.
|
||||
|
||||
### Acceptance Criteria
|
||||
|
||||
1. The requirement records, computes, or presents the source-defined data attributes: Expense ID (`EXP-YYYYMM-xxx`), Date, Category, Amount INR, Payee / Vendor, Linked Consignment / Sauda (if applicable), Payment Mode, Status.
|
||||
2. The system enforces the source-defined validation rules: Expense vouchers must balance against cash/bank ledger accounts.
|
||||
|
||||
---
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
---
|
||||
id: UC-013
|
||||
version: 1.0.0
|
||||
status: Draft
|
||||
---
|
||||
|
||||
# UC-013 — Mandi Operating Expense Recording
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| **Use Case ID** | `UC-013` |
|
||||
| **Name** | Mandi Operating Expense Recording |
|
||||
| **Owning Domain** | Finance |
|
||||
| **Primary Actor(s)** | Accounts Executive |
|
||||
| **Supporting Actor(s)** | None stated |
|
||||
| **Source Features** | `BRD-FR-033` |
|
||||
| **Status** | Draft |
|
||||
| **Version** | 1.0.0 |
|
||||
|
||||
## Goal
|
||||
|
||||
Record and classify a mandi or godown operating expense and reconcile its voucher against the cash or bank ledger.
|
||||
|
||||
## Preconditions
|
||||
|
||||
1. The actor is authenticated and has the role and tenant scope required by the source feature(s).
|
||||
2. Any source records or master data explicitly required by the selected feature are available and in the required state.
|
||||
|
||||
## Trigger
|
||||
|
||||
The actor initiates one of the 1 business operations covered by this use case: mandi operating expense classification & recording.
|
||||
|
||||
## Main Success Flow
|
||||
|
||||
1. The actor initiates **Mandi Operating Expense Classification & Recording**. The system performs the source-defined behavior: The system must record operational expenses incurred in mandi and godown operations categorizing entries under: Labor / Hamali (loading/unloading), Freight / Cartage, Weighbridge Fees, Godown Rent, Mandi Cess, Pest Control/Fumigation, and Office Expenses.
|
||||
|
||||
## Alternate Flows
|
||||
|
||||
- No alternate business flow is specified by the source features.
|
||||
|
||||
## Exception Flows
|
||||
|
||||
- **BRD-FR-033:** Reject or prevent the operation when its stated validation rules are not met: Expense vouchers must balance against cash/bank ledger accounts.
|
||||
|
||||
---
|
||||
|
||||
## Postconditions
|
||||
|
||||
- Successful operations create or update only the business records and outcomes stated in the linked BRD features.
|
||||
- Rejected operations do not bypass the validations and controls stated by those features.
|
||||
|
||||
## Referenced Screens / Routes
|
||||
|
||||
- Finance workflow screen(s) — route(s) to be specified during Stage 11 screen design
|
||||
|
||||
## Child Functional Requirements
|
||||
|
||||
- [FR-OPERATINGEXPENSES-001: Mandi Operating Expense Classification & Recording](functional-reqs.md#fr-operatingexpenses-001)
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
---
|
||||
id: UC-014-FR
|
||||
version: 1.0.0
|
||||
status: Draft
|
||||
---
|
||||
|
||||
# Functional Requirements — UC-014 Operational Alert Review
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| **Parent Use Case** | `UC-014` |
|
||||
| **Status** | Draft |
|
||||
| **Version** | 1.0.0 |
|
||||
|
||||
## FR-OPERATIONALALERTS-001: Real-Time Operational Alerts Engine
|
||||
|
||||
- **Requirement ID:** `FR-OPERATIONALALERTS-001`
|
||||
- **Parent UC:** `UC-014`
|
||||
- **Source Feature:** `BRD-FR-034`
|
||||
- **Priority:** Must (P0)
|
||||
- **Referenced Screen / Route:** Management & Alerts workflow screen(s) — route(s) to be specified during Stage 11 screen design
|
||||
- **Business Rules:** Evaluated synchronously upon transaction mutations and refreshed periodically.
|
||||
|
||||
### Statement
|
||||
|
||||
The system must evaluate active business data and publish automated proactive alerts across four critical categories:
|
||||
1. **QC Pending Alert:** Lots in state `Under QC` for $>24$ hours or currently on `QC Hold`.
|
||||
2. **Warehouse Capacity Alert:** Godowns exceeding 85% storage capacity utilization.
|
||||
3. **Credit Risk Alert:** Customer accounts exceeding 80% or 100% of sanctioned credit limit.
|
||||
4. **Active Procurement Window Alert:** Mandis with open buying orders during active trading hours.
|
||||
|
||||
### Acceptance Criteria
|
||||
|
||||
1. The requirement records, computes, or presents the source-defined data attributes: Alert ID, Severity (`Info`, `Warning`, `Critical`), Category, Title, Detail Text, Timestamp, Dismissed Status.
|
||||
2. The system enforces the source-defined validation rules: Evaluated synchronously upon transaction mutations and refreshed periodically.
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
---
|
||||
id: UC-014
|
||||
version: 1.0.0
|
||||
status: Draft
|
||||
---
|
||||
|
||||
# UC-014 — Operational Alert Review
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| **Use Case ID** | `UC-014` |
|
||||
| **Name** | Operational Alert Review |
|
||||
| **Owning Domain** | Management & Alerts |
|
||||
| **Primary Actor(s)** | Partner / Operations Supervisor |
|
||||
| **Supporting Actor(s)** | Partner, Operations Supervisor |
|
||||
| **Source Features** | `BRD-FR-034` |
|
||||
| **Status** | Draft |
|
||||
| **Version** | 1.0.0 |
|
||||
|
||||
## Goal
|
||||
|
||||
Review proactive alerts for QC, warehouse capacity, customer credit risk, and active procurement windows.
|
||||
|
||||
## Preconditions
|
||||
|
||||
1. The actor is authenticated and has the role and tenant scope required by the source feature(s).
|
||||
2. Any source records or master data explicitly required by the selected feature are available and in the required state.
|
||||
|
||||
## Trigger
|
||||
|
||||
The actor initiates one of the 1 business operations covered by this use case: real-time operational alerts engine.
|
||||
|
||||
## Main Success Flow
|
||||
|
||||
1. The actor initiates **Real-Time Operational Alerts Engine**. The system performs the source-defined behavior: The system must evaluate active business data and publish automated proactive alerts across four critical categories:
|
||||
1. **QC Pending Alert:** Lots in state `Under QC` for $>24$ hours or currently on `QC Hold`.
|
||||
2. **Warehouse Capacity Alert:** Godowns exceeding 85% storage capacity utilization.
|
||||
3. **Credit Risk Alert:** Customer accounts exceeding 80% or 100% of sanctioned credit limit.
|
||||
4. **Active Procurement Window Alert:** Mandis with open buying orders during active trading hours.
|
||||
|
||||
## Alternate Flows
|
||||
|
||||
- No alternate business flow is specified by the source features.
|
||||
|
||||
## Exception Flows
|
||||
|
||||
- **BRD-FR-034:** Reject or prevent the operation when its stated validation rules are not met: Evaluated synchronously upon transaction mutations and refreshed periodically.
|
||||
|
||||
## Postconditions
|
||||
|
||||
- Successful operations create or update only the business records and outcomes stated in the linked BRD features.
|
||||
- Rejected operations do not bypass the validations and controls stated by those features.
|
||||
|
||||
## Referenced Screens / Routes
|
||||
|
||||
- Management & Alerts workflow screen(s) — route(s) to be specified during Stage 11 screen design
|
||||
|
||||
## Child Functional Requirements
|
||||
|
||||
- [FR-OPERATIONALALERTS-001: Real-Time Operational Alerts Engine](functional-reqs.md#fr-operationalalerts-001)
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
---
|
||||
id: UC-015-FR
|
||||
version: 1.0.0
|
||||
status: Draft
|
||||
---
|
||||
|
||||
# Functional Requirements — UC-015 Executive Dashboard and Trading Snapshots
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| **Parent Use Case** | `UC-015` |
|
||||
| **Status** | Draft |
|
||||
| **Version** | 1.0.0 |
|
||||
|
||||
## FR-EXECUTIVEREPORTING-001: Executive Control Centre Dashboard
|
||||
|
||||
- **Requirement ID:** `FR-EXECUTIVEREPORTING-001`
|
||||
- **Parent UC:** `UC-015`
|
||||
- **Source Feature:** `BRD-FR-035`
|
||||
- **Priority:** Must (P0)
|
||||
- **Referenced Screen / Route:** Management workflow screen(s) — route(s) to be specified during Stage 11 screen design
|
||||
- **Business Rules:** Dashboard must load within $\le 1.5\text{s}$.
|
||||
|
||||
### Statement
|
||||
|
||||
The system must provide a unified operational dashboard displaying real-time metrics: Total Stock on Hand (MT), Total Active Stock Lines, Intraday Purchase Value INR, Intraday Sales Revenue INR, Total Customer Receivables INR, Top 10 Stock Lines by Volume, Top Recent Sales, and Warehouse Utilization Barometers.
|
||||
|
||||
### Acceptance Criteria
|
||||
|
||||
1. The requirement records, computes, or presents the source-defined data attributes: KPI Metric Cards, Warehouse Position Table, Top Stock Grid, Recent Sales Feed, Active Alerts Feed.
|
||||
2. The system enforces the source-defined validation rules: Dashboard must load within $\le 1.5\text{s}$.
|
||||
|
||||
## FR-EXECUTIVEREPORTING-002: 20-Day Consolidated Trading Trend Reporting
|
||||
|
||||
- **Requirement ID:** `FR-EXECUTIVEREPORTING-002`
|
||||
- **Parent UC:** `UC-015`
|
||||
- **Source Feature:** `BRD-FR-036`
|
||||
- **Priority:** Must (P0)
|
||||
- **Referenced Screen / Route:** Management workflow screen(s) — route(s) to be specified during Stage 11 screen design
|
||||
- **Business Rules:** Dynamically calculated from transaction ledgers; sub-second query performance.
|
||||
|
||||
---
|
||||
|
||||
### Statement
|
||||
|
||||
The system must compile daily management snapshots across a rolling 20-day trading window, tabulating: Date, Purchases MT, Sales MT, Closing Stock MT, Total Receivables INR, and Total Payables INR.
|
||||
|
||||
### Acceptance Criteria
|
||||
|
||||
1. The requirement records, computes, or presents the source-defined data attributes: Daily Snapshot Array (Date, Purchases MT, Sales MT, Stock MT, Receivables INR, Payables INR).
|
||||
2. The system enforces the source-defined validation rules: Dynamically calculated from transaction ledgers; sub-second query performance.
|
||||
|
||||
---
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
---
|
||||
id: UC-015
|
||||
version: 1.0.0
|
||||
status: Draft
|
||||
---
|
||||
|
||||
# UC-015 — Executive Dashboard and Trading Snapshots
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| **Use Case ID** | `UC-015` |
|
||||
| **Name** | Executive Dashboard and Trading Snapshots |
|
||||
| **Owning Domain** | Management |
|
||||
| **Primary Actor(s)** | Partner / Managing Director |
|
||||
| **Supporting Actor(s)** | Partner, Managing Director |
|
||||
| **Source Features** | `BRD-FR-035`, `BRD-FR-036` |
|
||||
| **Status** | Draft |
|
||||
| **Version** | 1.0.0 |
|
||||
|
||||
## Goal
|
||||
|
||||
Review current operational indicators and rolling 20-day purchase, sales, stock, receivable, and payable snapshots.
|
||||
|
||||
## Preconditions
|
||||
|
||||
1. The actor is authenticated and has the role and tenant scope required by the source feature(s).
|
||||
2. Any source records or master data explicitly required by the selected feature are available and in the required state.
|
||||
|
||||
## Trigger
|
||||
|
||||
The actor initiates one of the 2 business operations covered by this use case: executive control centre dashboard; 20-day consolidated trading trend reporting.
|
||||
|
||||
## Main Success Flow
|
||||
|
||||
1. The actor initiates **Executive Control Centre Dashboard**. The system performs the source-defined behavior: The system must provide a unified operational dashboard displaying real-time metrics: Total Stock on Hand (MT), Total Active Stock Lines, Intraday Purchase Value INR, Intraday Sales Revenue INR, Total Customer Receivables INR, Top 10 Stock Lines by Volume, Top Recent Sales, and Warehouse Utilization Barometers.
|
||||
2. The actor initiates **20-Day Consolidated Trading Trend Reporting**. The system performs the source-defined behavior: The system must compile daily management snapshots across a rolling 20-day trading window, tabulating: Date, Purchases MT, Sales MT, Closing Stock MT, Total Receivables INR, and Total Payables INR.
|
||||
|
||||
## Alternate Flows
|
||||
|
||||
- No alternate business flow is specified by the source features.
|
||||
|
||||
## Exception Flows
|
||||
|
||||
- **BRD-FR-035:** Reject or prevent the operation when its stated validation rules are not met: Dashboard must load within $\le 1.5\text{s}$.
|
||||
- **BRD-FR-036:** Reject or prevent the operation when its stated validation rules are not met: Dynamically calculated from transaction ledgers; sub-second query performance.
|
||||
|
||||
---
|
||||
|
||||
## Postconditions
|
||||
|
||||
- Successful operations create or update only the business records and outcomes stated in the linked BRD features.
|
||||
- Rejected operations do not bypass the validations and controls stated by those features.
|
||||
|
||||
## Referenced Screens / Routes
|
||||
|
||||
- Management workflow screen(s) — route(s) to be specified during Stage 11 screen design
|
||||
|
||||
## Child Functional Requirements
|
||||
|
||||
- [FR-EXECUTIVEREPORTING-001: Executive Control Centre Dashboard](functional-reqs.md#fr-executivereporting-001)
|
||||
- [FR-EXECUTIVEREPORTING-002: 20-Day Consolidated Trading Trend Reporting](functional-reqs.md#fr-executivereporting-002)
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
---
|
||||
id: UC-016-FR
|
||||
version: 1.0.0
|
||||
status: Draft
|
||||
---
|
||||
|
||||
# Functional Requirements — UC-016 Commodity and Trading Counterparty Master Data
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| **Parent Use Case** | `UC-016` |
|
||||
| **Status** | Draft |
|
||||
| **Version** | 1.0.0 |
|
||||
|
||||
## FR-MASTERDATA-001: Agricultural Commodity Master Data Management
|
||||
|
||||
- **Requirement ID:** `FR-MASTERDATA-001`
|
||||
- **Parent UC:** `UC-016`
|
||||
- **Source Feature:** `BRD-FR-037`
|
||||
- **Priority:** Must (P0)
|
||||
- **Referenced Screen / Route:** Master Data workflow screen(s) — route(s) to be specified during Stage 11 screen design
|
||||
- **Business Rules:** Commodity code must be unique; cannot delete commodities with active stock ledger entries.
|
||||
|
||||
### Statement
|
||||
|
||||
Maintain authoritative master catalogs for: Commodities (Chana, Soybean, Mustard, Wheat, Coriander, Cumin, Fenugreek, Groundnut, Isabgol, Jaggery, Maize, Turmeric), Varieties per commodity (e.g., Lokwan, Pusa, Eagle/Badami), and Commercial Quality Grades (`FAQ`, `Premium`, `Below FAQ`).
|
||||
|
||||
### Acceptance Criteria
|
||||
|
||||
1. The requirement records, computes, or presents the source-defined data attributes: Commodity Code, Commodity Name, Category (`Grains`, `Pulses`, `Oilseeds`, `Spices`), Varieties List, Standard Bag Weight kg.
|
||||
2. The system enforces the source-defined validation rules: Commodity code must be unique; cannot delete commodities with active stock ledger entries.
|
||||
|
||||
## FR-MASTERDATA-002: Trading Counterparty Masters (Suppliers, Customers & Godowns)
|
||||
|
||||
- **Requirement ID:** `FR-MASTERDATA-002`
|
||||
- **Parent UC:** `UC-016`
|
||||
- **Source Feature:** `BRD-FR-038`
|
||||
- **Priority:** Must (P0)
|
||||
- **Referenced Screen / Route:** Master Data workflow screen(s) — route(s) to be specified during Stage 11 screen design
|
||||
- **Business Rules:** Tax IDs validated where applicable.
|
||||
|
||||
### Statement
|
||||
|
||||
Maintain registries for: (1) Suppliers (Code, Name, City, Segment, Credit Days: 7/15/21), (2) Customers (Code, Name, City, Segment, Credit Limit INR, Contact), and (3) Godowns/Warehouses (Code, Name, City, Capacity MT).
|
||||
|
||||
### Acceptance Criteria
|
||||
|
||||
1. The requirement records, computes, or presents the source-defined data attributes: Entity Code, Name, Address, GSTIN/PAN, Bank Details, Status (`Active`, `Inactive`).
|
||||
2. The system enforces the source-defined validation rules: Tax IDs validated where applicable.
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
---
|
||||
id: UC-016
|
||||
version: 1.0.0
|
||||
status: Draft
|
||||
---
|
||||
|
||||
# UC-016 — Commodity and Trading Counterparty Master Data
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| **Use Case ID** | `UC-016` |
|
||||
| **Name** | Commodity and Trading Counterparty Master Data |
|
||||
| **Owning Domain** | Master Data |
|
||||
| **Primary Actor(s)** | System Administrator / Accounts Executive |
|
||||
| **Supporting Actor(s)** | System Administrator, Accounts Executive |
|
||||
| **Source Features** | `BRD-FR-037`, `BRD-FR-038` |
|
||||
| **Status** | Draft |
|
||||
| **Version** | 1.0.0 |
|
||||
|
||||
## Goal
|
||||
|
||||
Maintain the commodity catalogs and trading-party/warehouse registries used by business workflows.
|
||||
|
||||
## Preconditions
|
||||
|
||||
1. The actor is authenticated and has the role and tenant scope required by the source feature(s).
|
||||
2. Any source records or master data explicitly required by the selected feature are available and in the required state.
|
||||
|
||||
## Trigger
|
||||
|
||||
The actor initiates one of the 2 business operations covered by this use case: agricultural commodity master data management; trading counterparty masters (suppliers, customers & godowns).
|
||||
|
||||
## Main Success Flow
|
||||
|
||||
1. The actor initiates **Agricultural Commodity Master Data Management**. The system performs the source-defined behavior: Maintain authoritative master catalogs for: Commodities (Chana, Soybean, Mustard, Wheat, Coriander, Cumin, Fenugreek, Groundnut, Isabgol, Jaggery, Maize, Turmeric), Varieties per commodity (e.g., Lokwan, Pusa, Eagle/Badami), and Commercial Quality Grades (`FAQ`, `Premium`, `Below FAQ`).
|
||||
2. The actor initiates **Trading Counterparty Masters (Suppliers, Customers & Godowns)**. The system performs the source-defined behavior: Maintain registries for: (1) Suppliers (Code, Name, City, Segment, Credit Days: 7/15/21), (2) Customers (Code, Name, City, Segment, Credit Limit INR, Contact), and (3) Godowns/Warehouses (Code, Name, City, Capacity MT).
|
||||
|
||||
## Alternate Flows
|
||||
|
||||
- No alternate business flow is specified by the source features.
|
||||
|
||||
## Exception Flows
|
||||
|
||||
- **BRD-FR-037:** Reject or prevent the operation when its stated validation rules are not met: Commodity code must be unique; cannot delete commodities with active stock ledger entries.
|
||||
- **BRD-FR-038:** Reject or prevent the operation when its stated validation rules are not met: Tax IDs validated where applicable.
|
||||
|
||||
## Postconditions
|
||||
|
||||
- Successful operations create or update only the business records and outcomes stated in the linked BRD features.
|
||||
- Rejected operations do not bypass the validations and controls stated by those features.
|
||||
|
||||
## Referenced Screens / Routes
|
||||
|
||||
- Master Data workflow screen(s) — route(s) to be specified during Stage 11 screen design
|
||||
|
||||
## Child Functional Requirements
|
||||
|
||||
- [FR-MASTERDATA-001: Agricultural Commodity Master Data Management](functional-reqs.md#fr-masterdata-001)
|
||||
- [FR-MASTERDATA-002: Trading Counterparty Masters (Suppliers, Customers & Godowns)](functional-reqs.md#fr-masterdata-002)
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
---
|
||||
id: UC-017-FR
|
||||
version: 1.1.0
|
||||
status: Draft
|
||||
last_cr: CR-001
|
||||
---
|
||||
|
||||
# Functional Requirements — UC-017 Tenant Isolation and Transaction Audit
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| **Parent Use Case** | `UC-017` |
|
||||
| **Status** | Draft |
|
||||
| **Version** | 1.1.0 |
|
||||
| **Last CR** | `CR-001` |
|
||||
|
||||
## FR-TENANTSECURITYAUDIT-001: Tenant Data Isolation
|
||||
|
||||
- **Requirement ID:** `FR-TENANTSECURITYAUDIT-001`
|
||||
- **Parent UC:** `UC-017`
|
||||
- **Source Feature:** `BRD-FR-039`
|
||||
- **Priority:** Must (P0)
|
||||
- **Referenced Screen / Route:** Architecture & Security workflow screen(s) — route(s) to be specified during Stage 11 screen design
|
||||
- **Business Rules:** Tenant context must be enforced on every applicable business operation and verified for cross-tenant data access.
|
||||
|
||||
### Statement
|
||||
|
||||
Each independent trading enterprise is a tenant; its branches and godowns operate within that tenant boundary. Users and transactions must be associated with the correct tenant, and access to one tenant’s business data must not expose another tenant’s data. The isolation implementation must conform to the active technology profile.
|
||||
|
||||
### Acceptance Criteria
|
||||
|
||||
1. The requirement records, computes, or presents the source-defined data attributes: Tenant ID, Tenant Name, Tenant Status, Tenant Administrator, Branch and Godown IDs.
|
||||
2. The system enforces the source-defined validation rules: Tenant context must be enforced on every applicable business operation and verified for cross-tenant data access.
|
||||
|
||||
## FR-TENANTSECURITYAUDIT-003: Immutable Transaction Audit Logging
|
||||
|
||||
- **Requirement ID:** `FR-TENANTSECURITYAUDIT-003`
|
||||
- **Parent UC:** `UC-017`
|
||||
- **Source Feature:** `BRD-FR-041`
|
||||
- **Priority:** Must (P0)
|
||||
- **Referenced Screen / Route:** Architecture & Security workflow screen(s) — route(s) to be specified during Stage 11 screen design
|
||||
- **Business Rules:** Audit history cannot be deleted or modified through normal application operations.
|
||||
|
||||
### Statement
|
||||
|
||||
Submitted business records (GRNs, Sales Orders, Dispatches, Payment Receipts) must preserve an auditable history. Corrections must not silently rewrite the business history. The system must record user ID, timestamp, and the changed values for governed mutations.
|
||||
|
||||
### Acceptance Criteria
|
||||
|
||||
1. The requirement records, computes, or presents the source-defined data attributes: Audit Trail Log ID, Document Type, Document Name, Modified By, Modified Timestamp, Field Diff JSON.
|
||||
2. The system enforces the source-defined validation rules: Audit history cannot be deleted or modified through normal application operations.
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
---
|
||||
id: UC-017
|
||||
version: 1.1.0
|
||||
status: Draft
|
||||
last_cr: CR-001
|
||||
---
|
||||
|
||||
# UC-017 — Tenant Isolation and Transaction Audit
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| **Use Case ID** | `UC-017` |
|
||||
| **Name** | Tenant Isolation and Transaction Audit |
|
||||
| **Owning Domain** | Architecture & Security |
|
||||
| **Primary Actor(s)** | System Administrator |
|
||||
| **Supporting Actor(s)** | None stated |
|
||||
| **Source Features** | `BRD-FR-039`, `BRD-FR-041` |
|
||||
| **Status** | Draft |
|
||||
| **Version** | 1.1.0 |
|
||||
| **Last CR** | `CR-001` |
|
||||
|
||||
## Goal
|
||||
|
||||
Enforce tenant data boundaries and preserve immutable histories of governed transactions. Role-based authorization is specified in UC-001 under `BRD-FR-040`.
|
||||
|
||||
## Preconditions
|
||||
|
||||
1. The actor is authenticated and has the role and tenant scope required by the source feature(s).
|
||||
2. Any source records or master data explicitly required by the selected feature are available and in the required state.
|
||||
|
||||
## Trigger
|
||||
|
||||
The actor invokes a tenant-scoped operation or submits/corrects a governed business record.
|
||||
|
||||
## Main Success Flow
|
||||
|
||||
1. The actor initiates **Tenant Data Isolation**. The system performs the source-defined behavior: Each independent trading enterprise is a tenant; its branches and godowns operate within that tenant boundary. Users and transactions must be associated with the correct tenant, and access to one tenant’s business data must not expose another tenant’s data. The isolation implementation must conform to the active technology profile.
|
||||
2. The actor initiates **Immutable Transaction Audit Logging**. The system performs the source-defined behavior: Submitted business records (GRNs, Sales Orders, Dispatches, Payment Receipts) must preserve an auditable history. Corrections must not silently rewrite the business history. The system must record user ID, timestamp, and the changed values for governed mutations.
|
||||
|
||||
## Alternate Flows
|
||||
|
||||
- No alternate business flow is specified by the source features.
|
||||
|
||||
## Exception Flows
|
||||
|
||||
- **BRD-FR-039:** Reject or prevent the operation when its stated validation rules are not met: Tenant context must be enforced on every applicable business operation and verified for cross-tenant data access.
|
||||
- **BRD-FR-041:** Reject or prevent the operation when its stated validation rules are not met: Audit history cannot be deleted or modified through normal application operations.
|
||||
|
||||
## Postconditions
|
||||
|
||||
- Successful operations create or update only the business records and outcomes stated in the linked BRD features.
|
||||
- Rejected operations do not bypass the validations and controls stated by those features.
|
||||
|
||||
## Referenced Screens / Routes
|
||||
|
||||
- Architecture & Security workflow screen(s) — route(s) to be specified during Stage 11 screen design
|
||||
|
||||
## Child Functional Requirements
|
||||
|
||||
- [FR-TENANTSECURITYAUDIT-001: Tenant Data Isolation](functional-reqs.md#fr-tenantsecurityaudit-001)
|
||||
- [FR-TENANTSECURITYAUDIT-003: Immutable Transaction Audit Logging](functional-reqs.md#fr-tenantsecurityaudit-003)
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
---
|
||||
id: UC-018-FR
|
||||
version: 1.0.0
|
||||
status: Draft
|
||||
---
|
||||
|
||||
# Functional Requirements — UC-018 Tenant Provisioning and Lifecycle
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| **Parent Use Case** | `UC-018` |
|
||||
| **Status** | Draft |
|
||||
| **Version** | 1.0.0 |
|
||||
|
||||
## FR-TENANTLIFECYCLE-001: Tenant Provisioning and Lifecycle Management
|
||||
|
||||
- **Requirement ID:** `FR-TENANTLIFECYCLE-001`
|
||||
- **Parent UC:** `UC-018`
|
||||
- **Source Feature:** `BRD-FR-042`
|
||||
- **Priority:** Must (P0)
|
||||
- **Referenced Screen / Route:** Platform Administration workflow screen(s) — route(s) to be specified during Stage 11 screen design
|
||||
- **Business Rules:** None stated in the source feature.
|
||||
|
||||
### Statement
|
||||
|
||||
Public self-service tenant signup is out of scope for v1. An authorized platform administrator must create and configure each tenant, assign its initial Tenant Administrator, and activate, suspend, or close the tenant through a controlled lifecycle. Tenant lifecycle changes must not silently delete or expose business records.
|
||||
|
||||
### Acceptance Criteria
|
||||
|
||||
1. The requirement records, computes, or presents the source-defined data attributes: Tenant ID, Tenant Name, Lifecycle Status, Created/Updated Timestamps, Tenant Administrator, Lifecycle Actor and Reason.
|
||||
2. The outcome satisfies the source-defined acceptance intent: Each lifecycle transition is authorized, recorded, and reflected consistently across application access, API requests, and scheduled work. Closed/suspended tenant data handling follows the retention and deletion policy approved for the service.
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
---
|
||||
id: UC-018
|
||||
version: 1.0.0
|
||||
status: Draft
|
||||
---
|
||||
|
||||
# UC-018 — Tenant Provisioning and Lifecycle
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| **Use Case ID** | `UC-018` |
|
||||
| **Name** | Tenant Provisioning and Lifecycle |
|
||||
| **Owning Domain** | Platform Administration |
|
||||
| **Primary Actor(s)** | System Administrator |
|
||||
| **Supporting Actor(s)** | None stated |
|
||||
| **Source Features** | `BRD-FR-042` |
|
||||
| **Status** | Draft |
|
||||
| **Version** | 1.0.0 |
|
||||
|
||||
## Goal
|
||||
|
||||
Create, configure, activate, suspend, or close a tenant through an authorized and recorded lifecycle.
|
||||
|
||||
## Preconditions
|
||||
|
||||
1. The actor is authenticated and has the role and tenant scope required by the source feature(s).
|
||||
2. Any source records or master data explicitly required by the selected feature are available and in the required state.
|
||||
|
||||
## Trigger
|
||||
|
||||
The actor initiates one of the 1 business operations covered by this use case: tenant provisioning and lifecycle management.
|
||||
|
||||
## Main Success Flow
|
||||
|
||||
1. The actor initiates **Tenant Provisioning and Lifecycle Management**. The system performs the source-defined behavior: Public self-service tenant signup is out of scope for v1. An authorized platform administrator must create and configure each tenant, assign its initial Tenant Administrator, and activate, suspend, or close the tenant through a controlled lifecycle. Tenant lifecycle changes must not silently delete or expose business records.
|
||||
|
||||
## Alternate Flows
|
||||
|
||||
- No alternate business flow is specified by the source features.
|
||||
|
||||
## Exception Flows
|
||||
|
||||
- Any exceptions remain as specified in the source feature; no additional behavior is inferred.
|
||||
|
||||
## Postconditions
|
||||
|
||||
- Successful operations create or update only the business records and outcomes stated in the linked BRD features.
|
||||
- Rejected operations do not bypass the validations and controls stated by those features.
|
||||
|
||||
## Referenced Screens / Routes
|
||||
|
||||
- Platform Administration workflow screen(s) — route(s) to be specified during Stage 11 screen design
|
||||
|
||||
## Child Functional Requirements
|
||||
|
||||
- [FR-TENANTLIFECYCLE-001: Tenant Provisioning and Lifecycle Management](functional-reqs.md#fr-tenantlifecycle-001)
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
---
|
||||
id: UC-019-FR
|
||||
version: 1.0.0
|
||||
status: Draft
|
||||
---
|
||||
|
||||
# Functional Requirements — UC-019 Tenant Membership and Verified Context
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| **Parent Use Case** | `UC-019` |
|
||||
| **Status** | Draft |
|
||||
| **Version** | 1.0.0 |
|
||||
|
||||
## FR-TENANTMEMBERSHIPCONTEXT-001: Tenant Membership and Role Administration
|
||||
|
||||
- **Requirement ID:** `FR-TENANTMEMBERSHIPCONTEXT-001`
|
||||
- **Parent UC:** `UC-019`
|
||||
- **Source Feature:** `BRD-FR-043`
|
||||
- **Priority:** Must (P0)
|
||||
- **Referenced Screen / Route:** Identity & Access Management workflow screen(s) — route(s) to be specified during Stage 11 screen design
|
||||
- **Business Rules:** None stated in the source feature.
|
||||
|
||||
### Statement
|
||||
|
||||
A person may hold active memberships in multiple tenants. A Tenant Administrator must be able to add, deactivate, and assign approved business roles to users within their own tenant. A tenant administrator must not manage users or roles belonging to another tenant. Platform-level administrators and tenant-level administrators must have distinct permissions.
|
||||
|
||||
### Acceptance Criteria
|
||||
|
||||
1. The requirement records, computes, or presents the source-defined data attributes: User ID, Tenant ID, Membership Status, Role Assignments, Changed By, Changed At.
|
||||
2. The outcome satisfies the source-defined acceptance intent: Users receive no tenant access without an active membership and role assignment; membership changes take effect on subsequent authorized operations and are auditable.
|
||||
|
||||
## FR-TENANTMEMBERSHIPCONTEXT-002: Verified Tenant Context for Every Operation
|
||||
|
||||
- **Requirement ID:** `FR-TENANTMEMBERSHIPCONTEXT-002`
|
||||
- **Parent UC:** `UC-019`
|
||||
- **Source Feature:** `BRD-FR-044`
|
||||
- **Priority:** Must (P0)
|
||||
- **Referenced Screen / Route:** Identity & Access Management workflow screen(s) — route(s) to be specified during Stage 11 screen design
|
||||
- **Business Rules:** None stated in the source feature.
|
||||
|
||||
### Statement
|
||||
|
||||
The service must derive the effective tenant context from the authenticated user’s verified tenant membership. A client-supplied tenant identifier alone must never grant or switch tenant access. A user associated with multiple tenants must explicitly select the active tenant after sign-in; the service verifies that membership and its role for every request before permitting action in that tenant.
|
||||
|
||||
### Acceptance Criteria
|
||||
|
||||
1. The requirement records, computes, or presents the source-defined data attributes: Authenticated Subject, Effective Tenant ID, Membership, Role Claims, Request/Correlation ID.
|
||||
2. The outcome satisfies the source-defined acceptance intent: Missing, invalid, or unauthorized tenant context is denied by default; the same checks apply to REST APIs and non-interactive operations.
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
---
|
||||
id: UC-019
|
||||
version: 1.0.0
|
||||
status: Draft
|
||||
---
|
||||
|
||||
# UC-019 — Tenant Membership and Verified Context
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| **Use Case ID** | `UC-019` |
|
||||
| **Name** | Tenant Membership and Verified Context |
|
||||
| **Owning Domain** | Identity & Access Management |
|
||||
| **Primary Actor(s)** | Tenant Administrator / authenticated users |
|
||||
| **Supporting Actor(s)** | Tenant Administrator, All authenticated users |
|
||||
| **Source Features** | `BRD-FR-043`, `BRD-FR-044` |
|
||||
| **Status** | Draft |
|
||||
| **Version** | 1.0.0 |
|
||||
|
||||
## Goal
|
||||
|
||||
Administer tenant-scoped memberships and roles, then verify active tenant membership and role for each operation.
|
||||
|
||||
## Preconditions
|
||||
|
||||
1. The actor is authenticated and has the role and tenant scope required by the source feature(s).
|
||||
2. Any source records or master data explicitly required by the selected feature are available and in the required state.
|
||||
|
||||
## Trigger
|
||||
|
||||
The actor initiates one of the 2 business operations covered by this use case: tenant membership and role administration; verified tenant context for every operation.
|
||||
|
||||
## Main Success Flow
|
||||
|
||||
1. The actor initiates **Tenant Membership and Role Administration**. The system performs the source-defined behavior: A person may hold active memberships in multiple tenants. A Tenant Administrator must be able to add, deactivate, and assign approved business roles to users within their own tenant. A tenant administrator must not manage users or roles belonging to another tenant. Platform-level administrators and tenant-level administrators must have distinct permissions.
|
||||
2. The actor initiates **Verified Tenant Context for Every Operation**. The system performs the source-defined behavior: The service must derive the effective tenant context from the authenticated user’s verified tenant membership. A client-supplied tenant identifier alone must never grant or switch tenant access. A user associated with multiple tenants must explicitly select the active tenant after sign-in; the service verifies that membership and its role for every request before permitting action in that tenant.
|
||||
|
||||
## Alternate Flows
|
||||
|
||||
- No alternate business flow is specified by the source features.
|
||||
|
||||
## Exception Flows
|
||||
|
||||
- Any exceptions remain as specified in the source feature; no additional behavior is inferred.
|
||||
|
||||
## Postconditions
|
||||
|
||||
- Successful operations create or update only the business records and outcomes stated in the linked BRD features.
|
||||
- Rejected operations do not bypass the validations and controls stated by those features.
|
||||
|
||||
## Referenced Screens / Routes
|
||||
|
||||
- Identity & Access Management workflow screen(s) — route(s) to be specified during Stage 11 screen design
|
||||
|
||||
## Child Functional Requirements
|
||||
|
||||
- [FR-TENANTMEMBERSHIPCONTEXT-001: Tenant Membership and Role Administration](functional-reqs.md#fr-tenantmembershipcontext-001)
|
||||
- [FR-TENANTMEMBERSHIPCONTEXT-002: Verified Tenant Context for Every Operation](functional-reqs.md#fr-tenantmembershipcontext-002)
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
---
|
||||
id: UC-020-FR
|
||||
version: 1.0.0
|
||||
status: Draft
|
||||
---
|
||||
|
||||
# Functional Requirements — UC-020 Tenant Resource Isolation and Privileged Support
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| **Parent Use Case** | `UC-020` |
|
||||
| **Status** | Draft |
|
||||
| **Version** | 1.0.0 |
|
||||
|
||||
## FR-TENANTSUPPORTSECURITY-001: End-to-End Tenant Resource Isolation
|
||||
|
||||
- **Requirement ID:** `FR-TENANTSUPPORTSECURITY-001`
|
||||
- **Parent UC:** `UC-020`
|
||||
- **Source Feature:** `BRD-FR-045`
|
||||
- **Priority:** Must (P0)
|
||||
- **Referenced Screen / Route:** Platform Security workflow screen(s) — route(s) to be specified during Stage 11 screen design
|
||||
- **Business Rules:** None stated in the source feature.
|
||||
|
||||
### Statement
|
||||
|
||||
Tenant isolation must apply to all tenant-owned records and derived resources, including database reads and writes, API lookups, search/report results, exports, uploaded files, cache entries, and queued/background work. Cross-tenant access attempts must fail closed and must not reveal whether another tenant’s resource exists.
|
||||
|
||||
### Acceptance Criteria
|
||||
|
||||
1. The requirement records, computes, or presents the source-defined data attributes: Tenant ID on tenant-owned resources; resource owner; access decision; actor; timestamp; correlation ID.
|
||||
2. The outcome satisfies the source-defined acceptance intent: Automated negative tests demonstrate that users, crafted identifiers, concurrent requests, reused database connections, and background jobs cannot read or mutate another tenant’s resources. Database roles and policies must not allow normal application paths to bypass the configured row-level security controls.
|
||||
|
||||
## FR-TENANTSUPPORTSECURITY-002: Controlled Privileged Support Access
|
||||
|
||||
- **Requirement ID:** `FR-TENANTSUPPORTSECURITY-002`
|
||||
- **Parent UC:** `UC-020`
|
||||
- **Source Feature:** `BRD-FR-046`
|
||||
- **Priority:** Must (P0)
|
||||
- **Referenced Screen / Route:** Platform Security workflow screen(s) — route(s) to be specified during Stage 11 screen design
|
||||
- **Business Rules:** None stated in the source feature.
|
||||
|
||||
### Statement
|
||||
|
||||
Platform support must not imply routine unrestricted access to tenant business data. Support staff have no standing access to tenant business data. Ordinary exceptional access requires approval by that tenant’s Tenant Administrator for a specific support case and a limited duration. For an urgent incident, a designated platform security administrator may grant a break-glass access window of at most one hour, with a recorded reason, immediate audit alert, and notice to the tenant administrator within one business day. All access is recorded for tenant and platform security review.
|
||||
|
||||
### Acceptance Criteria
|
||||
|
||||
1. The requirement records, computes, or presents the source-defined data attributes: Support Actor, Tenant ID, Reason/Case Reference, Approval, Start/End Time, Resources Accessed, Audit Event.
|
||||
2. The outcome satisfies the source-defined acceptance intent: Privileged access can be granted and revoked through a controlled workflow; all such access is attributable and reviewable. Ordinary access requires tenant-admin approval; emergency break-glass access follows the one-hour limit and notification controls above.
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
---
|
||||
id: UC-020
|
||||
version: 1.0.0
|
||||
status: Draft
|
||||
---
|
||||
|
||||
# UC-020 — Tenant Resource Isolation and Privileged Support
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| **Use Case ID** | `UC-020` |
|
||||
| **Name** | Tenant Resource Isolation and Privileged Support |
|
||||
| **Owning Domain** | Platform Security |
|
||||
| **Primary Actor(s)** | System Administrator / Tenant Administrator / users |
|
||||
| **Supporting Actor(s)** | All users; System Administrator for platform controls, System Administrator |
|
||||
| **Source Features** | `BRD-FR-045`, `BRD-FR-046` |
|
||||
| **Status** | Draft |
|
||||
| **Version** | 1.0.0 |
|
||||
|
||||
## Goal
|
||||
|
||||
Protect tenant resources across application and asynchronous paths, and govern exceptional support access.
|
||||
|
||||
## Preconditions
|
||||
|
||||
1. The actor is authenticated and has the role and tenant scope required by the source feature(s).
|
||||
2. Any source records or master data explicitly required by the selected feature are available and in the required state.
|
||||
|
||||
## Trigger
|
||||
|
||||
The actor initiates one of the 2 business operations covered by this use case: end-to-end tenant resource isolation; controlled privileged support access.
|
||||
|
||||
## Main Success Flow
|
||||
|
||||
1. The actor initiates **End-to-End Tenant Resource Isolation**. The system performs the source-defined behavior: Tenant isolation must apply to all tenant-owned records and derived resources, including database reads and writes, API lookups, search/report results, exports, uploaded files, cache entries, and queued/background work. Cross-tenant access attempts must fail closed and must not reveal whether another tenant’s resource exists.
|
||||
2. The actor initiates **Controlled Privileged Support Access**. The system performs the source-defined behavior: Platform support must not imply routine unrestricted access to tenant business data. Support staff have no standing access to tenant business data. Ordinary exceptional access requires approval by that tenant’s Tenant Administrator for a specific support case and a limited duration. For an urgent incident, a designated platform security administrator may grant a break-glass access window of at most one hour, with a recorded reason, immediate audit alert, and notice to the tenant administrator within one business day. All access is recorded for tenant and platform security review.
|
||||
|
||||
## Alternate Flows
|
||||
|
||||
- No alternate business flow is specified by the source features.
|
||||
|
||||
## Exception Flows
|
||||
|
||||
- Any exceptions remain as specified in the source feature; no additional behavior is inferred.
|
||||
|
||||
## Postconditions
|
||||
|
||||
- Successful operations create or update only the business records and outcomes stated in the linked BRD features.
|
||||
- Rejected operations do not bypass the validations and controls stated by those features.
|
||||
|
||||
## Referenced Screens / Routes
|
||||
|
||||
- Platform Security workflow screen(s) — route(s) to be specified during Stage 11 screen design
|
||||
|
||||
## Child Functional Requirements
|
||||
|
||||
- [FR-TENANTSUPPORTSECURITY-001: End-to-End Tenant Resource Isolation](functional-reqs.md#fr-tenantsupportsecurity-001)
|
||||
- [FR-TENANTSUPPORTSECURITY-002: Controlled Privileged Support Access](functional-reqs.md#fr-tenantsupportsecurity-002)
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
---
|
||||
id: UC-021-FR
|
||||
version: 1.0.0
|
||||
status: Draft
|
||||
---
|
||||
|
||||
# Functional Requirements — UC-021 Personal Data Purpose, Notice and Consent
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| **Parent Use Case** | `UC-021` |
|
||||
| **Status** | Draft |
|
||||
| **Version** | 1.0.0 |
|
||||
|
||||
## FR-PRIVACYPURPOSECONSENT-001: Personal Data Purpose, Notice & Consent Records
|
||||
|
||||
- **Requirement ID:** `FR-PRIVACYPURPOSECONSENT-001`
|
||||
- **Parent UC:** `UC-021`
|
||||
- **Source Feature:** `BRD-FR-047`
|
||||
- **Priority:** Must (P0)
|
||||
- **Referenced Screen / Route:** Privacy Operations workflow screen(s) — route(s) to be specified during Stage 11 screen design
|
||||
- **Business Rules:** None stated in the source feature.
|
||||
|
||||
### Statement
|
||||
|
||||
The service must allow each responsible Data Fiduciary to determine and approve the processing purpose, applicable lawful basis, and privacy notice for its processing, then document personal-data categories, purpose, basis, notice version, and accountable contact. Tenant firms own these decisions for trading data; the ATB operator records them separately for its own account, security, and service processing. Privacy controls cover every natural person whose personal data is processed in tenant or platform contexts, whether or not that person has an application account. Where consent is the applicable basis, the service must capture evidence of the notice and consent, support withdrawal, and record resulting processing restrictions. Tenant and platform processing contexts must remain distinguishable.
|
||||
|
||||
### Acceptance Criteria
|
||||
|
||||
1. The requirement records, computes, or presents the source-defined data attributes: Processing Purpose ID, Data Category, Responsible Entity/Role, Processing Basis, Notice Version, Consent Status and Timestamp, Withdrawal Timestamp, Contact.
|
||||
2. The outcome satisfies the source-defined acceptance intent: Personal data processing purposes and notices are attributable to the responsible Data Fiduciary; consent-dependent processing can be stopped or adjusted following a verified withdrawal, subject to applicable lawful retention or other legal obligations.
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
---
|
||||
id: UC-021
|
||||
version: 1.0.0
|
||||
status: Draft
|
||||
---
|
||||
|
||||
# UC-021 — Personal Data Purpose, Notice and Consent
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| **Use Case ID** | `UC-021` |
|
||||
| **Name** | Personal Data Purpose, Notice and Consent |
|
||||
| **Owning Domain** | Privacy Operations |
|
||||
| **Primary Actor(s)** | Tenant Administrator / System Administrator |
|
||||
| **Supporting Actor(s)** | Tenant Administrator; System Administrator for platform-controlled processing |
|
||||
| **Source Features** | `BRD-FR-047` |
|
||||
| **Status** | Draft |
|
||||
| **Version** | 1.0.0 |
|
||||
|
||||
## Goal
|
||||
|
||||
Record each responsible Data Fiduciary’s processing purpose, lawful basis, notice, accountable contact, and any applicable consent and withdrawal evidence.
|
||||
|
||||
## Preconditions
|
||||
|
||||
1. The actor is authenticated and has the role and tenant scope required by the source feature(s).
|
||||
2. Any source records or master data explicitly required by the selected feature are available and in the required state.
|
||||
|
||||
## Trigger
|
||||
|
||||
The actor initiates one of the 1 business operations covered by this use case: personal data purpose, notice & consent records.
|
||||
|
||||
## Main Success Flow
|
||||
|
||||
1. The actor initiates **Personal Data Purpose, Notice & Consent Records**. The system performs the source-defined behavior: The service must allow each responsible Data Fiduciary to determine and approve the processing purpose, applicable lawful basis, and privacy notice for its processing, then document personal-data categories, purpose, basis, notice version, and accountable contact. Tenant firms own these decisions for trading data; the ATB operator records them separately for its own account, security, and service processing. Privacy controls cover every natural person whose personal data is processed in tenant or platform contexts, whether or not that person has an application account. Where consent is the applicable basis, the service must capture evidence of the notice and consent, support withdrawal, and record resulting processing restrictions. Tenant and platform processing contexts must remain distinguishable.
|
||||
|
||||
## Alternate Flows
|
||||
|
||||
- No alternate business flow is specified by the source features.
|
||||
|
||||
## Exception Flows
|
||||
|
||||
- Any exceptions remain as specified in the source feature; no additional behavior is inferred.
|
||||
|
||||
## Postconditions
|
||||
|
||||
- Successful operations create or update only the business records and outcomes stated in the linked BRD features.
|
||||
- Rejected operations do not bypass the validations and controls stated by those features.
|
||||
|
||||
## Referenced Screens / Routes
|
||||
|
||||
- Privacy Operations workflow screen(s) — route(s) to be specified during Stage 11 screen design
|
||||
|
||||
## Child Functional Requirements
|
||||
|
||||
- [FR-PRIVACYPURPOSECONSENT-001: Personal Data Purpose, Notice & Consent Records](functional-reqs.md#fr-privacypurposeconsent-001)
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
---
|
||||
id: UC-022-FR
|
||||
version: 1.0.0
|
||||
status: Draft
|
||||
---
|
||||
|
||||
# Functional Requirements — UC-022 Data Principal Rights and Grievance Requests
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| **Parent Use Case** | `UC-022` |
|
||||
| **Status** | Draft |
|
||||
| **Version** | 1.0.0 |
|
||||
|
||||
## FR-DATAPRINCIPALRIGHTS-001: Data Principal Rights & Grievance Case Management
|
||||
|
||||
- **Requirement ID:** `FR-DATAPRINCIPALRIGHTS-001`
|
||||
- **Parent UC:** `UC-022`
|
||||
- **Source Feature:** `BRD-FR-048`
|
||||
- **Priority:** Must (P0)
|
||||
- **Referenced Screen / Route:** Privacy Operations workflow screen(s) — route(s) to be specified during Stage 11 screen design
|
||||
- **Business Rules:** None stated in the source feature.
|
||||
|
||||
### Statement
|
||||
|
||||
The service must support receipt, identity verification, routing, tracking, response, and evidence retention for Data Principal requests and grievances concerning access to information, correction, erasure, consent withdrawal, grievance redressal, and nomination, as applicable, including for individuals who do not hold application accounts. Requests must be routed to the responsible Data Fiduciary and handled within the applicable statutory or approved contractual time limit. A request channel must be available without requiring a general customer or supplier portal account.
|
||||
|
||||
### Acceptance Criteria
|
||||
|
||||
1. The requirement records, computes, or presents the source-defined data attributes: Request ID, Data Principal Identifier, Tenant/Platform Scope, Request Type, Verification Evidence, Responsible Fiduciary, Received/Due/Resolved Timestamps, Disposition, Response Evidence.
|
||||
2. The outcome satisfies the source-defined acceptance intent: Requests are not silently lost or fulfilled against the wrong tenant; authorized operators can track deadlines, exceptions, approvals, and completion evidence while preserving tenant isolation.
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
---
|
||||
id: UC-022
|
||||
version: 1.0.0
|
||||
status: Draft
|
||||
---
|
||||
|
||||
# UC-022 — Data Principal Rights and Grievance Requests
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| **Use Case ID** | `UC-022` |
|
||||
| **Name** | Data Principal Rights and Grievance Requests |
|
||||
| **Owning Domain** | Privacy Operations |
|
||||
| **Primary Actor(s)** | Tenant Administrator / System Administrator |
|
||||
| **Supporting Actor(s)** | Tenant Administrator; System Administrator for platform-controlled processing |
|
||||
| **Source Features** | `BRD-FR-048` |
|
||||
| **Status** | Draft |
|
||||
| **Version** | 1.0.0 |
|
||||
|
||||
## Goal
|
||||
|
||||
Receive, verify, route, track, and respond to Data Principal requests and grievances, including requests from people without application accounts.
|
||||
|
||||
## Preconditions
|
||||
|
||||
1. The actor is authenticated and has the role and tenant scope required by the source feature(s).
|
||||
2. Any source records or master data explicitly required by the selected feature are available and in the required state.
|
||||
|
||||
## Trigger
|
||||
|
||||
The actor initiates one of the 1 business operations covered by this use case: data principal rights & grievance case management.
|
||||
|
||||
## Main Success Flow
|
||||
|
||||
1. The actor initiates **Data Principal Rights & Grievance Case Management**. The system performs the source-defined behavior: The service must support receipt, identity verification, routing, tracking, response, and evidence retention for Data Principal requests and grievances concerning access to information, correction, erasure, consent withdrawal, grievance redressal, and nomination, as applicable, including for individuals who do not hold application accounts. Requests must be routed to the responsible Data Fiduciary and handled within the applicable statutory or approved contractual time limit. A request channel must be available without requiring a general customer or supplier portal account.
|
||||
|
||||
## Alternate Flows
|
||||
|
||||
- No alternate business flow is specified by the source features.
|
||||
|
||||
## Exception Flows
|
||||
|
||||
- Any exceptions remain as specified in the source feature; no additional behavior is inferred.
|
||||
|
||||
## Postconditions
|
||||
|
||||
- Successful operations create or update only the business records and outcomes stated in the linked BRD features.
|
||||
- Rejected operations do not bypass the validations and controls stated by those features.
|
||||
|
||||
## Referenced Screens / Routes
|
||||
|
||||
- Privacy Operations workflow screen(s) — route(s) to be specified during Stage 11 screen design
|
||||
|
||||
## Child Functional Requirements
|
||||
|
||||
- [FR-DATAPRINCIPALRIGHTS-001: Data Principal Rights & Grievance Case Management](functional-reqs.md#fr-dataprincipalrights-001)
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
---
|
||||
id: UC-023-FR
|
||||
version: 1.0.0
|
||||
status: Draft
|
||||
---
|
||||
|
||||
# Functional Requirements — UC-023 Personal Data Breach Response Coordination
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| **Parent Use Case** | `UC-023` |
|
||||
| **Status** | Draft |
|
||||
| **Version** | 1.0.0 |
|
||||
|
||||
## FR-PRIVACYBREACHRESPONSE-001: Personal Data Breach Response Coordination
|
||||
|
||||
- **Requirement ID:** `FR-PRIVACYBREACHRESPONSE-001`
|
||||
- **Parent UC:** `UC-023`
|
||||
- **Source Feature:** `BRD-FR-049`
|
||||
- **Priority:** Must (P0)
|
||||
- **Referenced Screen / Route:** Privacy Operations & Security Operations workflow screen(s) — route(s) to be specified during Stage 11 screen design
|
||||
- **Business Rules:** None stated in the source feature.
|
||||
|
||||
### Statement
|
||||
|
||||
The service must support recording, triaging, investigation, impact assessment, remediation, and notification coordination for suspected or confirmed personal-data breaches. The platform operator must be able to identify affected tenants and notify the responsible tenant Data Fiduciary promptly when acting as its Data Processor. The workflow must support applicable notification content and deadlines to affected Data Principals and the Data Protection Board, including phased or subsequently amended statutory requirements.
|
||||
|
||||
### Acceptance Criteria
|
||||
|
||||
1. The requirement records, computes, or presents the source-defined data attributes: Incident ID, Detection Time, Affected Data/Tenants/Principals, Processor/Fiduciary Roles, Severity, Timeline, Evidence, Mitigation, Notifications and Delivery Status.
|
||||
2. The outcome satisfies the source-defined acceptance intent: Each incident has an accountable owner and audit trail; the responsible Data Fiduciary can assemble required facts and evidence for notifications and demonstrate completion within applicable deadlines.
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
---
|
||||
id: UC-023
|
||||
version: 1.0.0
|
||||
status: Draft
|
||||
---
|
||||
|
||||
# UC-023 — Personal Data Breach Response Coordination
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| **Use Case ID** | `UC-023` |
|
||||
| **Name** | Personal Data Breach Response Coordination |
|
||||
| **Owning Domain** | Privacy Operations & Security Operations |
|
||||
| **Primary Actor(s)** | System Administrator / Tenant Administrator |
|
||||
| **Supporting Actor(s)** | System Administrator; Tenant Administrator for tenant-scoped incidents |
|
||||
| **Source Features** | `BRD-FR-049` |
|
||||
| **Status** | Draft |
|
||||
| **Version** | 1.0.0 |
|
||||
|
||||
## Goal
|
||||
|
||||
Coordinate assessment, remediation, and notification work for suspected or confirmed personal-data breaches.
|
||||
|
||||
## Preconditions
|
||||
|
||||
1. The actor is authenticated and has the role and tenant scope required by the source feature(s).
|
||||
2. Any source records or master data explicitly required by the selected feature are available and in the required state.
|
||||
|
||||
## Trigger
|
||||
|
||||
The actor initiates one of the 1 business operations covered by this use case: personal data breach response coordination.
|
||||
|
||||
## Main Success Flow
|
||||
|
||||
1. The actor initiates **Personal Data Breach Response Coordination**. The system performs the source-defined behavior: The service must support recording, triaging, investigation, impact assessment, remediation, and notification coordination for suspected or confirmed personal-data breaches. The platform operator must be able to identify affected tenants and notify the responsible tenant Data Fiduciary promptly when acting as its Data Processor. The workflow must support applicable notification content and deadlines to affected Data Principals and the Data Protection Board, including phased or subsequently amended statutory requirements.
|
||||
|
||||
## Alternate Flows
|
||||
|
||||
- No alternate business flow is specified by the source features.
|
||||
|
||||
## Exception Flows
|
||||
|
||||
- Any exceptions remain as specified in the source feature; no additional behavior is inferred.
|
||||
|
||||
## Postconditions
|
||||
|
||||
- Successful operations create or update only the business records and outcomes stated in the linked BRD features.
|
||||
- Rejected operations do not bypass the validations and controls stated by those features.
|
||||
|
||||
## Referenced Screens / Routes
|
||||
|
||||
- Privacy Operations & Security Operations workflow screen(s) — route(s) to be specified during Stage 11 screen design
|
||||
|
||||
## Child Functional Requirements
|
||||
|
||||
- [FR-PRIVACYBREACHRESPONSE-001: Personal Data Breach Response Coordination](functional-reqs.md#fr-privacybreachresponse-001)
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
---
|
||||
id: UC-024-FR
|
||||
version: 1.0.0
|
||||
status: Draft
|
||||
---
|
||||
|
||||
# Functional Requirements — UC-024 Purpose-Aware Retention, Erasure and Legal Holds
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| **Parent Use Case** | `UC-024` |
|
||||
| **Status** | Draft |
|
||||
| **Version** | 1.0.0 |
|
||||
|
||||
## FR-RETENTIONERASURE-001: Purpose-Aware Retention, Erasure & Legal Hold
|
||||
|
||||
- **Requirement ID:** `FR-RETENTIONERASURE-001`
|
||||
- **Parent UC:** `UC-024`
|
||||
- **Source Feature:** `BRD-FR-050`
|
||||
- **Priority:** Must (P0)
|
||||
- **Referenced Screen / Route:** Privacy Operations & Data Governance workflow screen(s) — route(s) to be specified during Stage 11 screen design
|
||||
- **Business Rules:** None stated in the source feature.
|
||||
|
||||
### Statement
|
||||
|
||||
Use four internal sensitivity levels—Public, Internal, Confidential, and Restricted—with a separate personal-data flag and processing-purpose tag; these are product handling labels, not statutory DPDP classifications. The responsible Data Fiduciary must approve retention schedules by personal-data category and processing purpose after legal/accounting review (tenant firms for trading data; ATB operator for its own account, security, and service data). Authorized operators must be able to apply these schedules by tenant/platform responsibility and applicable legal obligation. The service must support correction, erasure or irreversible de-identification when required, legal holds and statutory retention exceptions, and deletion handling for derived copies and processors, including backups according to the approved schedule. Statutory processing-log retention requirements must be represented separately from general business-record retention.
|
||||
|
||||
### Acceptance Criteria
|
||||
|
||||
1. The requirement records, computes, or presents the source-defined data attributes: Data Category, Purpose, Responsible Fiduciary, Retention Rule, Trigger Date, Legal Basis/Exception, Hold Status, Erasure/De-identification Evidence, Processor Completion.
|
||||
2. The outcome satisfies the source-defined acceptance intent: Data is not erased while an applicable hold or mandatory retention obligation applies; once all approved purposes and legal exceptions expire, erasure is trackable across applicable system copies and contracted processors.
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
---
|
||||
id: UC-024
|
||||
version: 1.0.0
|
||||
status: Draft
|
||||
---
|
||||
|
||||
# UC-024 — Purpose-Aware Retention, Erasure and Legal Holds
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| **Use Case ID** | `UC-024` |
|
||||
| **Name** | Purpose-Aware Retention, Erasure and Legal Holds |
|
||||
| **Owning Domain** | Privacy Operations & Data Governance |
|
||||
| **Primary Actor(s)** | Tenant Administrator / System Administrator |
|
||||
| **Supporting Actor(s)** | Tenant Administrator; System Administrator for platform-controlled processing |
|
||||
| **Source Features** | `BRD-FR-050` |
|
||||
| **Status** | Draft |
|
||||
| **Version** | 1.0.0 |
|
||||
|
||||
## Goal
|
||||
|
||||
Apply approved retention schedules and manage correction, erasure, de-identification, legal holds, exceptions, and deletion evidence.
|
||||
|
||||
## Preconditions
|
||||
|
||||
1. The actor is authenticated and has the role and tenant scope required by the source feature(s).
|
||||
2. Any source records or master data explicitly required by the selected feature are available and in the required state.
|
||||
|
||||
## Trigger
|
||||
|
||||
The actor initiates one of the 1 business operations covered by this use case: purpose-aware retention, erasure & legal hold.
|
||||
|
||||
## Main Success Flow
|
||||
|
||||
1. The actor initiates **Purpose-Aware Retention, Erasure & Legal Hold**. The system performs the source-defined behavior: Use four internal sensitivity levels—Public, Internal, Confidential, and Restricted—with a separate personal-data flag and processing-purpose tag; these are product handling labels, not statutory DPDP classifications. The responsible Data Fiduciary must approve retention schedules by personal-data category and processing purpose after legal/accounting review (tenant firms for trading data; ATB operator for its own account, security, and service data). Authorized operators must be able to apply these schedules by tenant/platform responsibility and applicable legal obligation. The service must support correction, erasure or irreversible de-identification when required, legal holds and statutory retention exceptions, and deletion handling for derived copies and processors, including backups according to the approved schedule. Statutory processing-log retention requirements must be represented separately from general business-record retention.
|
||||
|
||||
## Alternate Flows
|
||||
|
||||
- No alternate business flow is specified by the source features.
|
||||
|
||||
## Exception Flows
|
||||
|
||||
- Any exceptions remain as specified in the source feature; no additional behavior is inferred.
|
||||
|
||||
## Postconditions
|
||||
|
||||
- Successful operations create or update only the business records and outcomes stated in the linked BRD features.
|
||||
- Rejected operations do not bypass the validations and controls stated by those features.
|
||||
|
||||
## Referenced Screens / Routes
|
||||
|
||||
- Privacy Operations & Data Governance workflow screen(s) — route(s) to be specified during Stage 11 screen design
|
||||
|
||||
## Child Functional Requirements
|
||||
|
||||
- [FR-RETENTIONERASURE-001: Purpose-Aware Retention, Erasure & Legal Hold](functional-reqs.md#fr-retentionerasure-001)
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
---
|
||||
id: UC-025-FR
|
||||
version: 1.0.0
|
||||
status: Draft
|
||||
---
|
||||
|
||||
# Functional Requirements — UC-025 Processor and Subprocessor Governance
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| **Parent Use Case** | `UC-025` |
|
||||
| **Status** | Draft |
|
||||
| **Version** | 1.0.0 |
|
||||
|
||||
## FR-PROCESSORGOVERNANCE-001: Data Processor & Subprocessor Governance
|
||||
|
||||
- **Requirement ID:** `FR-PROCESSORGOVERNANCE-001`
|
||||
- **Parent UC:** `UC-025`
|
||||
- **Source Feature:** `BRD-FR-051`
|
||||
- **Priority:** Must (P0)
|
||||
- **Referenced Screen / Route:** Platform Governance workflow screen(s) — route(s) to be specified during Stage 11 screen design
|
||||
- **Business Rules:** None stated in the source feature.
|
||||
|
||||
### Statement
|
||||
|
||||
The platform operator must maintain an inventory of processors and subprocessors used for tenant personal data, their processing purpose and location, applicable safeguards and contractual obligations, and status of due diligence. The operator must support tenant Data Fiduciaries with information and operational assistance needed for security safeguards, Data Principal requests, breach response, retention, and erasure obligations.
|
||||
|
||||
### Acceptance Criteria
|
||||
|
||||
1. The requirement records, computes, or presents the source-defined data attributes: Processor/Subprocessor, Processing Purpose, Data Categories, Processing Location, Contract/Safeguard Reference, Due-Diligence Status, Incident/Request Assistance Record.
|
||||
2. The outcome satisfies the source-defined acceptance intent: Processor and subprocessor relationships are identifiable and reviewable; support actions are attributable and consistent with documented tenant instructions and applicable contractual safeguards.
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
---
|
||||
id: UC-025
|
||||
version: 1.0.0
|
||||
status: Draft
|
||||
---
|
||||
|
||||
# UC-025 — Processor and Subprocessor Governance
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| **Use Case ID** | `UC-025` |
|
||||
| **Name** | Processor and Subprocessor Governance |
|
||||
| **Owning Domain** | Platform Governance |
|
||||
| **Primary Actor(s)** | System Administrator |
|
||||
| **Supporting Actor(s)** | None stated |
|
||||
| **Source Features** | `BRD-FR-051` |
|
||||
| **Status** | Draft |
|
||||
| **Version** | 1.0.0 |
|
||||
|
||||
## Goal
|
||||
|
||||
Maintain processor and subprocessor records and provide accountable operational assistance to tenant Data Fiduciaries.
|
||||
|
||||
## Preconditions
|
||||
|
||||
1. The actor is authenticated and has the role and tenant scope required by the source feature(s).
|
||||
2. Any source records or master data explicitly required by the selected feature are available and in the required state.
|
||||
|
||||
## Trigger
|
||||
|
||||
The actor initiates one of the 1 business operations covered by this use case: data processor & subprocessor governance.
|
||||
|
||||
## Main Success Flow
|
||||
|
||||
1. The actor initiates **Data Processor & Subprocessor Governance**. The system performs the source-defined behavior: The platform operator must maintain an inventory of processors and subprocessors used for tenant personal data, their processing purpose and location, applicable safeguards and contractual obligations, and status of due diligence. The operator must support tenant Data Fiduciaries with information and operational assistance needed for security safeguards, Data Principal requests, breach response, retention, and erasure obligations.
|
||||
|
||||
## Alternate Flows
|
||||
|
||||
- No alternate business flow is specified by the source features.
|
||||
|
||||
## Exception Flows
|
||||
|
||||
- Any exceptions remain as specified in the source feature; no additional behavior is inferred.
|
||||
|
||||
## Postconditions
|
||||
|
||||
- Successful operations create or update only the business records and outcomes stated in the linked BRD features.
|
||||
- Rejected operations do not bypass the validations and controls stated by those features.
|
||||
|
||||
## Referenced Screens / Routes
|
||||
|
||||
- Platform Governance workflow screen(s) — route(s) to be specified during Stage 11 screen design
|
||||
|
||||
## Child Functional Requirements
|
||||
|
||||
- [FR-PROCESSORGOVERNANCE-001: Data Processor & Subprocessor Governance](functional-reqs.md#fr-processorgovernance-001)
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
---
|
||||
id: UC-026-FR
|
||||
version: 1.0.0
|
||||
status: Draft
|
||||
---
|
||||
|
||||
# Functional Requirements — UC-026 Tenant Operating Policy Configuration
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| **Parent Use Case** | `UC-026` |
|
||||
| **Status** | Draft |
|
||||
| **Version** | 1.0.0 |
|
||||
|
||||
## FR-TENANTOPERATINGPOLICIES-001: Tenant Operating Policy Configuration & Audit
|
||||
|
||||
- **Requirement ID:** `FR-TENANTOPERATINGPOLICIES-001`
|
||||
- **Parent UC:** `UC-026`
|
||||
- **Source Feature:** `BRD-FR-052`
|
||||
- **Priority:** Must (P0)
|
||||
- **Referenced Screen / Route:** Tenant Business Administration workflow screen(s) — route(s) to be specified during Stage 11 screen design
|
||||
- **Business Rules:** None stated in the source feature.
|
||||
|
||||
### Statement
|
||||
|
||||
The service must provide tenant-scoped configuration for the provisional operating thresholds listed in §6.2, including market-price variance, weighment shortage, bag tare/packing, commodity quality grading/deductions, credit exposure, warehouse capacity/adjustments/transfers, dispatch tolerances, and alert timing. Policies must support commodity, grade, contract, or other applicable scope and effective dates where needed. Only roles authorized in the tenant permission model may change them; changes must record actor, timestamp, reason, prior value, and new value. Seed values remain provisional. Before each affected live workflow is enabled for a tenant, that tenant’s Partner/Managing Director or delegated authorized business owner must review and confirm or edit every applicable threshold. Missing or unreviewed thresholds block only the affected risk-sensitive workflow. Confirmed policies are versioned with an effective date and changes are audited.
|
||||
|
||||
### Acceptance Criteria
|
||||
|
||||
1. The requirement records, computes, or presents the source-defined data attributes: Tenant ID, Policy Type, Scope (Commodity/Grade/Contract), Value, Unit, Effective From/To, Changed By/At, Reason, Prior Value.
|
||||
2. The outcome satisfies the source-defined acceptance intent: One tenant’s policy never changes another tenant’s behavior. Applicable policy versions can be identified for every governed transaction; unauthorized or unaudited changes are rejected. Candidate values are never silently treated as universally validated rules; the affected workflow remains disabled for a tenant until its authorized business owner confirms or edits the applicable values.
|
||||
|
||||
---
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
---
|
||||
id: UC-026
|
||||
version: 1.0.0
|
||||
status: Draft
|
||||
---
|
||||
|
||||
# UC-026 — Tenant Operating Policy Configuration
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| **Use Case ID** | `UC-026` |
|
||||
| **Name** | Tenant Operating Policy Configuration |
|
||||
| **Owning Domain** | Tenant Business Administration |
|
||||
| **Primary Actor(s)** | Partner / Managing Director / authorized tenant functional managers |
|
||||
| **Supporting Actor(s)** | Partner, Managing Director; authorized tenant functional managers |
|
||||
| **Source Features** | `BRD-FR-052` |
|
||||
| **Status** | Draft |
|
||||
| **Version** | 1.0.0 |
|
||||
|
||||
## Goal
|
||||
|
||||
Review, configure, approve, and audit tenant-scoped operating thresholds before affected workflows are enabled.
|
||||
|
||||
## Preconditions
|
||||
|
||||
1. The actor is authenticated and has the role and tenant scope required by the source feature(s).
|
||||
2. Any source records or master data explicitly required by the selected feature are available and in the required state.
|
||||
|
||||
## Trigger
|
||||
|
||||
The actor initiates one of the 1 business operations covered by this use case: tenant operating policy configuration & audit.
|
||||
|
||||
## Main Success Flow
|
||||
|
||||
1. The actor initiates **Tenant Operating Policy Configuration & Audit**. The system performs the source-defined behavior: The service must provide tenant-scoped configuration for the provisional operating thresholds listed in §6.2, including market-price variance, weighment shortage, bag tare/packing, commodity quality grading/deductions, credit exposure, warehouse capacity/adjustments/transfers, dispatch tolerances, and alert timing. Policies must support commodity, grade, contract, or other applicable scope and effective dates where needed. Only roles authorized in the tenant permission model may change them; changes must record actor, timestamp, reason, prior value, and new value. Seed values remain provisional. Before each affected live workflow is enabled for a tenant, that tenant’s Partner/Managing Director or delegated authorized business owner must review and confirm or edit every applicable threshold. Missing or unreviewed thresholds block only the affected risk-sensitive workflow. Confirmed policies are versioned with an effective date and changes are audited.
|
||||
|
||||
## Alternate Flows
|
||||
|
||||
- No alternate business flow is specified by the source features.
|
||||
|
||||
## Exception Flows
|
||||
|
||||
- Any exceptions remain as specified in the source feature; no additional behavior is inferred.
|
||||
|
||||
## Postconditions
|
||||
|
||||
- Successful operations create or update only the business records and outcomes stated in the linked BRD features.
|
||||
- Rejected operations do not bypass the validations and controls stated by those features.
|
||||
|
||||
## Referenced Screens / Routes
|
||||
|
||||
- Tenant Business Administration workflow screen(s) — route(s) to be specified during Stage 11 screen design
|
||||
|
||||
## Child Functional Requirements
|
||||
|
||||
- [FR-TENANTOPERATINGPOLICIES-001: Tenant Operating Policy Configuration & Audit](functional-reqs.md#fr-tenantoperatingpolicies-001)
|
||||
|
|
@ -0,0 +1,89 @@
|
|||
---
|
||||
id: API-DESIGN-001
|
||||
parent_ids: [HLD-ATB, 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 9 design; Gate 9.1 passed, review pending
|
||||
last_cr: none
|
||||
---
|
||||
|
||||
# API Design — REST/OpenAPI Contracts
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| **Base path** | `/api/v1` for application APIs; identity protocol endpoints remain at Keycloak |
|
||||
| **Transport** | HTTPS; JSON request/response except documented evidence-upload references |
|
||||
| **AuthN/AuthZ** | Configured OIDC/JWT, role/action policy, verified tenant context before tenant data access (`DEC-021`) |
|
||||
| **Error envelope** | `code`, safe `message`, `correlation_id`, field errors; no secrets or cross-tenant existence disclosure |
|
||||
| **Idempotency** | Required for retryable financial, inventory, state-transition, tenant lifecycle, and evidence-finalization commands; scope key by verified tenant + operation |
|
||||
|
||||
Paths and method groups below are Stage 9 contracts. Combined method notation (for example POST/GET/PATCH) represents separate operations on the resource. The application must enforce all FR rules and NFR scopes from the Stage 8 SRS. Exact field schemas, pagination limits, error codes and generated OpenAPI components are maintained during construction without changing these semantics.
|
||||
|
||||
## Endpoint and component matrix
|
||||
|
||||
| FR | Operation / endpoint | Contract summary | Authorization / boundary | HLD / LLD |
|
||||
|---|---|---|---|---|
|
||||
| `FR-AUTH-001` | `IdP OIDC authorization-code/PKCE flow; GET /api/v1/auth/session` | Integration / session validation; no credentials or token material are accepted as ordinary business resource fields. | OIDC identity or policy evaluation; no untrusted tenant selector | `HLD-IAM` / `LLD-001` |
|
||||
| `FR-AUTH-002` | `Cross-cutting policy decision at each protected API command/query` | No standalone CRUD endpoint; evaluate role/action/resource permission and segregation rules. | Middleware/worker + RLS invariant; no endpoint | `HLD-IAM` / `LLD-001` |
|
||||
| `FR-AUTH-003` | `POST /api/v1/auth/logout` | End application session; exact provider revocation semantics remain AMB-009. | OIDC identity or policy evaluation; no untrusted tenant selector | `HLD-IAM` / `LLD-001` |
|
||||
| `FR-MKT-001` | `POST /api/v1/market-observations; GET /api/v1/market-observations` | Create/list by explicit tenant-scoped filters; enforce date, quantity, holiday and duplicate rules. | Authenticated role from FR permission matrix; verified active tenant + RLS | `HLD-MARKET-DESK` / `LLD-007` |
|
||||
| `FR-MKT-002` | `PUT /api/v1/market-observations/{observation_id}/rates` | Atomically store min/modal/max; reject nonpositive or out-of-range modal rate. | Authenticated role from FR permission matrix; verified active tenant + RLS | `HLD-MARKET-DESK` / `LLD-007` |
|
||||
| `FR-MARKETTRENDANALYTICS-001` | `GET /api/v1/market-analytics/trends` | Return requested intraday/20-day benchmark series within source FR response-time and data-scope rules. | Authenticated role from FR permission matrix; verified active tenant + RLS | `HLD-REPORTING` / `LLD-005` |
|
||||
| `FR-PROCUREMENTCONTRACTS-001` | `GET /api/v1/procurement/price-variance` | Calculate against tenant policy and current market modal data; explain variance basis. | Authenticated role from FR permission matrix; verified active tenant + RLS | `HLD-PROCUREMENT` / `LLD-004` |
|
||||
| `FR-PROCUREMENTCONTRACTS-002` | `POST /api/v1/procurement/contracts` | Create auction/direct-purchase sauda with source-defined commercial terms. | Authenticated role from FR permission matrix; verified active tenant + RLS | `HLD-PROCUREMENT` / `LLD-004` |
|
||||
| `FR-PROCUREMENTCONTRACTS-003` | `PUT /api/v1/suppliers/{supplier_id}/credit-terms` | Set approved supplier credit days and return computed due date on related purchase. | Authenticated role from FR permission matrix; verified active tenant + RLS | `HLD-PROCUREMENT` / `LLD-004` |
|
||||
| `FR-PROCUREMENTCONTRACTS-004` | `POST /api/v1/procurement/contracts/{contract_id}/levies:calculate` | Calculate/apportion configured cess and statutory levies without inventing rates. | Authenticated role from FR permission matrix; verified active tenant + RLS | `HLD-PROCUREMENT` / `LLD-004` |
|
||||
| `FR-INWARDRECEIVING-001` | `POST /api/v1/receipts/gate-entries` | Create verified inbound vehicle/gate entry. | Authenticated role from FR permission matrix; verified active tenant + RLS | `HLD-RECEIVING` / `LLD-003` |
|
||||
| `FR-INWARDRECEIVING-002` | `POST /api/v1/receipts/{receipt_id}/weighments` | Record gross/tare measurements and source. | Authenticated role from FR permission matrix; verified active tenant + RLS | `HLD-RECEIVING` / `LLD-003` |
|
||||
| `FR-INWARDRECEIVING-003` | `POST /api/v1/receipts/{receipt_id}/net-quantity:calculate` | Compute tare deduction/final net quantity using approved policy/contract inputs. | Authenticated role from FR permission matrix; verified active tenant + RLS | `HLD-RECEIVING` / `LLD-003` |
|
||||
| `FR-INWARDRECEIVING-004` | `POST /api/v1/receipts/{receipt_id}/shortage:assess` | Compare shortage against approved tolerance and capture disposition. | Authenticated role from FR permission matrix; verified active tenant + RLS | `HLD-RECEIVING` / `LLD-003` |
|
||||
| `FR-INWARDRECEIVING-005` | `POST /api/v1/goods-receipts` | Post GRN, warehouse placement, lot/stock/audit/outbox atomically. | Authenticated role from FR permission matrix; verified active tenant + RLS | `HLD-RECEIVING` / `LLD-003` |
|
||||
| `FR-INWARDRECEIVING-006` | `POST /api/v1/lots:generate` | Create unique lot/batch identity linked to its source receipt. | Authenticated role from FR permission matrix; verified active tenant + RLS | `HLD-RECEIVING` / `LLD-003` |
|
||||
| `FR-QUALITYANDLOTCONTROL-001` | `POST /api/v1/lots/{lot_id}/inspections` | Record QC parameters with numeric bounds. | Authenticated role from FR permission matrix; verified active tenant + RLS | `HLD-QUALITY` / `LLD-003` |
|
||||
| `FR-QUALITYANDLOTCONTROL-002` | `POST /api/v1/lots/{lot_id}/quality-adjustments:calculate` | Calculate contract/policy deduction and require authorization at the stated floor. | Authenticated role from FR permission matrix; verified active tenant + RLS | `HLD-QUALITY` / `LLD-003` |
|
||||
| `FR-QUALITYANDLOTCONTROL-003` | `POST /api/v1/lots/{lot_id}/transitions` | Apply allowed QC transition; prevent allocation/dispatch while held. | Authenticated role from FR permission matrix; verified active tenant + RLS | `HLD-QUALITY` / `LLD-003` |
|
||||
| `FR-QUALITYANDLOTCONTROL-004` | `POST /api/v1/lots/{lot_id}/lineage-operations` | Split/blend with exact parent/child quantity conservation and lineage. | Authenticated role from FR permission matrix; verified active tenant + RLS | `HLD-QUALITY` / `LLD-003` |
|
||||
| `FR-WAREHOUSEINVENTORY-001` | `GET /api/v1/inventory/positions; POST /api/v1/inventory/adjustments` | Read derived double-entry positions; adjustment uses reason/approval and cannot create negative stock. | Authenticated role from FR permission matrix; verified active tenant + RLS | `HLD-INVENTORY` / `LLD-003` |
|
||||
| `FR-WAREHOUSEINVENTORY-002` | `GET /api/v1/godowns/{godown_id}/capacity` | Return capacity, current MT and utilization with source warning threshold. | Authenticated role from FR permission matrix; verified active tenant + RLS | `HLD-INVENTORY` / `LLD-003` |
|
||||
| `FR-WAREHOUSEINVENTORY-003` | `POST /api/v1/inventory/transfers` | Post a tenant-scoped transfer aggregate with paired movements and idempotency. | Authenticated role from FR permission matrix; verified active tenant + RLS | `HLD-INVENTORY` / `LLD-003` |
|
||||
| `FR-SALESCONTRACTS-001` | `POST /api/v1/sales/contracts` | Create sales contract with actor authorization and source business constraints. | Authenticated role from FR permission matrix; verified active tenant + RLS | `HLD-SALES` / `LLD-004` |
|
||||
| `FR-SALESCONTRACTS-002` | `GET /api/v1/customers/{customer_id}/credit-exposure; POST /api/v1/credit-checks` | Calculate exposure and credit decision under serialized/consistent transaction semantics. | Authenticated role from FR permission matrix; verified active tenant + RLS | `HLD-SALES` / `LLD-004` |
|
||||
| `FR-SALESCONTRACTS-003` | `POST /api/v1/sales/contracts/{contract_id}/allocations` | Reserve eligible released stock atomically; reject QC-held or unavailable lots. | Authenticated role from FR permission matrix; verified active tenant + RLS | `HLD-SALES` / `LLD-004` |
|
||||
| `FR-DISPATCHDELIVERY-001` | `GET /api/v1/dispatches/board` | Return eligible dispatch work and current blockers. | Authenticated role from FR permission matrix; verified active tenant + RLS | `HLD-DISPATCH` / `LLD-004` |
|
||||
| `FR-DISPATCHDELIVERY-002` | `POST /api/v1/dispatches/{dispatch_id}/manifest` | Record outward weighment/manifest and transition dispatch under inventory/credit rules. | Authenticated role from FR permission matrix; verified active tenant + RLS | `HLD-DISPATCH` / `LLD-004` |
|
||||
| `FR-DISPATCHDELIVERY-003` | `POST /api/v1/dispatches/{dispatch_id}/proof-of-delivery` | Record POD/tracking evidence and status; document storage provider remains unselected. | Authenticated role from FR permission matrix; verified active tenant + RLS | `HLD-DISPATCH` / `LLD-004` |
|
||||
| `FR-FLEETREGISTRY-001` | `POST/GET/PATCH /api/v1/fleet/vehicles` | Maintain vehicle record; reject maintenance vehicles for dispatch assignment. | Authenticated role from FR permission matrix; verified active tenant + RLS | `HLD-FLEET` / `LLD-009` |
|
||||
| `FR-CUSTOMERRECEIVABLES-001` | `GET /api/v1/receivables/ledger` | Query immutable receivable entries and tenant-scoped aging. | Authenticated role from FR permission matrix; verified active tenant + RLS | `HLD-RECEIVABLES` / `LLD-004` |
|
||||
| `FR-CUSTOMERRECEIVABLES-002` | `GET /api/v1/receivables/credit-exposure; POST /api/v1/receivables/credit-evaluations` | Compute exposure and issue threshold alert from approved tenant policy. | Authenticated role from FR permission matrix; verified active tenant + RLS | `HLD-RECEIVABLES` / `LLD-004` |
|
||||
| `FR-CUSTOMERRECEIVABLES-003` | `POST /api/v1/customers/{customer_id}/credit-overrides` | Authorize, justify, audit and time-scope partner override; preserve required lock state. | Authenticated role from FR permission matrix; verified active tenant + RLS | `HLD-RECEIVABLES` / `LLD-004` |
|
||||
| `FR-CUSTOMERRECEIVABLES-004` | `POST /api/v1/receivables/receipts` | Record receipt in append-only financial ledger; bounced reversal uses compensating entry. | Authenticated role from FR permission matrix; verified active tenant + RLS | `HLD-RECEIVABLES` / `LLD-004` |
|
||||
| `FR-SUPPLIERPAYABLES-001` | `GET /api/v1/payables/aging` | Derive payable aging from accepted GRNs and supplier credit days. | Authenticated role from FR permission matrix; verified active tenant + RLS | `HLD-PAYABLES` / `LLD-004` |
|
||||
| `FR-OPERATINGEXPENSES-001` | `POST /api/v1/expenses/vouchers` | Create and post only balanced cash/bank expense voucher. | Authenticated role from FR permission matrix; verified active tenant + RLS | `HLD-EXPENSES` / `LLD-009` |
|
||||
| `FR-OPERATIONALALERTS-001` | `GET /api/v1/alerts; PATCH /api/v1/alerts/{alert_id}/review` | List/review tenant-scoped alerts; notification channel is configurable and no provider is selected. | Authenticated role from FR permission matrix; verified active tenant + RLS | `HLD-EVENTS-ALERTS` / `LLD-005` |
|
||||
| `FR-EXECUTIVEREPORTING-001` | `GET /api/v1/reports/executive-dashboard` | Return the requested KPI/source aggregates within the FR dashboard response target. | Authenticated role from FR permission matrix; verified active tenant + RLS | `HLD-REPORTING` / `LLD-005` |
|
||||
| `FR-EXECUTIVEREPORTING-002` | `GET /api/v1/reports/trading-snapshots` | Return rolling 20-day daily ledger-derived management snapshot. | Authenticated role from FR permission matrix; verified active tenant + RLS | `HLD-REPORTING` / `LLD-005` |
|
||||
| `FR-MASTERDATA-001` | `POST/GET/PATCH /api/v1/master-data/commodities; /varieties; /grades` | Maintain tenant-scoped catalogs; code uniqueness and active-stock delete restriction. | Authenticated role from FR permission matrix; verified active tenant + RLS | `HLD-MASTERDATA` / `LLD-008` |
|
||||
| `FR-MASTERDATA-002` | `POST/GET/PATCH /api/v1/master-data/suppliers; /customers; /godowns` | Maintain tenant-scoped counterparty/location masters; tax ID details subject to AMB-010. | Authenticated role from FR permission matrix; verified active tenant + RLS | `HLD-MASTERDATA` / `LLD-008` |
|
||||
| `FR-TENANTSECURITYAUDIT-001` | `Cross-cutting request/worker/data access enforcement` | No direct endpoint; verified tenant context plus PostgreSQL RLS on all tenant records. | Middleware/worker + RLS invariant; no endpoint | `HLD-ISOLATION-AUDIT` / `LLD-002` |
|
||||
| `FR-TENANTSECURITYAUDIT-003` | `GET /api/v1/audit/events (authorized audit readers only)` | Read immutable events; filters and response fields follow UC permissions/privacy constraints. | Authenticated role from FR permission matrix; verified active tenant + RLS | `HLD-ISOLATION-AUDIT` / `LLD-002` |
|
||||
| `FR-TENANTLIFECYCLE-001` | `POST /api/v1/platform/tenants; PATCH /api/v1/platform/tenants/{tenant_id}/status` | Platform-admin-only create/activate/suspend lifecycle commands with audit. | Platform administrator / operator role, control-plane boundary | `HLD-TENANCY` / `LLD-002` |
|
||||
| `FR-TENANTMEMBERSHIPCONTEXT-001` | `POST/PATCH /api/v1/tenants/{tenant_id}/memberships` | Tenant-admin membership/role administration restricted to that verified tenant. | Authenticated role from FR permission matrix; verified active tenant + RLS | `HLD-TENANCY` / `LLD-002` |
|
||||
| `FR-TENANTMEMBERSHIPCONTEXT-002` | `POST /api/v1/session/active-tenant; cross-cutting request resolver` | Validate chosen tenant membership/role on every API and worker operation; client ID alone grants nothing. | Authenticated role from FR permission matrix; verified active tenant + RLS | `HLD-TENANCY` / `LLD-002` |
|
||||
| `FR-TENANTSUPPORTSECURITY-001` | `Cross-cutting API/worker/export/file/cache isolation` | No direct endpoint; resource ownership and tenant context enforced end to end. | Middleware/worker + RLS invariant; no endpoint | `HLD-ISOLATION-AUDIT` / `LLD-002` |
|
||||
| `FR-TENANTSUPPORTSECURITY-002` | `POST /api/v1/platform/support-access/requests; POST /grants; POST /revocations` | Apply tenant-approved case access or urgent, reasoned, maximum one-hour break-glass grant and alert/notice requirements. | Tenant-admin approval or designated platform security admin with scoped support grant; separate control-plane authorization | `HLD-ISOLATION-AUDIT` / `LLD-002` |
|
||||
| `FR-PRIVACYPURPOSECONSENT-001` | `POST/GET/PATCH /api/v1/privacy/purposes; POST /consent-events` | Maintain responsible-entity-scoped purposes/notices; record consent only when selected basis is consent; process withdrawal. | Responsible fiduciary privacy role; verified tenant or platform scope | `HLD-PRIVACY-INCIDENT-LIFECYCLE` / `LLD-011` |
|
||||
| `FR-DATAPRINCIPALRIGHTS-001` | `POST /api/v1/privacy/requests; GET/PATCH /api/v1/privacy/requests/{request_id}` | Allow no-account intake, verify subject/scope, route to responsible fiduciary, track due date/disposition/evidence. | Public no-account intake creates an unverified case only; protected staff actions require the responsible fiduciary privacy role and verified scope | `HLD-PRIVACY-INCIDENT-LIFECYCLE` / `LLD-011` |
|
||||
| `FR-PRIVACYBREACHRESPONSE-001` | `POST/GET/PATCH /api/v1/privacy/breaches` | Coordinate incident, impact, evidence, roles and notification tasks; statutory deadline values require approved legal configuration. | Responsible fiduciary privacy role; verified tenant or platform scope | `HLD-PRIVACY-INCIDENT-LIFECYCLE` / `LLD-006` |
|
||||
| `FR-RETENTIONERASURE-001` | `POST /api/v1/privacy/retention-schedules; POST /api/v1/privacy/erasure-cases` | Resolve approved schedule/legal holds across stores, execute authorized lifecycle, produce non-sensitive evidence. | Responsible fiduciary privacy role; verified tenant or platform scope | `HLD-PRIVACY-INCIDENT-LIFECYCLE` / `LLD-006` |
|
||||
| `FR-PROCESSORGOVERNANCE-001` | `POST/GET/PATCH /api/v1/platform/processors` | Operator-only processor inventory/due diligence; no live connector implied by inventory. | Platform administrator / operator role, control-plane boundary | `HLD-PROCESSOR-GOVERNANCE` / `LLD-011` |
|
||||
| `FR-TENANTOPERATINGPOLICIES-001` | `POST/GET/PATCH /api/v1/tenant/policies; POST /confirmations` | Version tenant/scope/effective dates; authorized confirmation; block only impacted workflows while unreviewed. | Authenticated role from FR permission matrix; verified active tenant + RLS | `HLD-TENANT-POLICY` / `LLD-010` |
|
||||
|
||||
## Shared request, response and failure rules
|
||||
|
||||
- Tenant ID is resolved from authenticated membership; body/query tenant selectors only scope an already-authorized request.
|
||||
- List endpoints require bounded pagination and deterministic sort; filters apply after tenant scope. Export/report jobs preserve tenant identity, actor, filter and purpose in the job record.
|
||||
- State-changing requests carry an idempotency key when repeated delivery could duplicate a financial, inventory, lifecycle or privacy action. Duplicate keys return the original result or a typed conflict if payload differs.
|
||||
- Validation failures identify a stable rule code and affected field without returning sensitive values. Authorization failures do not disclose whether another tenant’s resource exists.
|
||||
- Concurrency conflicts return a retryable conflict only when the command is safe to retry; financial/stock conflicts require re-read/re-evaluation, not blind overwrite.
|
||||
- `FR-TENANTSECURITYAUDIT-001` and `FR-TENANTSUPPORTSECURITY-001` are enforced across all endpoints, workers and data surfaces.
|
||||
- Authentication/session endpoint details must respect `AMB-009`; browser token storage, exact callback and provider revocation timing are not asserted here.
|
||||
- Privacy deadlines and retention behavior use approved configured rules; missing legal configuration does not silently substitute a guessed duration (`AMB-006`).
|
||||
|
|
@ -0,0 +1,97 @@
|
|||
---
|
||||
id: ARCH-SPIKE-001
|
||||
version: 1.0.0
|
||||
status: Reviewed — Stage 7 design baseline approved by human lead; runtime validation pending
|
||||
last_cr: none
|
||||
---
|
||||
|
||||
# Architecture Spike Report — ATB Stages 6–7
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| **Scope** | Current 26 authored use cases / 54 child FRs |
|
||||
| **Architecture source** | `tech-profile.yaml` |
|
||||
| **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** | Candidate design baseline approved by human lead on 2026-10-11; runtime proof remains pending |
|
||||
|
||||
## 1. Spike Selection
|
||||
|
||||
The deep walkthrough uses the highest-risk representative cross-section: UC-001 (OIDC/auth), UC-019 (membership/context), UC-017/020 (isolation/audit/support), UC-005 (GRN), UC-006 (QC FSM), UC-007 (double-entry stock), UC-011 (financial reversal/credit), and UC-014 (operational alerts). Related architecturally significant use cases map to the same component patterns: UC-003/015 to reporting/events, UC-004/008/009/012 to financial controls, UC-018 to the tenant control plane, and UC-023/024 to privacy lifecycle controls. No non-significant use case is used to justify a separate Stage 7 architecture pattern.
|
||||
|
||||
## 2. Candidate Service Template
|
||||
|
||||
```text
|
||||
app/
|
||||
api/v1/ # thin FastAPI routes, auth/context dependencies
|
||||
modules/<bounded_context>/
|
||||
domain/ # entities, transitions, policies (no HTTP/DB framework)
|
||||
application/ # commands, queries, transaction boundaries
|
||||
infrastructure/ # SQLAlchemy repositories, outbox, adapters
|
||||
platform/
|
||||
identity/ # OIDC validation, membership/context resolver
|
||||
tenancy/ # transaction-local context + RLS helpers
|
||||
audit/ # append-only governed-mutation interface
|
||||
events/ # outbox publisher, idempotent consumers
|
||||
integrations/
|
||||
identity/ notification/ # configured real adapters + deterministic sandbox ports
|
||||
worker/ # outbox consumers use the same tenant context controls
|
||||
db/migrations/ # Alembic, RLS policies, indexes, constraints
|
||||
tests/
|
||||
unit/ integration/ api/ browser/ smoke/
|
||||
```
|
||||
|
||||
Domain modules depend on application ports; HTTP, SQLAlchemy, Keycloak and Valkey stay at adapters. Every write uses a transaction-scoped tenant context, authorization decision, idempotency key, audit write, and (when publishing) outbox row. The logical repository structure is an approved design pattern, not a claim that product files/code already exist.
|
||||
|
||||
## 3. End-to-End Walking-Skeleton Scenarios
|
||||
|
||||
### Scenario A — Tenant-scoped receipt through QC and stock
|
||||
|
||||
1. User signs in through Keycloak OIDC/PKCE; invalid identity/session fails closed.
|
||||
2. API resolves the selected tenant against active membership and role; a forged or inactive membership is denied.
|
||||
3. Yard Supervisor submits weighment and GRN command with idempotency key. One PostgreSQL transaction sets verified tenant context, applies RLS, validates measurements, persists GRN/lot, posts balanced stock entries and audit, then inserts outbox event.
|
||||
4. Quality Officer records inspection. A source-threshold breach transitions lot to `QC Hold`; an allocation/dispatch attempt is rejected in domain service and database transaction.
|
||||
5. Outbox worker publishes the committed event; alert consumer records one tenant-scoped alert. Retry after Valkey/messaging interruption is idempotent.
|
||||
6. A second tenant cannot read the GRN, lot, ledger, uploaded evidence or alert by API, direct repository query, export or background job.
|
||||
|
||||
### Scenario B — Bounced payment preserves financial history
|
||||
|
||||
1. Authorized Accounts Executive records a customer receipt under verified tenant context.
|
||||
2. A later `Bounced` transition atomically appends reversal entries, recomputes exposure, restores a required credit lock, writes audit and outbox event.
|
||||
3. A repeated bounce command does not add a second reversal. Concurrent sales confirmation cannot pass on stale exposure. Partner override requires a separate authorized, justified, audited command.
|
||||
|
||||
## 4. Design Validation Matrix
|
||||
|
||||
| Risk / invariant | Candidate control | Walkthrough result | Evidence still required |
|
||||
|---|---|---|---|
|
||||
| Forged tenant selector / stale membership | Server-side UC-019 resolver before tenant data access | Consistent: denial occurs before DB context is established | Implemented Keycloak adapter, membership tests |
|
||||
| Pooled connection tenant leakage | Transaction-local context; RLS USING + WITH CHECK; no BYPASSRLS role | Consistent if all tenant queries share the transaction wrapper; bypass remains a critical implementation hazard | PostgreSQL integration tests across reused connections and direct SQL paths |
|
||||
| Partial GRN/lot/ledger writes | Single ACID transaction + idempotency + constraints | Consistent: rollback leaves no partial posting | Migration execution, fault injection, retry tests |
|
||||
| QC Hold bypass / concurrent allocation | Domain transition and allocation lock/check in transaction | Consistent: service/API and browser cannot override state | Concurrency/invariant tests against PostgreSQL |
|
||||
| Duplicate/lost events | Transactional outbox, idempotent consumer; Valkey is not source of truth | Consistent under stream outage; delivery delay is visible | Worker restart, duplicate delivery and outage test |
|
||||
| Financial bounce reversal | Append-only compensating entries; serialize exposure update | Consistent with immutable financial history and lock recomputation | Race tests, precision tests, reconciliation evidence |
|
||||
| Data disclosure in export/cache/file | Tenant ownership on object references and job payload; resolver used in worker | Pattern is consistent but storage provider/ACL semantics unresolved | Cross-tenant security tests for each storage surface |
|
||||
| Provider outage | Identity fails closed; committed business events remain in outbox | Consistent; no login during identity outage; no event loss | Offline deterministic sandbox and failure-injection execution |
|
||||
|
||||
**Design walkthrough result:** no internal contradiction was found in the proposed trust/transaction sequence. The walkthrough is not runtime validation. There is no product app, database migration, deployment target, or spike test harness in this repository; no runtime or load tests were run. Stage 7 must not be described as runtime-validated.
|
||||
|
||||
## 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. The baseline patterns below were approved by `DEC-021`; implementation detail and validation remain open:
|
||||
|
||||
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. Runtime proof of the approved reference patterns remains an implementation/environment evidence requirement; Stage 7 approval does not claim runtime validation.
|
||||
|
||||
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
|
||||
|
||||
**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: User (approval recorded in session)
|
||||
- Disposition: Approve for Stage 7 and proceed
|
||||
- Date and notes: 2026-10-11; design baseline approval, not runtime validation.
|
||||
|
|
@ -0,0 +1,107 @@
|
|||
---
|
||||
id: DB-DESIGN-001
|
||||
parent_ids: [HLD-ATB, 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 9 design; Gate 9.1 passed, review pending
|
||||
last_cr: none
|
||||
---
|
||||
|
||||
# Database Design — PostgreSQL / SQLAlchemy / Alembic
|
||||
|
||||
## 1. Shared persistence rules
|
||||
|
||||
- Tenant-owned rows include non-null `tenant_id`; tenant-scoped primary/foreign/unique constraints include tenant ownership to prevent cross-tenant references. Use transaction-local PostgreSQL context set only by the verified membership resolver; enable RLS `USING` and `WITH CHECK`. Application runtime roles do not own protected tables and do not have `BYPASSRLS`.
|
||||
- Control-plane records (tenant directory, platform processor inventory, platform-operated privacy cases) use separately authorized tables/role policies; never grant ordinary tenant sessions broad control-plane access.
|
||||
- Use UUID surrogate keys unless a business-readable identifier is explicitly defined (for example the `EXP-YYYYMM-xxx` expense number). `timestamptz` stores instants; business dates use `date` with explicit timezone policy at API boundary.
|
||||
- Use exact numeric types, not binary floating point. Currency precision is 2 decimal places; weight/quantity precision follows source NFR (3 decimal places); rates and percentages use adequate exact numeric scale with source validation. Units are persisted explicitly where conversion is possible.
|
||||
- Posted stock, receivable, payable and cash/bank journal entries are append-only. Corrections create linked reversal/adjustment entries. Mutable query projections carry source version/watermark and are rebuildable.
|
||||
- Every migration adds FK/check/unique indexes and RLS policies with tenant tests; large-ledger query indexes follow measured access patterns. This design is not a migration-executed claim.
|
||||
|
||||
## 2. Entity and constraint catalog
|
||||
|
||||
| Domain / entity | FR scope | Key attributes / relationships | Principal constraints / access |
|
||||
| Identity / Tenant / Membership | FR-AUTH-001–003; FR-TENANTLIFECYCLE-001; FR-TENANTMEMBERSHIPCONTEXT-001/002 | Tenant, external identity subject, active membership, role grants, status/effective timestamps | Tenant control-plane permissions separate; unique (tenant_id, subject); active verified membership required before RLS context. |
|
||||
| MarketObservation | FR-MKT-001/002 | Market, commodity, variety, grade, business date, arrivals MT, stock MT, source, observed_at, holiday status, min/modal/max INR/Qtl | Tenant unique (market, commodity, variety, date); nonfuture date, arrivals >=0, holiday allows absent arrival; positive rates and min<=modal<=max. |
|
||||
| MarketTrendProjection | FR-MARKETTRENDANALYTICS-001 | Date/commodity/market aggregates, source observation IDs, projection watermark | Read model only; tenant keyed; rebuildable and bounded to requested date/20-day domain. |
|
||||
| ProcurementContract / SupplierTerms / Levy | FR-PROCUREMENTCONTRACTS-001–004 | Sauda mode, supplier, commodity, agreed rate/quantity, credit days/due date, levy type/base/rate/amount, modal comparison inputs | Credit days source-approved; configured values/levy rates not invented; contract and calculations tenant-owned. |
|
||||
| GateEntry / Weighment / GoodsReceipt / Lot | FR-INWARDRECEIVING-001–006 | Vehicle/source, gross/tare, packaging tare, net MT, shortage, receipt/GRN identity, warehouse, lot/batch link | Net nonnegative and source formulas/tolerance; unique tenant GRN/lot IDs; atomic GRN/lot/stock/audit/outbox commit. |
|
||||
| Inspection / QualityAdjustment / LotLineage | FR-QUALITYANDLOTCONTROL-001–004 | Inspection measures, officer, grade/status; base/penalty/adjusted rates; parent-child lot IDs and quantities | Percent 0..100; hold/release role FSM; held lot never allocated/dispatched; split quantities conserve parent. |
|
||||
| Warehouse / StockJournal / StockPosition / Transfer / Audit | FR-WAREHOUSEINVENTORY-001–003 | Warehouse capacity; signed inbound/outbound movement; MT/bag units; transfer state; physical count/reason; derived balance | Balanced append-only journal, nonnegative positions; adjustment approval at stated threshold; paired transfer movements in one transaction. |
|
||||
| SalesContract / CreditExposure / LotAllocation | FR-SALESCONTRACTS-001–003 | Customer, contract, quantity/rate, exposure inputs, credit decision, allocated lot/quantity/reservation | Serialize exposure and reservation; approved policy; no held/insufficient lot; idempotent command. |
|
||||
| Dispatch / Manifest / ProofOfDelivery | FR-DISPATCHDELIVERY-001–003 | Eligible order/lot, vehicle, outward weighment, manifest, transit state, POD evidence reference | Only credit-cleared and QC-released allocatable stock; evidence ref tenant-owned; mutation/audit and inventory boundary transactional. |
|
||||
| FleetVehicle | FR-FLEETREGISTRY-001 | Registration, make/model, payload MT, ownership, transporter, status, insurance/fitness expiry | Unique tenant registration; Maintenance cannot be assigned; no telematics integration table. |
|
||||
| Receivable / Receipt / CreditLock / PayableProjection | FR-CUSTOMERRECEIVABLES-001–004; FR-SUPPLIERPAYABLES-001 | Customer/supplier ledger entries, receipt instrument/status, due date, exposure, lock/override, daily payable snapshot | Append-only financial journal; bounced receipt reversal linked and idempotent; payables derive from accepted GRN. |
|
||||
| ExpenseVoucher / CashBankJournal | FR-OPERATINGEXPENSES-001 | Expense ID/date/category/amount/payee/link/payment mode/status and balanced debit-credit references | Currency exact 2 decimals; voucher balances before post; post corrections compensating only. |
|
||||
| OperationalAlert / DashboardSnapshot | FR-OPERATIONALALERTS-001; FR-EXECUTIVEREPORTING-001/002 | Alert condition/source/version/status/created/reviewed; dashboard and daily snapshot values | Tenant key; event consumer idempotency; reporting read model reconciles to ledgers; performance targets remain FR-derived. |
|
||||
| Commodity / Variety / Grade / Counterparty / Godown | FR-MASTERDATA-001/002 | Codes, labels, categories, units/standard bag weight; supplier/customer tax/contact/credit fields; godown capacity/location | Tenant-scoped unique codes; commodity with active stock cannot delete; tax-ID validation open AMB-010. |
|
||||
| AuditEvent / OutboxEvent / IdempotencyRecord | Cross-cutting NFR-AUDIT-001; all governed commands | Actor, tenant, resource/action, timestamp, correlation, FR-specific reason/delta; aggregate/version/event payload/status; command scope key/hash/result | Mutation audit and outbox commit in source transaction; audit append-only; outbox at-least-once; idempotency uniqueness scoped by tenant/operation. |
|
||||
| PrivacyPurpose / ConsentEvidence / RightsRequest | FR-PRIVACYPURPOSECONSENT-001; FR-DATAPRINCIPALRIGHTS-001 | Purpose/category/responsible role/basis/notice; consent/withdrawal evidence; principal reference, scope, request type, verification, deadline/disposition | Separate tenant Fiduciary from platform Fiduciary; consent events only if basis is consent; due dates from approved config; no-account intake. |
|
||||
| BreachCase / RetentionSchedule / ErasureCase / ProcessorRecord | FR-PRIVACYBREACHRESPONSE-001; FR-RETENTIONERASURE-001; FR-PROCESSORGOVERNANCE-001 | Incident/affected scope/evidence refs/roles/notification status; approved purpose schedules/legal holds; deletion workflow; processor location/safeguard/diligence | Privacy case access restricted/audited; hold blocks applicable erase; exact statutory timing/retention open AMB-006; control-plane processor inventory separated. |
|
||||
| TenantPolicyVersion | FR-TENANTOPERATINGPOLICIES-001 | Tenant/type/scope/value/unit/effective range/review actor/time/reason/prior value/version | No overlapping effective ranges for same scope; immutable versions; confirmed policy version referenced by governed transaction; unreviewed blocks only impacted flow. |
|
||||
|
||||
## 3. Requirement-to-data ownership matrix
|
||||
|
||||
| FR | SRS | Owning entity family |
|
||||
|---|---|---|
|
||||
| `FR-AUTH-001` | `SRS-AUTH-001` | See entity catalog row for this FR. |
|
||||
| `FR-AUTH-002` | `SRS-AUTH-002` | See entity catalog row for this FR. |
|
||||
| `FR-AUTH-003` | `SRS-AUTH-003` | See entity catalog row for this FR. |
|
||||
| `FR-MKT-001` | `SRS-MKT-001` | See entity catalog row for this FR. |
|
||||
| `FR-MKT-002` | `SRS-MKT-002` | See entity catalog row for this FR. |
|
||||
| `FR-MARKETTRENDANALYTICS-001` | `SRS-MARKETTRENDANALYTICS-001` | See entity catalog row for this FR. |
|
||||
| `FR-PROCUREMENTCONTRACTS-001` | `SRS-PROCUREMENTCONTRACTS-001` | See entity catalog row for this FR. |
|
||||
| `FR-PROCUREMENTCONTRACTS-002` | `SRS-PROCUREMENTCONTRACTS-002` | See entity catalog row for this FR. |
|
||||
| `FR-PROCUREMENTCONTRACTS-003` | `SRS-PROCUREMENTCONTRACTS-003` | See entity catalog row for this FR. |
|
||||
| `FR-PROCUREMENTCONTRACTS-004` | `SRS-PROCUREMENTCONTRACTS-004` | See entity catalog row for this FR. |
|
||||
| `FR-INWARDRECEIVING-001` | `SRS-INWARDRECEIVING-001` | See entity catalog row for this FR. |
|
||||
| `FR-INWARDRECEIVING-002` | `SRS-INWARDRECEIVING-002` | See entity catalog row for this FR. |
|
||||
| `FR-INWARDRECEIVING-003` | `SRS-INWARDRECEIVING-003` | See entity catalog row for this FR. |
|
||||
| `FR-INWARDRECEIVING-004` | `SRS-INWARDRECEIVING-004` | See entity catalog row for this FR. |
|
||||
| `FR-INWARDRECEIVING-005` | `SRS-INWARDRECEIVING-005` | See entity catalog row for this FR. |
|
||||
| `FR-INWARDRECEIVING-006` | `SRS-INWARDRECEIVING-006` | See entity catalog row for this FR. |
|
||||
| `FR-QUALITYANDLOTCONTROL-001` | `SRS-QUALITYANDLOTCONTROL-001` | See entity catalog row for this FR. |
|
||||
| `FR-QUALITYANDLOTCONTROL-002` | `SRS-QUALITYANDLOTCONTROL-002` | See entity catalog row for this FR. |
|
||||
| `FR-QUALITYANDLOTCONTROL-003` | `SRS-QUALITYANDLOTCONTROL-003` | See entity catalog row for this FR. |
|
||||
| `FR-QUALITYANDLOTCONTROL-004` | `SRS-QUALITYANDLOTCONTROL-004` | See entity catalog row for this FR. |
|
||||
| `FR-WAREHOUSEINVENTORY-001` | `SRS-WAREHOUSEINVENTORY-001` | See entity catalog row for this FR. |
|
||||
| `FR-WAREHOUSEINVENTORY-002` | `SRS-WAREHOUSEINVENTORY-002` | See entity catalog row for this FR. |
|
||||
| `FR-WAREHOUSEINVENTORY-003` | `SRS-WAREHOUSEINVENTORY-003` | See entity catalog row for this FR. |
|
||||
| `FR-SALESCONTRACTS-001` | `SRS-SALESCONTRACTS-001` | See entity catalog row for this FR. |
|
||||
| `FR-SALESCONTRACTS-002` | `SRS-SALESCONTRACTS-002` | See entity catalog row for this FR. |
|
||||
| `FR-SALESCONTRACTS-003` | `SRS-SALESCONTRACTS-003` | See entity catalog row for this FR. |
|
||||
| `FR-DISPATCHDELIVERY-001` | `SRS-DISPATCHDELIVERY-001` | See entity catalog row for this FR. |
|
||||
| `FR-DISPATCHDELIVERY-002` | `SRS-DISPATCHDELIVERY-002` | See entity catalog row for this FR. |
|
||||
| `FR-DISPATCHDELIVERY-003` | `SRS-DISPATCHDELIVERY-003` | See entity catalog row for this FR. |
|
||||
| `FR-FLEETREGISTRY-001` | `SRS-FLEETREGISTRY-001` | See entity catalog row for this FR. |
|
||||
| `FR-CUSTOMERRECEIVABLES-001` | `SRS-CUSTOMERRECEIVABLES-001` | See entity catalog row for this FR. |
|
||||
| `FR-CUSTOMERRECEIVABLES-002` | `SRS-CUSTOMERRECEIVABLES-002` | See entity catalog row for this FR. |
|
||||
| `FR-CUSTOMERRECEIVABLES-003` | `SRS-CUSTOMERRECEIVABLES-003` | See entity catalog row for this FR. |
|
||||
| `FR-CUSTOMERRECEIVABLES-004` | `SRS-CUSTOMERRECEIVABLES-004` | See entity catalog row for this FR. |
|
||||
| `FR-SUPPLIERPAYABLES-001` | `SRS-SUPPLIERPAYABLES-001` | See entity catalog row for this FR. |
|
||||
| `FR-OPERATINGEXPENSES-001` | `SRS-OPERATINGEXPENSES-001` | See entity catalog row for this FR. |
|
||||
| `FR-OPERATIONALALERTS-001` | `SRS-OPERATIONALALERTS-001` | See entity catalog row for this FR. |
|
||||
| `FR-EXECUTIVEREPORTING-001` | `SRS-EXECUTIVEREPORTING-001` | See entity catalog row for this FR. |
|
||||
| `FR-EXECUTIVEREPORTING-002` | `SRS-EXECUTIVEREPORTING-002` | See entity catalog row for this FR. |
|
||||
| `FR-MASTERDATA-001` | `SRS-MASTERDATA-001` | See entity catalog row for this FR. |
|
||||
| `FR-MASTERDATA-002` | `SRS-MASTERDATA-002` | See entity catalog row for this FR. |
|
||||
| `FR-TENANTSECURITYAUDIT-001` | `SRS-TENANTSECURITYAUDIT-001` | See entity catalog row for this FR. |
|
||||
| `FR-TENANTSECURITYAUDIT-003` | `SRS-TENANTSECURITYAUDIT-003` | See entity catalog row for this FR. |
|
||||
| `FR-TENANTLIFECYCLE-001` | `SRS-TENANTLIFECYCLE-001` | See entity catalog row for this FR. |
|
||||
| `FR-TENANTMEMBERSHIPCONTEXT-001` | `SRS-TENANTMEMBERSHIPCONTEXT-001` | See entity catalog row for this FR. |
|
||||
| `FR-TENANTMEMBERSHIPCONTEXT-002` | `SRS-TENANTMEMBERSHIPCONTEXT-002` | See entity catalog row for this FR. |
|
||||
| `FR-TENANTSUPPORTSECURITY-001` | `SRS-TENANTSUPPORTSECURITY-001` | See entity catalog row for this FR. |
|
||||
| `FR-TENANTSUPPORTSECURITY-002` | `SRS-TENANTSUPPORTSECURITY-002` | See entity catalog row for this FR. |
|
||||
| `FR-PRIVACYPURPOSECONSENT-001` | `SRS-PRIVACYPURPOSECONSENT-001` | See entity catalog row for this FR. |
|
||||
| `FR-DATAPRINCIPALRIGHTS-001` | `SRS-DATAPRINCIPALRIGHTS-001` | See entity catalog row for this FR. |
|
||||
| `FR-PRIVACYBREACHRESPONSE-001` | `SRS-PRIVACYBREACHRESPONSE-001` | See entity catalog row for this FR. |
|
||||
| `FR-RETENTIONERASURE-001` | `SRS-RETENTIONERASURE-001` | See entity catalog row for this FR. |
|
||||
| `FR-PROCESSORGOVERNANCE-001` | `SRS-PROCESSORGOVERNANCE-001` | See entity catalog row for this FR. |
|
||||
| `FR-TENANTOPERATINGPOLICIES-001` | `SRS-TENANTOPERATINGPOLICIES-001` | See entity catalog row for this FR. |
|
||||
|
||||
## 4. Indexing and retention boundaries
|
||||
|
||||
- All tenant unique indexes include `tenant_id`; all tenant joins validate matching ownership.
|
||||
- Index common filters by tenant plus business date/status/foreign key. Composite indexes for reports are chosen against the 50,000-row/tenant validation scenario and measured plans, not speculative blanket indexes.
|
||||
- Do not hard-code privacy durations. `RetentionSchedule` must reference purpose/category, approving fiduciary, effective period, legal-hold rule, and review evidence; `AMB-006` blocks concrete values.
|
||||
- Object/evidence references carry tenant, purpose and sensitivity tags as applicable; physical storage provider and backup/erasure contract remain undecided (`AMB-009`).
|
||||
- RLS policy, constraints, and migrations require PostgreSQL integration tests across reused connections and direct SQL paths before the FRs can advance implementation status.
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
---
|
||||
id: DEPLOYMENT-SPIKE
|
||||
version: 1.0.0
|
||||
status: Reviewed — Stage 7 design baseline; runtime validation pending
|
||||
last_cr: none
|
||||
---
|
||||
|
||||
# Deployment View — Stage 7 Architecture Spike
|
||||
|
||||
## 1. Logical Topology
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
User[Browser] --> CDN[Static React delivery]
|
||||
CDN --> Edge[TLS ingress / rate limiting]
|
||||
Edge --> API1[FastAPI API instance]
|
||||
Edge --> API2[FastAPI API instance]
|
||||
API1 --> PG[(PostgreSQL primary + HA recovery target)]
|
||||
API2 --> PG
|
||||
API1 --> Valkey[(Valkey HA cache / Streams)]
|
||||
Worker[FastAPI worker process] --> PG
|
||||
Worker --> Valkey
|
||||
API1 --> IdP[Keycloak OIDC]
|
||||
API2 --> IdP
|
||||
Worker --> Msg[Messaging adapter / deterministic sandbox]
|
||||
API1 --> Obj[Private object storage]
|
||||
Ops[Metrics, traces, redacted logs] --- API1
|
||||
Ops --- API2
|
||||
Ops --- Worker
|
||||
Backup[Encrypted backup / PITR] --> PG
|
||||
```
|
||||
|
||||
This is a logical candidate, not a provider selection or deployment manifest. Runtime target (cloud, region, managed/self-hosted services, ingress, secrets manager, object store and failover automation) is unselected.
|
||||
|
||||
## 2. Deployment Responsibilities
|
||||
|
||||
- React static assets are served through TLS-protected edge delivery. The browser obtains identity through Keycloak OIDC/PKCE and sends bearer tokens to the API.
|
||||
- API replicas are stateless. Request tenant context is never stored in process-global state; PostgreSQL context is transaction-local.
|
||||
- PostgreSQL stores business records, append-only audit, idempotency records, and outbox. Backup/PITR and restore exercises must prove NFR-011 (RPO ≤15 minutes, RTO ≤4 hours, encrypted daily backups retained 35 days, quarterly restore exercise).
|
||||
- A worker consumes durable outbox work; Valkey speeds delivery but is not the only copy of work. The worker uses the same code and tenant security middleware as the API.
|
||||
- Keycloak, object storage and notification providers are external trust boundaries. `sandbox/identity_mock.py`, `sandbox/notification_mock.py` and other configured mocks support reproducible offline tests.
|
||||
- Secrets are injected from an environment-specific secret store, not committed. Logs/telemetry exclude secrets and unnecessary personal or trading data; tenant/correlation labels are included only where authorized.
|
||||
|
||||
## 3. Deployment Proof Required Before Baseline
|
||||
|
||||
Demonstrate API/worker horizontal scaling without tenant context leakage; PostgreSQL failover and restore against NFR-011; stream unavailability with durable retry; private-file authorization and erasure behavior; and capacity at the NFR-012 envelope. These checks are pending; no cloud, cluster, instance, pool, or replica sizing is claimed as validated.
|
||||
|
|
@ -1,40 +1,80 @@
|
|||
# High-Level Architecture Design (HLD) — Universal Enterprise Platform
|
||||
---
|
||||
id: HLD-ATB
|
||||
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: 3.0.0
|
||||
status: Draft — Stage 9 design; Gate 9.1 passed, review pending
|
||||
last_cr: CR-001
|
||||
---
|
||||
|
||||
# High-Level Architecture Design — Agriculture Trading Backoffice
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| **Document** | `hld.md` |
|
||||
| **System** | Universal Enterprise Platform (UEP) |
|
||||
| **Pattern** | Modular Monolith with Multi-Tenant Row-Level Security |
|
||||
| **Version** | 1.0.0 |
|
||||
| **Status** | Baselined (Elaboration Phase) |
|
||||
| **System** | Agriculture Trading Backoffice (ATB) |
|
||||
| **Pattern** | FastAPI modular monolith with React/TypeScript client; PostgreSQL tenant RLS |
|
||||
| **Technology authority** | `tech-profile.yaml` |
|
||||
| **Architecture baseline** | Stage 7 patterns approved by human lead (`DEC-021`) |
|
||||
| **Stage 9 status** | Full-breadth module ownership and service boundaries designed; runtime validation pending |
|
||||
| **Requirements scope** | 26 UCs, 54 FRs; Stage 8 SRS catalog |
|
||||
|
||||
---
|
||||
## 1. Deployment and Trust Boundary
|
||||
|
||||
## 1. System Architecture Topology
|
||||
React SPA communicates with the FastAPI API over HTTPS and uses the configured Keycloak OIDC/PKCE identity flow. The API validates the configured JWT bearer credentials. Exact session termination/revocation semantics remain open under `AMB-009`; no token algorithm, lifetime or revocation SLA is invented here. Tenant membership and role are resolved server-side before a transaction-local PostgreSQL tenant context is established. RLS policies scope every tenant-owned row. A client tenant selector never confers authorization.
|
||||
|
||||
```mermaid
|
||||
graph TD
|
||||
ClientWeb["Web Portals (React + Vite + Tailwind)"] --> NGINX["API Gateway / Reverse Proxy (NGINX)"]
|
||||
ClientMobile["Mobile Apps / External Consumers"] --> NGINX
|
||||
|
||||
NGINX --> AuthFilter["Auth & Tenant Context Middleware"]
|
||||
AuthFilter --> Keycloak["Identity Provider (Keycloak OIDC)"]
|
||||
|
||||
subgraph Modular Monolith Core
|
||||
AuthFilter --> ModAuth["IAM / Auth Module (LLD-001)"]
|
||||
AuthFilter --> ModDomain["Core Business Modules"]
|
||||
AuthFilter --> ModIntegration["Integration & Sandboxes"]
|
||||
end
|
||||
|
||||
ModAuth --> PG[("PostgreSQL DB (with RLS)")]
|
||||
ModDomain --> PG
|
||||
ModAuth --> Valkey[("Valkey / Redis (Token Blacklist & Cache)")]
|
||||
```
|
||||
The API, outbox publisher, and workers run as separately scalable processes from one modular-monolith codebase. PostgreSQL is the authoritative source for domain state, financial/stock ledgers, audit, and outbox. Valkey is used for cache and event delivery only; it is not the source of truth. Object storage is behind a tenant-aware document port; production provider, region, encryption configuration, and retention behavior remain unselected. Hosting provider and topology sizing remain provider-neutral.
|
||||
|
||||
---
|
||||
## 2. Module and UC Ownership
|
||||
|
||||
## 2. Core Architectural Pillars
|
||||
| HLD Component | Owning UCs / FR scope | Responsibility and boundary | LLD |
|
||||
|---|---|---|---|
|
||||
| `HLD-IAM` | UC-001 / FR-AUTH-001–003 | OIDC session validation, authorization policy, logout application contract; membership is owned separately | LLD-001 |
|
||||
| `HLD-TENANCY` | UC-018/019 / FR-TENANTLIFECYCLE-001, FR-TENANTMEMBERSHIPCONTEXT-001/002 | Tenant control-plane lifecycle, membership administration, verified active context | LLD-002 |
|
||||
| `HLD-ISOLATION-AUDIT` | UC-017/020 / tenant isolation, audit and privileged support FRs | RLS wrapper, tenant ownership for async/export/file/cache paths, append-only mutation audit, controlled support access | LLD-002 |
|
||||
| `HLD-MARKET-DESK` | UC-002 / FR-MKT-001/002 | Manual APMC observation, arrival, price range and modal rate capture | LLD-007 |
|
||||
| `HLD-REPORTING` | UC-003/015 / analytics and dashboard FRs | Read models and tenant-scoped reports; no authoritative ledger writes | LLD-005 |
|
||||
| `HLD-PROCUREMENT` | UC-004 / procurement contract, credit terms and levy FRs | Sauda, supplier terms, modal-price comparison, configured levy computation | LLD-004 |
|
||||
| `HLD-RECEIVING` | UC-005 / inward receipt and GRN FRs | Gate entry, manual weighment, calculation and atomic GRN posting | LLD-003 |
|
||||
| `HLD-QUALITY` | UC-006 / QC inspection, hold/release, lineage FRs | Quality measures, state machine, quality calculation, lot lineage | LLD-003 |
|
||||
| `HLD-INVENTORY` | UC-007 / stock, capacity and transfer FRs | Append-only double-entry movement ledger and derived positions | LLD-003 |
|
||||
| `HLD-SALES` | UC-008 / contract, credit check, allocation FRs | Sales contract and atomic eligible-lot reservation | LLD-004 |
|
||||
| `HLD-DISPATCH` | UC-009 / dispatch, manifest, delivery FRs | Eligible dispatch transitions, manual outward weighment, POD references | LLD-004 |
|
||||
| `HLD-FLEET` | UC-010 / FR-FLEETREGISTRY-001 | Tenant fleet master and maintenance assignment exclusion | LLD-009 |
|
||||
| `HLD-RECEIVABLES` | UC-011 / receivable, credit, receipt FRs | Immutable receivable events, exposure/lock, receipt and compensating reversal | LLD-004 |
|
||||
| `HLD-PAYABLES` | UC-012 / FR-SUPPLIERPAYABLES-001 | Accepted-GRN payable projection and aging; no payment execution connector | LLD-004 |
|
||||
| `HLD-EXPENSES` | UC-013 / FR-OPERATINGEXPENSES-001 | Balanced operational-expense vouchers and cash/bank ledger link | LLD-009 |
|
||||
| `HLD-EVENTS-ALERTS` | UC-014 / FR-OPERATIONALALERTS-001 | Transactional outbox, idempotent event consumption, alert lifecycle | LLD-005 |
|
||||
| `HLD-MASTERDATA` | UC-016 / FR-MASTERDATA-001/002 | Tenant-scoped commodity, grade, supplier, customer and godown reference data | LLD-008 |
|
||||
| `HLD-PRIVACY-INCIDENT-LIFECYCLE` | UC-021–024 / purpose, rights, breach, retention FRs | Fiduciary-scoped privacy records, evidence, legal holds and controlled lifecycle | LLD-006, LLD-011 |
|
||||
| `HLD-PROCESSOR-GOVERNANCE` | UC-025 / FR-PROCESSORGOVERNANCE-001 | Operator-controlled processor/subprocessor inventory and due diligence | LLD-011 |
|
||||
| `HLD-TENANT-POLICY` | UC-026 / FR-TENANTOPERATINGPOLICIES-001 | Effective-dated tenant policy, business-owner confirmation, workflow gating | LLD-010 |
|
||||
|
||||
1. **Multi-Tenancy via Row-Level Security:** Every domain table carries a `tenant_id` UUID column. When requests arrive, the Auth Middleware extracts `tenant_id` from the verified JWT and sets `SET LOCAL app.current_tenant = '<tenant_id>'` on the database session connection pool.
|
||||
2. **Deterministic Wave 0 Sandboxing:** All external third-party integrations (payment gateways, identity verification, SMS/email) implement an abstract adapter with a local deterministic mock under `app/integrations/sandbox/`.
|
||||
3. **Pluggable Event Stream:** Inter-module communication executes via in-process domain event dispatchers that can scale out to message queues (RabbitMQ / Kafka) as needed.
|
||||
Bounded contexts may share the same deployment and PostgreSQL cluster; ownership boundaries are enforced in application modules and transaction/repository interfaces. Cross-context state changes use explicit commands/events, not direct mutation of another module's tables.
|
||||
|
||||
## 3. Standard Command, Query and Transaction Template
|
||||
|
||||
1. API dependency validates identity and resolves role and active tenant membership; system/platform administration uses a distinct control-plane authorization policy.
|
||||
2. Command schema validates format and source-defined invariants; idempotency key is required for retryable posting/state-changing operations.
|
||||
3. Application service opens a PostgreSQL transaction, sets verified tenant context transaction-locally, then reads/writes under RLS and applicable constraints.
|
||||
4. A business transition, its immutable audit record, and any outbox record commit atomically. Financial and stock history is corrected with compensating entries.
|
||||
5. Queries use tenant-filtered repository contracts and bounded pagination. Report projections are rebuildable from authoritative records and do not silently replace the ledger source.
|
||||
6. Worker consumers validate tenant/resource ownership in the job payload, establish their own tenant context, and process at least once with idempotent effects. They never inherit ambient request state.
|
||||
|
||||
## 4. Cross-Context Patterns
|
||||
|
||||
- **Isolation and audit:** Approved Stage 7 `DEC-021` patterns; detailed controls in LLD-002 and `database_design.md`.
|
||||
- **Outbox/events:** PostgreSQL outbox is durable source; Valkey Streams is delivery transport; retries are at-least-once, consumers are idempotent. No exactly-once claim.
|
||||
- **Ledger integrity:** Stock, receivables and cash/bank postings are append-only balanced journals; current positions/exposure are derived or transactionally maintained projections with reconciliation.
|
||||
- **Policy:** Effective-dated tenant values are versioned; an unreviewed value blocks only affected risk-sensitive operations.
|
||||
- **Privacy:** Purpose, responsible fiduciary, tenant/platform scope and sensitivity remain separate metadata; legal deadlines/retention durations are configurable approved inputs, not constants (`AMB-006`).
|
||||
- **External services:** Keycloak is configured for identity. No weighbridge or payment execution integration is added; messaging channel and document-storage production providers remain unselected (`AMB-009`).
|
||||
|
||||
## 5. Quality and Operational Constraints
|
||||
|
||||
- Availability ≥99.9% monthly; RTO ≤4 h; RPO ≤15 min; encrypted daily PITR backups retained 35 days and quarterly restore exercises (`BRD-NFR-011`).
|
||||
- Capacity validation envelope: 50 tenants, up to 25 named users/tenant, 250 concurrent active users; report validation at 50,000 ledger rows/tenant; provisional load scenario 200 documents/tenant/operating day with 5× peak-hour burst. No fixed document quota; fair-share thresholds require test evidence (`BRD-NFR-004`, `BRD-NFR-012`, `AMB-008`).
|
||||
- Reports obey FR-specific targets, including dashboard ≤1.5 s and sub-second 20-day report where stated; Stage 13+ load evidence is still required.
|
||||
- Currency/weight precision, privacy handling, and OWASP ASVS v5.0.0 Level 2 trace to source NFRs; exact applicability and legal schedule remain reviewable under `AMB-006`.
|
||||
|
||||
## 6. Design Status and Review Points
|
||||
|
||||
This document completes the Stage 9 logical decomposition; supporting endpoint, entity/constraint, and adapter contracts are in `api_design.md`, `database_design.md`, and `integration_design.md`. It is a design artifact, not implemented/runtime validation. Before construction, confirm the endpoint and entity contracts at Gate 9.1. Provider deployment choices, exact Keycloak logout contract, tax identifier validation, privacy legal timing/retention, and load-derived fairness thresholds remain open as recorded ambiguities.
|
||||
|
|
|
|||
|
|
@ -0,0 +1,52 @@
|
|||
---
|
||||
id: INT-DESIGN-001
|
||||
parent_ids: [HLD-ATB, UC-001, UC-005, UC-009, UC-014, UC-017, UC-018, UC-019, UC-020, UC-021, UC-022, UC-023, UC-024, UC-025]
|
||||
version: 1.0.0
|
||||
status: Draft — Stage 9 design; Gate 9.1 passed, review pending
|
||||
last_cr: none
|
||||
---
|
||||
|
||||
# Integration Design — Identity, Events and External Boundaries
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| **Architecture basis** | Approved Stage 7 patterns (`DEC-021`) |
|
||||
| **Configured adapters** | Keycloak identity, payment sandbox, messaging sandbox in `tech-profile.yaml` |
|
||||
| **Production provider status** | Keycloak configured; messaging/object-storage deployment choices not selected; payment gateway not in current FR scope |
|
||||
|
||||
## 1. Keycloak OIDC identity provider
|
||||
|
||||
- **Purpose / owning FRs:** OIDC authentication and session requirements (`FR-AUTH-001`, `FR-AUTH-003`); role policy enforcement is local and tenant membership is resolved by UC-019.
|
||||
- **Flow:** Browser initiates the configured OIDC authorization-code flow with PKCE against the configured Keycloak realm/client. The application accepts a session only after validating issuer, audience/client, signature using provider metadata/JWKS, time claims and required authentication result. Exact allowed algorithm/lifetime and refresh/logout/revocation requirements remain for security review under `AMB-009`; no custom target is introduced.
|
||||
- **Data boundary:** Do not place credentials or raw tokens in logs, audit payloads, URL analytics, or outbox events. Map stable provider subject to internal identity; resolve active tenant membership server-side on every request. Provider roles alone never establish tenant access.
|
||||
- **Failure:** Invalid token or identity-provider/JWKS inability fails closed for protected operations; emit safe operational telemetry with correlation, not token values. Session/logout contract is detailed with Keycloak behavior before implementation.
|
||||
- **Sandbox:** Use deterministic identity mock declared in `tech-profile.yaml` for offline tests; do not treat it as production IdP evidence.
|
||||
|
||||
## 2. Transactional outbox and Valkey Streams
|
||||
|
||||
- **Purpose:** Deliver business notifications/projections without losing an event after its source transaction commits; applies to receiving/inventory, finance and operational alert/reporting events.
|
||||
- **Write:** In the same PostgreSQL transaction as the business state and audit record, append outbox row with tenant, event ID, aggregate ID/version, event type/schema version, occurred time, and minimal payload. Commit is the durability boundary.
|
||||
- **Publish:** Worker claims pending rows, publishes using stable event ID to Valkey Streams, then marks delivery progress. Retry uses backoff and does not discard committed events. Valkey loss delays delivery but cannot lose source rows.
|
||||
- **Consume:** Consumer deduplicates event ID in an inbox/idempotency table and applies its projection/alert transition once logically. Delivery guarantee is at least once; ordering is per aggregate/version where required. Poison events are isolated and surfaced for operator review; no silent deletion.
|
||||
- **Tenant context:** Worker derives and validates tenant ownership from the persisted event envelope, sets transaction-local context, and uses RLS. It never trusts ambient API request context.
|
||||
|
||||
## 3. Messaging provider boundary
|
||||
|
||||
`FR-OPERATIONALALERTS-001` does not establish a production channel/provider or exact SMS/email timing. Define a `NotificationPort` with deterministic request/result and delivery status; connect the configured notification sandbox in offline tests. Production adapter, consent/notice requirements, retry and channel escalation remain unselected until product/channel decisions are approved. Failed delivery remains pending/failed and visible; never convert acceptance into a false “delivered” state.
|
||||
|
||||
## 4. Explicitly absent/unselected connectors
|
||||
|
||||
| Boundary | Stage 9 disposition | Reason / governing item |
|
||||
|---|---|---|
|
||||
| Physical weighbridge | No device connector; manual entry contract only | Current inward/outward FRs capture measurements, no device protocol (`RISK-005`, `RISK-009`). |
|
||||
| Payment gateway | Not used for customer receipt capture or supplier payment execution | Current FRs record receipts and payables; they do not authorize payment execution. Payment sandbox remains unused until approved scope. |
|
||||
| APMC/market feed | No live market feed; manual observation source is stored | `FR-MKT-001/002` require user-entered observation. |
|
||||
| Object/document storage | Port and tenant/evidence metadata only; production provider, region, encryption/key management, lifecycle and signed-URL behavior unselected | POD, privacy and incident evidence require private storage; resolve provider controls under `AMB-009` before implementation. |
|
||||
| Processor/subprocessor systems | Inventory only; no live integration | `FR-PROCESSORGOVERNANCE-001` manages due diligence and assistance records, not API connectivity. |
|
||||
|
||||
## 5. Operational/security requirements
|
||||
|
||||
- Secrets are managed outside source and database content; rotation and access are restricted by deployment policy (provider-neutral until deployment selection).
|
||||
- Correlate API command, audit event, outbox event and delivery attempt without logging personal payloads, credentials, access tokens or unnecessary identity attributes.
|
||||
- External failures must not partially commit a business command. Persist domain state and outbox atomically; async delivery failure is observable/retryable.
|
||||
- Provider outage and retry behavior require deterministic sandbox/failure-injection tests during Construction. Design consistency is not runtime proof.
|
||||
|
|
@ -1,68 +1,72 @@
|
|||
# LLD-001: IAM & Authentication Service
|
||||
---
|
||||
id: LLD-001
|
||||
parent_ids: [UC-001, UC-019]
|
||||
version: 2.1.0
|
||||
status: Draft — Stage 9 design; Gate 9.1 passed, review pending
|
||||
last_cr: CR-001
|
||||
---
|
||||
|
||||
# LLD-001 — Identity, OIDC Authentication & Authorization
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| **Document** | `LLD-001_auth_service.md` |
|
||||
| **Component** | `HLD-AUTH` (Identity & Access Management) |
|
||||
| **Parent Use Case** | [`UC-001`](../../03_requirements/use_cases/uc-001_user-authentication/use-case.md) |
|
||||
| **Parent FRs** | `FR-AUTH-001`, `FR-AUTH-002`, `FR-AUTH-003` |
|
||||
| **Status** | Baselined |
|
||||
| **Version** | 1.0.0 |
|
||||
| **Component** | Identity & Access Management |
|
||||
| **Parent UCs** | UC-001; tenant context delegated to UC-019 (LLD-002) |
|
||||
| **Parent FRs** | FR-AUTH-001, FR-AUTH-002, FR-AUTH-003 |
|
||||
| **Status** | Stage 9 detailed design; runtime/security validation pending |
|
||||
|
||||
---
|
||||
## 1. Boundary and API Shape
|
||||
|
||||
## 1. Component Boundaries & Endpoints
|
||||
The module establishes authenticated application sessions and evaluates the BRD-FR-040 role permission matrix. Tenant membership/active-tenant resolution is performed by LLD-002. This module does not own RLS schema policies, tenant provisioning, cross-tenant support access, or a super-admin bypass.
|
||||
|
||||
### 1.1 API Router Endpoints (`/api/v1/auth`)
|
||||
| Operation | Endpoint / boundary | Purpose |
|
||||
|---|---|---|
|
||||
| OIDC Authorization Code + PKCE | Browser ↔ configured Keycloak endpoints | Authenticate using configured identity provider; the provider callback is handled by the configured OIDC client flow, not a custom credential endpoint. |
|
||||
| GET | `/api/v1/auth/session` | Return whether the application session is authenticated and the minimal current subject/context summary. |
|
||||
| POST | `/api/v1/auth/logout` | End the active application session; exact Keycloak revocation mechanics remain AMB-009. |
|
||||
| Policy decision | Protected API operation middleware/service | Enforce role/action/resource and segregation rules; no general-purpose authorization CRUD endpoint. |
|
||||
|
||||
| Method | Endpoint | Description | Auth Required | Request Body | Response Codes |
|
||||
|---|---|---|---|---|---|
|
||||
| `POST` | `/api/v1/auth/token` | Exchange authorization code & PKCE verifier for JWT tokens | No | `TokenExchangeRequest` | 200 OK, 400 Bad Request |
|
||||
| `POST` | `/api/v1/auth/refresh` | Obtain fresh access token using valid refresh token | No | `RefreshTokenRequest` | 200 OK, 401 Unauthorized |
|
||||
| `POST` | `/api/v1/auth/logout` | Revoke session & blacklist active refresh token | Yes | `LogoutRequest` | 200 OK, 401 Unauthorized |
|
||||
| `GET` | `/api/v1/auth/me` | Return active user claims, roles, and tenant context | Yes | — | 200 OK, 401 Unauthorized |
|
||||
|
||||
---
|
||||
Refresh endpoint, token lifetime, signing algorithm, refresh-token storage, revocation latency, and provider-session behavior are not fixed by UC-001 or `tech-profile.yaml`; do not treat earlier sample values as requirements.
|
||||
|
||||
## 2. Database Schema (PostgreSQL with RLS)
|
||||
## 2. Authentication Request Flow
|
||||
|
||||
```sql
|
||||
-- Core Tenants Table
|
||||
CREATE TABLE tenants (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
code VARCHAR(32) NOT NULL UNIQUE,
|
||||
name VARCHAR(255) NOT NULL,
|
||||
is_active BOOLEAN NOT NULL DEFAULT true,
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
||||
);
|
||||
1. React client starts Keycloak OIDC Authorization Code + PKCE.
|
||||
2. The configured OIDC client completes the authorization response and validates issuer, audience, time claims, signature/JWKS and state/nonce according to approved security settings.
|
||||
3. Establish an application session using the configured JWT bearer-token approach. Reject malformed, invalid, expired or unauthenticated sessions.
|
||||
4. For a tenant operation, call the membership/context resolver described in LLD-002 and apply the role/action policy. No client-supplied role or tenant identifier grants access.
|
||||
5. Logout ends the application session and subsequent protected operations using that session are denied; exact IdP revocation mechanics and timing are open design decisions.
|
||||
|
||||
-- Users Table (Tenant-Scoped)
|
||||
CREATE TABLE users (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
tenant_id UUID NOT NULL REFERENCES tenants(id) ON DELETE CASCADE,
|
||||
email VARCHAR(255) NOT NULL,
|
||||
full_name VARCHAR(255) NOT NULL,
|
||||
is_active BOOLEAN NOT NULL DEFAULT true,
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||
CONSTRAINT uq_tenant_user_email UNIQUE (tenant_id, email)
|
||||
);
|
||||
## 3. Authorization Decision
|
||||
|
||||
-- Enable Row-Level Security on Users
|
||||
ALTER TABLE users ENABLE ROW LEVEL SECURITY;
|
||||
Input is authenticated subject, verified tenant context (when the resource is tenant-scoped), resource/action, and the approved role permission matrix. Enforce `Read`, `Write`, `Create`, `Delete`, `Submit`, `Cancel`, and `Amend` permissions plus the stated segregation-of-duties restrictions. Deny before the business command executes. Cache policy decisions only if freshness/invalidation preserves role-change revocation; this spike does not select a cache strategy.
|
||||
|
||||
CREATE POLICY tenant_isolation_policy ON users
|
||||
AS RESTRICTIVE
|
||||
USING (tenant_id = current_setting('app.current_tenant', true)::uuid);
|
||||
```
|
||||
## 4. Integration and Failure Contract
|
||||
|
||||
---
|
||||
- Keycloak/JWKS calls use the configured identity-provider adapter; local tests use `sandbox/identity_mock.py` and require no network.
|
||||
- Invalid identity response, provider outage during sign-in, unresolved key material, or absent active session fails closed.
|
||||
- Avoid logging bearer tokens, secrets, or unnecessary identity data. Use correlation IDs and the minimum subject/tenant context needed for authorized observability.
|
||||
- Errors from authentication, membership resolution, and business authorization remain distinct internally but reveal no cross-tenant resource existence.
|
||||
|
||||
## 3. Middleware & Security Context Propagation
|
||||
## 5. Validation Cases
|
||||
|
||||
The FastAPI dependency `get_current_user` extracts the JWT Bearer token:
|
||||
1. Validates signature with Keycloak JWKS public keys.
|
||||
2. Asserts token is not listed in Valkey blacklist (`blacklist:token:<jti>`).
|
||||
3. Extracts `tenant_id` and sets PostgreSQL session context:
|
||||
```python
|
||||
await db_session.execute(text("SET LOCAL app.current_tenant = :t_id"), {"t_id": str(user.tenant_id)})
|
||||
```
|
||||
| Case | Expected result |
|
||||
|---|---|
|
||||
| Valid OIDC/PKCE callback | Authenticated application session created |
|
||||
| Invalid signature/issuer/audience/expiry or replayed state | No session; protected action denied |
|
||||
| Keycloak unavailable at sign-in | Fail closed; deterministic mock supports offline tests |
|
||||
| Role lacks action permission / violates SoD | Business command is not invoked |
|
||||
| Logout then reuse ended session | Protected action denied; no specific revocation latency asserted |
|
||||
| Tenant selector forged or membership inactive | LLD-002 rejects before tenant-scoped data access |
|
||||
|
||||
**Runtime validation:** pending implementation and approved security settings. This is a Stage 9 design contract, not proof of an executed walking skeleton.
|
||||
|
||||
## Stage 9 SRS Traceability
|
||||
|
||||
| Parent FR | SRS | HLD component |
|
||||
|---|---|---|
|
||||
| `FR-AUTH-001` | `SRS-AUTH-001` | `HLD-IAM` |
|
||||
| `FR-AUTH-002` | `SRS-AUTH-002` | `HLD-IAM` |
|
||||
| `FR-AUTH-003` | `SRS-AUTH-003` | `HLD-IAM` |
|
||||
|
||||
Detailed API, entity and integration contracts are in the Stage 9 shared design documents.
|
||||
|
|
|
|||
|
|
@ -0,0 +1,75 @@
|
|||
---
|
||||
id: LLD-002
|
||||
parent_ids: [UC-001, UC-017, UC-018, UC-019, UC-020]
|
||||
version: 1.1.0
|
||||
status: Draft — Stage 9 design; Gate 9.1 passed, review pending
|
||||
last_cr: none
|
||||
---
|
||||
|
||||
# LLD-002 — Identity, Tenant Context, Isolation & Audit
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| **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** | Stage 7 reference pattern approved for detailed design; runtime validation pending |
|
||||
|
||||
## 1. Request Authentication and Context Resolution
|
||||
|
||||
1. Browser initiates Keycloak OIDC Authorization Code + PKCE using the configured client.
|
||||
2. API validates bearer token issuer, audience, expiry, signature against the configured provider metadata/JWKS, and application session state. Concrete algorithm/lifetime/revocation behavior needs security design sign-off.
|
||||
3. `TenantContextResolver` receives the user subject and requested active-tenant selector. It loads an active membership and role from server-side records. A role or tenant claim supplied by the client is not sufficient.
|
||||
4. Authorization evaluates the action/resource against the BRD-FR-040 permission matrix. The resolver returns an immutable request context `(subject_id, tenant_id, role_ids, correlation_id)` for that request.
|
||||
5. No active membership or suspended tenant returns a deny result; no fallback to a platform-wide tenant context.
|
||||
|
||||
## 2. PostgreSQL RLS Contract
|
||||
|
||||
- Every tenant-owned table has a non-null `tenant_id` and tenant-leading lookup/index keys where appropriate.
|
||||
- Set context only inside an open transaction, using a parameterized call equivalent to `set_config('app.tenant_id', :tenant_id, true)`. The final `true` makes the setting transaction-local and protects pooled connections.
|
||||
- RLS policies use both `USING` and `WITH CHECK`; an absent setting yields no visible rows and rejects writes. Consider `FORCE ROW LEVEL SECURITY`; the application role must not be superuser or have `BYPASSRLS`.
|
||||
- Tenant-specific DB work must use the same transaction/context wrapper. Background work obtains tenant id from a validated persisted job/outbox row and sets context for its own transaction. Missing or malformed tenant context is a hard failure.
|
||||
- Support access is a separate, explicit, time-bounded authorization path under UC-020 with reason and audit evidence; it does not weaken ordinary tenant policies.
|
||||
|
||||
```text
|
||||
verified identity
|
||||
-> active membership lookup (UC-019)
|
||||
-> action permission decision (UC-001 / BRD-FR-040)
|
||||
-> begin DB transaction
|
||||
-> SET LOCAL app.tenant_id = verified membership tenant
|
||||
-> RLS-protected query/write
|
||||
-> commit or rollback
|
||||
```
|
||||
|
||||
## 3. Audit Contract
|
||||
|
||||
For a governed business mutation, append an audit entry in the same transaction containing tenant id, actor subject, action, entity type/id, timestamp, and correlation id. Minimize personal/business payloads. The application DB role cannot update/delete audit rows; retention/legal-hold treatment is governed by the approved data-governance design. Do not introduce a cross-tenant audit query path except a specifically authorized platform security workflow.
|
||||
|
||||
## 4. Validation Cases
|
||||
|
||||
| Case | Expected result |
|
||||
|---|---|
|
||||
| Valid identity and active membership | Scoped operation proceeds under verified tenant context |
|
||||
| Missing membership, suspended tenant, or forged selector | Denied before business query/write |
|
||||
| No tenant context on direct tenant-owned table access | No rows visible; writes rejected |
|
||||
| Reuse pooled connection after tenant A request for tenant B | Tenant A context is absent; B sees only B rows |
|
||||
| Background export/job omits tenant binding | Job fails closed; no data emitted |
|
||||
| Ordinary support identity requests tenant data without approved grant | Denied and audited |
|
||||
|
||||
**Runtime validation:** pending implementation and isolated PostgreSQL environment; this contract is not yet proven by execution.
|
||||
|
||||
## Stage 9 SRS Traceability
|
||||
|
||||
| Parent FR | SRS | HLD component |
|
||||
|---|---|---|
|
||||
| `FR-AUTH-001` | `SRS-AUTH-001` | `HLD-IAM` |
|
||||
| `FR-AUTH-002` | `SRS-AUTH-002` | `HLD-IAM` |
|
||||
| `FR-AUTH-003` | `SRS-AUTH-003` | `HLD-IAM` |
|
||||
| `FR-TENANTSECURITYAUDIT-001` | `SRS-TENANTSECURITYAUDIT-001` | `HLD-ISOLATION-AUDIT` |
|
||||
| `FR-TENANTSECURITYAUDIT-003` | `SRS-TENANTSECURITYAUDIT-003` | `HLD-ISOLATION-AUDIT` |
|
||||
| `FR-TENANTLIFECYCLE-001` | `SRS-TENANTLIFECYCLE-001` | `HLD-TENANCY` |
|
||||
| `FR-TENANTMEMBERSHIPCONTEXT-001` | `SRS-TENANTMEMBERSHIPCONTEXT-001` | `HLD-TENANCY` |
|
||||
| `FR-TENANTMEMBERSHIPCONTEXT-002` | `SRS-TENANTMEMBERSHIPCONTEXT-002` | `HLD-TENANCY` |
|
||||
| `FR-TENANTSUPPORTSECURITY-001` | `SRS-TENANTSUPPORTSECURITY-001` | `HLD-ISOLATION-AUDIT` |
|
||||
| `FR-TENANTSUPPORTSECURITY-002` | `SRS-TENANTSUPPORTSECURITY-002` | `HLD-ISOLATION-AUDIT` |
|
||||
|
||||
Detailed API, entity and integration contracts are in the Stage 9 shared design documents.
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
---
|
||||
id: LLD-003
|
||||
parent_ids: [UC-005, UC-006, UC-007]
|
||||
version: 1.1.0
|
||||
status: Draft — Stage 9 design; Gate 9.1 passed, review pending
|
||||
last_cr: none
|
||||
---
|
||||
|
||||
# LLD-003 — Receiving, Quality FSM & Stock Ledger
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| **Parent UCs** | UC-005, UC-006, UC-007 |
|
||||
| **Parent FRs** | 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 |
|
||||
| **Status** | Stage 9 detailed design; runtime validation pending |
|
||||
|
||||
## 1. Component Contracts
|
||||
|
||||
- `ReceivingService`: records vehicle/gate details and gross/tare measurements, validates tare < gross, applies approved packaging tare inputs, computes net received quantity, and posts a GRN.
|
||||
- `LotService`: creates the immutable lot identity with the GRN; captures inspection measures; enforces the BRD-defined `Under QC` → `QC Hold` / `Released` transition and lot split/blend lineage.
|
||||
- `InventoryLedger`: records append-only, balanced movement entries for GRN receipt, dispatch, and inter-godown transfer. Position views are derived from entries, not independently editable balances.
|
||||
- No physical weighbridge protocol/API is included: the current FRs specify recording weighment measurements, not device integration. Add a device adapter only after an approved requirement/design decision.
|
||||
|
||||
## 2. Posting Boundary
|
||||
|
||||
A GRN posting command has a tenant-scoped idempotency key and executes in one PostgreSQL transaction:
|
||||
|
||||
1. Revalidate authorization and tenant context; acquire the relevant sauda/receipt serialization lock.
|
||||
2. Validate measurement and quantity invariants without floating-point arithmetic; apply NFR-001 precision rules.
|
||||
3. Persist GRN and uniquely identified lot; start its QC lifecycle as specified by the current process model.
|
||||
4. Append stock receipt journal entries and mutation-audit record.
|
||||
5. Insert an outbox event keyed by tenant and aggregate version.
|
||||
6. Commit once. Any failure before commit rolls back all six writes; retry with the same command key returns the original posting result without duplicate stock.
|
||||
|
||||
A lot in `QC Hold` is rejected by server-side allocation and dispatch services. State checks and the corresponding stock reservation/movement must share a transaction/locking strategy so concurrent commands cannot bypass the hold or overdraw the available balance.
|
||||
|
||||
## 3. Transfer and Reconciliation
|
||||
|
||||
A godown transfer is modeled as one transfer aggregate with origin deduction, in-transit identity, destination confirmation, and paired inventory entries. Partial completion must remain represented as in transit; retries are idempotent. Physical stock adjustment creates a separately authorized, reason-coded journal entry and audit item; it never edits historical movements.
|
||||
|
||||
## 4. Validation Walkthrough
|
||||
|
||||
- Valid weighment posts one GRN, one lot, balanced stock movements, audit and outbox atomically.
|
||||
- `tare >= gross`, invalid quantity, wrong tenant, or duplicate identity produces no partial posting.
|
||||
- Concurrent duplicate command creates only one GRN/stock effect.
|
||||
- QC Hold lot is denied allocation and dispatch through API paths.
|
||||
- Outbox worker outage leaves committed source event pending for retry; repeated delivery has one logical effect.
|
||||
|
||||
**Runtime validation:** pending; scenario results in the spike report are design reasoning, not executed test results.
|
||||
|
||||
## Stage 9 SRS Traceability
|
||||
|
||||
| Parent FR | SRS | HLD component |
|
||||
|---|---|---|
|
||||
| `FR-INWARDRECEIVING-001` | `SRS-INWARDRECEIVING-001` | `HLD-RECEIVING` |
|
||||
| `FR-INWARDRECEIVING-002` | `SRS-INWARDRECEIVING-002` | `HLD-RECEIVING` |
|
||||
| `FR-INWARDRECEIVING-003` | `SRS-INWARDRECEIVING-003` | `HLD-RECEIVING` |
|
||||
| `FR-INWARDRECEIVING-004` | `SRS-INWARDRECEIVING-004` | `HLD-RECEIVING` |
|
||||
| `FR-INWARDRECEIVING-005` | `SRS-INWARDRECEIVING-005` | `HLD-RECEIVING` |
|
||||
| `FR-INWARDRECEIVING-006` | `SRS-INWARDRECEIVING-006` | `HLD-RECEIVING` |
|
||||
| `FR-QUALITYANDLOTCONTROL-001` | `SRS-QUALITYANDLOTCONTROL-001` | `HLD-QUALITY` |
|
||||
| `FR-QUALITYANDLOTCONTROL-002` | `SRS-QUALITYANDLOTCONTROL-002` | `HLD-QUALITY` |
|
||||
| `FR-QUALITYANDLOTCONTROL-003` | `SRS-QUALITYANDLOTCONTROL-003` | `HLD-QUALITY` |
|
||||
| `FR-QUALITYANDLOTCONTROL-004` | `SRS-QUALITYANDLOTCONTROL-004` | `HLD-QUALITY` |
|
||||
| `FR-WAREHOUSEINVENTORY-001` | `SRS-WAREHOUSEINVENTORY-001` | `HLD-INVENTORY` |
|
||||
| `FR-WAREHOUSEINVENTORY-002` | `SRS-WAREHOUSEINVENTORY-002` | `HLD-INVENTORY` |
|
||||
| `FR-WAREHOUSEINVENTORY-003` | `SRS-WAREHOUSEINVENTORY-003` | `HLD-INVENTORY` |
|
||||
|
||||
Detailed API, entity and integration contracts are in the Stage 9 shared design documents.
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
---
|
||||
id: LLD-004
|
||||
parent_ids: [UC-004, UC-008, UC-009, UC-011, UC-012]
|
||||
version: 1.1.0
|
||||
status: Draft — Stage 9 design; Gate 9.1 passed, review pending
|
||||
last_cr: none
|
||||
---
|
||||
|
||||
# LLD-004 — Receivables, Credit Locks & Financial Posting
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| **Parent UCs** | UC-004, UC-008, UC-009, UC-011, UC-012 |
|
||||
| **Parent FRs** | FR-PROCUREMENTCONTRACTS-001, FR-PROCUREMENTCONTRACTS-002, FR-PROCUREMENTCONTRACTS-003, FR-PROCUREMENTCONTRACTS-004; FR-SALESCONTRACTS-001, FR-SALESCONTRACTS-002, FR-SALESCONTRACTS-003; FR-DISPATCHDELIVERY-001, FR-DISPATCHDELIVERY-002, FR-DISPATCHDELIVERY-003; FR-CUSTOMERRECEIVABLES-001, FR-CUSTOMERRECEIVABLES-002, FR-CUSTOMERRECEIVABLES-003, FR-CUSTOMERRECEIVABLES-004; FR-SUPPLIERPAYABLES-001 |
|
||||
| **Status** | Stage 9 detailed design; runtime validation pending |
|
||||
|
||||
## 1. Financial Consistency Rules
|
||||
|
||||
- Use PostgreSQL transactions for each contract/receipt/ledger state change; preserve NFR-001 decimal precision (weight 3 decimals, currency 2 decimals).
|
||||
- Posted ledger entries are append-only. Correct an error through a reversing/compensating entry with actor, reason, source entry and audit linkage.
|
||||
- Sales credit exposure check and confirmation must serialize on the customer account/credit projection so concurrent orders cannot both pass a stale limit check. Reserve exposure consistently with order state.
|
||||
- A customer receipt records its BRD status (`Pending Clearance`, `Cleared`, `Bounced`). A bounce creates a reversal entry, recomputes exposure, reinstates a >100% credit lock and emits an alert in the same database transaction. It does not erase the original receipt history.
|
||||
- A Partner override is an explicit authorized command with mandatory justification and an immutable audit event; it does not mutate the historical lock decision.
|
||||
- No external payment execution API is assumed; the BRD currently records received instruments and statuses.
|
||||
|
||||
## 2. Data/Command Shape
|
||||
|
||||
`PartyLedgerEntry(tenant_id, party_id, source_type, source_id, entry_type, debit, credit, currency, effective_at, reversal_of, idempotency_key)`; account/tenant uniqueness is enforced in the database. `CreditControl` stores the sanctioned limit and lock state/version. Derived outstanding/exposure values must be reconciled to the immutable journal and not maintained as an independent source of truth.
|
||||
|
||||
Commands: `ConfirmSalesOrder`, `RecordReceipt`, `MarkReceiptBounced`, `OverrideCreditLock`. Each command carries tenant context from LLD-002, actor, correlation id and idempotency key. Endpoint and source-document contract is detailed in `api_design.md`; transaction/entity mapping is in `database_design.md`.
|
||||
|
||||
## 3. Validation Cases
|
||||
|
||||
- Two concurrent orders near limit cannot exceed available approved exposure without the specified override.
|
||||
- Replaying a receipt/bounce command creates no duplicate ledger entry.
|
||||
- Bounce reverses the credit posting, restores receivable exposure, reinstates the lock where the source threshold requires it, and emits one alert.
|
||||
- Unauthorized override is denied and leaves ledger/lock state unchanged.
|
||||
- Every financial write is tenant-isolated and has an attributable audit record.
|
||||
|
||||
**Runtime validation:** pending implementation, schema, and load/concurrency evidence.
|
||||
|
||||
## Stage 9 SRS Traceability
|
||||
|
||||
| Parent FR | SRS | HLD component |
|
||||
|---|---|---|
|
||||
| `FR-PROCUREMENTCONTRACTS-001` | `SRS-PROCUREMENTCONTRACTS-001` | `HLD-PROCUREMENT` |
|
||||
| `FR-PROCUREMENTCONTRACTS-002` | `SRS-PROCUREMENTCONTRACTS-002` | `HLD-PROCUREMENT` |
|
||||
| `FR-PROCUREMENTCONTRACTS-003` | `SRS-PROCUREMENTCONTRACTS-003` | `HLD-PROCUREMENT` |
|
||||
| `FR-PROCUREMENTCONTRACTS-004` | `SRS-PROCUREMENTCONTRACTS-004` | `HLD-PROCUREMENT` |
|
||||
| `FR-SALESCONTRACTS-001` | `SRS-SALESCONTRACTS-001` | `HLD-SALES` |
|
||||
| `FR-SALESCONTRACTS-002` | `SRS-SALESCONTRACTS-002` | `HLD-SALES` |
|
||||
| `FR-SALESCONTRACTS-003` | `SRS-SALESCONTRACTS-003` | `HLD-SALES` |
|
||||
| `FR-DISPATCHDELIVERY-001` | `SRS-DISPATCHDELIVERY-001` | `HLD-DISPATCH` |
|
||||
| `FR-DISPATCHDELIVERY-002` | `SRS-DISPATCHDELIVERY-002` | `HLD-DISPATCH` |
|
||||
| `FR-DISPATCHDELIVERY-003` | `SRS-DISPATCHDELIVERY-003` | `HLD-DISPATCH` |
|
||||
| `FR-CUSTOMERRECEIVABLES-001` | `SRS-CUSTOMERRECEIVABLES-001` | `HLD-RECEIVABLES` |
|
||||
| `FR-CUSTOMERRECEIVABLES-002` | `SRS-CUSTOMERRECEIVABLES-002` | `HLD-RECEIVABLES` |
|
||||
| `FR-CUSTOMERRECEIVABLES-003` | `SRS-CUSTOMERRECEIVABLES-003` | `HLD-RECEIVABLES` |
|
||||
| `FR-CUSTOMERRECEIVABLES-004` | `SRS-CUSTOMERRECEIVABLES-004` | `HLD-RECEIVABLES` |
|
||||
| `FR-SUPPLIERPAYABLES-001` | `SRS-SUPPLIERPAYABLES-001` | `HLD-PAYABLES` |
|
||||
|
||||
Detailed API, entity and integration contracts are in the Stage 9 shared design documents.
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
---
|
||||
id: LLD-005
|
||||
parent_ids: [UC-003, UC-014, UC-015, UC-005]
|
||||
version: 1.1.0
|
||||
status: Draft — Stage 9 design; Gate 9.1 passed, review pending
|
||||
last_cr: none
|
||||
---
|
||||
|
||||
# LLD-005 — Operational Events, Alerts & Reporting
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| **Parent UCs** | UC-003, UC-014, UC-015; consumes events from UC-005–012 |
|
||||
| **Parent FRs** | FR-MARKETTRENDANALYTICS-001; FR-OPERATIONALALERTS-001; FR-EXECUTIVEREPORTING-001, FR-EXECUTIVEREPORTING-002 |
|
||||
| **Status** | Stage 9 detailed design; runtime validation pending |
|
||||
|
||||
## 1. Source-of-Truth and Event Delivery
|
||||
|
||||
- Domain mutations write a versioned outbox row in the same transaction as the business state and audit record. The outbox is the durable source; Valkey Streams is a delivery/cache mechanism configured in `tech-profile.yaml`.
|
||||
- A worker publishes eligible outbox records, records delivery attempts, and retries transient failures with bounded backoff. Consumers use `(tenant_id, event_id)` for idempotency and preserve tenant context for each read/write.
|
||||
- If Valkey or the messaging adapter is unavailable, source transactions may commit; delivery is delayed and observable, not silently dropped. Poison-event retention and manual replay authorization remain open under AMB-011; events are isolated and surfaced, never silently discarded.
|
||||
- Alert evaluation is based on source events plus periodic reconciliation so a missed event cannot permanently suppress an active alert. Only channels supported by approved messaging configuration are enabled.
|
||||
|
||||
## 2. Read Models and Performance
|
||||
|
||||
- UC-003/UC-015 queries remain tenant-scoped and read from indexed transactional data or a derived tenant-scoped summary. Any summary is rebuildable from source records and has a documented freshness indicator.
|
||||
- Validate the 20-day trend and multi-godown reports at 50,000 ledger rows in under 1 second (BRD-NFR-004), and the 50-tenant/250-active-user 5× peak scenario (BRD-NFR-012). Do not assert that Valkey alone meets the report SLA.
|
||||
- Keep reports read-only; never calculate a decision-critical credit or stock balance from a stale display projection.
|
||||
|
||||
## 3. Validation Cases
|
||||
|
||||
- Database commit succeeds while stream is unavailable: event remains pending and later publishes once logically.
|
||||
- Duplicate/out-of-order event does not duplicate or regress alert state.
|
||||
- Tenant-A event cannot populate or be queried from tenant-B projection.
|
||||
- Rebuilt report summary matches the source ledger within defined freshness and exact financial/quantity precision.
|
||||
|
||||
**Runtime validation:** pending offline sandbox, load profile, and implementation.
|
||||
|
||||
## Stage 9 SRS Traceability
|
||||
|
||||
| Parent FR | SRS | HLD component |
|
||||
|---|---|---|
|
||||
| `FR-MARKETTRENDANALYTICS-001` | `SRS-MARKETTRENDANALYTICS-001` | `HLD-REPORTING` |
|
||||
| `FR-OPERATIONALALERTS-001` | `SRS-OPERATIONALALERTS-001` | `HLD-EVENTS-ALERTS` |
|
||||
| `FR-EXECUTIVEREPORTING-001` | `SRS-EXECUTIVEREPORTING-001` | `HLD-REPORTING` |
|
||||
| `FR-EXECUTIVEREPORTING-002` | `SRS-EXECUTIVEREPORTING-002` | `HLD-REPORTING` |
|
||||
|
||||
Detailed API, entity and integration contracts are in the Stage 9 shared design documents.
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
---
|
||||
id: LLD-006
|
||||
parent_ids: [UC-023, UC-024]
|
||||
version: 1.1.0
|
||||
status: Draft — Stage 9 design; Gate 9.1 passed, review pending
|
||||
last_cr: none
|
||||
---
|
||||
|
||||
# LLD-006 — Privacy Incident and Data Lifecycle Boundaries
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| **Parent UCs** | UC-023, UC-024 |
|
||||
| **Parent FRs** | FR-PRIVACYBREACHRESPONSE-001; FR-RETENTIONERASURE-001 |
|
||||
| **Status** | Stage 9 detailed design; legal/runtime validation pending |
|
||||
|
||||
## 1. Privacy-Safe Architecture Boundaries
|
||||
|
||||
- Every data object carries tenant ownership and purpose/sensitivity metadata as applicable; purpose tags and four internal sensitivity labels are not treated as statutory classifications.
|
||||
- Breach cases link affected tenant/data categories and evidence references, not bulk sensitive payloads. Access to incident evidence is role-restricted, audited, and tenant-scoped.
|
||||
- Erasure is a governed workflow: determine subject/data scope, check approved purpose schedule and legal holds, apply deletions/anonymization where legally permitted, and record evidence without retaining the erased payload in the audit log.
|
||||
- Backups, processor copies, exports, caches and derived reports need explicit retention/erasure treatment. A deletion from the primary table alone is not completion.
|
||||
- Exact retention durations, statutory exception mapping, and evidence retention remain blocked by AMB-006; this LLD invents none.
|
||||
|
||||
## 2. Validation Cases
|
||||
|
||||
- Tenant operator cannot resolve another tenant's subject or breach case.
|
||||
- Active legal hold blocks the affected erasure action while unrelated data rights cases continue.
|
||||
- Completed erasure removes or de-identifies in-scope live/search/cache/derived data and creates non-sensitive evidence; backup expiry/restore behavior follows the approved schedule.
|
||||
- Incident evidence access creates a separate audit entry and excludes secrets from service telemetry.
|
||||
|
||||
**Runtime/legal validation:** pending qualified legal review, approved schedules and implementation.
|
||||
|
||||
## Stage 9 SRS Traceability
|
||||
|
||||
| Parent FR | SRS | HLD component |
|
||||
|---|---|---|
|
||||
| `FR-PRIVACYBREACHRESPONSE-001` | `SRS-PRIVACYBREACHRESPONSE-001` | `HLD-PRIVACY-INCIDENT-LIFECYCLE` |
|
||||
| `FR-RETENTIONERASURE-001` | `SRS-RETENTIONERASURE-001` | `HLD-PRIVACY-INCIDENT-LIFECYCLE` |
|
||||
|
||||
Detailed API, entity and integration contracts are in the Stage 9 shared design documents.
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
---
|
||||
id: LLD-007
|
||||
parent_ids: [UC-002]
|
||||
version: 1.0.0
|
||||
status: Draft — Stage 9 design; Gate 9.1 passed, review pending
|
||||
last_cr: none
|
||||
---
|
||||
|
||||
# LLD-007 — Market Observations & Daily Mandi Rates
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| **Parent UCs** | UC-002 |
|
||||
| **Parent FRs** | FR-MKT-001, FR-MKT-002 |
|
||||
| **Stage 8 SRS** | SRS-MKT-001, SRS-MKT-002 |
|
||||
| **Architecture reference** | `DEC-021`; approved Stage 7 template |
|
||||
| **Status** | Stage 9 detailed design; runtime validation pending |
|
||||
|
||||
## 1. Aggregate and invariants
|
||||
|
||||
`MarketObservation` is the tenant-scoped daily record keyed by market yard, commodity, variety, and observation date. It stores grade, arrival quantity (MT), internal stock position (MT), source, observed-at timestamp, and status. A tenant-scoped unique constraint prevents duplicate yard/commodity/variety/date records. `Closed / Mandi Holiday` is an explicit status that permits arrival quantity to be absent when no observation is available; it is not represented as a fabricated zero arrival. Observation dates after the business current date and negative arrivals are rejected; zero is valid.
|
||||
|
||||
Price range and modal rate are fields of the daily observation. Rates use INR per quintal and must each be positive, with `min_rate <= modal_rate <= max_rate`; the service returns the violated arithmetic predicate in validation errors.
|
||||
|
||||
## 2. Command/query boundaries
|
||||
|
||||
- `MarketObservationService.record(...)` validates tenant, actor role, required fields, date, status, and unique key before inserting.
|
||||
- `MarketObservationService.set_rates(...)` validates the three-rate invariant and updates the rate set atomically; concurrent updates use row versioning.
|
||||
- `MarketObservationQuery.list(...)` filters by tenant and explicit date/market/commodity criteria; sorting and page limits are explicit in the API design.
|
||||
- The domain records user-entered source and timestamp; no external APMC data feed is assumed.
|
||||
|
||||
## 3. Persistence, audit and events
|
||||
|
||||
Use PostgreSQL RLS and transaction-local tenant context. Record create/update as immutable audit events in the same transaction. Emit `market.observation.recorded` and `market.observation.rates_changed` through the transactional outbox only after the mutation is committed. A uniqueness conflict returns a duplicate-observation validation response without a second row or event.
|
||||
|
||||
## 4. FR coverage
|
||||
|
||||
`FR-MKT-001` maps to create/list observation operations. `FR-MKT-002` maps to the atomic rate-capture operation. Analytics in `FR-MARKETTRENDANALYTICS-001` read this source through the reporting design in LLD-005; no duplicate source of truth is created.
|
||||
|
||||
## Stage 9 SRS Traceability
|
||||
|
||||
| Parent FR | SRS | HLD component |
|
||||
|---|---|---|
|
||||
| `FR-MKT-001` | `SRS-MKT-001` | `HLD-MARKET-DESK` |
|
||||
| `FR-MKT-002` | `SRS-MKT-002` | `HLD-MARKET-DESK` |
|
||||
|
||||
Detailed API, entity and integration contracts are in the Stage 9 shared design documents.
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
---
|
||||
id: LLD-008
|
||||
parent_ids: [UC-016]
|
||||
version: 1.0.0
|
||||
status: Draft — Stage 9 design; Gate 9.1 passed, review pending
|
||||
last_cr: none
|
||||
---
|
||||
|
||||
# LLD-008 — Commodity, Counterparty & Godown Master Data
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| **Parent UCs** | UC-016 |
|
||||
| **Parent FRs** | FR-MASTERDATA-001, FR-MASTERDATA-002 |
|
||||
| **Stage 8 SRS** | SRS-MASTERDATA-001, SRS-MASTERDATA-002 |
|
||||
| **Architecture reference** | `DEC-021`; approved Stage 7 template |
|
||||
| **Status** | Stage 9 detailed design; runtime validation pending |
|
||||
|
||||
## 1. Ownership and records
|
||||
|
||||
This module owns tenant-scoped reference records for `Commodity`, `CommodityVariety`, `QualityGrade`, `Supplier`, `Customer`, and `Godown`. Commodity code is unique within a tenant. Commodity deletion is rejected while active stock-ledger references exist; inactive reference records remain resolvable by historical transactions. Supplier, customer, and godown codes are unique within their tenant/entity type. All business references include tenant ownership and are protected by RLS.
|
||||
|
||||
Supplier credit days are restricted to the source-defined values 7, 15, and 21. Customer credit limit uses INR. Godown capacity uses MT. GSTIN/PAN validation is applied where relevant, but identifier applicability, accepted formats, and external verification expectations are unresolved under new `AMB-010`; no live tax-authority connector is assumed.
|
||||
|
||||
## 2. API and lifecycle
|
||||
|
||||
Create/read/update and deactivate operations are separated by resource. Deletes are soft deactivation where the FR bars deletion or historical transactions reference the record. Authorization uses the UC-001 role matrix within the verified tenant context. Master-data updates publish versioned outbox events so downstream caches/read models can invalidate; consumers are idempotent.
|
||||
|
||||
## 3. Constraints and audit
|
||||
|
||||
Enforce tenant-scoped unique constraints in PostgreSQL in addition to application checks. Validate enum, code, capacity, and credit-day rules at the application boundary and database constraint where representable. Tax identifier validation behavior must remain configurable until `AMB-010` is resolved. Audit changes with actor, tenant, prior/new values, timestamp, and reason when provided by the command.
|
||||
|
||||
## Stage 9 SRS Traceability
|
||||
|
||||
| Parent FR | SRS | HLD component |
|
||||
|---|---|---|
|
||||
| `FR-MASTERDATA-001` | `SRS-MASTERDATA-001` | `HLD-MASTERDATA` |
|
||||
| `FR-MASTERDATA-002` | `SRS-MASTERDATA-002` | `HLD-MASTERDATA` |
|
||||
|
||||
Detailed API, entity and integration contracts are in the Stage 9 shared design documents.
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
---
|
||||
id: LLD-009
|
||||
parent_ids: [UC-010, UC-013]
|
||||
version: 1.0.0
|
||||
status: Draft — Stage 9 design; Gate 9.1 passed, review pending
|
||||
last_cr: none
|
||||
---
|
||||
|
||||
# LLD-009 — Fleet Registry & Operating Expense Services
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| **Parent UCs** | UC-010, UC-013 |
|
||||
| **Parent FRs** | FR-FLEETREGISTRY-001, FR-OPERATINGEXPENSES-001 |
|
||||
| **Stage 8 SRS** | SRS-FLEETREGISTRY-001, SRS-OPERATINGEXPENSES-001 |
|
||||
| **Architecture reference** | `DEC-021`; approved Stage 7 template |
|
||||
| **Status** | Stage 9 detailed design; runtime validation pending |
|
||||
|
||||
## 1. Fleet registry
|
||||
|
||||
`FleetVehicle` stores registration number, make/model, payload capacity (MT), ownership type, transporter name, operational status, insurance expiry where supplied, and fitness expiry. Registration number is unique within the owning tenant. Only eligible active vehicles may be assigned to a dispatch; status `Maintenance` is a hard rejection at both assignment and dispatch confirmation, including concurrent assignment checks. No live telematics or carrier API is specified.
|
||||
|
||||
## 2. Expense voucher
|
||||
|
||||
`ExpenseVoucher` records ID, date, category, amount INR, payee/vendor, optional consignment/sauda link, payment mode, and status. Category is limited to the FR-defined classes. Posting is an atomic double-entry cash/bank journal transaction: debit the selected expense account and credit the selected cash/bank account for equal currency amounts. An unbalanced or invalid account mapping cannot post. Draft/edit and post commands are distinct; a posted voucher is corrected through a compensating entry, not silent history rewrite.
|
||||
|
||||
## 3. Boundaries and audit
|
||||
|
||||
Both components use the verified tenant context and RLS. Fleet and voucher writes are auditable and idempotent where command retries are possible. Expense posting records the linked ledger transaction ID; no payment processor is invoked. Fleet status change emits an outbox event only where dispatch eligibility/read models consume it.
|
||||
|
||||
## Stage 9 SRS Traceability
|
||||
|
||||
| Parent FR | SRS | HLD component |
|
||||
|---|---|---|
|
||||
| `FR-FLEETREGISTRY-001` | `SRS-FLEETREGISTRY-001` | `HLD-FLEET` |
|
||||
| `FR-OPERATINGEXPENSES-001` | `SRS-OPERATINGEXPENSES-001` | `HLD-EXPENSES` |
|
||||
|
||||
Detailed API, entity and integration contracts are in the Stage 9 shared design documents.
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
---
|
||||
id: LLD-010
|
||||
parent_ids: [UC-026]
|
||||
version: 1.0.0
|
||||
status: Draft — Stage 9 design; Gate 9.1 passed, review pending
|
||||
last_cr: none
|
||||
---
|
||||
|
||||
# LLD-010 — Effective-Dated Tenant Operating Policies
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| **Parent UCs** | UC-026 |
|
||||
| **Parent FRs** | FR-TENANTOPERATINGPOLICIES-001 |
|
||||
| **Stage 8 SRS** | SRS-TENANTOPERATINGPOLICIES-001 |
|
||||
| **Architecture reference** | `DEC-021`; approved Stage 7 template |
|
||||
| **Status** | Stage 9 detailed design; runtime validation pending |
|
||||
|
||||
## 1. Policy model
|
||||
|
||||
`TenantPolicy` versions a policy by tenant, policy type, applicable scope (commodity/grade/contract where relevant), unit, effective-from/to, review status, and source/version. Candidate seed values are never treated as approved business rules. A tenant Partner/Managing Director or delegated authorized business owner confirms or edits all applicable values before each affected risk-sensitive workflow is enabled. A missing or unreviewed policy blocks only the affected workflow.
|
||||
|
||||
## 2. Read/write semantics
|
||||
|
||||
Policy mutation is effective-dated and append-only by version. Updates require an authorized tenant role and reason; audit stores actor, timestamp, reason, previous value, and new value. Transaction commands resolve the policy version effective at the business event time and persist its version ID on the governed transaction where the FR requires later explainability. Tenant RLS prevents cross-tenant policy visibility or effect.
|
||||
|
||||
## 3. Validation and eventing
|
||||
|
||||
Reject overlapping effective intervals for the same tenant/type/scope unless the interval boundary is non-overlapping. Numeric type, unit and range must follow the owning FR/approved tenant value; no global operating threshold is invented. Policy confirmation/change emits an outbox event for affected services. Missing policy produces a typed `policy_not_reviewed` business denial; unrelated tenant workflows remain available.
|
||||
|
||||
## Stage 9 SRS Traceability
|
||||
|
||||
| Parent FR | SRS | HLD component |
|
||||
|---|---|---|
|
||||
| `FR-TENANTOPERATINGPOLICIES-001` | `SRS-TENANTOPERATINGPOLICIES-001` | `HLD-TENANT-POLICY` |
|
||||
|
||||
Detailed API, entity and integration contracts are in the Stage 9 shared design documents.
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
---
|
||||
id: LLD-011
|
||||
parent_ids: [UC-021, UC-022, UC-025]
|
||||
version: 1.0.0
|
||||
status: Draft — Stage 9 design; Gate 9.1 passed, review pending
|
||||
last_cr: none
|
||||
---
|
||||
|
||||
# LLD-011 — Privacy Purpose, Rights & Processor Governance
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| **Parent UCs** | UC-021, UC-022, UC-025 |
|
||||
| **Parent FRs** | FR-PRIVACYPURPOSECONSENT-001, FR-DATAPRINCIPALRIGHTS-001, FR-PROCESSORGOVERNANCE-001 |
|
||||
| **Stage 8 SRS** | SRS-PRIVACYPURPOSECONSENT-001, SRS-DATAPRINCIPALRIGHTS-001, SRS-PROCESSORGOVERNANCE-001 |
|
||||
| **Architecture reference** | `DEC-021`; approved Stage 7 template |
|
||||
| **Status** | Stage 9 detailed design; runtime validation pending |
|
||||
|
||||
## 1. Ownership and trust boundary
|
||||
|
||||
The privacy governance module keeps tenant Data Fiduciary processing records separate from ATB operator processing records. A tenant administrator/reviewer can access only that tenant’s purpose, notice, request, and assistance records. Operator-only processor inventory and platform-processing records use a distinct control-plane authorization path; this is not a general cross-tenant support grant. The service covers natural persons without app accounts through an intake path that does not require a general customer/supplier portal login.
|
||||
|
||||
## 2. Processing purpose and consent
|
||||
|
||||
`ProcessingPurpose` stores purpose ID, data category, responsible entity/role, processing basis, notice version, accountable contact, and current state. `ConsentEvidence` is created only when the responsible Data Fiduciary has selected consent as the applicable basis; it stores notice evidence, timestamp, status, and withdrawal timestamp. A verified withdrawal causes the affected consent-dependent processing to be restricted, subject to an applicable legal retention obligation. Consent is not used as a default basis.
|
||||
|
||||
## 3. Data Principal request case
|
||||
|
||||
`RightsRequest` records request ID, principal reference, tenant/platform scope, request type, identity-verification evidence reference, responsible Data Fiduciary, received/due/resolved timestamps, disposition, and response evidence reference. Intake, verification, routing, response and completion are explicit states. Route to the responsible party; require a verified subject/scope match before disclosure or action. Due dates use an approved statutory/contractual rule input; do not hard-code deadlines while `AMB-006` remains open. Fail closed on ambiguous tenant/subject matching and preserve an auditable exception path.
|
||||
|
||||
## 4. Processor/subprocessor records
|
||||
|
||||
`ProcessorRecord` stores processor/subprocessor identity, processing purpose, data categories, location, contract/safeguard reference, due-diligence status, and incident/request assistance record. Review and assistance actions are attributable to an operator role and linked to applicable tenant instructions/contractual safeguards. This is an inventory and governance capability; it does not itself create a live integration with each listed processor.
|
||||
|
||||
## 5. Data minimization and evidence
|
||||
|
||||
Store evidence references and minimum metadata needed for review; do not duplicate complete identity documents or breach payloads without a scoped requirement. Privacy-case access is audited. Tenant-owned personal data remains under RLS. Exact retention periods, statutory deadlines and additional legal obligations stay unresolved under `AMB-006`; these are configurable/approved inputs, not constants in the domain model.
|
||||
|
||||
## Stage 9 SRS Traceability
|
||||
|
||||
| Parent FR | SRS | HLD component |
|
||||
|---|---|---|
|
||||
| `FR-PRIVACYPURPOSECONSENT-001` | `SRS-PRIVACYPURPOSECONSENT-001` | `HLD-PRIVACY-INCIDENT-LIFECYCLE` |
|
||||
| `FR-DATAPRINCIPALRIGHTS-001` | `SRS-DATAPRINCIPALRIGHTS-001` | `HLD-PRIVACY-INCIDENT-LIFECYCLE` |
|
||||
| `FR-PROCESSORGOVERNANCE-001` | `SRS-PROCESSORGOVERNANCE-001` | `HLD-PROCESSOR-GOVERNANCE` |
|
||||
|
||||
Detailed API, entity and integration contracts are in the Stage 9 shared design documents.
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
---
|
||||
id: ARCH-REVIEW-009
|
||||
parent_ids: [HLD-ATB, API-DESIGN-001, DB-DESIGN-001, INT-DESIGN-001]
|
||||
version: 1.0.0
|
||||
status: Draft — Stage 9 review brief; Gate 9.1 pending
|
||||
last_cr: none
|
||||
---
|
||||
|
||||
# Stage 9 Design Review Brief
|
||||
|
||||
## Core problem and completed design
|
||||
|
||||
Stage 8 produced one SRS for each of the 54 FRs. Stage 9 now assigns all 26 use cases to HLD components and LLD contracts, and provides explicit REST, PostgreSQL entity/constraint, and integration boundaries. The eight previously unmodeled low-risk use cases are covered by LLD-007 through LLD-011, applying the Stage 7 approved modular-monolith, tenant-context, RLS, audit and outbox patterns.
|
||||
|
||||
## Decisions and trade-offs
|
||||
|
||||
- Keep one modular-monolith codebase and separate bounded contexts; PostgreSQL remains authoritative, Valkey handles cache/stream delivery, and outbox consumers are at-least-once/idempotent.
|
||||
- Use tenant-scoped uniqueness, RLS and transaction-local verified tenant context. Tenant/platform privacy records and control-plane administration remain separately authorized.
|
||||
- Use append-only stock/financial journals and compensating corrections. Do not infer payment execution or physical weighbridge integration.
|
||||
- Keep provider-neutral hosting and document storage because the project profile has not selected providers.
|
||||
|
||||
## Assumptions and security boundaries
|
||||
|
||||
All authenticated tenant operations resolve membership server-side. Background jobs re-establish and verify tenant context. Application runtime roles cannot bypass RLS. Legal timing/retention, tax-ID specifics, exact logout/session revocation, messaging provider/channel and object-storage controls remain open under `AMB-006`, `AMB-009`, and `AMB-010`. Design documents do not claim runtime or load proof.
|
||||
|
||||
## Targeted review points
|
||||
|
||||
1. Confirm proposed API paths/resource boundaries and public no-account privacy request intake boundary.
|
||||
2. Review separation of tenant Data Fiduciary records from operator control-plane/processor governance records.
|
||||
3. Confirm tax identifier validation scope and allowed formats (new `AMB-010`), and poison-event retention/replay authority (new `AMB-011`).
|
||||
4. Confirm the balanced expense voucher ledger relationship and use of compensating entries.
|
||||
5. Confirm which design choices require adjustment before Gate 9.1.
|
||||
|
|
@ -4,7 +4,10 @@
|
|||
|---|---|
|
||||
| **Iteration** | `iteration-01` |
|
||||
| **Parent Use Case** | [`UC-001`](../../../03_requirements/use_cases/uc-001_user-authentication/use-case.md) |
|
||||
| **Status** | Ready for Construction |
|
||||
| **Governed Standard** | UP-AI v1.5 Stage 10 Standard |
|
||||
| **Status** | Aligned with Stage 9 Architecture (Gate 9.1 Passed); Ready for Stage 11/12 |
|
||||
| **Version** | 1.2.0 |
|
||||
| **Last CR** | `CR-001` |
|
||||
|
||||
---
|
||||
|
||||
|
|
@ -12,6 +15,55 @@
|
|||
|
||||
| Story ID | Parent FR | Story Title | Points | Priority | Primary Delivery Surface | Assigned Roles | Status |
|
||||
|---|---|---|---|---|---|---|---|
|
||||
| `STORY-AUTH-001` | `FR-AUTH-001` | OIDC PKCE Authorization Code Exchange | 5 | P0 | Backend API (`/api/v1/auth/token`), Frontend `/login` | `@backend-dev`, `@ui-designer-dev` | Ready |
|
||||
| `STORY-AUTH-002` | `FR-AUTH-002` | Tenant Context Propagation & PostgreSQL RLS | 5 | P0 | Middleware, Database Migrations | `@backend-dev` | Ready |
|
||||
| `STORY-AUTH-003` | `FR-AUTH-003` | Session Monitoring, Token Blacklist & Logout | 3 | P1 | Backend API (`/api/v1/auth/logout`), Cache (Valkey) | `@backend-dev`, `@adversarial-tester` | Ready |
|
||||
| `STORY-AUTH-001` | `FR-AUTH-001` | OIDC PKCE Authorization Code Exchange & Application Session | 5 | P0 | Backend API (`GET /api/v1/auth/session`), Frontend `/login`, `/auth/callback` | `@backend-dev`, `@ui-designer-dev` | Ready for Construction |
|
||||
| `STORY-AUTH-002` | `FR-AUTH-002` | Role Permission Matrix Enforcement & Segregation of Duties | 5 | P0 | Cross-cutting API Authorization Dependency / Middleware | `@backend-dev` | Ready for Construction |
|
||||
| `STORY-AUTH-003` | `FR-AUTH-003` | End Application Session and Logout | 3 | P1 | Backend API (`POST /api/v1/auth/logout`), Frontend `/account/sessions` & Header | `@backend-dev`, `@adversarial-tester` | Ready for Construction |
|
||||
|
||||
---
|
||||
|
||||
## Detailed Story Specifications
|
||||
|
||||
### STORY-AUTH-001: OIDC PKCE Authorization Code Exchange & Application Session
|
||||
- **Parent Requirement:** [`FR-AUTH-001`](../../../03_requirements/use_cases/uc-001_user-authentication/functional-reqs.md#fr-auth-001-oidc-authentication)
|
||||
- **SRS Linkage:** `SRS-AUTH-001`
|
||||
- **Architecture Contract:** `HLD-IAM`, [`LLD-001`](../../../04_architecture_design/lld/LLD-001_auth_service.md), [`api_design.md`](../../../04_architecture_design/api_design.md)
|
||||
- **Story Points:** 5 (P0)
|
||||
- **Description:** Implement OIDC Authorization Code flow with Proof Key for Code Exchange (PKCE) against the Keycloak identity provider, validating tokens on callback and providing an authenticated application session endpoint (`GET /api/v1/auth/session`).
|
||||
- **Acceptance Criteria:**
|
||||
1. The React client initiates authorization-code flow with PKCE (`code_challenge` generated via SHA-256 and `code_verifier`).
|
||||
2. The backend validates the callback exchange and verifies JWT signatures against provider JWKS, issuer (`iss`), audience (`aud`), state, and time validity claims (`exp`, `nbf`).
|
||||
3. `GET /api/v1/auth/session` returns the session status (`authenticated: true`), the authenticated subject identifier (`sub`), and token validity without exposing secret tokens.
|
||||
4. Unauthenticated, expired, or tampered tokens return HTTP `401 Unauthorized`.
|
||||
5. The entire flow runs deterministically offline using `sandbox/identity_mock.py` when Keycloak is unavailable.
|
||||
|
||||
---
|
||||
|
||||
### STORY-AUTH-002: Role Permission Matrix Enforcement & Segregation of Duties
|
||||
- **Parent Requirement:** [`FR-AUTH-002`](../../../03_requirements/use_cases/uc-001_user-authentication/functional-reqs.md#fr-auth-002-role-based-authorization)
|
||||
- **SRS Linkage:** `SRS-AUTH-002`
|
||||
- **Architecture Contract:** `HLD-IAM`, [`LLD-001`](../../../04_architecture_design/lld/LLD-001_auth_service.md)
|
||||
- **Story Points:** 5 (P0)
|
||||
- **Description:** Implement a cross-cutting authorization policy evaluator that validates the BRD-FR-040 role-based permission matrix across all 11 PRD roles and strictly enforces segregation of duties on protected operations.
|
||||
- **Acceptance Criteria:**
|
||||
1. Evaluates permissions across all 11 PRD roles: `Tenant Administrator`, `Mandi Buyer`, `Purchase Manager`, `Yard Supervisor`, `Quality Officer`, `Sales Executive`, `Sales Manager`, `Logistics Coordinator`, `Accounts Executive`, `Partner / MD`, and `System Administrator`.
|
||||
2. Enforces discrete actions: `Read`, `Write`, `Create`, `Delete`, `Submit`, `Cancel`, and `Amend`.
|
||||
3. Denies any operation not permitted by the matrix before invoking business logic, returning HTTP `403 Forbidden`.
|
||||
4. Strictly enforces segregation of duties:
|
||||
- Quality Officers cannot edit prices.
|
||||
- Yard Supervisors cannot confirm sales.
|
||||
- Sales Executives cannot override credit locks.
|
||||
5. Does not grant cross-tenant authorization; tenant administrative permissions are valid only within the verified tenant membership context.
|
||||
|
||||
---
|
||||
|
||||
### STORY-AUTH-003: End Application Session and Logout
|
||||
- **Parent Requirement:** [`FR-AUTH-003`](../../../03_requirements/use_cases/uc-001_user-authentication/functional-reqs.md#fr-auth-003-session-handling-and-logout)
|
||||
- **SRS Linkage:** `SRS-AUTH-003`
|
||||
- **Architecture Contract:** `HLD-IAM`, [`LLD-001`](../../../04_architecture_design/lld/LLD-001_auth_service.md), [`api_design.md`](../../../04_architecture_design/api_design.md)
|
||||
- **Story Points:** 3 (P1)
|
||||
- **Description:** Implement the session termination and logout workflow, enabling authenticated users to end their active session and preventing any reuse of ended sessions.
|
||||
- **Acceptance Criteria:**
|
||||
1. Authenticated user can initiate logout via UI controls or via `POST /api/v1/auth/logout`.
|
||||
2. The application terminates the active application session and clears client credentials/cookies.
|
||||
3. Any subsequent protected operation using the ended session credentials returns HTTP `401 Unauthorized`.
|
||||
4. Fails closed on malformed or replayed logout requests.
|
||||
|
|
|
|||
|
|
@ -1,20 +1,49 @@
|
|||
# Iteration Plan — Iteration 01 (IAM & Multi-Tenant Core)
|
||||
# Iteration Plan — Iteration 01 (OIDC Authentication, Authorization & Session)
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| **Iteration** | `iteration-01` |
|
||||
| **Slice Goal** | Deliver end-to-end multi-tenant OIDC login, RBAC authorization, and session lifecycle (`UC-001`). |
|
||||
| **Governed Standard** | UP-AI v1.0 Stage 10 Standard |
|
||||
| **Slice Goal** | Deliver OIDC authentication, BRD-FR-040 role authorization, and application session/logout behavior (`UC-001`) with deterministic offline sandbox integration. |
|
||||
| **Governed Standard** | UP-AI v1.5 Stage 10 Standard |
|
||||
| **Parent Use Case** | [`UC-001`](../../../03_requirements/use_cases/uc-001_user-authentication/use-case.md) |
|
||||
| **Capacity** | 3 Stories (13 Story Points) |
|
||||
| **Status** | Approved for Construction |
|
||||
| **Status** | Aligned with Stage 9 Architecture (Gate 9.1 Passed); Ready for Stage 11/12 |
|
||||
| **Version** | 1.2.0 |
|
||||
| **Last CR** | `CR-001` |
|
||||
|
||||
---
|
||||
|
||||
## 1. Demo & Acceptance Criteria
|
||||
## 1. Iteration Goal & Scope Summary
|
||||
|
||||
At the conclusion of Iteration 01, the team will demonstrate:
|
||||
1. An unauthenticated user accessing `/` is redirected to Keycloak OIDC login and returns with valid session tokens.
|
||||
2. A Tenant Admin logging in accesses `/admin/roles` and sees tenant-scoped RBAC management with PostgreSQL RLS active.
|
||||
3. Logging out from the profile menu invalidates the active session and blacklists the token across subsequent API calls.
|
||||
4. Multi-path automated test suite achieves $\ge 95.0\%$ coverage via `scripts/run_tests.sh --scope iteration-01`.
|
||||
5. 21-sheet Excel Manual QA Workbook is compiled and verified under `07_test_design/manual_qa/workbooks/`.
|
||||
Deliver the foundational authentication, session management, and authorization boundaries for the Agriculture Trading Backoffice (ATB) application. This vertical slice implements Keycloak OIDC Authorization Code flow with PKCE, JWT bearer validation, server-side session querying and termination, and the PRD-defined role permission matrix with segregation of duties (`UC-001`: `FR-AUTH-001`, `FR-AUTH-002`, `FR-AUTH-003`).
|
||||
|
||||
Tenant membership verification and PostgreSQL Row-Level Security isolation remain distinct architectural components owned by their respective downstream use cases and are resolved in their own iterations.
|
||||
|
||||
---
|
||||
|
||||
## 2. Demo & Acceptance Criteria
|
||||
|
||||
Planned acceptance evidence for Iteration 01:
|
||||
1. **OIDC Authentication Flow (`FR-AUTH-001`):** An unauthenticated user accessing `/` or protected routes is redirected to the Keycloak OIDC login interface using PKCE. Upon successful callback, the client receives session credentials, and `GET /api/v1/auth/session` returns authenticated state, current subject ID, and assigned roles.
|
||||
2. **Role-Based Authorization & Segregation of Duties (`FR-AUTH-002`):** Protected business API actions enforce the `BRD-FR-040` role permission matrix covering `Read`, `Write`, `Create`, `Delete`, `Submit`, `Cancel`, and `Amend` across all 11 PRD roles. Enforces mandatory segregation of duties:
|
||||
- Quality Officers cannot edit prices.
|
||||
- Yard Supervisors cannot confirm sales.
|
||||
- Sales Executives cannot override credit locks.
|
||||
Unpermitted actions are denied before business command execution with HTTP `403 Forbidden`.
|
||||
3. **Application Session Termination (`FR-AUTH-003`):** The user can terminate their active application session via `POST /api/v1/auth/logout`. Any subsequent protected requests using the terminated session are rejected with HTTP `401 Unauthorized`.
|
||||
4. **Deterministic Offline Sandbox:** All authentication and authorization automated tests can execute deterministically without external network connectivity using the mock adapter at `sandbox/identity_mock.py` (matching `tech-profile.yaml`).
|
||||
5. **Quality & Coverage Compliance:** Automated test execution satisfies the tiered coverage threshold:
|
||||
- Backend domain/FSM coverage: $\ge 95.0\%$
|
||||
- Integration adapter coverage: $\ge 90.0\%$
|
||||
- Frontend components coverage: $\ge 80.0\%$
|
||||
6. **Gate 14.1 Artifact Density:**
|
||||
- 21-sheet Excel QA Workbook with $\ge 20$ dense test cases across categories (`scripts/generate_manual_qa_workbook.py`).
|
||||
- Git-versioned Bruno API collections (`.bru`) under `docs/api/bruno/auth/` covering all declared endpoints (`GET /api/v1/auth/session`, `POST /api/v1/auth/logout`).
|
||||
- Multi-path 4-dimension functional test models in `07_test_design/functional_test_cases/`.
|
||||
|
||||
---
|
||||
|
||||
## 3. Carried-Over Scope & Regression Debt
|
||||
|
||||
- **Carried-over stories from previous iteration:** None (Iteration 01 is the initial Construction loop).
|
||||
- **Regression debt from `regression_test_cases.md`:** None. Initial suite setup includes active pytest specs `TC-AUTH-001` through `TC-AUTH-004`.
|
||||
|
|
|
|||
|
|
@ -3,8 +3,10 @@
|
|||
| Field | Value |
|
||||
|---|---|
|
||||
| **Iteration** | `iteration-01` |
|
||||
| **Governed Standard** | UP-AI v1.0 Standard |
|
||||
| **Status** | Verified for Gate 14.1 |
|
||||
| **Governed Standard** | UP-AI v1.5 Stage 10 Standard |
|
||||
| **Status** | Implemented (Domain/Schema & Frontend Views) |
|
||||
| **Version** | 1.3.0 |
|
||||
| **Last CR** | `CR-001` |
|
||||
|
||||
---
|
||||
|
||||
|
|
@ -12,6 +14,27 @@
|
|||
|
||||
| Story ID | Parent FR | Portal / Screen | Route | API Endpoint | DB Migration | Sandbox / Mock | Config / Secret | Test Scopes | Dev Owner | QA Owner | Surface Status |
|
||||
|---|---|---|---|---|---|---|---|---|---|---|---|
|
||||
| `STORY-AUTH-001` | `FR-AUTH-001` | Auth Portal / Login | `/login` | `POST /api/v1/auth/token` | Alembic `001_auth_core.py` | `sandbox/identity_mock.py` | `KEYCLOAK_URL` | Unit, Bruno, Playwright | `@backend-dev` | `@adversarial-tester` | Specified |
|
||||
| `STORY-AUTH-002` | `FR-AUTH-002` | Admin Portal / Roles | `/admin/roles` | `GET /api/v1/auth/me` | Alembic `002_rls_policies.py` | N/A (Internal DB) | `DATABASE_URL` | Unit, Integration RLS | `@backend-dev` | `@adversarial-tester` | Specified |
|
||||
| `STORY-AUTH-003` | `FR-AUTH-003` | User Settings / Sessions | `/account/sessions` | `POST /api/v1/auth/logout` | None (Valkey keys) | N/A (Internal Cache) | `VALKEY_URL` | Unit, FSM Invariant | `@backend-dev` | `@adversarial-tester` | Specified |
|
||||
| `STORY-AUTH-001` | `FR-AUTH-001` | Login Screen & Callback View | `/login`, `/auth/callback` | `GET /api/v1/auth/session` | Schema baseline: `users` table via Alembic | `sandbox/identity_mock.py` | `KEYCLOAK_URL`, `KEYCLOAK_REALM`, `KEYCLOAK_CLIENT_ID` | Unit (pytest/unittest), API (Bruno), Browser E2E (Playwright) | `@backend-dev`, `@ui-designer-dev` | `@adversarial-tester` | Implemented (Domain/Schema & Frontend Views) |
|
||||
| `STORY-AUTH-002` | `FR-AUTH-002` | Protected Portal Navigation Guards | Protected routes (`/`, `/market`, `/procurement`, `/finance`) | Policy Middleware (`Depends(verify_role_permission)`) | Role permission matrix seed data | Test user personas (`Trader`, `AccountsOfficer`, `QualityInspector`) | Role policy definition | Unit (pytest matrix), Security API checks, FSM invariant | `@backend-dev` | `@adversarial-tester` | Implemented (Domain/Schema & Frontend Views) |
|
||||
| `STORY-AUTH-003` | `FR-AUTH-003` | User Profile Menu & Session Controls | `/account/sessions` | `POST /api/v1/auth/logout` | Session revocation store (in-memory / Valkey) | `sandbox/identity_mock.py` | IdP logout redirect URI | Unit (pytest/unittest), API (Bruno), Browser E2E (Playwright), FSM invariant | `@backend-dev` | `@adversarial-tester` | Implemented (Domain/Schema & Frontend Views) |
|
||||
|
||||
---
|
||||
|
||||
## Surface Breakdown & Responsibilities
|
||||
|
||||
1. **Frontend Portal / Screen Surfaces:**
|
||||
- **Login & Callback View (`STORY-AUTH-001`):** React component with Tailwind/shadcn UI handling redirection to Keycloak OIDC login with PKCE and token exchange on callback route `/auth/callback`.
|
||||
- **Protected Navigation Guards (`STORY-AUTH-002`):** Zustand-backed auth store guarding routes and rendering UI elements based on active role permissions.
|
||||
- **Session Controls (`STORY-AUTH-003`):** Header user profile dropdown and `/account/sessions` view offering user-initiated session termination.
|
||||
2. **Backend API Endpoints:**
|
||||
- `GET /api/v1/auth/session`: Validates current application session token and returns subject ID and token claims without leaking secrets.
|
||||
- `Policy Middleware`: Cross-cutting FastAPI dependency applied to all protected routes enforcing the BRD-FR-040 role matrix and segregation of duties.
|
||||
- `POST /api/v1/auth/logout`: Invalidates the active application session and cleans up server-side state.
|
||||
3. **Database & Migrations:**
|
||||
- Initial Alembic migration defining the `users` table for internal subject mapping, ensuring foreign-key referential integrity for downstream tenant memberships.
|
||||
4. **Integration Sandboxes (Wave 0):**
|
||||
- Deterministic Keycloak mock adapter at `sandbox/identity_mock.py` providing reproducible JWKS endpoints, PKCE code exchange, and token signing for isolated offline execution.
|
||||
5. **Quality Assurance Deliverables:**
|
||||
- **Bruno Collections:** Git-versioned collections in `docs/api/bruno/auth/` for `GET /api/v1/auth/session` and `POST /api/v1/auth/logout`.
|
||||
- **Excel QA Workbook:** 21-sheet manual QA workbook compiled with $\ge 20$ test cases across categories.
|
||||
- **Multi-Path Automated Tests:** Happy Path, Boundary/Edge, Negative/Security, and FSM Invariant tests in `tests/backend/` and `tests/frontend/e2e/`.
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue