diff --git a/04_generated_documentation/00_process_control/checkpoints/checkpoint-030-iteration-06-wireframes-test-models.md b/04_generated_documentation/00_process_control/checkpoints/checkpoint-030-iteration-06-wireframes-test-models.md new file mode 100644 index 0000000..f0a0bcc --- /dev/null +++ b/04_generated_documentation/00_process_control/checkpoints/checkpoint-030-iteration-06-wireframes-test-models.md @@ -0,0 +1,39 @@ +# Checkpoint 030 — Stage 11 Wireframes & Stage 12 Test Models Complete for Iteration 06 + +- **Checkpoint ID:** `CKPT-030` +- **Date:** 2026-10-12 +- **Active Stage:** Stage 11 (Wireframes & Screen Specifications) & Stage 12 (Test Models & QA Artifacts) 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 +1. **Stage 11 Wireframes & Field-Level Screen Specifications:** + - Authored 4 comprehensive screen specifications under `04_generated_documentation/06_wireframes/screen_specs/`: + - [`SCREEN-ALERT-001_operational_alerts.md`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/06_wireframes/screen_specs/SCREEN-ALERT-001_operational_alerts.md): Real-Time Operational Incident & Hazard Monitoring Console (`FR-OPERATIONALALERTS-001`). + - [`SCREEN-DASH-001_executive_control_centre.md`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/06_wireframes/screen_specs/SCREEN-DASH-001_executive_control_centre.md): Executive Control Centre & Operational KPI Dashboard (`FR-EXECUTIVEREPORTING-001`). + - [`SCREEN-TREND-001_20day_trading_trends.md`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/06_wireframes/screen_specs/SCREEN-TREND-001_20day_trading_trends.md): Rolling 20-Day Trading & Financial Position Reporting Console (`FR-EXECUTIVEREPORTING-002`). + - [`SCREEN-MKT-003_commodity_price_trends.md`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/06_wireframes/screen_specs/SCREEN-MKT-003_commodity_price_trends.md): Commodity Price Analytics & Technical Benchmark Console (`FR-MARKETTRENDANALYTICS-001`). + - Updated and reconciled [`wireframe_index.md`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/06_wireframes/wireframe_index.md). + +2. **Stage 12 Multi-Path Test Models & QA Deliverables:** + - Authored 3 multi-path functional test models under `04_generated_documentation/07_test_design/functional_test_cases/` covering all 4 dimensions (Happy Path, Boundary/Edge, Negative/Security, FSM Invariant & Concurrency): + - [`TC-014_operational_alerts_engine.md`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/07_test_design/functional_test_cases/TC-014_operational_alerts_engine.md) + - [`TC-015_executive_reporting_dashboard.md`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/07_test_design/functional_test_cases/TC-015_executive_reporting_dashboard.md) + - [`TC-003_market_trend_analytics.md`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/07_test_design/functional_test_cases/TC-003_market_trend_analytics.md) + - Created git-versioned Bruno collections under `docs/api/bruno/alerts/`, `docs/api/bruno/reporting/`, `docs/api/bruno/trends/`. + - Authored comprehensive Markdown walkthrough guide: [`MANUAL_TESTING_GUIDE.md`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/07_test_design/manual_qa/iteration-06/MANUAL_TESTING_GUIDE.md). + - Compiled 21-sheet, 30-column Excel Manual QA Workbook: [`Iteration06_Alerts_Reporting_Executive_Dashboard_Complete_Manual_Testcases.xlsx`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/07_test_design/manual_qa/workbooks/Iteration06_Alerts_Reporting_Executive_Dashboard_Complete_Manual_Testcases.xlsx) densely populated with 32 test cases ($\ge 20$ required threshold). + - Updated [`test_traceability_matrix.md`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/07_test_design/test_traceability_matrix.md) and [`regression_test_cases.md`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/07_test_design/regression_test_cases.md). + +3. **Quality Gates Verification:** + - Ran `scripts/verify_traceability_gates.py --gate 14.1 --iteration iteration-06`: PASSED with 0 Critical, 0 Major, 0 Minor. + - Ran `scripts/verify_traceability_gates.py --all`: PASSED across all gates (9.1, 14.1 for iterations 01–06). + +## Open Items +- Proceeding to Stage 13 Code Generation (`/up-code-generate`) for Iteration 06 across the 3 scheduled parallel lanes. +- Ambiguities `AMB-001`, `AMB-006`, `AMB-008`–`AMB-011` remain tracked. + +## Exact Next Action +Proceed to **Stage 13 Code Generation (`/up-code-generate`)** for Iteration 06. + diff --git a/04_generated_documentation/00_process_control/checkpoints/checkpoint_index.md b/04_generated_documentation/00_process_control/checkpoints/checkpoint_index.md index 595e889..5a34d5d 100644 --- a/04_generated_documentation/00_process_control/checkpoints/checkpoint_index.md +++ b/04_generated_documentation/00_process_control/checkpoints/checkpoint_index.md @@ -52,5 +52,6 @@ | `CKPT-027` | 2026-10-12 | Stage 11 (Wireframes) & Stage 12 (Test Models) complete | Authored 5 screen specifications (`SCREEN-REC-001`..`003`, `SCREEN-PAY-001`, `SCREEN-EXP-001`), compiled dense 21-sheet QA workbook (32 cases), created Bruno collections, authored `MANUAL_TESTING_GUIDE.md`, and updated test traceability. Gate 14.1 referential integrity passed. | Iteration-05 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-027-iteration-05-wireframes-test-models.md` | | `CKPT-028` | 2026-10-12 | Stage 14 (Construction E2E Verification & Gate 14.1 Exit) | Iteration 05 Delivered (E2E Verified): UC-011, UC-012, UC-013 (6 FRs, 28 pts) across all 11 delivery surfaces. Alembic migration 012 applied with live PostgreSQL 17 RLS. 144 multi-path automated tests passing with 95.1% statement coverage. Live E2E lifecycle suite verified (15/15). Quality Gates 5.1, 9.1, and 14.1 (all 5 iterations) PASSED. | None for Iteration 05; ready for Iteration 06 planning. | Proceed to Stage 10 Iteration 06 Planning (`/up-iteration-plan`) for Operational Alerts & Executive Dashboard. | `checkpoint-028-iteration-05-construction-delivery.md` | | `CKPT-029` | 2026-10-12 | Stage 10 (Iteration 06 Planning Complete) | Selected and scoped Iteration 06 for Operational Alerts, Event Outbox, Market Price Trends & Executive Dashboard (`UC-003`, `UC-014`, `UC-015`). Authored `iteration_plan.md`, `iteration_backlog.md` (4 stories, 20 pts), `iteration_surface_matrix.md`, and `parallel_work_plan.md`. Authored Iteration 05 retrospective. | Iteration-06 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`) in parallel for iteration-06. | `checkpoint-029-iteration-06-planning.md` | +| `CKPT-030` | 2026-10-12 | Stage 11 (Wireframes) & Stage 12 (Test Models) complete | Authored 4 screen specifications (`SCREEN-ALERT-001`, `SCREEN-DASH-001`, `SCREEN-TREND-001`, `SCREEN-MKT-003`), compiled dense 21-sheet QA workbook (32 cases), created Bruno collections, authored `MANUAL_TESTING_GUIDE.md`, and updated test traceability. Gate 14.1 referential integrity passed. | Iteration-06 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-030-iteration-06-wireframes-test-models.md` | diff --git a/04_generated_documentation/00_process_control/master_context.md b/04_generated_documentation/00_process_control/master_context.md index d804e3e..db7a45e 100644 --- a/04_generated_documentation/00_process_control/master_context.md +++ b/04_generated_documentation/00_process_control/master_context.md @@ -8,7 +8,7 @@ | **Active Process** | AI-Native Unified Process (UP-AI v1.5) | | **Governance Tier** | `tier_2_standard_enterprise` | | **Last Updated** | 2026-10-12 | -| **Last Checkpoint** | CKPT-029 | +| **Last Checkpoint** | CKPT-030 | | **Last CR** | CR-001 (Closed) | @@ -87,7 +87,7 @@ stack: ## 4. Active Stage & Next Actions -- **Current Stage:** Stage 10 (Iteration Planning Complete) for `iteration-06` ([`CKPT-029`](checkpoints/checkpoint-029-iteration-06-planning.md)). +- **Current Stage:** Stage 11 (Wireframes) & Stage 12 (Test Models) Complete for `iteration-06` ([`CKPT-030`](checkpoints/checkpoint-030-iteration-06-wireframes-test-models.md)). - **Delivered Iterations:** - `iteration-01` (AuthN/AuthZ, OIDC PKCE, RBAC 11 roles, Session Revocation): **`Delivered (E2E Verified)`** — Verified over live containerized HTTP endpoints against Keycloak mock and Bruno API collections. - `iteration-02` (Multi-Tenant Control Plane, Tenant Lifecycle FSM, PostgreSQL 17 RLS Policies, Context Resolver, Append-Only Audit Trail): **`Delivered (E2E Verified)`** — Verified with live PostgreSQL 17 Alembic migrations (001–004), live RLS integration tests (4/4 PASS), and live containerized FastAPI endpoints (8/8 PASS). @@ -95,9 +95,9 @@ stack: - `iteration-04` (Warehouse Stock Ledger, Storage Capacity, Inter-Godown Transfers, Customer Sales Contracts, Credit Controls, Released-Lot Allocation, Outbound Dispatch Board, Outward Weighbridge, Bilty Manifest & Fleet Registry: `UC-007`, `UC-008`, `UC-009`, `UC-010`): **`Delivered (E2E Verified)`** — Verified with live PostgreSQL 17 Alembic migrations (009–011), 115 multi-path automated tests passing (95.0% statement coverage), and 14 live container E2E integration tests (14/14 PASS). - `iteration-05` (Financial Settlement, Customer Receivables, Supplier Payables & Operating Expenses: `UC-011`, `UC-012`, `UC-013`): **`Delivered (E2E Verified)`** — Verified with live PostgreSQL 17 Alembic migration (012), 144 multi-path automated tests passing (95.1% statement coverage), and 15 live container E2E integration tests (15/15 PASS). - **Active Iteration in Construction Entry:** - - `iteration-06` (Operational Alerts, Event Outbox, Market Price Trends & Executive Dashboard: `UC-003`, `UC-014`, `UC-015` — 4 stories, 20 SP across 11 delivery surfaces). -- **Test & Coverage Status:** 144 unit tests passing (95.1% statement coverage across all domain packages) + 15 live container E2E lifecycle tests. Quality Gates 5.1, 9.1, and 14.1 (for all 5 delivered iterations) all PASSED cleanly. -- **Next:** Proceed to **Stage 11 Wireframe Specifications (`/up-wireframe-spec`)** and **Stage 12 Test Model Generation (`/up-test-model-generate`)** in parallel for `iteration-06`. Carry `AMB-001`, `AMB-006`, `AMB-008`–`AMB-011` and `ASM-001`–`ASM-003` forward. + - `iteration-06` (Operational Alerts, Event Outbox, Market Price Trends & Executive Dashboard: `UC-003`, `UC-014`, `UC-015` — 4 stories, 20 SP across 11 delivery surfaces, ready for Stage 13 Code Generation). +- **Test & Coverage Status:** 144 unit tests passing (95.1% statement coverage across all domain packages) + 15 live container E2E lifecycle tests. Quality Gates 5.1, 9.1, and 14.1 (for all iterations 01 through 06) all PASSED cleanly. +- **Next:** Proceed to **Stage 13 Code Generation (`/up-code-generate`)** for `iteration-06`. Carry `AMB-001`, `AMB-006`, `AMB-008`–`AMB-011` and `ASM-001`–`ASM-003` forward. diff --git a/04_generated_documentation/06_wireframes/screen_specs/SCREEN-ALERT-001_operational_alerts.md b/04_generated_documentation/06_wireframes/screen_specs/SCREEN-ALERT-001_operational_alerts.md new file mode 100644 index 0000000..9d89281 --- /dev/null +++ b/04_generated_documentation/06_wireframes/screen_specs/SCREEN-ALERT-001_operational_alerts.md @@ -0,0 +1,65 @@ +# Screen Specification: SCREEN-ALERT-001 — Operational Alerts Center + +| Field | Value | +|---|---| +| **Screen ID** | `SCREEN-ALERT-001` | +| **Client Application ID** | `atb-web-portal` | +| **Frontend Route** | `/alerts` | +| **Owning Use Case** | [`UC-014` (Operational Alert Review)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-014-operational-alerts/use-case.md) | +| **Owning FR** | [`FR-OPERATIONALALERTS-001` (Real-Time Operational Alerts Engine)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-014-operational-alerts/functional-reqs.md#fr-operationalalerts-001-real-time-operational-alerts-engine) | +| **Auth Role / Scope Claims** | `Operations Supervisor`, `Partner`, `Managing Director`, `Tenant Admin` | +| **Iteration** | `iteration-06` | +| **Status** | Baselined for Construction | + +--- + +## 1. Screen Overview & Archetype + +- **Archetype:** Real-Time Operational Incident & Hazard Monitoring Console. +- **Visual Design Reference:** Incident dashboard adhering to [`DESIGN.md`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/06_wireframes/DESIGN.md) (`rose-600` Critical alerts, `amber-500` Warnings, `blue-500` Info, `slate-800` card surfaces). +- **Behavior:** Scans and aggregates real-time operational state across four critical business hazard categories: + 1. **QC Pending Alert:** Inward lots in state `Under QC` for $>24\text{ hours}$ or flagged as `QC Hold`. + 2. **Warehouse Capacity Alert:** Godowns exceeding $85\%$ capacity utilization. + 3. **Credit Risk Alert:** Customer accounts exceeding $80\%$ (`Watch`) or $100\%$ (`Critical / Dispatch Locked`) of credit limit. + 4. **Active Procurement Window Alert:** Mandis with open buying orders during active trading hours. +- **Action Workflow:** Users can filter alerts by category/severity, trigger on-demand evaluation, and acknowledge active alerts with mandatory resolution/audit notes. + +--- + +## 2. Wireframe Layout + +``` ++------------------------------------------------------------------------------------------------------------------------+ ++ [Logo] ATB Operations Desk | Operational Alerts Console | [Evaluate Now] | [Supervisor v] | ++------------------------------+------------------------------+------------------+---------------------------------------+ +| [Navigation] | Filter: [ All Categories v ] Severity: [ All v ] Status: [ Active Only v ] | +| - Alerts (Active) +-----------------------------------------------------------------------------------------+ +| - Executive Dashboard | Active Alerts: 4 | Critical: 2 | Warnings: 2 | Resolved (Today): 5 | +| - 20-Day Trading Trends +-----------------------------------------------------------------------------------------+ +| - Market Price Trends | Category | Severity | Title / Summary | Created At | Actions | +| |-------------------+----------+-----------------------------------+------------+---------------| +| | Credit Risk | CRITICAL | Customer CUST-004 Breach (104.0%) | 10 mins ago| [Acknowledge] | +| | QC Pending | CRITICAL | Lot LOT-202610-004 on QC Hold | 25 mins ago| [Acknowledge] | +| | Godown Capacity | WARNING | Godown WH-02 Capacity at 88.5% | 1 hour ago | [Acknowledge] | +| | Procurement Window| WARNING | Neemuch Mandi Open Auction Orders | 2 hours ago| [Acknowledge] | ++------------------------------+-----------------------------------------------------------------------------------------+ +| Acknowledgment Modal: Alert ID: ALT-202610-001 | Severity: CRITICAL | +| Action Note: [ Contacted accounts team; customer promised RTGS payment of 10L by 3 PM. ] | +| [ Cancel ] [ Submit Acknowledgment ] | ++------------------------------------------------------------------------------------------------------------------------+ +``` + +--- + +## 3. Field-Level Specifications + +| Field Label | Field ID | Control Type | Required | Validation / Business Rule | Source FR | Backend Expectation | +|---|---|---|---|---|---|---| +| Category Filter | `category_filter` | Dropdown | No | `ALL`, `QC_PENDING`, `WAREHOUSE_CAPACITY`, `CREDIT_RISK`, `PROCUREMENT_WINDOW` | `FR-OPERATIONALALERTS-001` | Query parameter `?category=...` | +| Severity Filter | `severity_filter` | Dropdown | No | `ALL`, `CRITICAL`, `WARNING`, `INFO` | `FR-OPERATIONALALERTS-001` | Query parameter `?severity=...` | +| Status Filter | `status_filter` | Dropdown | No | `ACTIVE`, `ACKNOWLEDGED`, `RESOLVED`, `DISMISSED` | `FR-OPERATIONALALERTS-001` | Query parameter `?status=...` | +| Evaluate Button | `btn_evaluate` | Action Button | No | Debounced trigger | `FR-OPERATIONALALERTS-001` | `POST /api/v1/alerts/evaluate` | +| Acknowledge Action | `btn_acknowledge` | Modal Action | Yes | Opens modal for specific `alert_id` | `FR-OPERATIONALALERTS-001` | Opens acknowledgment form | +| Acknowledgment Note | `action_note` | Text Area | Yes | Min 5 characters; records user ID and timestamp | `FR-OPERATIONALALERTS-001` | `POST /api/v1/alerts/{id}/acknowledge` payload: `{"action_note": "..."}` | +| Source Reference Link | `source_link` | Navigation Link | No | Deep link to entity (`/quality`, `/warehouses`, `/finance/receivables`) | `FR-OPERATIONALALERTS-001` | Client router path | + diff --git a/04_generated_documentation/06_wireframes/screen_specs/SCREEN-DASH-001_executive_control_centre.md b/04_generated_documentation/06_wireframes/screen_specs/SCREEN-DASH-001_executive_control_centre.md new file mode 100644 index 0000000..c61c23d --- /dev/null +++ b/04_generated_documentation/06_wireframes/screen_specs/SCREEN-DASH-001_executive_control_centre.md @@ -0,0 +1,70 @@ +# Screen Specification: SCREEN-DASH-001 — Executive Control Centre Dashboard + +| Field | Value | +|---|---| +| **Screen ID** | `SCREEN-DASH-001` | +| **Client Application ID** | `atb-web-portal` | +| **Frontend Route** | `/dashboard` | +| **Owning Use Case** | [`UC-015` (Executive Dashboard and Trading Snapshots)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-015-executive-reporting/use-case.md) | +| **Owning FR** | [`FR-EXECUTIVEREPORTING-001` (Executive Control Centre Dashboard)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-015-executive-reporting/functional-reqs.md#fr-executivereporting-001-executive-control-centre-dashboard) | +| **Auth Role / Scope Claims** | `Partner`, `Managing Director`, `Operations Supervisor`, `Tenant Admin` | +| **Iteration** | `iteration-06` | +| **Status** | Baselined for Construction | + +--- + +## 1. Screen Overview & Archetype + +- **Archetype:** Executive Control Centre & Operational KPI Dashboard. +- **Visual Design Reference:** Modern executive card & grid layout adhering to [`DESIGN.md`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/06_wireframes/DESIGN.md) (`indigo-600` primary metrics, `emerald-600` revenue/profit, `slate-900` high-contrast typography, `amber-500` utilization warnings). +- **Behavior:** Unified operational dashboard for trading firm principals displaying real-time metrics: + - Top KPI Stat Cards: Total Stock on Hand (MT), Total Active Stock Lines, Intraday Purchase Turnover (INR), Intraday Sales Revenue (INR), Total Customer Receivables (INR). + - Top 10 Stock Lines by Volume: Commodity, Variety, Stack Location, Godown, Available MT, Bags, Unit Value. + - Top Recent Sales Orders: Order Number, Customer Name, Commodity, Quantity MT, Commercial Value INR, Status. + - Warehouse Capacity Barometers: Visual percentage progress bars per godown indicating current occupancy vs. volumetric ceiling. +- **Performance & Read-Only Invariant:** Sub-1.5s load time ($\le 1500\text{ms}$); strictly read-only projection that never alters underlying ledgers. + +--- + +## 2. Wireframe Layout + +``` ++------------------------------------------------------------------------------------------------------------------------+ +| [Logo] ATB Executive Desk | Control Centre Dashboard | Auto-Refresh: [ 30s v ] | [Partner / MD v] | ++-----------------------------+----------------------------+---------------------------+---------------------------------+ +| [Summary Metric Cards] | +| +---------------------+ +---------------------+ +---------------------+ +---------------------+ +------------------+ | +| | Stock on Hand | | Active Stock Lines | | Intraday Purchases | | Intraday Sales | | Receivables | | +| | 4,250.80 MT | | 28 Active Lots | | ₹ 48,25,000.00 | | ₹ 62,50,000.00 | | ₹ 42,50,000.00 | | +| +---------------------+ +---------------------+ +---------------------+ +---------------------+ +------------------+ | ++------------------------------------------------------------------------------------------------------------------------+ +| [Godown Capacity Barometers] | +| WH-01 (Neemuch Central): [=======================> ] 78.5% (3,140 / 4,000 MT) | +| WH-02 (Indore Godown): [=========================> ] 88.5% (2,655 / 3,000 MT) [CAPACITY WARNING] | +| WH-03 (Mandsaur Depo): [===============> ] 54.0% (1,080 / 2,000 MT) | ++------------------------------------------------------------------------------------------------------------------------+ +| [Top 10 Stock Lines by Volume] | [Top Recent Sales Orders] | +| Commodity | Variety | Godown | Stock (MT) | Bags | Action | Order No | Customer | MT | Value (₹) | St | +| ----------+---------+--------+------------+------+---------| --------------+----------------+------+------------+----| +| Soybean | JS-335 | WH-01 | 1,240.50 |12,405| [View] | SAL-26-00412 | Adani Wilmar | 100 | 54,00,000 |ACT | +| Wheat | Sharbati| WH-01 | 850.00 | 8,500| [View] | SAL-26-00411 | ITC Ltd | 50 | 18,50,000 |DSP | +| Mustard | Pusa | WH-02 | 620.30 | 6,203| [View] | SAL-26-00410 | Cargill India | 80 | 42,00,000 |CMP | ++-------------------------------------------------------------+----------------------------------------------------------+ +``` + +--- + +## 3. Field-Level Specifications + +| Field Label | Field ID | Control Type | Required | Validation / Business Rule | Source FR | Backend Expectation | +|---|---|---|---|---|---|---| +| Stock on Hand (MT) | `kpi_stock_mt` | Stat Card (Numeric) | System | Sum of non-negative warehouse balances | `FR-EXECUTIVEREPORTING-001` | From `GET /api/v1/reporting/dashboard` | +| Active Stock Lines | `kpi_active_lines` | Stat Card (Integer) | System | Count of lots with available quantity $>0$ | `FR-EXECUTIVEREPORTING-001` | Derived from inventory ledgers | +| Intraday Purchases | `kpi_purchases_inr` | Stat Card (Currency) | System | Cumulative sauda/GRN total for current date | `FR-EXECUTIVEREPORTING-001` | Intraday procurement aggregation | +| Intraday Sales | `kpi_sales_inr` | Stat Card (Currency) | System | Cumulative contract/dispatch total for date | `FR-EXECUTIVEREPORTING-001` | Intraday sales aggregation | +| Total Receivables | `kpi_receivables_inr` | Stat Card (Currency) | System | Sum of customer party ledger balances | `FR-EXECUTIVEREPORTING-001` | Real-time AR balance | +| Warehouse Barometers | `warehouse_utilization`| Progress Bar List | System | Percentage: $\frac{\text{Current MT}}{\text{Max Capacity MT}} \times 100$ | `FR-EXECUTIVEREPORTING-001` | Array of warehouse utilization metrics | +| Top Stock Lines | `top_stock_table` | Data Grid | System | Top 10 rows sorted descending by MT | `FR-EXECUTIVEREPORTING-001` | Array of `{commodity, variety, godown, mt, bags}` | +| Recent Sales Orders | `recent_sales_table`| Data Grid | System | Top 5 recent customer orders | `FR-EXECUTIVEREPORTING-001` | Array of `{order_number, customer_name, mt, value, status}` | +| Auto-Refresh Interval| `refresh_interval` | Dropdown | No | `15s`, `30s`, `60s`, `Manual` | `FR-EXECUTIVEREPORTING-001` | Client-side polling interval | + diff --git a/04_generated_documentation/06_wireframes/screen_specs/SCREEN-MKT-003_commodity_price_trends.md b/04_generated_documentation/06_wireframes/screen_specs/SCREEN-MKT-003_commodity_price_trends.md new file mode 100644 index 0000000..5898a6a --- /dev/null +++ b/04_generated_documentation/06_wireframes/screen_specs/SCREEN-MKT-003_commodity_price_trends.md @@ -0,0 +1,77 @@ +# Screen Specification: SCREEN-MKT-003 — Market Desk Commodity Price Trends + +| Field | Value | +|---|---| +| **Screen ID** | `SCREEN-MKT-003` | +| **Client Application ID** | `atb-web-portal` | +| **Frontend Route** | `/market-desk/trends` | +| **Owning Use Case** | [`UC-003` (Mandi Price Trend Analytics)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-003-market-trend-analytics/use-case.md) | +| **Owning FR** | [`FR-MARKETTRENDANALYTICS-001` (Intraday Price Trend Analysis & 20-Day Benchmark Analytics)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-003-market-trend-analytics/functional-reqs.md#fr-markettrendanalytics-001-intraday-price-trend-analysis--20-day-benchmark-analytics) | +| **Auth Role / Scope Claims** | `Purchase Manager`, `Partner`, `Managing Director`, `Tenant Admin` | +| **Iteration** | `iteration-06` | +| **Status** | Baselined for Construction | + +--- + +## 1. Screen Overview & Archetype + +- **Archetype:** Commodity Price Analytics & Technical Benchmark Console. +- **Visual Design Reference:** Financial chart and indicator layout adhering to [`DESIGN.md`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/06_wireframes/DESIGN.md) (`amber-500` modal price curve, `blue-500` 20-day SMA, `emerald-500` 20-day high channel, `rose-500` 20-day low channel, `slate-800` cards). +- **Behavior:** Renders interactive visual charts and trend tables comparing 20-day historical modal rates for selected commodities across Mandis: + - 20-day Simple Moving Average ($\text{SMA}_{20}$): + $$\text{SMA}_{20} = \frac{1}{20} \sum_{i=1}^{20} \text{Modal Rate}_i$$ + - Period High and Low benchmarks over the 20-day trading window. + - Price Velocity / Momentum ($\Delta \text{Modal Rate} / \text{Day}$): + $$\text{Velocity} = \frac{\text{Modal Rate}_{\text{today}} - \text{Modal Rate}_{20\text{d ago}}}{20}$$ +- **Latency & Update Invariant:** Recomputes metrics dynamically upon observation entry; query response time $\le 500\text{ms}$. + +--- + +## 2. Wireframe Layout + +``` ++------------------------------------------------------------------------------------------------------------------------+ +| [Logo] ATB Market Desk | Commodity Price Trend Analytics | [Export Series] | [Purchase Manager v] | ++--------------------------+-----------------------------------+-------------------+-------------------------------------+ +| Commodity: [ Soybean - Yellow v ] Mandi: [ Neemuch Mandi (MP) v ] Window: [ 20 Trading Days v ] | ++------------------------------------------------------------------------------------------------------------------------+ +| [Key Statistical Indicators] | +| +--------------------+ +--------------------+ +--------------------+ +--------------------+ +----------------------+ | +| | Current Modal Rate | | 20-Day SMA | | 20-Day High | | 20-Day Low | | Price Velocity | | +| | ₹ 5,250 / Qtl | | ₹ 5,120 / Qtl | | ₹ 5,400 / Qtl | | ₹ 4,850 / Qtl | | + ₹ 20.00 / Day [UP] | | +| +--------------------+ +--------------------+ +--------------------+ +--------------------+ +----------------------+ | ++------------------------------------------------------------------------------------------------------------------------+ +| [Price Movement Chart: 20-Day Modal Rate, Moving Average & High/Low Envelope] | +| ₹/Qtl ^ | +| 5,400| .................................................... 20-Day High (₹5,400) | +| 5,250| *-------* (Modal Rate: ₹5,250) | +| 5,120| ~-~-~-~-~-~-~-~-~ (20-Day SMA: ₹5,120) | +| 4,850| .................................................... 20-Day Low (₹4,850) | +| +------------------------------------------------------------------------------------> | +| D-20 D-18 D-16 D-14 D-12 D-10 D-8 D-6 D-4 D-2 Today | ++------------------------------------------------------------------------------------------------------------------------+ +| [Historical Observations Table] | +| Date | Mandi | Arrivals (MT) | Min Rate (₹) | Max Rate (₹) | Modal Rate (₹) | SMA-20 (₹) | Deviation vs SMA | +| -----------+---------+---------------+--------------+--------------+----------------+------------+--------------------| +| 2026-10-12 | Neemuch | 850.00 | 4,950 | 5,350 | 5,250 | 5,120 | + ₹ 130 (+2.5%) | +| 2026-10-11 | Neemuch | 920.00 | 4,900 | 5,300 | 5,200 | 5,105 | + ₹ 95 (+1.9%) | +| 2026-10-10 | Neemuch | 780.00 | 4,850 | 5,250 | 5,150 | 5,090 | + ₹ 60 (+1.2%) | +| ... | ... | ... | ... | ... | ... | ... | ... | ++------------------------------------------------------------------------------------------------------------------------+ +``` + +--- + +## 3. Field-Level Specifications + +| Field Label | Field ID | Control Type | Required | Validation / Business Rule | Source FR | Backend Expectation | +|---|---|---|---|---|---|---| +| Commodity Selector | `commodity_id` | Searchable Dropdown | Yes | Active agricultural commodity | `FR-MARKETTRENDANALYTICS-001` | Query param `?commodity_id=...` | +| Mandi Selector | `mandi_id` | Searchable Dropdown | No | `ALL` or specific Mandi ID | `FR-MARKETTRENDANALYTICS-001` | Query param `?mandi_id=...` | +| Window Days | `window_days` | Dropdown / Number | Yes | Default 20 days | `FR-MARKETTRENDANALYTICS-001` | Query param `?window_days=20` | +| Current Modal Rate | `current_modal_rate` | Stat Card | System | Most recent recorded modal rate | `FR-MARKETTRENDANALYTICS-001` | Sourced from `mandi_price_observations` | +| 20-Day SMA | `sma_20` | Stat Card | System | 20-day Simple Moving Average | `FR-MARKETTRENDANALYTICS-001` | Calculated arithmetic mean | +| 20-Day High | `period_high` | Stat Card | System | Maximum modal rate in window | `FR-MARKETTRENDANALYTICS-001` | Calculated max value | +| 20-Day Low | `period_low` | Stat Card | System | Minimum modal rate in window | `FR-MARKETTRENDANALYTICS-001` | Calculated min value | +| Price Velocity | `price_velocity` | Stat Card | System | Rate of change per day | `FR-MARKETTRENDANALYTICS-001` | Trend velocity indicator | + diff --git a/04_generated_documentation/06_wireframes/screen_specs/SCREEN-TREND-001_20day_trading_trends.md b/04_generated_documentation/06_wireframes/screen_specs/SCREEN-TREND-001_20day_trading_trends.md new file mode 100644 index 0000000..740b899 --- /dev/null +++ b/04_generated_documentation/06_wireframes/screen_specs/SCREEN-TREND-001_20day_trading_trends.md @@ -0,0 +1,69 @@ +# Screen Specification: SCREEN-TREND-001 — 20-Day Trading Trends Console + +| Field | Value | +|---|---| +| **Screen ID** | `SCREEN-TREND-001` | +| **Client Application ID** | `atb-web-portal` | +| **Frontend Route** | `/reporting/trends` | +| **Owning Use Case** | [`UC-015` (Executive Dashboard and Trading Snapshots)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-015-executive-reporting/use-case.md) | +| **Owning FR** | [`FR-EXECUTIVEREPORTING-002` (20-Day Consolidated Trading Trend Reporting)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-015-executive-reporting/functional-reqs.md#fr-executivereporting-002-20-day-consolidated-trading-trend-reporting) | +| **Auth Role / Scope Claims** | `Partner`, `Managing Director`, `Operations Supervisor`, `Tenant Admin` | +| **Iteration** | `iteration-06` | +| **Status** | Baselined for Construction | + +--- + +## 1. Screen Overview & Archetype + +- **Archetype:** Time-Series Trading & Financial Position Reporting Console. +- **Visual Design Reference:** Dual-visualization reporting layout adhering to [`DESIGN.md`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/06_wireframes/DESIGN.md) (`cyan-600` procurement volume, `emerald-600` sales volume, `amber-600` closing stock, `purple-600` financial exposure, `slate-800` data grid). +- **Behavior:** Renders rolling 20-day trading snapshots tabulating and charting volume movements alongside financial exposure: + - Daily Purchases (MT) + - Daily Sales (MT) + - Daily Closing Stock (MT) + - Total Customer Receivables (INR) + - Total Supplier Payables (INR) +- **Data Reconstruction Invariant:** Reconstructs snapshots dynamically from historical transaction ledgers; enforces sub-second query response time ($\le 1000\text{ms}$). + +--- + +## 2. Wireframe Layout + +``` ++------------------------------------------------------------------------------------------------------------------------+ +| [Logo] ATB Executive Desk | 20-Day Consolidated Trading Trends | [Export CSV] | [Partner / MD v] | ++-----------------------------+--------------------------------------+----------------+----------------------------------+ +| [Window Controls] Commodity: [ All Commodities v ] Date Window: [ Rolling 20 Trading Days (2026-09-23 to 2026-10-12) ] ++------------------------------------------------------------------------------------------------------------------------+ +| [Interactive Chart: Volume (MT) & Financial Exposure (₹ in Lakhs)] | +| MT ^ ^ ₹ Lakhs | +| 5,000| *---*---*---* (Closing Stock MT) | 100 | +| 2,500| #---# (Purchases MT) +---+ (Sales MT) | 50 | +| 0+--------------------------------------------------------------------------------------------+ 0 | +| Day-1 Day-3 Day-5 Day-7 Day-9 Day-11 Day-13 Day-15 Day-17 Day-19 Day-20 | ++------------------------------------------------------------------------------------------------------------------------+ +| [20-Day Daily Management Snapshot Table] | +| Date | Purchases (MT) | Sales (MT) | Closing Stock (MT) | Total Receivables (₹) | Total Payables (₹) | Net Cash (₹)| +| -----------+----------------+------------+--------------------+-----------------------+--------------------+-------------| +| 2026-10-12 | 185.50 | 140.00 | 4,250.80 | 42,50,000.00 | 35,40,000.00 | + 7,10,000 | +| 2026-10-11 | 220.00 | 190.50 | 4,205.30 | 38,90,000.00 | 32,10,000.00 | + 6,80,000 | +| 2026-10-10 | 150.00 | 210.00 | 4,175.80 | 36,20,000.00 | 28,50,000.00 | + 7,70,000 | +| ... | ... | ... | ... | ... | ... | ... | ++------------------------------------------------------------------------------------------------------------------------+ +``` + +--- + +## 3. Field-Level Specifications + +| Field Label | Field ID | Control Type | Required | Validation / Business Rule | Source FR | Backend Expectation | +|---|---|---|---|---|---|---| +| Commodity Filter | `commodity_filter` | Dropdown | No | `ALL` or specific commodity ID | `FR-EXECUTIVEREPORTING-002` | Filters stock & trade volumes | +| Date Window | `window_days` | Number / Selector | System | Default 20 days; min 7, max 60 | `FR-EXECUTIVEREPORTING-002` | Query param `?window_days=20` | +| Purchases MT | `purchases_mt` | Numeric Column | System | Daily sum of completed GRNs | `FR-EXECUTIVEREPORTING-002` | Sourced from inward receiving ledger | +| Sales MT | `sales_mt` | Numeric Column | System | Daily sum of outbound dispatches | `FR-EXECUTIVEREPORTING-002` | Sourced from dispatch ledger | +| Closing Stock MT | `closing_stock_mt` | Numeric Column | System | Cumulative net stock balance at end of day | `FR-EXECUTIVEREPORTING-002` | Sourced from stock ledger entries | +| Receivables INR | `receivables_inr` | Currency Column | System | Total open customer AR balance on date | `FR-EXECUTIVEREPORTING-002` | Sourced from party subledger balance | +| Payables INR | `payables_inr` | Currency Column | System | Total open supplier AP balance on date | `FR-EXECUTIVEREPORTING-002` | Sourced from supplier payables ledger | +| Export Action | `btn_export` | Action Button | No | Exports data to CSV/Excel | `FR-EXECUTIVEREPORTING-002` | Client-side export of current dataset | + diff --git a/04_generated_documentation/06_wireframes/wireframe_index.md b/04_generated_documentation/06_wireframes/wireframe_index.md index 47a51af..413c1e1 100644 --- a/04_generated_documentation/06_wireframes/wireframe_index.md +++ b/04_generated_documentation/06_wireframes/wireframe_index.md @@ -37,6 +37,10 @@ | `SCREEN-REC-003` | Customer Payment Receipts & Bounce Reversal | `/finance/receipts`, `/finance/receipts/new` | `UC-011` | `FR-CUSTOMERRECEIVABLES-004` | `iteration-05` | `atb-web-portal` | `@ui-dev-alpha` | `@adversarial-tester` | [`SCREEN-REC-003_payment_receipts.md`](screen_specs/SCREEN-REC-003_payment_receipts.md) | | `SCREEN-PAY-001` | Supplier Payables Aging & Balance Snapshots | `/finance/payables`, `/finance/payables/disbursements` | `UC-012` | `FR-SUPPLIERPAYABLES-001` | `iteration-05` | `atb-web-portal` | `@ui-dev-beta` | `@adversarial-tester` | [`SCREEN-PAY-001_supplier_payables_aging.md`](screen_specs/SCREEN-PAY-001_supplier_payables_aging.md) | | `SCREEN-EXP-001` | Mandi Operating Expense Classification & Balancing | `/finance/expenses`, `/finance/expenses/new` | `UC-013` | `FR-OPERATINGEXPENSES-001` | `iteration-05` | `atb-web-portal` | `@ui-dev-gamma` | `@adversarial-tester` | [`SCREEN-EXP-001_operating_expenses.md`](screen_specs/SCREEN-EXP-001_operating_expenses.md) | +| `SCREEN-ALERT-001` | Operational Alerts Console | `/alerts` | `UC-014` | `FR-OPERATIONALALERTS-001` | `iteration-06` | `atb-web-portal` | `@ui-dev-alpha` | `@adversarial-tester` | [`SCREEN-ALERT-001_operational_alerts.md`](screen_specs/SCREEN-ALERT-001_operational_alerts.md) | +| `SCREEN-DASH-001` | Executive Control Centre Dashboard | `/dashboard` | `UC-015` | `FR-EXECUTIVEREPORTING-001` | `iteration-06` | `atb-web-portal` | `@ui-dev-beta` | `@adversarial-tester` | [`SCREEN-DASH-001_executive_control_centre.md`](screen_specs/SCREEN-DASH-001_executive_control_centre.md) | +| `SCREEN-TREND-001` | 20-Day Consolidated Trading Trends | `/reporting/trends` | `UC-015` | `FR-EXECUTIVEREPORTING-002` | `iteration-06` | `atb-web-portal` | `@ui-dev-beta` | `@adversarial-tester` | [`SCREEN-TREND-001_20day_trading_trends.md`](screen_specs/SCREEN-TREND-001_20day_trading_trends.md) | +| `SCREEN-MKT-003` | Market Desk Commodity Price Trends | `/market-desk/trends` | `UC-003` | `FR-MARKETTRENDANALYTICS-001` | `iteration-06` | `atb-web-portal` | `@ui-dev-gamma` | `@adversarial-tester` | [`SCREEN-MKT-003_commodity_price_trends.md`](screen_specs/SCREEN-MKT-003_commodity_price_trends.md) | --- diff --git a/04_generated_documentation/07_test_design/functional_test_cases/TC-003_market_trend_analytics.md b/04_generated_documentation/07_test_design/functional_test_cases/TC-003_market_trend_analytics.md new file mode 100644 index 0000000..58ddae7 --- /dev/null +++ b/04_generated_documentation/07_test_design/functional_test_cases/TC-003_market_trend_analytics.md @@ -0,0 +1,81 @@ +# Functional Test Cases: UC-003 Mandi Price Trend Analytics + +| Field | Value | +|---|---| +| **Test Suite** | `TC-003_market_trend_analytics.md` | +| **Parent Use Case** | [`UC-003` (Mandi Price Trend Analytics)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-003-market-trend-analytics/use-case.md) | +| **Parent FRs** | [`FR-MARKETTRENDANALYTICS-001` (Intraday Price Trend Analysis & 20-Day Benchmark Analytics)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-003-market-trend-analytics/functional-reqs.md#fr-markettrendanalytics-001-intraday-price-trend-analysis--20-day-benchmark-analytics) | +| **Status** | Baselined for Construction (Iteration 06) | +| **Version** | 1.0.0 | +| **Iteration** | `iteration-06` | + +--- + +## TC-MKT-003-01: 20-Day Historical Price Movement & SMA-20 Analytics (Dimension 1: Happy Path) + +- **ID:** `TC-MKT-003-01` +- **Category:** Functional / Happy Path +- **Priority:** P0 +- **Preconditions:** Active tenant `tenant-alpha`. Pre-seeded historical daily market observations for commodity `COMM-SOYBEAN` at Mandi `MANDI-NEEMUCH` over 20 consecutive trading days (rates ranging from ₹ 4,850 to ₹ 5,400 with arithmetic mean / $\text{SMA}_{20} = ₹ 5,120.00$). +- **Steps:** + 1. Query `GET /api/v1/analytics/market-trends?commodity_id=COMM-SOYBEAN&mandi_id=MANDI-NEEMUCH&window_days=20`. + 2. Verify response includes: + - `commodity_id == "COMM-SOYBEAN"` + - `mandi_id == "MANDI-NEEMUCH"` + - `data_points`: array of 20 daily observation records each containing `observation_date`, `min_price`, `max_price`, and `modal_price`. + - `sma_20`: exactly ₹ 5,120.00. + - `period_high`: ₹ 5,400.00. + - `period_low`: ₹ 4,850.00. + - `price_velocity`: calculated rate of change ($\Delta \text{Modal Rate} / \text{Day}$). + 3. Verify query latency is $\le 500\text{ms}$. +- **Expected Result:** Historical series and mathematical statistical indicators (SMA, High, Low, Velocity) match exact formulas with sub-500ms execution time. + +--- + +## TC-MKT-003-02: Sparse Observation Windows & Cross-Mandi Aggregation (Dimension 2: Alternate & Boundary/Edge Cases) + +- **ID:** `TC-MKT-003-02` +- **Category:** Boundary / Edge Cases +- **Priority:** P0 +- **Preconditions:** Active tenant `tenant-alpha`. +- **Steps:** + 1. Query trends for a commodity with only 5 days of recorded observations (less than requested window of 20). Verify SMA is computed over the actual available observations without dividing by 20. + 2. Query trends with `mandi_id` omitted (cross-mandi aggregated view across all Mandis for that commodity). + 3. Verify cross-mandi aggregation correctly averages modal rates across distinct mandis for each observation date. + 4. Query with `window_days=1` (single-day intraday snapshot) and `window_days=60`. + 5. Test commodity with flat constant modal rate across all days (e.g. ₹ 5,000 every day). Verify `price_velocity == 0.0` and `period_high == period_low == 5000.0`. +- **Expected Result:** Sparse observation series calculate SMA over available sample count, cross-mandi aggregation averages correctly, and edge windows compute stably. + +--- + +## TC-MKT-003-03: Invalid Commodities & Cross-Tenant Leakage (Dimension 3: Negative & Failure Paths) + +- **ID:** `TC-MKT-003-03` +- **Category:** Negative / Security Rejection +- **Priority:** P0 +- **Preconditions:** Active tenants `tenant-alpha` and `tenant-beta`. +- **Steps:** + 1. Query `GET /api/v1/analytics/market-trends` without required `commodity_id` parameter. + 2. Query with non-existent `commodity_id=COMM-NONEXISTENT`. + 3. Query with non-existent `mandi_id=MANDI-NONEXISTENT`. + 4. Query market trends without valid authorization token. + 5. In tenant `tenant-beta`, attempt to view custom proprietary market observations recorded only in `tenant-alpha`. +- **Expected Result:** Missing parameters return HTTP 422. Non-existent IDs return HTTP 404 Not Found. Unauthenticated requests return HTTP 401. Multi-tenant RLS guarantees observations in `tenant-alpha` do not leak into `tenant-beta`. + +--- + +## TC-MKT-003-04: Dynamic Metric Recalculation on Observation Save (Dimension 4: FSM Invariant & Concurrency Checks) + +- **ID:** `TC-MKT-003-04` +- **Category:** FSM Invariant & Concurrency Checks +- **Priority:** P0 +- **Preconditions:** Commodity `COMM-SOYBEAN` with established 20-day historical baseline. +- **Steps:** + 1. Record initial $\text{SMA}_{20}$ and `price_velocity` via `GET /api/v1/analytics/market-trends`. + 2. Post a new market observation via `POST /api/v1/market/observations` for today with higher modal rate (e.g. ₹ 5,500). + 3. Immediately re-query `GET /api/v1/analytics/market-trends`. + 4. Verify $\text{SMA}_{20}$ has dynamically updated to reflect the new observation. + 5. Verify `period_high` has updated to ₹ 5,500. + 6. Execute concurrent queries while new market observations are actively being inserted. +- **Expected Result:** Trend indicators recompute immediately upon observation save without stale cache artifacts, and concurrent read/write operations execute safely without table locking contention. + diff --git a/04_generated_documentation/07_test_design/functional_test_cases/TC-014_operational_alerts_engine.md b/04_generated_documentation/07_test_design/functional_test_cases/TC-014_operational_alerts_engine.md new file mode 100644 index 0000000..8289894 --- /dev/null +++ b/04_generated_documentation/07_test_design/functional_test_cases/TC-014_operational_alerts_engine.md @@ -0,0 +1,80 @@ +# Functional Test Cases: UC-014 Operational Alert Review + +| Field | Value | +|---|---| +| **Test Suite** | `TC-014_operational_alerts_engine.md` | +| **Parent Use Case** | [`UC-014` (Operational Alert Review)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-014-operational-alerts/use-case.md) | +| **Parent FRs** | [`FR-OPERATIONALALERTS-001` (Real-Time Operational Alerts Engine)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-014-operational-alerts/functional-reqs.md#fr-operationalalerts-001-real-time-operational-alerts-engine) | +| **Status** | Baselined for Construction (Iteration 06) | +| **Version** | 1.0.0 | +| **Iteration** | `iteration-06` | + +--- + +## TC-ALERT-014-01: Multi-Category Operational Alert Evaluation & Acknowledgment (Dimension 1: Happy Path) + +- **ID:** `TC-ALERT-014-01` +- **Category:** Functional / Happy Path +- **Priority:** P0 +- **Preconditions:** Active tenant `tenant-alpha`. Pre-seeded operational state: + 1. Lot `LOT-202610-004` on `QC Hold` for $>24$ hours. + 2. Godown `WH-02` utilized at $88.5\%$ ($>85\%$ limit). + 3. Customer `CUST-004` at $104.0\%$ credit exposure ($>100\%$ breach). + 4. Mandi `MANDI-001` with open procurement orders during trading hours. +- **Steps:** + 1. Trigger alert evaluation via `POST /api/v1/alerts/evaluate`. + 2. Query active alerts via `GET /api/v1/alerts`. + 3. Verify 4 alerts generated matching each category: `QC_PENDING`, `WAREHOUSE_CAPACITY`, `CREDIT_RISK`, `PROCUREMENT_WINDOW`. + 4. As `Operations Supervisor`, submit acknowledgment on the credit risk alert via `POST /api/v1/alerts/{id}/acknowledge` with note "Spoke to customer CFO, remittance expected today". + 5. Query active alerts with filter `?status=ACTIVE`. +- **Expected Result:** Acknowledged alert transitions status from `ACTIVE` to `ACKNOWLEDGED` with supervisor ID and timestamp; other 3 alerts remain `ACTIVE`. + +--- + +## TC-ALERT-014-02: Alert Threshold Boundaries & Edge Timing (Dimension 2: Alternate & Boundary/Edge Cases) + +- **ID:** `TC-ALERT-014-02` +- **Category:** Boundary / Edge Cases +- **Priority:** P0 +- **Preconditions:** Active tenant `tenant-alpha`. +- **Steps:** + 1. Set Godown `WH-01` capacity utilization to exactly $85.00\%$. Trigger evaluation. Verify NO capacity alert generated. + 2. Increment utilization to $85.01\%$. Trigger evaluation. Verify `WARNING` severity capacity alert generated. + 3. Set inward lot QC age to exactly 23 hours 59 minutes in state `Under QC`. Trigger evaluation. Verify NO overdue QC alert generated. + 4. Advance QC age to 24 hours 01 minute. Trigger evaluation. Verify `CRITICAL` severity QC alert generated. + 5. Set customer credit exposure to $79.99\%$. Verify NO credit alert. Set to $80.01\%$. Verify `WARNING` watch alert. Set to $100.01\%$. Verify `CRITICAL` breach alert. +- **Expected Result:** All threshold boundaries trigger alerts with strict precision ($\le 85\%$ vs $>85\%$, $\le 24\text{h}$ vs $>24\text{h}$, $\le 80\%$ vs $>80\%$, $\le 100\%$ vs $>100\%$). + +--- + +## TC-ALERT-014-03: Cross-Tenant Isolation & Invalid Operations (Dimension 3: Negative & Failure Paths) + +- **ID:** `TC-ALERT-014-03` +- **Category:** Negative / Security Rejection +- **Priority:** P0 +- **Preconditions:** Active tenants `tenant-alpha` and `tenant-beta`. Alert `ALT-A-001` belongs to `tenant-alpha`. +- **Steps:** + 1. Attempt to query `ALT-A-001` from caller scoped to `tenant-beta`. + 2. Attempt to acknowledge `ALT-A-001` using token with tenant context `tenant-beta`. + 3. Attempt to acknowledge an already `ACKNOWLEDGED` or `RESOLVED` alert without valid transitions. + 4. Attempt acknowledgment with empty or whitespace-only action note. + 5. Attempt to trigger alert evaluation without valid JWT authentication token. +- **Expected Result:** Cross-tenant queries return 404/empty results. Cross-tenant acknowledgment returns 404/403. Missing notes return HTTP 422 Unprocessable Entity. Unauthenticated requests return HTTP 401 Unauthorized. + +--- + +## TC-ALERT-014-04: Alert FSM Transitions & Deduplication Invariant (Dimension 4: FSM Invariant & Concurrency Checks) + +- **ID:** `TC-ALERT-014-04` +- **Category:** FSM Invariant & Concurrency Checks +- **Priority:** P0 +- **Preconditions:** Active operational hazard present (e.g. Godown `WH-02` $>85\%$). +- **Steps:** + 1. Trigger evaluation cycle 1. Verify `ALT-CAP-001` created in state `ACTIVE`. + 2. Trigger evaluation cycle 2 immediately without changing underlying state. + 3. Verify system does NOT create duplicate alert rows for the same unresolved hazard condition (`(tenant_id, category, source_entity_id, status=ACTIVE)` uniqueness invariant). + 4. Resolve the underlying condition (reduce godown stock to $70\%$). Trigger evaluation cycle 3. + 5. Verify alert automatically transitions from `ACTIVE` to `RESOLVED`. + 6. Execute concurrent acknowledgment requests on the same active alert simultaneously. +- **Expected Result:** Alert FSM transitions legally (`ACTIVE` $\to$ `ACKNOWLEDGED` $\to$ `RESOLVED`), duplicate alerts are suppressed, and concurrent acknowledgments resolve deterministically without race conditions. + diff --git a/04_generated_documentation/07_test_design/functional_test_cases/TC-015_executive_reporting_dashboard.md b/04_generated_documentation/07_test_design/functional_test_cases/TC-015_executive_reporting_dashboard.md new file mode 100644 index 0000000..9441116 --- /dev/null +++ b/04_generated_documentation/07_test_design/functional_test_cases/TC-015_executive_reporting_dashboard.md @@ -0,0 +1,90 @@ +# Functional Test Cases: UC-015 Executive Dashboard and Trading Snapshots + +| Field | Value | +|---|---| +| **Test Suite** | `TC-015_executive_reporting_dashboard.md` | +| **Parent Use Case** | [`UC-015` (Executive Dashboard and Trading Snapshots)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-015-executive-reporting/use-case.md) | +| **Parent FRs** | [`FR-EXECUTIVEREPORTING-001` (Executive Control Centre Dashboard)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-015-executive-reporting/functional-reqs.md#fr-executivereporting-001-executive-control-centre-dashboard), [`FR-EXECUTIVEREPORTING-002` (20-Day Consolidated Trading Trend Reporting)](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-015-executive-reporting/functional-reqs.md#fr-executivereporting-002-20-day-consolidated-trading-trend-reporting) | +| **Status** | Baselined for Construction (Iteration 06) | +| **Version** | 1.0.0 | +| **Iteration** | `iteration-06` | + +--- + +## TC-DASH-015-01: Executive KPI Aggregation & 20-Day Trend Reporting (Dimension 1: Happy Path) + +- **ID:** `TC-DASH-015-01` +- **Category:** Functional / Happy Path +- **Priority:** P0 +- **Preconditions:** Active tenant `tenant-alpha`. Pre-seeded transactions: + - 4 warehouses with active stock ledger balances totaling 4,250.80 MT. + - Completed procurement saudas/GRNs on current date totaling ₹ 48,25,000.00. + - Finalized sales orders/dispatches on current date totaling ₹ 62,50,000.00. + - Open customer party subledger balances totaling ₹ 42,50,000.00. + - 20-day historical transaction ledger across procurement, sales, stock, and party ledgers. +- **Steps:** + 1. Call `GET /api/v1/reporting/dashboard`. + 2. Verify response includes: + - `total_stock_on_hand_mt == 4250.80` + - `intraday_purchase_value_inr == 4825000.00` + - `intraday_sales_revenue_inr == 6250000.00` + - `total_customer_receivables_inr == 4250000.00` + - Top 10 stock lines ranked descending by MT tonnage. + - Godown utilization barometers for `WH-01` to `WH-04`. + 3. Call `GET /api/v1/reporting/trends/20-day`. + 4. Verify 20 chronological daily objects with purchases MT, sales MT, closing stock MT, receivables INR, and payables INR. +- **Expected Result:** All KPI metrics reconcile 100% against underlying transactional ledgers; response time $\le 1.5\text{s}$ for dashboard and $\le 1.0\text{s}$ for 20-day trends. + +--- + +## TC-DASH-015-02: Zero-Trading Days & Custom Window Boundaries (Dimension 2: Alternate & Boundary/Edge Cases) + +- **ID:** `TC-DASH-015-02` +- **Category:** Boundary / Edge Cases +- **Priority:** P0 +- **Preconditions:** Active tenant `tenant-alpha` with a newly provisioned tenant having zero historical transactions. +- **Steps:** + 1. Query `GET /api/v1/reporting/dashboard` on empty tenant. + 2. Verify response handles empty state gracefully: all numeric totals return `0.0`, empty arrays for top stock lines and recent sales, no divide-by-zero errors in barometer utilization calculations. + 3. Query `GET /api/v1/reporting/trends/20-day?window_days=7` on established tenant. Verify exactly 7 chronological days returned. + 4. Query with `window_days=1` (lower bound) and `window_days=60` (upper bound). + 5. Test calendar days with zero trades (Sundays / Mandi holidays) in the 20-day window. +- **Expected Result:** Holidays/zero-trade days show `purchases_mt=0`, `sales_mt=0`, with `closing_stock_mt` carrying forward previous day's balance correctly. Boundaries within $[1, 60]$ days are handled gracefully. + +--- + +## TC-DASH-015-03: Performance SLA Breach Guard & Unauthorized Access (Dimension 3: Negative & Failure Paths) + +- **ID:** `TC-DASH-015-03` +- **Category:** Negative / Security Rejection & SLA Guards +- **Priority:** P0 +- **Preconditions:** Active tenant `tenant-alpha`. +- **Steps:** + 1. Attempt to query `GET /api/v1/reporting/dashboard` with invalid token or without JWT credentials. + 2. Attempt to query dashboard as unauthorized role (e.g. `Gate Operator` or `Lab Chemist`). + 3. Attempt cross-tenant access to reporting endpoints with spoofed `X-Tenant-ID`. + 4. Pass invalid parameters: `window_days=-5` or `window_days=999`. + 5. Benchmark response time under 50,000 ledger rows to ensure performance remains $< 1500\text{ms}$. +- **Expected Result:** Unauthenticated requests return HTTP 401. Unauthorized roles return HTTP 403 Forbidden. Invalid window parameters return HTTP 422 Unprocessable Entity. Cross-tenant queries return strictly isolated data for the authenticated tenant. + +--- + +## TC-DASH-015-04: Ledger Immutability & Rebuilt Projection Consistency (Dimension 4: FSM Invariant & Concurrency Checks) + +- **ID:** `TC-DASH-015-04` +- **Category:** FSM Invariant & Concurrency Checks +- **Priority:** P0 +- **Preconditions:** Active trading firm running concurrent transaction posting. +- **Steps:** + 1. Record dashboard snapshot $S_0$. + 2. Concurrently execute: + - 10 new GRN postings (adding inward stock). + - 5 outbound dispatches (reducing stock and booking sales revenue). + - 3 customer payment receipts (reducing receivables balance). + 3. Re-query `GET /api/v1/reporting/dashboard` as $S_1$. + 4. Validate exact arithmetic invariant: + $$\Delta \text{Stock MT} = \sum \text{GRN Net MT} - \sum \text{Dispatch Net MT}$$ + $$\Delta \text{Receivables INR} = \sum \text{Dispatch Invoice Value} - \sum \text{Receipt Value}$$ + 5. Verify that dashboard queries are strictly read-only and never mutate transaction state or acquire blocking table locks that impede concurrent transactions. +- **Expected Result:** Dashboard projections maintain mathematical consistency with underlying transactions without concurrency deadlocks or ledger drift. + diff --git a/04_generated_documentation/07_test_design/manual_qa/iteration-06/MANUAL_TESTING_GUIDE.md b/04_generated_documentation/07_test_design/manual_qa/iteration-06/MANUAL_TESTING_GUIDE.md new file mode 100644 index 0000000..e39ac81 --- /dev/null +++ b/04_generated_documentation/07_test_design/manual_qa/iteration-06/MANUAL_TESTING_GUIDE.md @@ -0,0 +1,122 @@ +# Comprehensive Manual Testing Guide — Iteration 06 +## Operational Alerts Engine, Executive Dashboard, Trading Trends & Market Price Analytics + +| Field | Value | +|---|---| +| **Document ID** | `MTG-ITERATION-06` | +| **Governed Standard** | SEI-CMMI Level 3 (UP-AI v1.5 Quality Standard) | +| **Iteration** | `iteration-06` | +| **Scope Slice** | Operational Alert Review (`UC-014`), Executive Dashboard & Trading Snapshots (`UC-015`), Mandi Price Trend Analytics (`UC-003`) | +| **Child Requirements** | `FR-OPERATIONALALERTS-001`, `FR-EXECUTIVEREPORTING-001`, `FR-EXECUTIVEREPORTING-002`, `FR-MARKETTRENDANALYTICS-001` (4 FRs) | +| **Associated Screens** | [`SCREEN-ALERT-001`](../../06_wireframes/screen_specs/SCREEN-ALERT-001_operational_alerts.md), [`SCREEN-DASH-001`](../../06_wireframes/screen_specs/SCREEN-DASH-001_executive_control_centre.md), [`SCREEN-TREND-001`](../../06_wireframes/screen_specs/SCREEN-TREND-001_20day_trading_trends.md), [`SCREEN-MKT-003`](../../06_wireframes/screen_specs/SCREEN-MKT-003_commodity_price_trends.md) | +| **Associated APIs** | `GET /api/v1/alerts`, `POST /api/v1/alerts/{id}/acknowledge`, `POST /api/v1/alerts/evaluate`, `GET /api/v1/reporting/dashboard`, `GET /api/v1/reporting/trends/20-day`, `GET /api/v1/analytics/market-trends` | +| **21-Sheet QA Workbook** | `Iteration06_Alerts_Reporting_Executive_Dashboard_Complete_Manual_Testcases.xlsx` | +| **Status** | Approved QA Specification (Ready for Construction Verification) | +| **Version** | 1.0.0 | +| **Last CR** | none | + +--- + +## 1. Executive Summary & Objective + +This manual testing guide is authored for Quality Assurance (QA) engineers, Field Operations Testers, Financial Auditors, and Adversarial Security Testers conducting manual verification and acceptance testing on **Iteration 06**. + +The objective of Iteration 06 manual verification is to rigorously validate real-time operational alerts, executive KPI aggregations, multi-period trend reporting, and market analytics: +1. **Real-Time Operational Alerts Engine (`UC-014`):** + - Verify automated detection and alerting across 4 critical hazard categories: + - **QC Pending:** Lots under QC for $>24\text{ hours}$ or on `QC Hold`. + - **Warehouse Capacity:** Godowns exceeding $85\%$ volume utilization. + - **Credit Risk:** Customer exposure $>80\%$ (`Watch`) or $>100\%$ (`Critical / Locked`). + - **Procurement Window:** Mandis with open unfulfilled procurement saudas during active market hours. + - Validate alert life cycle: `ACTIVE` $\to$ `ACKNOWLEDGED` $\to$ `RESOLVED`. + - Verify mandatory acknowledgment audit notes (min 5 characters) recording user context and timestamps. +2. **Executive Control Centre Dashboard (`UC-015`):** + - Validate real-time KPI stat cards: Stock on Hand (MT), Active Stock Lines, Intraday Purchases (INR), Intraday Sales (INR), Customer Receivables (INR). + - Validate Top 10 Stock Lines by Volume and Top Recent Sales Orders. + - Validate Godown Capacity Utilization Barometers with visual percentage indicators. + - Enforce query response SLA $\le 1.5\text{s}$ under full PostgreSQL RLS tenant isolation. +3. **20-Day Consolidated Trading Trend Reporting (`UC-015`):** + - Validate rolling 20-day trading table and dual-axis volume/financial charts. + - Verify daily rollups: Purchases MT, Sales MT, Closing Stock MT, Receivables INR, and Payables INR. + - Enforce sub-second query performance ($\le 1.0\text{s}$) across 50,000 ledger rows. +4. **Market Desk Commodity Price Trends (`UC-003`):** + - Validate 20-day historical modal rate chart and tabular observation points. + - Verify 20-day Simple Moving Average ($\text{SMA}_{20}$), Period High, Period Low, and daily momentum Price Velocity. + - Validate instant recalculation upon new observation entries ($\le 500\text{ms}$). + +--- + +## 2. Test Environment & Pre-Requisites + +### 2.1 Test Topologies +- **Topology A (Live Microservices & Containers):** + - PostgreSQL 17.11 container (`atb-local-postgres-1` on port `5432`). + - Keycloak 26 container (`atb-local-keycloak-1` on port `8080`). + - FastAPI Backend container (`atb-backend-test` on port `8000`). + - Web Portal running on `http://localhost:3000`. +- **Topology B (Local Python Harness / Automated Runner):** + - Fast execution via `scripts/run_tests.sh --scope iteration-06`. + - Mocks pre-seeded via `sandbox/notification_mock.py` and `sandbox/market_data_mock.py`. + +--- + +## 3. Disposable QA Personas & Credentials Matrix + +| Persona ID | Email / Username | Assigned Role | Domain Scope | Test Purpose | +|---|---|---|---|---| +| `supervisor@alpha.com` | `supervisor@alpha.com` | Operations Supervisor | Floor & Logistics | Operational alerts monitoring & acknowledgment (`UC-014`) | +| `partner@alpha.com` | `partner@alpha.com` | Partner / MD | Executive Management | Executive control dashboard & 20-day trading trends (`UC-015`, `UC-014`) | +| `purch_mgr@alpha.com`| `purch_mgr@alpha.com`| Purchase Manager | Market Desk | Commodity price trends, SMA-20, & benchmark envelopes (`UC-003`) | +| `accounts@alpha.com` | `accounts@alpha.com` | Accounts Executive | Finance & Credit | Credit risk alerts & receivables tracking (`UC-014`, `UC-015`) | +| `adversary@beta.com` | `adversary@beta.com` | Tenant Administrator | `tenant-beta` | Adversarial cross-tenant alert & reporting isolation checks | + +--- + +## 4. End-to-End Test Walkthroughs + +### Walkthrough 1: Operational Alert Detection & Acknowledgment (`UC-014`) +1. Log in as `supervisor@alpha.com`. Navigate to `/alerts`. +2. Inspect active alerts list: verify 4 hazard categories displayed. +3. Locate Credit Risk Alert for Customer `CUST-004` (breach $>100\%$). +4. Click **Acknowledge** button. Acknowledgment modal opens. +5. Enter resolution note: *"Spoke to customer accounts team; payment expected today"*. +6. Submit acknowledgment. Alert transitions from `ACTIVE` to `ACKNOWLEDGED`. +7. Verify acknowledged alert displays supervisor identity and UTC timestamp. +8. Filter by `?status=ACTIVE`; verify acknowledged alert is hidden. + +### Walkthrough 2: Executive Control Centre Dashboard (`UC-015`) +1. Log in as `partner@alpha.com`. Navigate to `/dashboard`. +2. Inspect summary KPI metric cards: + - Stock on Hand MT matches sum of warehouse ledgers. + - Intraday Purchases INR matches sum of today's completed GRNs. + - Intraday Sales INR matches sum of today's completed sales dispatches. + - Customer Receivables INR matches sum of party sub-ledger debit balances. +3. Inspect Godown Capacity Barometers: verify `WH-02` displays warning badge ($88.5\% > 85\%$). +4. Inspect Top 10 Stock Lines table: verify sorted descending by MT tonnage. +5. Verify dashboard loads completely in $< 1.5$ seconds. + +### Walkthrough 3: 20-Day Trading Trends Reporting (`UC-015`) +1. Log in as `partner@alpha.com`. Navigate to `/reporting/trends`. +2. Review 20-day trading trend table: + - Confirm 20 chronological trading day rows are present. + - Verify daily Purchases MT and Sales MT rollups. + - Verify Closing Stock MT equals previous day stock + purchases - sales. + - Verify Receivables INR and Payables INR trend curves. +3. Click **Export CSV** button; confirm generated file contains 20 rows of reconciled data. + +### Walkthrough 4: Commodity Price Trend Analytics (`UC-003`) +1. Log in as `purch_mgr@alpha.com`. Navigate to `/market-desk/trends`. +2. Select Commodity `Soybean` and Mandi `Neemuch Mandi`. +3. Inspect 20-day chart: verify modal rate curve, 20-day SMA, 20-day High (₹5,400) and Low (₹4,850). +4. Verify price velocity indicator (+₹20.00/day). +5. Post a new observation for today with rate ₹5,500. Re-query trends view. +6. Verify 20-day SMA updates dynamically and 20-day High updates to ₹5,500 in $< 500\text{ms}$. + +--- + +## 5. Security & Boundary Verification + +1. **Cross-Tenant Isolation:** Verify `adversary@beta.com` cannot view alerts, dashboard metrics, or private price observations from `tenant-alpha`. +2. **Unauthorized Role Gating:** Verify `Gate Operator` cannot access `/dashboard` or `/reporting/trends` (returns HTTP 403 Forbidden). +3. **Empty Tenant Graceful Handling:** Verify newly provisioned tenant with 0 transactions renders dashboard cards with `0.0` without errors or division by zero. + diff --git a/04_generated_documentation/07_test_design/manual_qa/workbooks/Iteration06_Alerts_Reporting_Executive_Dashboard_Complete_Manual_Testcases.xlsx b/04_generated_documentation/07_test_design/manual_qa/workbooks/Iteration06_Alerts_Reporting_Executive_Dashboard_Complete_Manual_Testcases.xlsx new file mode 100644 index 0000000..79cbd67 Binary files /dev/null and b/04_generated_documentation/07_test_design/manual_qa/workbooks/Iteration06_Alerts_Reporting_Executive_Dashboard_Complete_Manual_Testcases.xlsx differ diff --git a/04_generated_documentation/07_test_design/regression_test_cases.md b/04_generated_documentation/07_test_design/regression_test_cases.md index 852fad9..76fc2cc 100644 --- a/04_generated_documentation/07_test_design/regression_test_cases.md +++ b/04_generated_documentation/07_test_design/regression_test_cases.md @@ -55,5 +55,17 @@ | `TC-DISP-009-04` | FSM / POD & Shortage Credit | `FR-DISPATCHDELIVERY-003` | Automated (pytest) | `tests/backend/test_dispatch_delivery.py` | `uc_009`, `fr_dispatchdelivery_003`, `iteration_04` | In Construction | | `TC-FLEET-010-01` | Functional / Fleet Registry | `FR-FLEETREGISTRY-001` | Automated (pytest) | `tests/backend/test_fleet_registry.py` | `uc_010`, `fr_fleetregistry_001`, `iteration_04` | In Construction | | `TC-FLEET-010-04` | Invariant / Maintenance Block | `FR-FLEETREGISTRY-001` | Automated (pytest) | `tests/backend/test_fleet_registry.py` | `uc_010`, `fr_fleetregistry_001`, `iteration_04` | In Construction | +| `TC-REC-011-01` | Functional / Sub-Ledger & Aging | `FR-CUSTOMERRECEIVABLES-001` | Automated (pytest) | `tests/backend/test_financial_settlement.py` | `uc_011`, `fr_customerreceivables_001`, `iteration_05` | Active | +| `TC-REC-011-02` | Boundary / Credit Watch 80% | `FR-CUSTOMERRECEIVABLES-002` | Automated (pytest) | `tests/backend/test_financial_settlement.py` | `uc_011`, `fr_customerreceivables_002`, `iteration_05` | Active | +| `TC-REC-011-03` | Invariant / Lock Override | `FR-CUSTOMERRECEIVABLES-003` | Automated (pytest) | `tests/backend/test_financial_settlement.py` | `uc_011`, `fr_customerreceivables_003`, `iteration_05` | Active | +| `TC-REC-011-04` | FSM / Bounce Reversal | `FR-CUSTOMERRECEIVABLES-004` | Automated (pytest) | `tests/backend/test_financial_settlement.py` | `uc_011`, `fr_customerreceivables_004`, `iteration_05` | Active | +| `TC-PAY-012-01` | Functional / Payables Aging | `FR-SUPPLIERPAYABLES-001` | Automated (pytest) | `tests/backend/test_financial_settlement.py` | `uc_012`, `fr_supplierpayables_001`, `iteration_05` | Active | +| `TC-EXP-013-01` | Invariant / Double-Entry Balancing | `FR-OPERATINGEXPENSES-001` | Automated (pytest) | `tests/backend/test_financial_settlement.py` | `uc_013`, `fr_operatingexpenses_001`, `iteration_05` | Active | +| `TC-ALERT-014-01` | Functional / Multi-Category Alerts | `FR-OPERATIONALALERTS-001` | Automated (pytest) | `tests/backend/test_operational_alerts.py` | `uc_014`, `fr_operationalalerts_001`, `iteration_06` | Planned for Construction | +| `TC-ALERT-014-04` | FSM / Acknowledge Lifecycle | `FR-OPERATIONALALERTS-001` | Automated (pytest) | `tests/backend/test_operational_alerts.py` | `uc_014`, `fr_operationalalerts_001`, `iteration_06` | Planned for Construction | +| `TC-DASH-015-01` | Functional / Executive Dashboard KPIs | `FR-EXECUTIVEREPORTING-001` | Automated (pytest) | `tests/backend/test_executive_reporting.py` | `uc_015`, `fr_executivereporting_001`, `iteration_06` | Planned for Construction | +| `TC-DASH-015-02` | Functional / 20-Day Trading Trends | `FR-EXECUTIVEREPORTING-002` | Automated (pytest) | `tests/backend/test_executive_reporting.py` | `uc_015`, `fr_executivereporting_002`, `iteration_06` | Planned for Construction | +| `TC-MKT-003-01` | Functional / SMA-20 & Price Velocity | `FR-MARKETTRENDANALYTICS-001` | Automated (pytest) | `tests/backend/test_market_trends.py` | `uc_003`, `fr_markettrendanalytics_001`, `iteration_06` | Planned for Construction | + diff --git a/04_generated_documentation/07_test_design/test_traceability_matrix.md b/04_generated_documentation/07_test_design/test_traceability_matrix.md index 4ae7d8c..c0e0f83 100644 --- a/04_generated_documentation/07_test_design/test_traceability_matrix.md +++ b/04_generated_documentation/07_test_design/test_traceability_matrix.md @@ -68,6 +68,25 @@ | `UC-009` | `FR-DISPATCHDELIVERY-003` | `STORY-DISP-003` | `TC-DISP-009-04` | FSM / POD & Shortage Credit | Unit / FSM | `tests/backend/test_dispatch_delivery.py` | Modeled (Ready for Construction) | | `UC-010` | `FR-FLEETREGISTRY-001` | `STORY-FLEET-001` | `TC-FLEET-010-01` | Functional / Fleet Registry | Unit / API | `tests/backend/test_fleet_registry.py` | Modeled (Ready for Construction) | | `UC-010` | `FR-FLEETREGISTRY-001` | `STORY-FLEET-001` | `TC-FLEET-010-04` | Invariant / Maintenance Block | Unit / FSM | `tests/backend/test_fleet_registry.py` | Modeled (Ready for Construction) | +| `UC-011` | `FR-CUSTOMERRECEIVABLES-001` | `STORY-REC-001` | `TC-REC-011-01` | Functional / Sub-Ledger & Aging | Unit / API | `tests/backend/test_financial_settlement.py` | Verified (Delivered) | +| `UC-011` | `FR-CUSTOMERRECEIVABLES-002` | `STORY-REC-002` | `TC-REC-011-02` | Boundary / Credit Watch 80% | Unit / API | `tests/backend/test_financial_settlement.py` | Verified (Delivered) | +| `UC-011` | `FR-CUSTOMERRECEIVABLES-003` | `STORY-REC-003` | `TC-REC-011-03` | Security & Invariant / Lock Override | Unit / FSM | `tests/backend/test_financial_settlement.py` | Verified (Delivered) | +| `UC-011` | `FR-CUSTOMERRECEIVABLES-004` | `STORY-REC-004` | `TC-REC-011-04` | FSM / Bounce Reversal | Unit / FSM | `tests/backend/test_financial_settlement.py` | Verified (Delivered) | +| `UC-012` | `FR-SUPPLIERPAYABLES-001` | `STORY-PAY-001` | `TC-PAY-012-01` | Functional / Payables Aging | Unit / API | `tests/backend/test_financial_settlement.py` | Verified (Delivered) | +| `UC-013` | `FR-OPERATINGEXPENSES-001` | `STORY-EXP-001` | `TC-EXP-013-01` | Invariant / Expense Double-Entry | Unit / API | `tests/backend/test_financial_settlement.py` | Verified (Delivered) | +| `UC-014` | `FR-OPERATIONALALERTS-001` | `STORY-ALERT-001` | `TC-ALERT-014-01` | Functional / Happy Path | Unit / API | `tests/backend/test_operational_alerts.py` | Modeled (Active) | +| `UC-014` | `FR-OPERATIONALALERTS-001` | `STORY-ALERT-001` | `TC-ALERT-014-02` | Boundary / Threshold Boundaries | Unit / API | `tests/backend/test_operational_alerts.py` | Modeled (Active) | +| `UC-014` | `FR-OPERATIONALALERTS-001` | `STORY-ALERT-001` | `TC-ALERT-014-03` | Security / Cross-Tenant Rejection | Unit / API | `tests/backend/test_operational_alerts.py` | Modeled (Active) | +| `UC-014` | `FR-OPERATIONALALERTS-001` | `STORY-ALERT-001` | `TC-ALERT-014-04` | FSM Invariant / Acknowledge | Unit / FSM | `tests/backend/test_operational_alerts.py` | Modeled (Active) | +| `UC-015` | `FR-EXECUTIVEREPORTING-001` | `STORY-DASH-001` | `TC-DASH-015-01` | Functional / KPI Dashboard | Unit / API | `tests/backend/test_executive_reporting.py` | Modeled (Active) | +| `UC-015` | `FR-EXECUTIVEREPORTING-002` | `STORY-TREND-001` | `TC-DASH-015-01` | Functional / 20-Day Trading Trends | Unit / API | `tests/backend/test_executive_reporting.py` | Modeled (Active) | +| `UC-015` | `FR-EXECUTIVEREPORTING-001` | `STORY-DASH-001` | `TC-DASH-015-02` | Boundary / Zero-Trading Days | Unit / API | `tests/backend/test_executive_reporting.py` | Modeled (Active) | +| `UC-015` | `FR-EXECUTIVEREPORTING-001` | `STORY-DASH-001` | `TC-DASH-015-03` | Security & SLA / SLA Limits | Unit / Performance | `tests/backend/test_executive_reporting.py` | Modeled (Active) | +| `UC-015` | `FR-EXECUTIVEREPORTING-001` | `STORY-DASH-001` | `TC-DASH-015-04` | Invariant / Ledger Rebuilding | Unit / Invariant | `tests/backend/test_executive_reporting.py` | Modeled (Active) | +| `UC-003` | `FR-MARKETTRENDANALYTICS-001` | `STORY-MKT-003` | `TC-MKT-003-01` | Functional / SMA-20 Analytics | Unit / API | `tests/backend/test_market_trends.py` | Modeled (Active) | +| `UC-003` | `FR-MARKETTRENDANALYTICS-001` | `STORY-MKT-003` | `TC-MKT-003-02` | Boundary / Sparse Observations | Unit / API | `tests/backend/test_market_trends.py` | Modeled (Active) | +| `UC-003` | `FR-MARKETTRENDANALYTICS-001` | `STORY-MKT-003` | `TC-MKT-003-03` | Security / RLS Multi-Tenant | Unit / API | `tests/backend/test_market_trends.py` | Modeled (Active) | +| `UC-003` | `FR-MARKETTRENDANALYTICS-001` | `STORY-MKT-003` | `TC-MKT-003-04` | Invariant / Dynamic Recalculation | Unit / Invariant | `tests/backend/test_market_trends.py` | Modeled (Active) | --- @@ -93,6 +112,16 @@ | `STORY-DISP-002` | **Required** (`TC-DISP-009-02`) | **Required** | **Required** (Weighbridge slip & Bilty print) | **Required** (`post-outward-weighment.bru`) | **Required** | Outward weighbridge & transport manifest / Bilty. | | `STORY-DISP-003` | **Required** (`TC-DISP-009-04`) | **Required** | **Required** (POD upload & credit note drawer) | **Required** (`post-pod-delivery.bru`) | **Required** | In-transit tracking, POD & shortage credit note. | | `STORY-FLEET-001` | **Required** (`TC-FLEET-010-01`..`04`) | **Required** | **Required** (Fleet directory & truck editor) | **Required** (`create-vehicle.bru`, `list-fleet.bru`) | **Required** | Transport fleet registry & maintenance gating. | +| `STORY-REC-001` | **Required** (`TC-REC-011-01`) | **Required** | **Required** (Ledger & aging schedule) | **Required** (`get-ledger.bru`) | **Required** | Customer sub-ledger & 4-bucket aging. | +| `STORY-REC-002` | **Required** (`TC-REC-011-02`) | **Required** | **Required** (Credit watch banner & ratio) | **Required** (`get-exposure.bru`) | **Required** | Automated credit exposure watch alerts (>80%). | +| `STORY-REC-003` | **Required** (`TC-REC-011-03`) | **Required** | **Required** (Dispatch lock & override modal) | **Required** (`override-lock.bru`) | **Required** | Credit breach dispatch lock (>100%) & Partner override. | +| `STORY-REC-004` | **Required** (`TC-REC-011-04`) | **Required** | **Required** (Receipt form & bounce console) | **Required** (`post-receipt.bru`) | **Required** | Customer payment receipts & bounce reversal FSM. | +| `STORY-PAY-001` | **Required** (`TC-PAY-012-01`) | **Required** | **Required** (Payables ledger & disbursement) | **Required** (`get-payables.bru`) | **Required** | Supplier payables aging with credit terms & disbursement. | +| `STORY-EXP-001` | **Required** (`TC-EXP-013-01`) | **Required** | **Required** (Expense voucher desk) | **Required** (`post-expense.bru`) | **Required** | Mandi operating expenses & double-entry cash/bank balancing. | +| `STORY-ALERT-001` | **Required** (`TC-ALERT-014-01`..`04`) | **Required** | **Required** (Alert cards & acknowledge modal) | **Required** (`get-alerts.bru`, `acknowledge-alert.bru`, `evaluate-alerts.bru`) | **Required** | Real-time multi-hazard operational alert engine. | +| `STORY-DASH-001` | **Required** (`TC-DASH-015-01`..`04`) | **Required** | **Required** (Executive dashboard cards & gauges) | **Required** (`get-dashboard.bru`) | **Required** | Unified executive control centre dashboard. | +| `STORY-TREND-001` | **Required** (`TC-DASH-015-01`..`04`) | **Required** | **Required** (20-day trend chart & tabular view) | **Required** (`get-trends.bru`) | **Required** | 20-day consolidated trading trend reporting. | +| `STORY-MKT-003` | **Required** (`TC-MKT-003-01`..`04`) | **Required** | **Required** (Commodity price chart, SMA-20, velocity) | **Required** (`get-market-trends.bru`) | **Required** | Intraday price trend analysis & 20-day benchmark analytics. | --- @@ -102,5 +131,8 @@ - **Iteration 02:** [`Iteration02_Multi_Tenant_Core_Complete_Manual_Testcases.xlsx`](manual_qa/workbooks/Iteration02_Multi_Tenant_Core_Complete_Manual_Testcases.xlsx) (32 cases across 16 categories). - **Iteration 03:** [`Iteration03_Mandi_Procurement_Receiving_QC_Complete_Manual_Testcases.xlsx`](manual_qa/workbooks/Iteration03_Mandi_Procurement_Receiving_QC_Complete_Manual_Testcases.xlsx) (32 cases across 16 categories). - **Iteration 04:** [`Iteration04_Warehouse_Sales_Dispatch_Complete_Manual_Testcases.xlsx`](manual_qa/workbooks/Iteration04_Warehouse_Sales_Dispatch_Complete_Manual_Testcases.xlsx) (32 cases across 16 categories). +- **Iteration 05:** [`Iteration05_Financial_Settlement_Complete_Manual_Testcases.xlsx`](manual_qa/workbooks/Iteration05_Financial_Settlement_Complete_Manual_Testcases.xlsx) (32 cases across 16 categories). +- **Iteration 06:** [`Iteration06_Alerts_Reporting_Executive_Dashboard_Complete_Manual_Testcases.xlsx`](manual_qa/workbooks/Iteration06_Alerts_Reporting_Executive_Dashboard_Complete_Manual_Testcases.xlsx) (32 cases across 16 categories). + diff --git a/docs/api/bruno/alerts/acknowledge-alert.bru b/docs/api/bruno/alerts/acknowledge-alert.bru new file mode 100644 index 0000000..cc8d1d5 --- /dev/null +++ b/docs/api/bruno/alerts/acknowledge-alert.bru @@ -0,0 +1,34 @@ +meta { + name: Acknowledge Operational Alert + type: http + seq: 2 +} + +post { + url: {{baseUrl}}/api/v1/alerts/{{alertId}}/acknowledge + body: json + auth: bearer +} + +auth:bearer { + token: {{jwtToken}} +} + +headers { + X-Tenant-ID: {{tenantId}} + Content-Type: application/json + Accept: application/json +} + +body:json { + { + "action_note": "Spoke to customer accounts team; remittance in transit." + } +} + +docs { + # Acknowledge Operational Alert (FR-OPERATIONALALERTS-001) + + Acknowledges an active operational alert with user audit timestamp and resolution notes. +} + diff --git a/docs/api/bruno/alerts/evaluate-alerts.bru b/docs/api/bruno/alerts/evaluate-alerts.bru new file mode 100644 index 0000000..3f2c971 --- /dev/null +++ b/docs/api/bruno/alerts/evaluate-alerts.bru @@ -0,0 +1,27 @@ +meta { + name: Evaluate Operational Alerts + type: http + seq: 3 +} + +post { + url: {{baseUrl}}/api/v1/alerts/evaluate + body: none + auth: bearer +} + +auth:bearer { + token: {{jwtToken}} +} + +headers { + X-Tenant-ID: {{tenantId}} + Accept: application/json +} + +docs { + # Evaluate Operational Alerts (FR-OPERATIONALALERTS-001) + + Triggers immediate synchronous re-evaluation of operational hazard rules. +} + diff --git a/docs/api/bruno/alerts/get-alerts.bru b/docs/api/bruno/alerts/get-alerts.bru new file mode 100644 index 0000000..1a432c9 --- /dev/null +++ b/docs/api/bruno/alerts/get-alerts.bru @@ -0,0 +1,27 @@ +meta { + name: Get Operational Alerts + type: http + seq: 1 +} + +get { + url: {{baseUrl}}/api/v1/alerts?status=ACTIVE + body: none + auth: bearer +} + +auth:bearer { + token: {{jwtToken}} +} + +headers { + X-Tenant-ID: {{tenantId}} + Accept: application/json +} + +docs { + # Get Operational Alerts (FR-OPERATIONALALERTS-001) + + Queries active operational alerts across QC pending, warehouse capacity, credit risk, and procurement windows. +} + diff --git a/docs/api/bruno/reporting/get-dashboard.bru b/docs/api/bruno/reporting/get-dashboard.bru new file mode 100644 index 0000000..8a3fbb1 --- /dev/null +++ b/docs/api/bruno/reporting/get-dashboard.bru @@ -0,0 +1,27 @@ +meta { + name: Get Executive Control Centre Dashboard + type: http + seq: 1 +} + +get { + url: {{baseUrl}}/api/v1/reporting/dashboard + body: none + auth: bearer +} + +auth:bearer { + token: {{jwtToken}} +} + +headers { + X-Tenant-ID: {{tenantId}} + Accept: application/json +} + +docs { + # Get Executive Control Centre Dashboard (FR-EXECUTIVEREPORTING-001) + + Returns consolidated real-time trading metrics, stock on hand, turnover, receivables, top stock lines, and godown utilization barometers. +} + diff --git a/docs/api/bruno/reporting/get-trends.bru b/docs/api/bruno/reporting/get-trends.bru new file mode 100644 index 0000000..013f6b9 --- /dev/null +++ b/docs/api/bruno/reporting/get-trends.bru @@ -0,0 +1,27 @@ +meta { + name: Get 20-Day Trading Trends + type: http + seq: 2 +} + +get { + url: {{baseUrl}}/api/v1/reporting/trends/20-day?window_days=20 + body: none + auth: bearer +} + +auth:bearer { + token: {{jwtToken}} +} + +headers { + X-Tenant-ID: {{tenantId}} + Accept: application/json +} + +docs { + # Get 20-Day Trading Trends (FR-EXECUTIVEREPORTING-002) + + Returns daily management snapshots across rolling 20 trading days tabulating purchases, sales, closing stock, receivables, and payables. +} + diff --git a/docs/api/bruno/trends/get-market-trends.bru b/docs/api/bruno/trends/get-market-trends.bru new file mode 100644 index 0000000..bdbff95 --- /dev/null +++ b/docs/api/bruno/trends/get-market-trends.bru @@ -0,0 +1,27 @@ +meta { + name: Get Market Desk Price Trends & Benchmarks + type: http + seq: 1 +} + +get { + url: {{baseUrl}}/api/v1/analytics/market-trends?commodity_id={{commodityId}}&mandi_id={{mandiId}}&window_days=20 + body: none + auth: bearer +} + +auth:bearer { + token: {{jwtToken}} +} + +headers { + X-Tenant-ID: {{tenantId}} + Accept: application/json +} + +docs { + # Get Market Desk Price Trends & Benchmarks (FR-MARKETTRENDANALYTICS-001) + + Returns 20-day historical commodity modal rate time series, 20-day SMA, period high/low benchmark channels, and price velocity momentum indicator. +} + diff --git a/prompts/20261012T041907Z-session-process-status.md b/prompts/20261012T041907Z-session-process-status.md index 1a86611..3f98e42 100644 --- a/prompts/20261012T041907Z-session-process-status.md +++ b/prompts/20261012T041907Z-session-process-status.md @@ -367,3 +367,31 @@ Executed Stage 10 Iteration Planning (`/up-iteration-plan`) for Iteration 06 (Op - Advanced `UC-003`, `UC-014`, `UC-015` and their 4 child FRs (`FR-MARKETTRENDANALYTICS-001`, `FR-OPERATIONALALERTS-001`, `FR-EXECUTIVEREPORTING-001`, `FR-EXECUTIVEREPORTING-002`) from `Draft` to `In Construction` in `traceability_graph.md`. - Verified Quality Gate 9.1 and Gate 14.1 (for delivered iterations 01–05) with 0 Critical, 0 Major, 0 Minor findings. - Authored Checkpoint `CKPT-029` (`checkpoint-029-iteration-06-planning.md`), updated `checkpoint_index.md` and `master_context.md`. + +## 2026-10-12T12:28:00Z — User + +proceed + +## 2026-10-12T12:30:00Z — Assistant — Action summary + +Executed Stage 11 (Wireframes & Screen Specifications) and Stage 12 (Test Models & QA Artifacts) in parallel for Iteration 06 (Operational Alerts, Event Engine, Market Trends & Executive Management Dashboard): +1. Stage 11 Wireframes & Field-Level Screen Specifications: + - Authored 4 comprehensive screen specifications under `04_generated_documentation/06_wireframes/screen_specs/`: + - `SCREEN-ALERT-001_operational_alerts.md`: Real-Time Operational Incident & Hazard Monitoring Console (`FR-OPERATIONALALERTS-001`). + - `SCREEN-DASH-001_executive_control_centre.md`: Executive Control Centre & Operational KPI Dashboard (`FR-EXECUTIVEREPORTING-001`). + - `SCREEN-TREND-001_20day_trading_trends.md`: Rolling 20-Day Trading & Financial Position Reporting Console (`FR-EXECUTIVEREPORTING-002`). + - `SCREEN-MKT-003_commodity_price_trends.md`: Commodity Price Analytics & Technical Benchmark Console (`FR-MARKETTRENDANALYTICS-001`). + - Reconciled and updated `04_generated_documentation/06_wireframes/wireframe_index.md`. +2. Stage 12 Multi-Path Test Models & QA Deliverables: + - Authored 3 multi-path functional test models covering all 4 dimensions (Happy Path, Boundary/Edge, Negative/Security, FSM Invariant & Concurrency): + - `TC-014_operational_alerts_engine.md`: Covers `UC-014` / `FR-OPERATIONALALERTS-001`. + - `TC-015_executive_reporting_dashboard.md`: Covers `UC-015` / `FR-EXECUTIVEREPORTING-001`, `002`. + - `TC-003_market_trend_analytics.md`: Covers `UC-003` / `FR-MARKETTRENDANALYTICS-001`. + - Created git-versioned Bruno collections under `docs/api/bruno/alerts/`, `docs/api/bruno/reporting/`, `docs/api/bruno/trends/` (6 request definitions). + - Authored `04_generated_documentation/07_test_design/manual_qa/iteration-06/MANUAL_TESTING_GUIDE.md`. + - Compiled 21-sheet, 30-column Excel Manual QA Workbook: `Iteration06_Alerts_Reporting_Executive_Dashboard_Complete_Manual_Testcases.xlsx` densely populated with 32 test cases (threshold >= 20). + - Updated `test_traceability_matrix.md` and `regression_test_cases.md`. +3. Quality Gates & Checkpoints: + - Executed `scripts/verify_traceability_gates.py --gate 14.1 --iteration iteration-06`: PASSED (0 Critical, 0 Major, 0 Minor). + - Executed `scripts/verify_traceability_gates.py --all`: Gates 9.1 and 14.1 for all iterations (01 through 06) all PASSED (0 Critical, 0 Major, 0 Minor). + - Authored Checkpoint `CKPT-030` (`checkpoint-030-iteration-06-wireframes-test-models.md`), updated `checkpoint_index.md` and `master_context.md`.