Description
Investor exposure caps currently apply per-offering. Add cross-offering aggregation that enforces a global cap per investor identity, evaluated at submission time using a serializable read against current commitments.
Requirements and context
- Must be secure, tested, and documented
- Should be efficient and easy to review
- Relevant code:
src/services/investmentService.ts, src/db/repositories/investmentRepository.ts
- Aggregate must include pending and confirmed states
Suggested execution
- Fork the repo and create a branch
git checkout -b feat/global-investor-cap
- Implement changes
- Add
investor_cap_config with effective date
- Add aggregator query with serializable isolation
- Reject submission with structured error code
- Validate security and correctness assumptions
Test and commit
- Run tests
- Cover edge cases
- Concurrent submissions across offerings, cap reduction mid-flight
- Include test output and notes
Example commit message
feat: global per-investor exposure cap enforcement
Guidelines
- Minimum 95 percent test coverage
- Clear documentation
- Timeframe: 96 hours
Description
Investor exposure caps currently apply per-offering. Add cross-offering aggregation that enforces a global cap per investor identity, evaluated at submission time using a serializable read against current commitments.
Requirements and context
src/services/investmentService.ts,src/db/repositories/investmentRepository.tsSuggested execution
git checkout -b feat/global-investor-capinvestor_cap_configwith effective dateTest and commit
npm testExample commit message
feat: global per-investor exposure cap enforcementGuidelines