Development Workflow
Feature branch
All work occurs on feature branches. No direct commits to
main. Branch naming convention follows the issue tracker reference.Local quality gates
Developers run
npm run lint (ESLint) and npm test (Vitest) before pushing. ESLint is configured with eslint-config-next for Next.js-aware rules.Pull request
PRs require at least one reviewer approval. The CI pipeline must pass before merge is permitted.
CI pipeline
GitHub Actions runs type-checking, linting, unit tests, and security tests on every PR. See CI section below.
CI Pipeline
The CI pipeline enforces the following gates on every pull request:| Gate | Tool | Failure blocks merge? |
|---|---|---|
| Type checking | tsc --noEmit | ✅ |
| Linting | ESLint (eslint-config-next) | ✅ |
| Unit tests | Vitest | ✅ |
| Security tests | Vitest (security suite) | ✅ |
| E2E tests | Playwright | ✅ |
| Dependency audit | npm audit | Configured per policy |
ESLint runs as a dedicated CI step and is skipped during
next build (configured in next.config.ts) to avoid duplicate work and keep build times predictable.Testing Strategy
Unit Tests (Vitest)
Located insrc/tests/. Cover:
- Domain logic — FSM state machine transitions for
SchemeandMemberentities - Change proposal — proposal creation, approval, rejection, expiry logic
- Security regression —
src/tests/api/security.test.tsverifies that API routes never leak connection strings, stack traces, or environment variable names in error responses
Security Tests
The security test suite (src/tests/api/security.test.ts) specifically tests:
- DB health endpoint does not expose PostgreSQL connection strings in 503 responses
- Ready endpoint does not enumerate missing environment variable names
- API routes return clean error messages without stack traces or
node_modulespaths
E2E Tests (Playwright)
Playwright tests cover critical user journeys including health endpoint availability. Configuration inplaywright.config.ts.
Code Review Standards
Every PR is reviewed for:- Authentication and authorisation — does the new route check
sessionand scope bybrokerId? - Sensitive data handling — is PPS data handled via the encrypted field? Is it excluded from logs?
- Audit logging — do material changes write to
audit_logs? - Error handling — do catch blocks return sanitised messages, not raw errors?
Dependency Management
package-lock.jsonis committed and pinnednpm auditis run in CI to detect known vulnerabilities- Dependabot (or equivalent) is configured for automated dependency update PRs
Secrets in Code
Secrets must never be committed to the repository. The.env.example file contains placeholder values only. Real secrets are managed via Vercel environment variables. See Secrets Management.
A git-secrets or equivalent pre-commit hook is recommended for all developers to prevent accidental secret commits.