# Agriculture Trading Backoffice — Master Context | Field | Value | |---|---| | **Project** | Agriculture Trading Backoffice | | **Code** | `ATB` | | **Archetype** | Greenfield (0-to-1) | | **Active Process** | AI-Native Unified Process (UP-AI v1.5) | | **Governance Tier** | `tier_2_standard_enterprise` | | **Last Updated** | 2026-10-13 | | **Last Checkpoint** | CKPT-034 | | **Last CR** | CR-001 (Closed) | | **Active Phase** | Phase IV — Transition (Stages 15–18 Complete) | --- ## 1. Project Goal & Overview Agriculture Trading Backoffice (ATB) is a greenfield, India-first multi-tenant backoffice platform for agricultural trading firms. The stakeholder-reviewed PRD at [`01_BRD/PRD_Specification.md`](../../../01_BRD/PRD_Specification.md) is baselined for Stage 1 extraction under bounded assumptions; pilot, legal/accounting, and load-test evidence gates remain open for production readiness. --- ## 2. Active Technology Profile Derived authoritatively from [`tech-profile.yaml`](../../tech-profile.yaml): ```yaml stack: architecture_pattern: "modular_monolith" multi_tenancy: enabled: true model: "row_level_security" backend: language: "python" framework: "fastapi" orm: "sqlalchemy" migrations: "alembic" api_standard: "rest_openapi" test_framework: "pytest" coverage_tool: "pytest-cov" frontend: framework: "react" language: "typescript" state_management: "zustand" ui_library: "tailwind_shadcn" test_framework: "vitest" e2e_framework: "playwright" authentication: provider: "keycloak" protocol: "oidc_pkce" token_standard: "jwt_bearer" authorization_model: "rbac_abac" database: primary: "postgresql" cache_and_streams: "valkey" search_engine: "none" sandboxes: - identity_provider: deterministic mock at sandbox/identity_mock.py - payment_gateway: deterministic mock at sandbox/payment_mock.py - messaging_service: deterministic mock at sandbox/notification_mock.py quality: tailoring_tier: "tier_2_standard_enterprise" backend_domain_fsm_coverage: 95.0 integration_adapter_coverage: 90.0 frontend_component_coverage: 80.0 ``` --- ## 3. Directory Layout & Traceability Spine ``` 01_BRD/ # Business Requirements & PRD inputs 04_generated_documentation/ ├── 00_process_control/ # Master context, registers, decisions, checkpoints ├── 01_source_inventories/ # PRD / Feature extractions (BRD-FR-xxx) ├── 02_legacy_analysis/ # Brownfield legacy code, DB & screen mining ├── 03_requirements/use_cases/ # Atomic Use Cases (UC-xxx) & Functional Reqs (FR-xxx) ├── 04_architecture_design/ # HLD, LLD (API/Table/Event contracts), Spike Reports ├── 05_iteration_planning/ # Iteration backlogs, plans, and surface matrices ├── 06_wireframes/ # Screen specifications, wireframes, DESIGN.md ├── 07_test_design/ # Test strategies, Multi-path models, 21-sheet QA Workbooks └── 08_review_ready_baselines/ # Stage 18 review-ready baselines and handover ``` --- ## 4. Active Stage & Next Actions - **Current Stage:** Phase IV — Transition Complete (Stages 15–18 Complete — [`CKPT-034`](checkpoints/checkpoint-034-transition-handover-baseline.md)). - **Exit Gate:** **Quality Gate QG-T PASSED** (Certified for UAT & Production Deployment). - **Core Scope Delivery Status:** 100% of defined operational and trading use cases (`UC-001` through `UC-020`, `UC-026`) and 49 Functional Requirements are **`Delivered (E2E Verified)`**. - **Delivered Iterations:** - `iteration-01` (AuthN/AuthZ, OIDC PKCE, RBAC 11 roles, Session Revocation): **`Delivered (E2E Verified)`** - `iteration-02` (Multi-Tenant Control Plane, Tenant Lifecycle FSM, PostgreSQL 17 RLS Policies, Context Resolver, Append-Only Audit Trail): **`Delivered (E2E Verified)`** - `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)`** - `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)`** - `iteration-05` (Financial Settlement, Customer Receivables, Supplier Payables & Operating Expenses: `UC-011`, `UC-012`, `UC-013`): **`Delivered (E2E Verified)`** - `iteration-06` (Operational Alerts Engine, Event Outbox, Market Price Trends & Executive Dashboard: `UC-003`, `UC-014`, `UC-015`): **`Delivered (E2E Verified)`** - `iteration-07` (Platform Master Data Governance, Tenant Operating Policies & Controlled Privileged Support Access: `UC-016`, `UC-020`, `UC-026`): **`Delivered (E2E Verified)`** - **Transition Deliverables (Stages 15–18):** - Stage 15 (DevOps): Multi-stage Dockerfiles (`Dockerfile.backend`, `Dockerfile.frontend`), Nginx configuration, Production Compose (`docker-compose.prod.yaml`), GitHub Actions CI/CD (`.github/workflows/ci.yml`). - Stage 16 (UAT Package): Release Notes v1.0.0, Known Issues & Limitations, Cumulative Regression Evidence (182 unit tests, 95.3% statement coverage, 17 container E2E tests), Production Readiness Checklist (28/28 DoD criteria verified). - Stage 17 (Handover Package): Deployment Runbook, Operational Runbook, API Integration Guide, Disaster Recovery Runbook (RPO $\le 15$m, RTO $\le 4$h). - Stage 18 (Baselines): Master Traceability Baseline (54 FRs, 26 UCs), Stakeholder Sign-Off Brief (Human Review Brief per §8.6), Gate QG-T Report (PASSED). - **Next Action:** Present transition package and stakeholder sign-off brief for executive human review and pilot commissioning.