iter-05 plan
This commit is contained in:
parent
9127c98efd
commit
5ab42d5982
|
|
@ -0,0 +1,64 @@
|
|||
# Checkpoint 026: Iteration 05 Planning Complete (Financial Settlement, Receivables, Payables & Expenses)
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| **Checkpoint ID** | `CKPT-026` |
|
||||
| **Date** | 2026-10-12 |
|
||||
| **Governed Standard** | SEI-CMMI Level 3 (UP-AI v1.5 Generic Framework) |
|
||||
| **Active Stage** | Stage 10 (Iteration Planning Complete for `iteration-05`) |
|
||||
| **Lifecycle State** | `In Construction (Stage 10 Planned)` |
|
||||
| **Parent Use Cases** | [`UC-011`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-011-customer-receivables/use-case.md), [`UC-012`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-012-supplier-payables/use-case.md), [`UC-013`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-013-operating-expenses/use-case.md) |
|
||||
| **Requirements Scope** | `FR-CUSTOMERRECEIVABLES-001`..`004`, `FR-SUPPLIERPAYABLES-001`, `FR-OPERATINGEXPENSES-001` (6 FRs, 28 Story Points) |
|
||||
| **Document Path** | `04_generated_documentation/00_process_control/checkpoints/checkpoint-026-iteration-05-planning.md` |
|
||||
| **Previous Checkpoint** | [`CKPT-025`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/00_process_control/checkpoints/checkpoint-025-iteration-04-construction-delivery.md) |
|
||||
| **Next Stage** | Stage 11 (`up-wireframe-spec`) & Stage 12 (`up-test-model-generate`) in parallel for `iteration-05` |
|
||||
|
||||
---
|
||||
|
||||
## 1. Executive Summary
|
||||
|
||||
Iteration 05 (**Financial Settlement, Customer Receivables, Supplier Payables & Operating Expenses**) has completed Stage 10 planning in accordance with UP-AI v1.5 specifications following the formal delivery and retrospective closure of Iteration 04.
|
||||
|
||||
A vertical slice of 3 cohesive financial use cases (`UC-011`, `UC-012`, `UC-013`) comprising 6 Functional Requirements and 28 Story Points has been scoped across all 11 delivery surfaces.
|
||||
|
||||
---
|
||||
|
||||
## 2. Planning Artifacts Authored
|
||||
|
||||
1. **Iteration 04 Retrospective:**
|
||||
- [`04_generated_documentation/05_iteration_planning/iterations/iteration-04/retrospective.md`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/05_iteration_planning/iterations/iteration-04/retrospective.md): Formalized delivery of Iteration 04 (10 FRs, 40 SP, 115 tests passing with 95.0% coverage, 14 live container E2E tests passing, 0 carried-over scope, 0 open CRs).
|
||||
2. **Iteration 05 Plan:**
|
||||
- [`04_generated_documentation/05_iteration_planning/iterations/iteration-05/iteration_plan.md`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/05_iteration_planning/iterations/iteration-05/iteration_plan.md): Defines 28-point capacity, slice goals, demo criteria, and regression test continuity.
|
||||
3. **Iteration 05 Backlog:**
|
||||
- [`04_generated_documentation/05_iteration_planning/iterations/iteration-05/iteration_backlog.md`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/05_iteration_planning/iterations/iteration-05/iteration_backlog.md): 6 detailed stories (`STORY-REC-001`..`004`, `STORY-PAY-001`, `STORY-EXP-001`) with explicit acceptance criteria, mathematical formulas, and immutable accounting rules.
|
||||
4. **Iteration Delivery Surface Matrix:**
|
||||
- [`04_generated_documentation/05_iteration_planning/iterations/iteration-05/iteration_surface_matrix.md`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/05_iteration_planning/iterations/iteration-05/iteration_surface_matrix.md): Maps all 11 delivery dimensions across React finance screens, FastAPI endpoints, Alembic migration `012_finance_settlement.py`, Wave 0 sandboxes, and test scopes.
|
||||
5. **Parallel Work Plan:**
|
||||
- [`04_generated_documentation/05_iteration_planning/iterations/iteration-05/parallel_work_plan.md`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/05_iteration_planning/iterations/iteration-05/parallel_work_plan.md): Establishes Wave 0 mock (`sandbox/payment_mock.py`) and 3 isolated parallel lanes (Lane 1: Customer Receivables & Credit Locks, Lane 2: Supplier Payables & GRN Due Dates, Lane 3: Mandi Operating Expenses).
|
||||
|
||||
---
|
||||
|
||||
## 3. Governance & Quality Gate Status
|
||||
|
||||
- **Traceability Graph Updated:** Advanced `UC-011`, `UC-012`, `UC-013` and child FRs (`FR-CUSTOMERRECEIVABLES-001`–`004`, `FR-SUPPLIERPAYABLES-001`, `FR-OPERATINGEXPENSES-001`) from `Draft` to `In Construction` in [`traceability_graph.md`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/00_process_control/traceability_graph.md).
|
||||
- **Gate 9.1 Status:** **PASS** (0 Critical, 0 Major, 0 Minor).
|
||||
- **Gate 14.1 Status (Iteration 04 Delivery):** **PASS** (0 Critical, 0 Major, 0 Minor).
|
||||
|
||||
---
|
||||
|
||||
## 4. Next Recommended Actions
|
||||
|
||||
Proceed to **Stage 11 Wireframe Specifications (`up-wireframe-spec`)** and **Stage 12 Test Model Generation (`up-test-model-generate`)** in parallel for Iteration 05:
|
||||
1. Author screen specifications under `04_generated_documentation/06_wireframes/screen_specs/`:
|
||||
- `SCREEN-REC-001_customer_ledger_aging.md`
|
||||
- `SCREEN-REC-002_credit_exposure_locks.md`
|
||||
- `SCREEN-REC-003_payment_receipts.md`
|
||||
- `SCREEN-PAY-001_supplier_payables_aging.md`
|
||||
- `SCREEN-EXP-001_operating_expenses.md`
|
||||
2. Author 4-dimension functional test models under `04_generated_documentation/07_test_design/functional_test_cases/`:
|
||||
- `TC-011_customer_receivables_credit_controls.md`
|
||||
- `TC-012_supplier_payables_aging.md`
|
||||
- `TC-013_mandi_operating_expenses.md`
|
||||
3. Author `04_generated_documentation/07_test_design/manual_qa/iteration-05/MANUAL_TESTING_GUIDE.md`.
|
||||
4. Compile 21-sheet Excel QA Workbook `Iteration05_Financial_Settlement_Complete_Manual_Testcases.xlsx`.
|
||||
|
||||
|
|
@ -48,5 +48,6 @@
|
|||
| `CKPT-023` | 2026-10-12 | Stage 10 (Iteration 04 Planning Complete) | Selected and scoped Iteration 04 for Warehouse Inventory, Stock Ledger, Customer Sales Contracts, Credit Controls, Lot Allocation, Outbound Dispatch, and Transport Fleet Registry (`UC-007`, `UC-008`, `UC-009`, `UC-010`). Authored `iteration_plan.md`, `iteration_backlog.md` (10 stories, 40 pts), `iteration_surface_matrix.md`, and `parallel_work_plan.md`. Authored Iteration 03 retrospective. | Iteration-04 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-04. | `checkpoint-023-iteration-04-planning.md` |
|
||||
| `CKPT-024` | 2026-10-12 | Stage 11 (Wireframes) & Stage 12 (Test Models) complete | Authored 7 screen specifications (`SCREEN-WH-001`..`002`, `SCREEN-SALES-001`..`002`, `SCREEN-DISP-001`..`002`, `SCREEN-FLEET-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-04 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-024-iteration-04-wireframes-test-models.md` |
|
||||
| `CKPT-025` | 2026-10-12 | Stage 14 (Construction E2E Verification & Gate 14.1 Exit) | Iteration 04 Delivered (E2E Verified): UC-007, UC-008, UC-009, UC-010 (10 FRs, 40 pts) across all 11 delivery surfaces. Alembic migrations 009–011 applied with live PostgreSQL 17 RLS. 115 multi-path automated tests passing with 95.0% statement coverage. Live E2E lifecycle suite verified (14/14). Quality Gates 5.1, 9.1, and 14.1 (all 4 iterations) PASSED. | None for Iteration 04; ready for Iteration 05 planning. | Proceed to Stage 10 Iteration 05 Planning (`/up-iteration-plan`) for Financial Settlement, Receivables & Payables. | `checkpoint-025-iteration-04-construction-delivery.md` |
|
||||
| `CKPT-026` | 2026-10-12 | Stage 10 (Iteration 05 Planning Complete) | Selected and scoped Iteration 05 for Financial Settlement, Customer Receivables, Supplier Payables & Operating Expenses (`UC-011`, `UC-012`, `UC-013`). Authored `iteration_plan.md`, `iteration_backlog.md` (6 stories, 28 pts), `iteration_surface_matrix.md`, and `parallel_work_plan.md`. Authored Iteration 04 retrospective. | Iteration-05 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-05. | `checkpoint-026-iteration-05-planning.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-025 |
|
||||
| **Last Checkpoint** | CKPT-026 |
|
||||
| **Last CR** | CR-001 (Closed) |
|
||||
|
||||
|
||||
|
|
@ -87,14 +87,16 @@ stack:
|
|||
|
||||
## 4. Active Stage & Next Actions
|
||||
|
||||
- **Current Stage:** Stage 14 (Construction E2E Verification & Gate 14.1 Exit) complete for `iteration-04` ([`CKPT-025`](checkpoints/checkpoint-025-iteration-04-construction-delivery.md)).
|
||||
- **Current Stage:** Stage 10 (Iteration Planning Complete) for `iteration-05` ([`CKPT-026`](checkpoints/checkpoint-026-iteration-05-planning.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).
|
||||
- `iteration-03` (Mandi Market Desk, Sauda Procurement, Gate Inward Weighbridge/Tare, Lab Assay & Lot Control: `UC-002`, `UC-004`, `UC-005`, `UC-006`): **`Delivered (E2E Verified)`** — Verified with live PostgreSQL 17 Alembic migrations (005–008), 92 multi-path automated tests passing (95.4% AST statement coverage), and 13 live container E2E integration tests (13/13 PASS).
|
||||
- `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).
|
||||
- **Active Iteration in Planning / Construction Entry:**
|
||||
- `iteration-05` (Financial Settlement, Customer Receivables, Supplier Payables & Operating Expenses: `UC-011`, `UC-012`, `UC-013` — 6 stories, 28 SP across 11 delivery surfaces).
|
||||
- **Test & Coverage Status:** 115 unit tests passing (95.0% statement coverage across all domain packages) + 14 live container E2E lifecycle tests. Quality Gates 5.1, 9.1, and 14.1 (for all 4 delivered iterations) all PASSED cleanly.
|
||||
- **Next:** Proceed to **Stage 10 Iteration 05 Planning (`/up-iteration-plan`)** for Customer Receivables, Supplier Payables, and Operating Expenses (`UC-011`, `UC-012`, `UC-013`). Carry `AMB-001`, `AMB-006`, `AMB-008`–`AMB-011` and `ASM-001`–`ASM-003` forward.
|
||||
- **Next:** Proceed to **Stage 11 Wireframe Specifications (`/up-wireframe-spec`)** and **Stage 12 Test Model Generation (`/up-test-model-generate`)** in parallel for `iteration-05`. Carry `AMB-001`, `AMB-006`, `AMB-008`–`AMB-011` and `ASM-001`–`ASM-003` forward.
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -136,15 +136,15 @@ These artifacts are candidate Stage 7 spike outputs. They do not replace Stage 8
|
|||
| `FR-DISPATCHDELIVERY-003` | In-Transit Tracking & Proof of Delivery (POD) | `UC-009` | `BRD-FR-026` | Delivered (E2E Verified) |
|
||||
| `UC-010` | Transport Fleet Registry | — | `BRD-FR-027` | Delivered (E2E Verified) |
|
||||
| `FR-FLEETREGISTRY-001` | Transport Fleet Registry | `UC-010` | `BRD-FR-027` | Delivered (E2E Verified) |
|
||||
| `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-011` | Customer Receivables and Credit Controls | — | `BRD-FR-028`, `BRD-FR-029`, `BRD-FR-030`, `BRD-FR-031` | In Construction |
|
||||
| `FR-CUSTOMERRECEIVABLES-001` | Customer Ledger & Aging Statement | `UC-011` | `BRD-FR-028` | In Construction |
|
||||
| `FR-CUSTOMERRECEIVABLES-002` | Automated Customer Credit Exposure Watch & Threshold Alert | `UC-011` | `BRD-FR-029` | In Construction |
|
||||
| `FR-CUSTOMERRECEIVABLES-003` | Credit Breach Dispatch Lock & Partner Override | `UC-011` | `BRD-FR-030` | In Construction |
|
||||
| `FR-CUSTOMERRECEIVABLES-004` | Customer Payment Receipt Posting | `UC-011` | `BRD-FR-031` | In Construction |
|
||||
| `UC-012` | Supplier Payables and Aging | — | `BRD-FR-032` | In Construction |
|
||||
| `FR-SUPPLIERPAYABLES-001` | Supplier Payables Aging & Balance Snapshots | `UC-012` | `BRD-FR-032` | In Construction |
|
||||
| `UC-013` | Mandi Operating Expense Recording | — | `BRD-FR-033` | In Construction |
|
||||
| `FR-OPERATINGEXPENSES-001` | Mandi Operating Expense Classification & Recording | `UC-013` | `BRD-FR-033` | In Construction |
|
||||
| `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 |
|
||||
|
|
|
|||
|
|
@ -0,0 +1,74 @@
|
|||
# Iteration Retrospective — Iteration 04 (Warehouse Inventory, Stock Ledger & Sales Dispatch)
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| **Iteration** | `iteration-04` |
|
||||
| **Governing Standard** | SEI-CMMI Level 3 (UP-AI v1.5 Generic Framework) |
|
||||
| **Document Path** | `04_generated_documentation/05_iteration_planning/iterations/iteration-04/retrospective.md` |
|
||||
| **Completed Date** | 2026-10-12 |
|
||||
| **Lifecycle State** | Delivered (E2E Verified) |
|
||||
| **Exit Gate** | Gate 14.1 PASSED (0 Critical, 0 Major, 0 Minor) |
|
||||
| **Associated Checkpoint** | [`CKPT-025`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/00_process_control/checkpoints/checkpoint-025-iteration-04-construction-delivery.md) |
|
||||
|
||||
---
|
||||
|
||||
## 1. Executive Summary & Delivery Scope
|
||||
|
||||
Iteration 04 delivered the full warehouse inventory, customer sales contract booking, credit exposure evaluation, released-lot inventory allocation, outbound consignment dispatch board, outward weighbridge gross/tare logging, manifest/Bilty issuance, and destination POD / transit shortage credit note workflow across four core use cases:
|
||||
- `UC-007`: Multi-Warehouse Stock Ledger, Godown Capacity Tracking & Internal Transfers (`FR-WAREHOUSEINVENTORY-001`–`003`)
|
||||
- `UC-008`: Customer Sales Contracts, Credit Exposure Verification & Released-Lot Allocation (`FR-SALESCONTRACTS-001`–`003`)
|
||||
- `UC-009`: Outbound Dispatch Board, Outward Weighbridge, Bilty/Manifest & Proof of Delivery / Shortage Credit Notes (`FR-DISPATCHDELIVERY-001`–`003`)
|
||||
- `UC-010`: Transport Fleet & Carrier Registry with Maintenance Gating (`FR-FLEETREGISTRY-001`)
|
||||
|
||||
**Total Delivery:** 10 Functional Requirements (40 Story Points) across all 11 delivery surfaces.
|
||||
|
||||
---
|
||||
|
||||
## 2. Key Achievements & Verification Evidence
|
||||
|
||||
1. **Multi-Path Automated Test Coverage:**
|
||||
- Authored test suites covering Happy Path, Boundary Value, Negative/Security, and FSM Invariant dimensions.
|
||||
- Executed 115 unit & integration tests in 0.105s with **95.0% statement coverage** across all domain packages (satisfying UP-AI target $\ge 95.0\%$).
|
||||
2. **PostgreSQL 17 Live Migrations & RLS:**
|
||||
- Applied Alembic revisions 009, 010, and 011 inside the live PostgreSQL container (`atb-local-postgres-1`).
|
||||
- Verified row-level security policies across 24 relations including `stock_ledger_entries`, `stock_adjustments`, `warehouse_capacities`, `stock_transfers`, `customer_sales_orders`, `sales_order_allocations`, `outbound_dispatches`, `outbound_weighments`, `dispatch_bilty`, `proof_of_deliveries`, `sales_credit_notes`, and `transport_fleet`.
|
||||
3. **Containerized HTTP E2E Verification:**
|
||||
- 14 live E2E integration tests passing inside the Docker Compose network in 0.168s against the live FastAPI application (`atb-backend-test`).
|
||||
- Verified the complete stock-to-dispatch lifecycle from capacity check through shortage credit note approval.
|
||||
4. **Governance & QA Artifact Density:**
|
||||
- Authored comprehensive `MANUAL_TESTING_GUIDE.md` detailing end-to-end walkthroughs, disposable personas, and acceptance criteria.
|
||||
- Compiled dense 21-sheet QA workbook with 32 comprehensive test cases.
|
||||
- Maintained git-versioned Bruno collections covering all 10 endpoints.
|
||||
- Validated Quality Gates 5.1, 9.1, and 14.1 with 0 critical findings across all 4 iterations.
|
||||
|
||||
---
|
||||
|
||||
## 3. Challenges & Engineering Lessons Learned
|
||||
|
||||
1. **Tenant-Aware Default Mock Seeding:**
|
||||
- *Challenge:* In multi-tenant environments, dynamically provisioned tenants in live E2E runs (`tenant-iter4-xxxx`) did not have pre-seeded warehouse capacities or vehicle registries because seed functions defaulted to static `"tenant-alpha"`.
|
||||
- *Resolution:* Parameterized `_seed_initial_data(tenant_id)` and `_seed_initial_fleet(tenant_id)` to dynamically populate default sandbox profiles on first query per tenant.
|
||||
2. **Composite Role Resolution & PRD Role Aliases:**
|
||||
- *Challenge:* Tokens carrying standard PRD role titles (`Partner / MD`, `Sales Manager`, `Tenant Administrator`) were rejected when authorization checks tested only uppercase shorthand tokens (`PARTNER`, `SALES_MANAGER`).
|
||||
- *Resolution:* Aggregated caller roles from both JWT claims and active database tenant memberships, and supported both canonical PRD role names and uppercase identifiers in all permission guards.
|
||||
3. **Double-Entry Dual-Unit Stock Integrity:**
|
||||
- *Challenge:* Physical audit adjustments and godown transfers must maintain strict dual-unit synchronization (MT and Bags) while preventing negative stock positions.
|
||||
- *Resolution:* Enforced absolute non-negative balance invariants in `StockLedgerEntry` and `StockTransfer` with tolerance checks ($\pm 1.0\%$ partner approval, $\pm 0.2\%$ transfer tolerance).
|
||||
|
||||
---
|
||||
|
||||
## 4. Scope Adjustments & Carried-Over Items
|
||||
|
||||
- **Carried-Over Stories:** **0** (All 10 stories delivered and E2E verified).
|
||||
- **Raised Change Requests (CRs):** **0** (No requirements gaps surfaced).
|
||||
- **Regression Debt:** **0** (All 115 automated tests passing, no flaky or deprecated suites).
|
||||
|
||||
---
|
||||
|
||||
## 5. Next Iteration Scope Recommendation
|
||||
|
||||
Proceed immediately to **Iteration 05**: **Financial Settlement, Customer Receivables, Supplier Payables & Operating Expenses**:
|
||||
- `UC-011`: Customer Receivables, Credit Exposure Monitoring, Aging Statements & Payment Receipts (`FR-CUSTOMERRECEIVABLES-001`–`004`)
|
||||
- `UC-012`: Supplier Payables Aging, Payment Disbursements & Bank Advice (`FR-SUPPLIERPAYABLES-001`)
|
||||
- `UC-013`: Operating Expenses, Mandi Cess / Krishi Upaj Tax, Hamali/Tolai Labor Charges & Freight Vouchers (`FR-OPERATINGEXPENSES-001`)
|
||||
|
||||
|
|
@ -0,0 +1,114 @@
|
|||
# Iteration Backlog — Iteration 05
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| **Iteration** | `iteration-05` |
|
||||
| **Parent Use Cases** | [`UC-011`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-011-customer-receivables/use-case.md), [`UC-012`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-012-supplier-payables/use-case.md), [`UC-013`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-013-operating-expenses/use-case.md) |
|
||||
| **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.0.0 |
|
||||
| **Last CR** | none |
|
||||
|
||||
---
|
||||
|
||||
## Story Backlog Summary
|
||||
|
||||
| Story ID | Parent FR | Story Title | Points | Priority | Primary Delivery Surface | Assigned Roles | Status |
|
||||
|---|---|---|---|---|---|---|---|
|
||||
| `STORY-REC-001` | `FR-CUSTOMERRECEIVABLES-001` | Customer Sub-Ledger & Multi-Bucket Aging Statement | 5 | P0 | Backend API (`/api/v1/finance/receivables/ledger`), Web Screen `/finance/receivables` | `@backend-dev-alpha`, `@ui-dev-alpha` | Ready for Construction |
|
||||
| `STORY-REC-002` | `FR-CUSTOMERRECEIVABLES-002` | Automated Credit Exposure Watch & Threshold Alert (>80%) | 3 | P0 | Backend Credit Engine (`/api/v1/finance/receivables/exposure`), Web Banner | `@backend-dev-alpha`, `@ui-dev-alpha` | Ready for Construction |
|
||||
| `STORY-REC-003` | `FR-CUSTOMERRECEIVABLES-003` | Credit Breach Dispatch Lock & Partner Electronic Override | 5 | P0 | Backend Lock Guard (`/api/v1/finance/receivables/locks/{id}/override`), Web Modal | `@backend-dev-alpha`, `@adversarial-tester` | Ready for Construction |
|
||||
| `STORY-REC-004` | `FR-CUSTOMERRECEIVABLES-004` | Customer Payment Receipt Posting & Bounce Reversal FSM | 5 | P0 | Backend API (`/api/v1/finance/receivables/receipts`), Web Screen `/finance/receipts` | `@backend-dev-alpha`, `@ui-dev-alpha` | Ready for Construction |
|
||||
| `STORY-PAY-001` | `FR-SUPPLIERPAYABLES-001` | Supplier Payables Aging & Balance Snapshots with Credit Terms | 5 | P0 | Backend API (`/api/v1/finance/payables`), Web Screen `/finance/payables` | `@backend-dev-beta`, `@ui-dev-beta` | Ready for Construction |
|
||||
| `STORY-EXP-001` | `FR-OPERATINGEXPENSES-001` | Mandi Operating Expense Classification & Cash/Bank Balancing | 5 | P1 | Backend API (`/api/v1/finance/expenses`), Web Screen `/finance/expenses` | `@backend-dev-gamma`, `@ui-dev-gamma` | Ready for Construction |
|
||||
|
||||
---
|
||||
|
||||
## Detailed Story Specifications
|
||||
|
||||
### STORY-REC-001: Customer Sub-Ledger & Multi-Bucket Aging Statement
|
||||
- **Parent Requirement:** [`FR-CUSTOMERRECEIVABLES-001`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-011-customer-receivables/functional-reqs.md#fr-customerreceivables-001-customer-ledger--aging-statement)
|
||||
- **SRS Linkage:** `SRS-CUSTOMERRECEIVABLES-001`
|
||||
- **Architecture Contract:** `HLD-RECEIVABLES-SERVICE`, [`LLD-004`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/04_architecture_design/lld/LLD-004_financial_controls.md)
|
||||
- **Story Points:** 5 (P0)
|
||||
- **Assigned Roles:** Accounts Executive, Sales Manager, Partner / MD
|
||||
- **Description:** Implement the immutable customer party sub-ledger tracking debits from finalized sales invoices and credits from payment receipts. Calculate real-time outstanding balance and multi-bucket aging schedules (`0–7 days`, `8–15 days`, `16–30 days`, `>30 days`).
|
||||
- **Acceptance Criteria:**
|
||||
1. Record and query party sub-ledger entries per customer: Customer ID, Posting Date, Voucher Type (`Sales Invoice`, `Payment Receipt`, `Credit Note`), Voucher Number, Debit Amount INR, Credit Amount INR, Running Outstanding INR.
|
||||
2. Enforce strict immutability: posted ledger entries cannot be updated or deleted; corrections require explicit reversing/compensating vouchers.
|
||||
3. Compute real-time aging schedule based on invoice due date vs. current date into standard buckets: 0–7 days, 8–15 days, 16–30 days, >30 days.
|
||||
|
||||
---
|
||||
|
||||
### STORY-REC-002: Automated Credit Exposure Watch & Threshold Alert (>80%)
|
||||
- **Parent Requirement:** [`FR-CUSTOMERRECEIVABLES-002`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-011-customer-receivables/functional-reqs.md#fr-customerreceivables-002-automated-customer-credit-exposure-watch--threshold-alert)
|
||||
- **SRS Linkage:** `SRS-CUSTOMERRECEIVABLES-002`
|
||||
- **Architecture Contract:** `HLD-RECEIVABLES-SERVICE`, [`LLD-004`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/04_architecture_design/lld/LLD-004_financial_controls.md)
|
||||
- **Story Points:** 3 (P0)
|
||||
- **Assigned Roles:** Accounts Executive, Sales Manager, Partner / MD
|
||||
- **Description:** Continuous recomputation of customer credit exposure ratio upon every invoice and receipt event. Trigger automated visual `Watch` tags and operational alerts when exposure exceeds 80%.
|
||||
- **Acceptance Criteria:**
|
||||
1. Calculate customer exposure percentage:
|
||||
$$\text{Exposure Ratio \%} = \frac{\text{Current Outstanding (INR)}}{\text{Sanctioned Credit Limit (INR)}} \times 100$$
|
||||
2. If exposure $> 80.0\%$, account is automatically assigned `Risk Flag = Watch` and visual amber badge rendered in UI.
|
||||
3. Surface exposed customer metrics via `GET /api/v1/finance/receivables/exposure`: Customer ID, Name, Sanctioned Limit, Outstanding, Exposure %, and Risk Flag (`Normal`, `Watch`, `Critical`).
|
||||
|
||||
---
|
||||
|
||||
### STORY-REC-003: Credit Breach Dispatch Lock & Partner Electronic Override
|
||||
- **Parent Requirement:** [`FR-CUSTOMERRECEIVABLES-003`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-011-customer-receivables/functional-reqs.md#fr-customerreceivables-003-credit-breach-dispatch-lock--partner-override)
|
||||
- **SRS Linkage:** `SRS-CUSTOMERRECEIVABLES-003`
|
||||
- **Architecture Contract:** `HLD-RECEIVABLES-SERVICE`, [`LLD-004`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/04_architecture_design/lld/LLD-004_financial_controls.md)
|
||||
- **Story Points:** 5 (P0)
|
||||
- **Assigned Roles:** Accounts Executive, Logistics Coordinator, Partner / MD
|
||||
- **Description:** Automated enforcement of dispatch locks when customer outstanding balance exceeds 100% of sanctioned credit limit. Provide electronic override workflow requiring Partner authorization key and justification.
|
||||
- **Acceptance Criteria:**
|
||||
1. When customer outstanding $> 100.0\%$ of sanctioned credit limit, set `Risk Flag = Critical` and automatically activate `Dispatch Lock = Active`.
|
||||
2. Any attempt to schedule or confirm an outbound dispatch for a locked customer is rejected with `403 CREDIT_BREACH_DISPATCH_LOCKED`.
|
||||
3. Partner user can execute `POST /api/v1/finance/receivables/locks/{id}/override` providing mandatory justification text. The lock transitions to `Overridden` and unblocks dispatch scheduling.
|
||||
4. Override event is permanently and immutably recorded in the tenant audit log with Partner user ID, timestamp, and justification reason.
|
||||
|
||||
---
|
||||
|
||||
### STORY-REC-004: Customer Payment Receipt Posting & Bounce Reversal FSM
|
||||
- **Parent Requirement:** [`FR-CUSTOMERRECEIVABLES-004`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-011-customer-receivables/functional-reqs.md#fr-customerreceivables-004-customer-payment-receipt-posting)
|
||||
- **SRS Linkage:** `SRS-CUSTOMERRECEIVABLES-004`
|
||||
- **Architecture Contract:** `HLD-RECEIVABLES-SERVICE`, [`LLD-004`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/04_architecture_design/lld/LLD-004_financial_controls.md)
|
||||
- **Story Points:** 5 (P0)
|
||||
- **Assigned Roles:** Accounts Executive, Cashier, Sales Manager
|
||||
- **Description:** Record customer payment receipts across modes (`NEFT`, `RTGS`, `Cheque`, `Cash`, `UPI`) with clearance state management (`Pending Clearance`, `Cleared`, `Bounced`). Handle atomic bounce reversal restoring customer debt and credit locks.
|
||||
- **Acceptance Criteria:**
|
||||
1. Record payment receipt capturing Receipt ID (`PAY-YYYYMM-xxx`), Customer ID, Amount INR ($> 0$), Payment Mode, Bank/Instrument Reference (UTR/Cheque No), Bank Name, and Clearance Status.
|
||||
2. When status transitions to `Cleared`, credit entry is posted to customer party sub-ledger, reducing outstanding debt and recomputing exposure ratio.
|
||||
3. If an instrument transitions to `Bounced`, execute atomic reversal FSM: post reversing debit entry to sub-ledger, restore previous debt balance, recompute exposure %, reinstate dispatch lock if exposure $> 100\%$, and record immutable audit record with bounce reason.
|
||||
|
||||
---
|
||||
|
||||
### STORY-PAY-001: Supplier Payables Aging & Balance Snapshots with Credit Terms
|
||||
- **Parent Requirement:** [`FR-SUPPLIERPAYABLES-001`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-012-supplier-payables/functional-reqs.md#fr-supplierpayables-001-supplier-payables-aging--balance-snapshots)
|
||||
- **SRS Linkage:** `SRS-SUPPLIERPAYABLES-001`
|
||||
- **Architecture Contract:** `HLD-PAYABLES-SERVICE`, [`LLD-004`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/04_architecture_design/lld/LLD-004_financial_controls.md)
|
||||
- **Story Points:** 5 (P0)
|
||||
- **Assigned Roles:** Accounts Executive, Purchase Manager, Finance Head
|
||||
- **Description:** Track accounts payable liabilities to farmers, commission agents, and aggregators generated from accepted GRNs. Calculate due dates using supplier credit terms, classify overdue aging, and record supplier disbursements.
|
||||
- **Acceptance Criteria:**
|
||||
1. Maintain supplier payable records linked to accepted GRNs: Supplier ID, GRN Number, Sauda Reference, Invoice Amount INR, GRN Date, Supplier Credit Days, Due Date ($\text{Due Date} = \text{GRN Date} + \text{Credit Days}$).
|
||||
2. Compute days overdue and classify into aging buckets: Current (Not Due), 1–7 days overdue, 8–15 days overdue, >15 days overdue.
|
||||
3. Record supplier disbursement payments reducing outstanding balance, updating payment status (`Unpaid`, `Partially Paid`, `Paid`).
|
||||
4. Generate daily aggregate payables snapshot summarizing total outstanding liability and immediate cash outflow requirements.
|
||||
|
||||
---
|
||||
|
||||
### STORY-EXP-001: Mandi Operating Expense Classification & Cash/Bank Balancing
|
||||
- **Parent Requirement:** [`FR-OPERATINGEXPENSES-001`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-013-operating-expenses/functional-reqs.md#fr-operatingexpenses-001-mandi-operating-expense-classification--recording)
|
||||
- **SRS Linkage:** `SRS-OPERATINGEXPENSES-001`
|
||||
- **Architecture Contract:** `HLD-EXPENSES-SERVICE`, [`LLD-009`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/04_architecture_design/lld/LLD-009_fleet_and_expense.md)
|
||||
- **Story Points:** 5 (P1)
|
||||
- **Assigned Roles:** Accounts Executive, Yard Supervisor, Cashier
|
||||
- **Description:** Record operational and mandi-specific expenses incurred during procurement and warehouse operations with mandatory expense categorization and double-entry cash/bank ledger balancing.
|
||||
- **Acceptance Criteria:**
|
||||
1. Create Expense Vouchers (`EXP-YYYYMM-xxx`) with mandatory fields: Date, Expense Category, Amount INR ($> 0$), Payee/Vendor Name, Linked Consignment / Sauda (optional), Payment Mode (`Cash`, `Bank Transfer`, `UPI`), and Cash/Bank Account ID.
|
||||
2. Restrict category to source-defined options: `Labor / Hamali (loading/unloading)`, `Freight / Cartage`, `Weighbridge Fees`, `Godown Rent`, `Mandi Cess`, `Pest Control / Fumigation`, `Office Expenses`.
|
||||
3. Enforce atomic double-entry posting: debit expense category sub-account and credit cash/bank asset account for identical amounts. Unbalanced entries are rejected.
|
||||
4. Query and filter expense vouchers by date range, category, payment mode, and linked operational documents.
|
||||
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
# Iteration Plan — Iteration 05 (Financial Settlement, Customer Receivables, Supplier Payables & Operating Expenses)
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| **Iteration** | `iteration-05` |
|
||||
| **Slice Goal** | Deliver the end-to-end financial accounting and party settlement workflow, including immutable customer sub-ledgers, aging schedules (0–7d, 8–15d, 16–30d, >30d), real-time automated credit exposure watch alerts (>80%), credit breach dispatch locks with Partner electronic override (>100%), customer payment receipt recording with multi-instrument support (NEFT, RTGS, Cheque, Cash, UPI) and automatic bounce reversal FSM, supplier payables aging with GRN credit terms, and mandi operating expense vouchers with double-entry cash/bank balancing across `UC-011`, `UC-012`, and `UC-013`. |
|
||||
| **Governed Standard** | UP-AI v1.5 Stage 10 Standard |
|
||||
| **Parent Use Cases** | [`UC-011`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-011-customer-receivables/use-case.md), [`UC-012`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-012-supplier-payables/use-case.md), [`UC-013`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/03_requirements/use_cases/uc-013-operating-expenses/use-case.md) |
|
||||
| **Capacity** | 6 Stories (28 Story Points) |
|
||||
| **Status** | In Planning (Stage 10 Planned) |
|
||||
| **Version** | 1.0.0 |
|
||||
| **Last CR** | none |
|
||||
|
||||
---
|
||||
|
||||
## 1. Iteration Goal & Scope Summary
|
||||
|
||||
Deliver the core **Financial Settlement, Customer Receivables, Supplier Payables & Mandi Operating Expenses Pipeline** for the Agriculture Trading Backoffice (ATB). Building upon the multi-tenant control plane, PostgreSQL RLS, RBAC, Inward Mandi pipeline, and Warehouse/Sales Dispatch pipeline established in Iterations 01 through 04, this slice operationalizes:
|
||||
|
||||
1. **Customer Receivables & Credit Controls (`UC-011`):**
|
||||
- **Customer Sub-Ledger & Aging Statement (`FR-CUSTOMERRECEIVABLES-001`):** Immutable party sub-ledger for each customer, debiting finalized sales invoices, crediting payment receipts, presenting real-time outstanding balances and multi-bucket aging schedules (`0–7 days`, `8–15 days`, `16–30 days`, `>30 days`).
|
||||
- **Automated Customer Credit Exposure Watch & Threshold Alert (`FR-CUSTOMERRECEIVABLES-002`):** Continuous recomputation of customer credit exposure ratio ($\text{Outstanding} / \text{Credit Limit}$). If exposure $>80\%$, the account is automatically tagged with a visual `Watch` badge, and an operational warning alert is generated on the Executive Dashboard.
|
||||
- **Credit Breach Dispatch Lock & Partner Override (`FR-CUSTOMERRECEIVABLES-003`):** If outstanding receivables exceed 100% of sanctioned credit limit, all pending dispatches for that customer are automatically hard-locked. Only a Partner user can record an explicit electronic approval override with mandatory justification notes to release the lock.
|
||||
- **Customer Payment Receipt Posting & Bounce Reversal FSM (`FR-CUSTOMERRECEIVABLES-004`):** Record customer payment receipts capturing receipt date, customer ID, received amount INR, payment instrument mode (`NEFT`, `RTGS`, `Cheque`, `Cash`, `UPI`), bank reference/UTR number, and clearance status (`Pending Clearance`, `Cleared`, `Bounced`). Enforce automatic atomic reversal upon Cheque/Instrument Bounce: immediately reverse sub-ledger credit, restore outstanding receivables, recompute exposure ratio %, reinstate credit locks if exposure $>100\%$, and trigger an urgent financial alert.
|
||||
|
||||
2. **Supplier Payables & Aging (`UC-012`):**
|
||||
- **Supplier Payables Aging & Balance Snapshots (`FR-SUPPLIERPAYABLES-001`):** Track supplier liabilities arising from accepted Goods Receipt Notes (GRNs), applying supplier credit days to compute due dates, generating aging schedules, and providing daily aggregate payables balance snapshots.
|
||||
|
||||
3. **Mandi Operating Expenses (`UC-013`):**
|
||||
- **Mandi Operating Expense Classification & Recording (`FR-OPERATINGEXPENSES-001`):** 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`. Enforce atomic double-entry debit against expense account and credit against cash/bank ledger account.
|
||||
|
||||
---
|
||||
|
||||
## 2. Demo & Acceptance Criteria
|
||||
|
||||
Planned demo evidence for Iteration 05 review:
|
||||
1. **Customer Sub-Ledger & Aging:** Accounts Executive views customer party ledger for Adani Wilmar (`CUST-001`) showing debit entries from sales invoices and credits from receipts. System renders multi-bucket aging breakdown (`0–7d`, `8–15d`, `16–30d`, `>30d`).
|
||||
2. **Automated Credit Exposure Watch Alert:** When customer outstanding reaches ₹42,50,000 against sanctioned limit ₹50,00,000 (85.0% exposure), system automatically tags account with `WATCH` badge and triggers inline dashboard alert.
|
||||
3. **Credit Breach Dispatch Lock & Partner Override:** When an invoice pushes customer balance to ₹52,00,000 (104.0% exposure), pending dispatches for `CUST-001` are locked. Attempting dispatch scheduling returns a credit breach lock error. Partner enters electronic authorization key with justification "Board approved temporary harvest facility" to release the lock.
|
||||
4. **Payment Receipt Posting & Bounce Reversal FSM:** Accounts Executive posts receipt `PAY-202610-001` for ₹15,00,000 via Cheque #445901 with status `Pending Clearance`. Upon clearance, customer balance decreases by ₹15,00,000. When Cheque is marked `Bounced` (insufficient funds), system atomically reverses the credit, reinstates ₹15,00,000 outstanding debt, re-locks dispatches, and emits an alert.
|
||||
5. **Supplier Payables Aging:** Accounts Executive reviews supplier payables for Neemuch Farmer Producer Co-op (`SUPP-001`). System computes due dates based on GRN date + 15 credit days and classifies overdue aging.
|
||||
6. **Operating Expense Voucher Balancing:** Accounts Executive records ₹12,500 for `Labor / Hamali` with cash payment mode. System verifies atomic balance between expense debit and cash account credit.
|
||||
7. **Quality & Coverage Compliance:**
|
||||
- Backend domain/FSM statement coverage: $\ge 95.0\%$
|
||||
- Integration adapter coverage: $\ge 90.0\%$
|
||||
- Frontend components coverage: $\ge 80.0\%$
|
||||
8. **Gate 14.1 Density:**
|
||||
- 21-sheet Excel QA Workbook with $\ge 20$ dense test cases across receivables, payables, and expenses.
|
||||
- Git-versioned Bruno API collections (`.bru`) under `docs/api/bruno/receivables/`, `docs/api/bruno/payables/`, `docs/api/bruno/expenses/`.
|
||||
- Multi-path 4-dimension functional test models in `07_test_design/functional_test_cases/` for `UC-011`, `UC-012`, `UC-013`.
|
||||
|
||||
---
|
||||
|
||||
## 3. Carried-Over Scope & Regression Debt
|
||||
|
||||
- **Carried-over stories from previous iterations:** None. Iterations 01, 02, 03, and 04 are 100% delivered and E2E verified in live container infrastructure ([`CKPT-025`](file:///home/ps-ch/w/prj/mandi/04_generated_documentation/00_process_control/checkpoints/checkpoint-025-iteration-04-construction-delivery.md)).
|
||||
- **Regression debt from `regression_test_cases.md`:** All 115 automated tests from Iterations 01, 02, 03, and 04 (OIDC Auth, RBAC 11 roles, Tenant Lifecycle FSM, PostgreSQL RLS, Mandi Market Desk, Sauda Procurement, Gate Inward Weighbridge, GRN Lot minting, Lab QC FSM, Multi-Godown Stock Ledger, Customer Sales Contracts, Outbound Weighbridge Bilty, and Fleet Registry) are continuously executed and regression-tested.
|
||||
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
# Iteration Delivery Surface Matrix — Iteration 05
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| **Iteration** | `iteration-05` |
|
||||
| **Governed Standard** | UP-AI v1.5 Stage 10 Standard |
|
||||
| **Status** | In Planning (Stage 10 Planned) |
|
||||
| **Version** | 1.0.0 |
|
||||
| **Last CR** | none |
|
||||
|
||||
---
|
||||
|
||||
## 11-Dimension Delivery Surface Coverage
|
||||
|
||||
| Story ID | Parent FR | Portal / Screen | Route | API Endpoint | DB Migration | Sandbox / Mock | Config / Secret | Test Scopes | Dev Owner | QA Owner | Surface Status |
|
||||
|---|---|---|---|---|---|---|---|---|---|---|---|
|
||||
| `STORY-REC-001` | `FR-CUSTOMERRECEIVABLES-001` | Customer Sub-Ledger & Aging View | `/finance/receivables` | `GET /api/v1/finance/receivables/ledger`, `GET /api/v1/finance/receivables/aging` | Table `party_subledgers` (Alembic `012_finance_settlement.py`) | `sandbox/customer_credit_mock.py` | none | Unit, Immutability check, Aging buckets (0–7d, 8–15d, 16–30d, >30d), API (Bruno) | `@backend-dev-alpha`, `@ui-dev-alpha` | `@adversarial-tester` | In Planning |
|
||||
| `STORY-REC-002` | `FR-CUSTOMERRECEIVABLES-002` | Credit Exposure Dashboard & Watch Alert | `/finance/receivables/exposure` | `GET /api/v1/finance/receivables/exposure` | Schema fields on `party_subledgers` (Alembic `012_finance_settlement.py`) | `sandbox/customer_credit_mock.py` | Credit Watch threshold (`CREDIT_WATCH_THRESHOLD_PCT=80.0`) | Unit, Boundary ($>80\%$), Visual alert flag | `@backend-dev-alpha`, `@ui-dev-alpha` | `@adversarial-tester` | In Planning |
|
||||
| `STORY-REC-003` | `FR-CUSTOMERRECEIVABLES-003` | Credit Breach Dispatch Lock & Override Modal | `/finance/receivables/locks` | `GET /api/v1/finance/receivables/locks`, `POST /api/v1/finance/receivables/locks/{id}/override` | Table `credit_dispatch_locks` (Alembic `012_finance_settlement.py`) | Dispatch blocking integration | Credit Lock threshold (`CREDIT_LOCK_THRESHOLD_PCT=100.0`) | Unit, Dispatch lock invariant, Partner authorization check, Immutable audit trail | `@backend-dev-alpha`, `@adversarial-tester` | `@adversarial-tester` | In Planning |
|
||||
| `STORY-REC-004` | `FR-CUSTOMERRECEIVABLES-004` | Payment Receipt Register & Bounce Reversal Console | `/finance/receipts`, `/finance/receipts/new` | `POST /api/v1/finance/receivables/receipts`, `POST /api/v1/finance/receivables/receipts/{id}/clear`, `POST /api/v1/finance/receivables/receipts/{id}/bounce` | Table `customer_payment_receipts` (Alembic `012_finance_settlement.py`) | `sandbox/payment_mock.py` | Supported payment instruments (`NEFT`, `RTGS`, `Cheque`, `Cash`, `UPI`) | Unit, FSM Invariants (`Pending` -> `Cleared`, `Pending` -> `Bounced`), Atomic ledger reversal | `@backend-dev-alpha`, `@ui-dev-alpha` | `@adversarial-tester` | In Planning |
|
||||
| `STORY-PAY-001` | `FR-SUPPLIERPAYABLES-001` | Supplier Payables & Aging Console | `/finance/payables` | `GET /api/v1/finance/payables`, `POST /api/v1/finance/payables/disbursements`, `GET /api/v1/finance/payables/snapshot` | Table `supplier_payables`, `supplier_disbursements` (Alembic `012_finance_settlement.py`) | GRN invoice fixtures | Default credit terms (`DEFAULT_SUPPLIER_CREDIT_DAYS=15`) | Unit, Due date calculation, Aging buckets, Partial disbursement, API (Bruno) | `@backend-dev-beta`, `@ui-dev-beta` | `@adversarial-tester` | In Planning |
|
||||
| `STORY-EXP-001` | `FR-OPERATINGEXPENSES-001` | Mandi Operating Expense Voucher Screen | `/finance/expenses`, `/finance/expenses/new` | `POST /api/v1/finance/expenses`, `GET /api/v1/finance/expenses` | Table `mandi_expense_vouchers`, `cash_bank_accounts` (Alembic `012_finance_settlement.py`) | Bank account seed mock | Approved expense categories | Unit, Double-entry balancing invariant (Debit == Credit), Category validation, API (Bruno) | `@backend-dev-gamma`, `@ui-dev-gamma` | `@adversarial-tester` | In Planning |
|
||||
|
||||
---
|
||||
|
||||
## Surface Breakdown & Responsibilities
|
||||
|
||||
1. **Frontend Portal / Screen Surfaces:**
|
||||
- **Customer Receivables & Credit Desk (`STORY-REC-001`, `002`, `003`):** React console for Accounts Executives and Sales Managers to view immutable customer ledgers, inspect 4-bucket aging schedules, monitor real-time credit exposure with inline `Watch` indicators ($>80\%$), and request Partner electronic overrides on credit breach dispatch locks ($>100\%$).
|
||||
- **Payment Receipts & Bounce Clearance (`STORY-REC-004`):** Cashier and Accounts Executive UI to post received customer payments, record bank UTR/Cheque references, trigger instrument clearance, and execute automatic atomic cheque bounce reversals.
|
||||
- **Supplier Payables & Disbursements (`STORY-PAY-001`):** Accounts Executive screen to view supplier payables generated from accepted GRNs, compute due dates based on supplier credit terms, review aging buckets, record disbursements, and monitor daily liquidity snapshots.
|
||||
- **Mandi Operating Expenses (`STORY-EXP-001`):** Operating expense voucher screen to record daily Mandi charges (Hamali, Tolai, Mandi Cess, Freight, Fumigation) with cash/bank account balancing.
|
||||
2. **Backend API Endpoints:**
|
||||
- Receivables APIs: `/api/v1/finance/receivables/ledger`, `/api/v1/finance/receivables/aging`, `/api/v1/finance/receivables/exposure`, `/api/v1/finance/receivables/locks`, `/api/v1/finance/receivables/locks/{id}/override`, `/api/v1/finance/receivables/receipts`, `/api/v1/finance/receivables/receipts/{id}/clear`, `/api/v1/finance/receivables/receipts/{id}/bounce`.
|
||||
- Payables APIs: `/api/v1/finance/payables`, `/api/v1/finance/payables/disbursements`, `/api/v1/finance/payables/snapshot`.
|
||||
- Expense APIs: `/api/v1/finance/expenses`.
|
||||
3. **Database & Migrations:**
|
||||
- Alembic migration `012_finance_settlement.py`: `party_subledgers`, `credit_dispatch_locks`, `customer_payment_receipts`, `supplier_payables`, `supplier_disbursements`, `mandi_expense_vouchers`, `cash_bank_accounts` with PostgreSQL RLS enabled and forced.
|
||||
4. **Integration Sandboxes (Wave 0):**
|
||||
- Deterministic payment adapter in `sandbox/payment_mock.py` simulating UTR clearance, cheque bounce simulation, and bank account balances.
|
||||
5. **Quality Assurance Deliverables:**
|
||||
- Bruno API Collections under `docs/api/bruno/receivables/`, `docs/api/bruno/payables/`, `docs/api/bruno/expenses/`.
|
||||
- 21-sheet Excel QA Workbook with $\ge 20$ dense test cases across all financial categories.
|
||||
- Multi-Path Automated Tests in `tests/backend/` and `tests/e2e/`.
|
||||
|
||||
|
|
@ -0,0 +1,104 @@
|
|||
# Parallel Work Plan — Iteration 05 (Financial Settlement, Receivables, Payables & Expenses)
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| **Iteration** | `iteration-05` |
|
||||
| **Governed Standard** | UP-AI v1.5 Stage 10 Standard |
|
||||
| **Status** | Approved Plan (Stage 10 Planned) |
|
||||
| **Version** | 1.0.0 |
|
||||
| **Last CR** | none |
|
||||
|
||||
---
|
||||
|
||||
## 1. Wave 0 Deterministic Sandboxes & Shared Foundation
|
||||
|
||||
In compliance with UP-AI v1.5 rules for financial and third-party accounting dependencies, Wave 0 establishes deterministic in-memory sandboxes before business logic execution begins:
|
||||
|
||||
- **`sandbox/payment_mock.py`:** Pre-seeds bank accounts (e.g. State Bank of India Neemuch Mandi Branch, HDFC Bank Indore Operations), simulates bank UTR clearance, and provides deterministic trigger methods for Cheque clearance and Cheque bounce events (`status="Bounced"`, `bounce_reason="Insufficient Funds"`).
|
||||
- **`sandbox/customer_credit_mock.py`:** Reuses established customer credit fixtures (`CUST-001` to `CUST-005`), integrating party sub-ledger debit/credit operations with sanctioned limit calculations.
|
||||
|
||||
---
|
||||
|
||||
## 2. Implementation Lanes & Work Distribution
|
||||
|
||||
```mermaid
|
||||
graph TD
|
||||
subgraph Wave0 [Wave 0: Foundation & Sandboxes]
|
||||
MOCK1["sandbox/payment_mock.py (Bank Accounts, UTR, Bounce)"]
|
||||
MOCK2["sandbox/customer_credit_mock.py (Integrated AR)"]
|
||||
end
|
||||
|
||||
subgraph Lanes [Parallel Construction Lanes]
|
||||
L1["Lane 1: Customer Receivables & Credit Locks (STORY-REC-001..004)"]
|
||||
L2["Lane 2: Supplier Payables & Aging (STORY-PAY-001)"]
|
||||
L3["Lane 3: Mandi Operating Expenses (STORY-EXP-001)"]
|
||||
end
|
||||
|
||||
subgraph Integration [Unified Integration & Verification]
|
||||
INT["Alembic 012 Migration + Finance APIs + Live Container E2E"]
|
||||
end
|
||||
|
||||
Wave0 --> L1
|
||||
Wave0 --> L2
|
||||
Wave0 --> L3
|
||||
L1 --> INT
|
||||
L2 --> INT
|
||||
L3 --> INT
|
||||
```
|
||||
|
||||
### Lane 1: Customer Receivables, Aging, Credit Locks & Receipts
|
||||
- **Stories:** `STORY-REC-001`, `STORY-REC-002`, `STORY-REC-003`, `STORY-REC-004` (18 Story Points)
|
||||
- **Owners:** `@backend-dev-alpha`, `@ui-dev-alpha`
|
||||
- **Assigned Surfaces:**
|
||||
- Backend domain entities: `PartySubLedgerEntry`, `CustomerAgingSchedule`, `CreditDispatchLock`, `CustomerPaymentReceipt`.
|
||||
- Backend controller: `ReceivablesController` in `app/api/finance.py`.
|
||||
- Frontend screens: `/finance/receivables`, `/finance/receivables/exposure`, `/finance/receipts`.
|
||||
- Automated tests: `tests/backend/test_customer_receivables.py`.
|
||||
- **Allowed Scope:** Customer sub-ledger debit/credit entries, 4-bucket aging schedule, exposure ratio %, credit breach dispatch locking ($>100\%$), Partner electronic override workflow, receipt posting across instruments, and atomic cheque bounce reversal FSM.
|
||||
|
||||
### Lane 2: Supplier Payables & GRN Due Date Aging
|
||||
- **Stories:** `STORY-PAY-001` (5 Story Points)
|
||||
- **Owners:** `@backend-dev-beta`, `@ui-dev-beta`
|
||||
- **Assigned Surfaces:**
|
||||
- Backend domain entities: `SupplierPayable`, `SupplierDisbursement`.
|
||||
- Backend controller: `PayablesController` in `app/api/finance.py`.
|
||||
- Frontend screen: `/finance/payables`.
|
||||
- Automated tests: `tests/backend/test_supplier_payables.py`.
|
||||
- **Allowed Scope:** Tracking supplier liabilities from accepted GRNs, due date calculation ($\text{GRN Date} + \text{Credit Days}$), overdue aging classification, disbursement recording, and daily aggregate payables snapshot.
|
||||
|
||||
### Lane 3: Mandi Operating Expense Vouchers & Double-Entry Balancing
|
||||
- **Stories:** `STORY-EXP-001` (5 Story Points)
|
||||
- **Owners:** `@backend-dev-gamma`, `@ui-dev-gamma`
|
||||
- **Assigned Surfaces:**
|
||||
- Backend domain entities: `MandiExpenseVoucher`, `CashBankAccount`.
|
||||
- Backend controller: `ExpenseController` in `app/api/finance.py`.
|
||||
- Frontend screen: `/finance/expenses`.
|
||||
- Automated tests: `tests/backend/test_mandi_expenses.py`.
|
||||
- **Allowed Scope:** Expense categorization (`Labor / Hamali`, `Freight / Cartage`, `Weighbridge Fees`, `Godown Rent`, `Mandi Cess`, `Pest Control`, `Office Expenses`), atomic double-entry debit/credit ledger validation, and cash/bank balance tracking.
|
||||
|
||||
---
|
||||
|
||||
## 3. Shared Artifacts & Coordination Protocol
|
||||
|
||||
| Shared Artifact | Sole Owner | Coordination Protocol |
|
||||
|---|---|---|
|
||||
| Database Migration `012_finance_settlement.py` | Lane 1 (`@backend-dev-alpha`) | Lane 2 and Lane 3 declare required tables (`supplier_payables`, `mandi_expense_vouchers`); Lane 1 compiles single atomic Alembic migration with PostgreSQL RLS enabled and forced across all tables. |
|
||||
| API Router `backend/app/api/finance.py` | Lane 1 (`@backend-dev-alpha`) | Modular class architecture (`ReceivablesController`, `PayablesController`, `ExpenseController`) mounted under unified `/api/v1/finance` prefix in `main.py`. |
|
||||
| 21-Sheet Excel QA Workbook | QA Lead (`@adversarial-tester`) | Single compiler script `scripts/generate_manual_qa_workbook.py` produces `Iteration05_Financial_Settlement_Complete_Manual_Testcases.xlsx`. |
|
||||
|
||||
---
|
||||
|
||||
## 4. Integration, Merge Order & Verification Evidence
|
||||
|
||||
1. **Phase 1: Wave 0 Sandbox Scaffolding**
|
||||
- Verify `sandbox/payment_mock.py` bank accounts, UTR verification, and bounce simulation.
|
||||
2. **Phase 2: Domain Logic & Unit Test Execution**
|
||||
- Execute domain tests in parallel: `test_customer_receivables.py`, `test_supplier_payables.py`, `test_mandi_expenses.py`.
|
||||
- Achieve $\ge 95.0\%$ AST statement coverage in `tests/run_all_tests.py`.
|
||||
3. **Phase 3: Live PostgreSQL 17 Migration & Container Deployment**
|
||||
- Apply Alembic revision `012_finance_settlement.py` inside live container `atb-backend-test`.
|
||||
- Verify PostgreSQL RLS tenant isolation across all financial tables.
|
||||
4. **Phase 4: Real-Runtime Live Container E2E Lifecycle Suite**
|
||||
- Execute containerized HTTP integration test `tests/e2e/test_live_finance_settlement_e2e.py` covering: Customer Ledger $\to$ Exposure Watch $\to$ Credit Breach Dispatch Lock $\to$ Partner Override $\to$ Receipt Posting $\to$ Cheque Bounce Reversal $\to$ Supplier Payables Aging $\to$ Operating Expense Balancing.
|
||||
- Cumulative E2E test suite passing.
|
||||
|
||||
|
|
@ -275,3 +275,24 @@ Executed Stage 13 (Construction Code Generation) and Stage 14 (Defect Fix, E2E V
|
|||
- Executed `scripts/verify_traceability_gates.py --all`: Gates 9.1 and 14.1 (iterations 01, 02, 03, 04) all **PASSED** (0 Critical, 0 Major, 0 Minor).
|
||||
- Authored Checkpoint `CKPT-025` (`checkpoint-025-iteration-04-construction-delivery.md`).
|
||||
- Updated `checkpoint_index.md` and `master_context.md`.
|
||||
|
||||
## 2026-10-12T10:18:00Z — User
|
||||
|
||||
proceed
|
||||
|
||||
## 2026-10-12T10:24:00Z — Assistant — Action summary
|
||||
|
||||
Executed Stage 10 Iteration Planning (`/up-iteration-plan`) for Iteration 05 (Financial Settlement, Customer Receivables, Supplier Payables & Operating Expenses):
|
||||
1. Iteration 04 Retrospective:
|
||||
- Authored `04_generated_documentation/05_iteration_planning/iterations/iteration-04/retrospective.md` formalizing delivery of Iteration 04 (10 FRs, 40 SP, 115 unit tests passing with 95.0% coverage, 14 live container E2E tests, 0 carried-over stories, 0 open CRs).
|
||||
2. Iteration 05 Scope & Backlog:
|
||||
- Selected vertical slice spanning `UC-011` (Customer Receivables and Credit Controls), `UC-012` (Supplier Payables and Aging), and `UC-013` (Mandi Operating Expenses).
|
||||
- Authored `iteration_plan.md` defining 28-point capacity across 6 stories, demo criteria, and regression test continuity.
|
||||
- Authored `iteration_backlog.md` detailing `STORY-REC-001`–`004`, `STORY-PAY-001`, and `STORY-EXP-001` with explicit acceptance criteria, mathematical formulas, and immutable accounting rules.
|
||||
3. Delivery Surface Matrix & Parallel Work Plan:
|
||||
- Authored `iteration_surface_matrix.md` covering all 11 dimensions across React screens, FastAPI endpoints, Alembic migration `012_finance_settlement.py`, Wave 0 sandboxes, and test scopes.
|
||||
- Authored `parallel_work_plan.md` establishing Wave 0 mock (`sandbox/payment_mock.py`) and 3 isolated parallel lanes (Lane 1: Customer Receivables & Credit Locks, Lane 2: Supplier Payables & Aging, Lane 3: Mandi Operating Expenses).
|
||||
4. Traceability & Governance:
|
||||
- Advanced `UC-011`, `UC-012`, `UC-013` and their 6 child FRs (`FR-CUSTOMERRECEIVABLES-001`–`004`, `FR-SUPPLIERPAYABLES-001`, `FR-OPERATINGEXPENSES-001`) from `Draft` to `In Construction` in `traceability_graph.md`.
|
||||
- Verified Quality Gate 9.1 and Gate 14.1 (for delivered iterations 01–04) with zero blocking issues.
|
||||
- Authored Checkpoint `CKPT-026` (`checkpoint-026-iteration-05-planning.md`), updated `checkpoint_index.md` and `master_context.md`.
|
||||
|
|
|
|||
Loading…
Reference in New Issue