Skip to content

feat-002: KYC Verification Stub#7

Closed
leecampbell-codeagent wants to merge 9 commits into
ralph/feat-001-account-authfrom
ralph/feat-002-kyc-stub
Closed

feat-002: KYC Verification Stub#7
leecampbell-codeagent wants to merge 9 commits into
ralph/feat-001-account-authfrom
ralph/feat-002-kyc-stub

Conversation

@leecampbell-codeagent
Copy link
Copy Markdown
Owner

Summary

  • Implements KYC verification stub with GET /api/v1/kyc/status and POST /api/v1/kyc/submit endpoints; stub auto-approves (not_started → pending → verified) in a single request with two audit events
  • New KYC bounded context (packages/backend/src/kyc/) with StubKycVerificationAdapter, KycAppService, and immutable kyc_audit_events audit table; atomic state transitions via conditional WHERE (G-020)
  • KycStatusBadge and KycVerificationPanel frontend components added to /settings/profile page; KycStatus value renamed 'failed'→'rejected' (G-018)

Stacked on: ralph/feat-001-account-auth (merge parent PR first)

Screenshots

Screenshots: app stack requires Clerk credentials and Docker — see Manual Task #1 and #2. All 356 tests pass as proxy verification.

Quality Gate

  • Tests: 356/356 passing (143 backend + 213 frontend)
  • Security: 0 critical/high findings (npm audit — 0 critical/high)
  • Audit: PASS — hex architecture, parameterised SQL, append-only audit events
  • E2E: ISSUES FOUND (3 minor, non-blocking)

Reports

  • Exploratory: .claude/reports/feat-002-exploratory.md
  • Security: .claude/reports/feat-002-security.md
  • Audit: .claude/reports/feat-002-audit.md
  • CI/CD: .claude/reports/feat-002-cicd.md
  • Merge: .claude/reports/feat-002-merge.md

Manual Tasks

Task Service Status
Task #3 Veriff (real KYC) ⬜ Low priority — stub works for demo

leecampbell-codeagent and others added 9 commits March 5, 2026 13:26
…t-001)

- Add users table migration with clerk_user_id TEXT, roles[], notification_prefs JSONB
- Implement User entity with private constructor, create()/reconstitute() pattern
- Add AccountAppService, REST API, and React frontend with full design system
- 248 tests passing (76 backend + 172 frontend), builds succeed

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…at-001)

- HIGH-001: Replace Zod schema internals in 400 responses with sanitised
  issue list (path + message only, no format() internals)
- HIGH-002: Error handler returns static generic message instead of
  err.message; domain error classes use static strings without user data
- HIGH-003: Remove onboardingCompleted/onboardingStep from PATCH /me/profile
  schema — onboarding state is server-controlled only

Also commit exploratory and security review reports.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Resolves regression introduced by HIGH-003 security fix. The profile PATCH
endpoint no longer accepts onboardingCompleted/onboardingStep from clients,
but the onboarding page needed a way to complete the flow.

Solution: dedicated server-controlled endpoint that only sets
onboardingCompleted=true and onboardingStep='complete' — clients cannot
set arbitrary values.

- Add completeOnboarding() to UserRepository port, pg adapter, and
  in-memory adapter
- Add completeOnboarding() to AccountAppService with audit logging
- Add POST /api/v1/me/onboarding/complete route (auth required)
- Frontend: call completeOnboarding() instead of profile PATCH for
  onboarding completion and skip flows
- Add 8 new tests (4 unit + 4 integration) — 256 total now passing

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Exploratory: PASS — 256/256 tests, all ACs verified
- Security: 0 critical/high findings, 3 medium, 5 low
- Audit: PASS — hex architecture, parameterised SQL, no enums, all checks
- CI/CD: PASS — pipeline can support this feature

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Mark feat-001 as SHIPPED in backlog
- Add G-016: hooks with -r flag scan everything when no files passed
- Add G-017: ======= pattern needs ^ anchor to avoid false positives

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Backend:
- New KYC bounded context (packages/backend/src/kyc/) with ports,
  stub adapter, app service, API router, and full test coverage
- GET /api/v1/kyc/status and POST /api/v1/kyc/submit endpoints
- StubKycVerificationAdapter: auto-approves synchronously
- Two state transitions per submit: not_started→pending→verified
  with DB-first ordering and best-effort audit logging (G-019)
- Atomic conditional WHERE on kyc_status updates (G-020)
- updateKycStatus() added to UserRepository port and adapters
- AuditLoggerPort: resourceType expanded to 'user'|'kyc', KycStatusChange action
- kyc_audit_events table (immutable, GDPR-safe ON DELETE SET NULL)

Frontend:
- KycStatusBadge: all 6 states, Tier 2 tokens only, role="status"
- KycVerificationPanel: 6 status states, loading skeleton, error state
- Settings profile page: KYC section added below profile form
- useKycStatus hook and useKycSubmit mutation (cache invalidation)

Migrations:
- 20260305140000: rename 'failed'→'rejected' in kyc_status CHECK (G-018)
- 20260305141000: create kyc_audit_events table

Tests: 356 total (143 backend + 213 frontend), all passing

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Exploratory: ISSUES FOUND (3 minor, non-blocking) — 356/356 tests
- Security: 0 critical/high findings, 3 medium, 0 low
- Audit: PASS — hex architecture, parameterised SQL, no enums
- CI/CD: PASS — pipeline supports this feature

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@leecampbell-codeagent leecampbell-codeagent force-pushed the ralph/feat-001-account-auth branch from ecdf8d9 to de8824b Compare March 5, 2026 21:07
@leecampbell-codeagent leecampbell-codeagent deleted the ralph/feat-002-kyc-stub branch March 6, 2026 03:31
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