What was broken: Loading all proposals at once = slow & unbounded queries
Files Changed:
- ✅
backend/src/db/schema.ts- Addedproposalstable - ✅
backend/src/api/controllers/GovernanceController.ts- NEW (list + detail endpoints) - ✅
backend/src/routes/governance.routes.ts- NEW (route handlers) - ✅
backend/src/index.ts- Registered governance router - ✅
frontend/src/app/governance/page.tsx- Uses real API with pagination
Result: 20 proposals per page, Previous/Next buttons, proper loading states
API Example:
GET /api/governance/proposals?page=1&limit=20&status=activeWhat was broken: new Date("not-a-date").getTime() produces NaN → silently converts to 0n in BigInt
File Changed:
- ✅
frontend/src/hooks/useCreateMarket.ts- AddedvalidateScheduledAt()function
Validation Checks:
- ISO 8601 format check (rejects malformed dates)
- Future date check (rejects past dates)
- Clear error messages before transaction building
Example Error:
"Invalid date format: "not-a-date". Expected ISO 8601 format (e.g., "2025-02-15T14:30:00Z")"
What was broken: Freighter check throws error before Albedo code path → Albedo users blocked
File Changed:
- ✅
frontend/src/services/wallet.ts- FixedconnectWallet()logic
Before: if (freighter) { ... } if (albedo) { ... } throw → error if freighter missing
After: Try freighter → fallback to albedo → throw only if both missing
Result: Freighter users see Freighter, Albedo users see Albedo, both can connect
What was broken: Each Jest import creates new pg.Pool instance → test DB max connections exceeded
Files Changed:
- ✅
indexer/src/db.ts- Lazy singleton pattern - ✅
indexer/src/__tests__/indexer.test.ts- Updated cleanup to usegetDatabase()
Change: Module now creates pool only on first access, reuses for all subsequent calls
Result: Single pool instance across entire test suite; tests don't exhaust DB connections
| File | Change | Type |
|---|---|---|
backend/src/db/schema.ts |
Added proposals table |
Schema |
backend/src/api/controllers/GovernanceController.ts |
NEW governance endpoints | New |
backend/src/routes/governance.routes.ts |
NEW routes | New |
backend/src/index.ts |
Registered governance router | Config |
frontend/src/app/governance/page.tsx |
Pagination + real API | Feature |
frontend/src/hooks/useCreateMarket.ts |
Date validation | Fix |
frontend/src/services/wallet.ts |
Independent wallet checks | Fix |
indexer/src/db.ts |
Lazy singleton | Fix |
indexer/src/__tests__/indexer.test.ts |
Updated cleanup | Test |
- Governance pagination works end-to-end
- useCreateMarket rejects invalid dates with clear errors
- Wallet connection allows both Freighter and Albedo users
- Indexer tests don't exhaust DB connections
- All changes backward compatible
- No breaking API changes
- TypeScript compilation ready
-
Migrate database (if not auto-migrated):
- Create
proposalstable with schema fromISSUES_FIXED.md
- Create
-
Deploy backend:
- Push backend changes (includes governance routes)
-
Deploy frontend:
- Push frontend changes (governance page + wallet/hook fixes)
-
Deploy indexer (separate):
- Push indexer changes (lazy loading fix)
No downtime, no breaking changes.