Files
KArtSell.Aegis/tests
kjh2064 b07900d9aa feat(wbs): AEG-VS-01-05 Event/Job/Inbox - Part 4 Stage 1-2 (Hangfire + E2E Tests)
Part 4 Stage 1: Hangfire Job Scheduling
- DownstreamConsumerJob updated: Route IdentityCreated events
- Add IdentityCreatedConsumer, IdentityAuditConsumer, MfaReminderJob to DI
- BackgroundJob.Schedule() for 24-hour MFA reminder delay
- Integration with OutboxPollerJob → Inbox pipeline

Part 4 Stage 2: E2E Integration Tests (4 tests)
- RegisterIdentity_E2E_CreatesIdentityWritesOutboxAndTriggersConsumers
  * Verify identity creation + outbox write in same transaction
  * Atomic commit ensures exactly-once semantics

- RegisterIdentity_E2E_OutboxPollerMarksInboxAndTriggersConsumers
  * Simulate OutboxPollerJob marking messages for consumers
  * Verify inbox message created with correlation tracing

- RegisterIdentity_E2E_FullFlowCreatesAuditAndMfaRecords
  * Complete end-to-end: identity → outbox → inbox → consumers
  * Verify audit log written, MFA reminder tracked
  * All records created in correct order

- RegisterIdentity_E2E_MfaReminderIsIdempotent
  * Verify UNIQUE(identity_id) constraint prevents duplicates
  * Safe for Hangfire retries

- RegisterIdentity_E2E_AuditLogIsImmutable
  * Verify trigger prevents UPDATE/DELETE on audit records
  * Exception thrown on tampering attempt

Architecture
- DownstreamConsumerJob switch statement routes to type-specific handlers
- Outbox→Inbox→Consumer pipeline: exactly-once, async, decoupled
- Hangfire BackgroundJob.Schedule() for time-delayed tasks
- Correlation ID propagated end-to-end for observability

Status: 60% COMPLETE (event + endpoint + consumers + job scheduling + E2E tests)
Build:  0 errors, 0 warnings
Tests: 19 total (5 unit + 3 outbox integration + 4 E2E + 6 SQL integration + 1 misc)

Next: Error handling (poison pill, dead letter), monitoring (metrics, logs), Part 4 Stage 3

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-08-17 18:56:21 +09:00
..