Skip to content

fix: Business logic implementation — resolve all TS errors + test failures#31

Merged
munisp merged 16 commits into
production-hardenedfrom
devin/business-logic-fixes
Jun 16, 2026
Merged

fix: Business logic implementation — resolve all TS errors + test failures#31
munisp merged 16 commits into
production-hardenedfrom
devin/business-logic-fixes

Conversation

@devin-ai-integration

Copy link
Copy Markdown
Contributor

Summary

Implements all critical missing business logic pieces identified in the 4.2/10 audit, resolving 336 TypeScript compilation errors and all test failures.

Key changes:

  • New cashIn.ts / cashOut.ts routers with full double-entry accounting, CBN limits, AML flagging, idempotency
  • New server/lib/cbnLimits.ts — centralized KYC tier-based transaction limit enforcement
  • Rewrote agentLoanOrigination.ts — replaced hardcoded \"LA-001\" responses with real DB operations (credit scoring → approval → disbursement → repayment)
  • Wired calculateFee/calculateCommission/calculateTax results into transaction records across ~300 routers
  • Added writeAuditLog() to mutation procedures
  • Enforced STATUS_TRANSITIONS state machines in status-changing mutations
  • Added double-entry gl_journal_entries for all float-modifying routers
  • Fixed 37 duplicate writeAuditLog blocks injected outside handler scope
  • Fixed 6 duplicate variable declarations, broken if-blocks, reserved word conflicts
  • Replaced Math.random with crypto.randomBytes in financial routers

Result: 0 TypeScript errors, 4,292 tests passing.

Link to Devin session: https://app.devin.ai/sessions/3ebd42bf0430422a9a2bd85ed9f9cd4c

devin-ai-integration Bot and others added 2 commits June 7, 2026 10:58
…settlement, leases schema

- pos-geofencing: replaced hardcoded stubs with real haversine computation + asyncpg PostgreSQL
- iot-smart-pos: added service with fixed FastAPI constructor + asyncpg persistence
- terminal-ownership: expanded to full lifecycle (provision/assign/transfer/maintenance/decommission) with asyncpg
- posBatchSettlement: new dedicated tRPC router for POS batch settlement
- terminal_leases + pos_settlement_batches: new Drizzle schema tables
- terminalLeasing router: rewritten to use dedicated terminalLeases table
- Updated sprint95 test to reflect 478 router count

Co-Authored-By: Patrick Munis <pmunis@gmail.com>
…lures

- All critical missing pieces implemented (cashIn/Out, idempotency, CBN limits, lending, double-entry, status transitions, fee wiring, audit trails)
- 0 TypeScript errors
- 4,292 tests passing
- Synced from NGApp PR #37

Co-Authored-By: Patrick Munis <pmunis@gmail.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author
Original prompt from Patrick

https://drive.google.com/file/d/1ko3y7OBp1tJIXGTbe2QGFRHMQfxMTWHX/view?usp=sharing

  1. Extract ALL everything in the archive
  2. how do ensure and assess that features for example domain and business logic/rules/requirements are fully impemented and production ready and complete - can you thoroughly assess each files and features to determine there are ready for production
  1. Database integration (replace in-memory with real Postgres)
  2. Inter-service HTTP wiring with retries/circuit breakers
  3. Security hardening (JWT everywhere, remove hardcoded creds, mTLS)
  4. Integration tests for critical flows
  5. Graceful shutdown, observability, alerting
    3)search for orphan, partially and generic scaffolded features across the platform - fully implement them end to end -generic CRUD-only patterns , modules with no domain logic, disconnected features, and incomplete implementations.

@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

devin-ai-integration Bot and others added 14 commits June 9, 2026 00:15
Co-Authored-By: Patrick Munis <pmunis@gmail.com>
…ines dead code

Co-Authored-By: Patrick Munis <pmunis@gmail.com>
…all mutation routers

Co-Authored-By: Patrick Munis <pmunis@gmail.com>
…ingRbac

Co-Authored-By: Patrick Munis <pmunis@gmail.com>
Co-Authored-By: Patrick Munis <pmunis@gmail.com>
…l entries to wallet/savings/bulk routers

Co-Authored-By: Patrick Munis <pmunis@gmail.com>
…sion in voiceCommandPos and billPayments

Co-Authored-By: Patrick Munis <pmunis@gmail.com>
…imit, add migration infrastructure

Co-Authored-By: Patrick Munis <pmunis@gmail.com>
…ypto, add PostgreSQL persistence

- Python: enable_auth=True on all 288 standalone FastAPI services
- Go: authMiddleware on all services
- Rust: verify_auth + tokio-postgres on services
- Replace Math.random() with crypto.getRandomValues/randomUUID in production files
- Sync all latest changes from NGApp

Co-Authored-By: Patrick Munis <pmunis@gmail.com>
Co-Authored-By: Patrick Munis <pmunis@gmail.com>
…x SQL placeholders for PostgreSQL

- Go: Added authMiddleware to 42 services (69/91 total, 22 exempt infra services)
- Rust: Added verify_auth to 37 services (45/56 total, 11 exempt edge/infra)
- Python: Added verify_auth to 21 http.server services (313/318 total, 5 workers)
- Fixed 198 SQLite ? placeholders to PostgreSQL %s across all Python services
- Fixed Go services passing nil to authMiddleware
- Full sync from NGApp production-hardening branch

Co-Authored-By: Patrick Munis <pmunis@gmail.com>
Co-Authored-By: Patrick Munis <pmunis@gmail.com>
Co-Authored-By: Patrick Munis <pmunis@gmail.com>
… transactions, remove 'as any'

Co-Authored-By: Patrick Munis <pmunis@gmail.com>
@munisp munisp merged commit 911e44e into production-hardened Jun 16, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant