7.5 KiB
7.5 KiB
Checkpoint 035 — Sales Demo Zero-Hardcoding, Dynamic Backend Integration & Side-Effect Free Teardown
- Checkpoint ID:
CKPT-035 - Date: 2026-10-15
- Active Stage: Phase IV — Transition & Commercial Demo Governance (Steps 1 & 2 Complete)
- Active Track: Greenfield, India-first, multi-tenant Agriculture Trading Backoffice (ATB)
- Active Skills:
up-code-generate,up-defect-fix,up-context-checkpoint - Governed Standard: UP-AI v1.5 Standard Enterprise Tier (SEI-CMMI Level 3)
Completed Work This Session
-
Mock Authentication & Navigation RBAC Gating:
- Fixed single-click authentication in
LoginView.tsxby removing hardwindow.location.href = '/'and replacing with history state navigation, preventingSESSION_EXPIREDtoken race conditions. - Enforced role-based navigation gating in
App.tsxbased onROLE_PERMISSIONS: Mandi Buyer (buyer@malwa-agri.demo) automatically lands onMarket Desk(market) and sees only authorized operational tabs; administrative tabs (tenants,members,audit) are hidden.
- Fixed single-click authentication in
-
Step 1 — Zero-Hardcoding UI Dynamic API Loading:
- Refactored
MarketDeskView.tsx(SCREEN-MKT-001):- Completely removed
DEFAULT_RATESstatic array; initial staterates = [],isLoading = true. - Queries
GET /api/v1/market/observations?mandi_id=...&date=.... - When observations exist (seeded), displays live APMC clearing ticker (₹4,800/Qtl, 620 MT arrivals) and daily rate blotters.
- When zero observations exist (purged), displays clean production empty state ("No Market Observations Recorded" with
+ Record ObservationCTA). - Live form submission via
POST /api/v1/market/observationsre-fetches from backend automatically.
- Completely removed
- Refactored
SaudaProcurementView.tsx(SCREEN-PROC-001):- Completely removed
DEFAULT_SAUDASstatic array; initial statesaudas = [],isLoading = true. - Queries
GET /api/v1/procurement/saudawith status filters. - When contracts exist (seeded), displays live contract statuses (
ACTIVE,PARTIALLY_RECEIVED,CLOSED), open balance positions, and landed cost breakdowns. - When zero contracts exist (purged), displays clean production empty state ("No Purchase Contracts Booked" with
+ Book New SaudaCTA) with all KPIs zeroed. - Added
Mandi Buyertoallowed_rolesinprocurement.py, aligning withrbac.py.
- Completely removed
- Rebuilt frontend with
tsc && vite build(zero TypeScript errors) and deployed toatb-local-frontend-1:/usr/share/nginx/html/.
- Refactored
-
Step 2 — Backend Demo Seeding & Side-Effect Free Teardown Engine:
- Created
backend/app/db/demo_seed.py:seed_demo_dataset(store, tenant_id): Seeds tenant, 8 persona memberships, master commodities (SOY, CHN, WHT, MST), varieties, godowns, counterparties, fleet, operating policy, 4 daily market rate observations for Indore APMC (Soybean ₹4,800/Qtl, Chana ₹6,000/Qtl, Wheat ₹2,450/Qtl, Mustard ₹5,400/Qtl), connected storyboard transactions (SDA-2026-001throughBLT-2026-089), subledgers, payables, cess voucher, operational alerts, and 20 days of historical trading snapshots.purge_demo_dataset(store, tenant_id, purge_tenant=False): Cascades deletion across all 24 relational collections with zero residue while preserving the tenant shell and operator memberships so the logged-in application can immediately be used in a clean, empty production state.
- Configured
backend/app/db/session.pyto automatically invokeseed_demo_datasetduring container boot in mock identity mode. - Exposed
POST /api/v1/demo/seedandPOST /api/v1/demo/cleanupinbackend/app/main.py. - Updated
process/scripts/demo/seed_demo_data.pyandcleanup_demo_data.pyto synchronize running backend server athttp://localhost:8000. - Deployed updated backend to
atb-local-backend-1and restarted container.
- Created
-
Verification & Testing Evidence:
- Full regression suite:
./scripts/run_tests.sh --scope projectran 197 tests in 0.868s. 197/197 passed with 98.2% statement coverage. - Purge cycle verified:
cleanup_demo_data.py --confirm-purgeremoves all 65 demo records; counts drop to 0; UI renders clean empty states. - Seed cycle verified:
seed_demo_data.pyseeds 4 observations and 4 saudas; UI immediately reflects live data. - Live form submission verified:
POST /api/v1/market/observations(HTTP 201) andPOST /api/v1/procurement/sauda(HTTP 201) persist and reflect dynamically.
- Full regression suite:
Mid-Flight / Open Diagnoses
- Root Cause of Issue 2 (Gate 14.1 passed with only 8 screens):
- In
scripts/verify_traceability_gates.py, Gate 14.1 validated surface matrix markdown presence but never checked whether the declared React.tsxfiles actually existed inproject_code/frontend/src/. - Iterations 03–07 prematurely recorded delivery rows as
Delivered (E2E Verified)instead ofImplemented (Domain/Schema).
- In
- Root Cause of Issue 3 (Identical QA workbooks in generator):
- In
scripts/generate_manual_qa_workbook.py,get_default_iteration_cases()hardcodedUC-001,FR-AUTH-001..003, and 32 authentication test cases as a fallback. When executed across iterations 02–07, it merely replaced theTC-01-ID prefix, emitting identical Auth tests. - Gate 14.1 only checked row counts (
\ge 20) without asserting semantic alignment against the iteration's in-scope use cases.
- In
Exact Next Action Upon Resumption
- Step 4 — Process & Quality Gate Hardening:
- Update
scripts/verify_traceability_gates.py:- In Gate 14.1, verify physical existence of all declared frontend
.tsxcomponents inproject_code/frontend/src/for any row markedDelivered (E2E Verified). - In Gate 14.1, assert that QA workbook test cases semantically match in-scope use cases/FRs (
\ge 80\%matching).
- In Gate 14.1, verify physical existence of all declared frontend
- Update
scripts/generate_manual_qa_workbook.py:- Dynamically parse the iteration backlog use cases and functional test models rather than falling back to static Auth templates.
- Update
- Step 3 — Production Frontend Expansion:
- Implement the remaining 7 production React views for Journeys 2–8 (
GateEntryView,QualityLabView,StockLedgerView,SalesOrderView,DispatchBoardView,FinanceLedgerView,ExecutiveDashboardView) with zero hardcoding, connecting them to existing backend APIs and demo data.
- Implement the remaining 7 production React views for Journeys 2–8 (