5.5 KiB
5.5 KiB
| id | parent_ids | version | status | last_cr | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| INT-DESIGN-001 |
|
1.0.0 | Draft — Stage 9 design; Gate 9.1 passed, review pending | none |
Integration Design — Identity, Events and External Boundaries
| Field | Value |
|---|---|
| Architecture basis | Approved Stage 7 patterns (DEC-021) |
| Configured adapters | Keycloak identity, payment sandbox, messaging sandbox in tech-profile.yaml |
| Production provider status | Keycloak configured; messaging/object-storage deployment choices not selected; payment gateway not in current FR scope |
1. Keycloak OIDC identity provider
- Purpose / owning FRs: OIDC authentication and session requirements (
FR-AUTH-001,FR-AUTH-003); role policy enforcement is local and tenant membership is resolved by UC-019. - Flow: Browser initiates the configured OIDC authorization-code flow with PKCE against the configured Keycloak realm/client. The application accepts a session only after validating issuer, audience/client, signature using provider metadata/JWKS, time claims and required authentication result. Exact allowed algorithm/lifetime and refresh/logout/revocation requirements remain for security review under
AMB-009; no custom target is introduced. - Data boundary: Do not place credentials or raw tokens in logs, audit payloads, URL analytics, or outbox events. Map stable provider subject to internal identity; resolve active tenant membership server-side on every request. Provider roles alone never establish tenant access.
- Failure: Invalid token or identity-provider/JWKS inability fails closed for protected operations; emit safe operational telemetry with correlation, not token values. Session/logout contract is detailed with Keycloak behavior before implementation.
- Sandbox: Use deterministic identity mock declared in
tech-profile.yamlfor offline tests; do not treat it as production IdP evidence.
2. Transactional outbox and Valkey Streams
- Purpose: Deliver business notifications/projections without losing an event after its source transaction commits; applies to receiving/inventory, finance and operational alert/reporting events.
- Write: In the same PostgreSQL transaction as the business state and audit record, append outbox row with tenant, event ID, aggregate ID/version, event type/schema version, occurred time, and minimal payload. Commit is the durability boundary.
- Publish: Worker claims pending rows, publishes using stable event ID to Valkey Streams, then marks delivery progress. Retry uses backoff and does not discard committed events. Valkey loss delays delivery but cannot lose source rows.
- Consume: Consumer deduplicates event ID in an inbox/idempotency table and applies its projection/alert transition once logically. Delivery guarantee is at least once; ordering is per aggregate/version where required. Poison events are isolated and surfaced for operator review; no silent deletion.
- Tenant context: Worker derives and validates tenant ownership from the persisted event envelope, sets transaction-local context, and uses RLS. It never trusts ambient API request context.
3. Messaging provider boundary
FR-OPERATIONALALERTS-001 does not establish a production channel/provider or exact SMS/email timing. Define a NotificationPort with deterministic request/result and delivery status; connect the configured notification sandbox in offline tests. Production adapter, consent/notice requirements, retry and channel escalation remain unselected until product/channel decisions are approved. Failed delivery remains pending/failed and visible; never convert acceptance into a false “delivered” state.
4. Explicitly absent/unselected connectors
| Boundary | Stage 9 disposition | Reason / governing item |
|---|---|---|
| Physical weighbridge | No device connector; manual entry contract only | Current inward/outward FRs capture measurements, no device protocol (RISK-005, RISK-009). |
| Payment gateway | Not used for customer receipt capture or supplier payment execution | Current FRs record receipts and payables; they do not authorize payment execution. Payment sandbox remains unused until approved scope. |
| APMC/market feed | No live market feed; manual observation source is stored | FR-MKT-001/002 require user-entered observation. |
| Object/document storage | Port and tenant/evidence metadata only; production provider, region, encryption/key management, lifecycle and signed-URL behavior unselected | POD, privacy and incident evidence require private storage; resolve provider controls under AMB-009 before implementation. |
| Processor/subprocessor systems | Inventory only; no live integration | FR-PROCESSORGOVERNANCE-001 manages due diligence and assistance records, not API connectivity. |
5. Operational/security requirements
- Secrets are managed outside source and database content; rotation and access are restricted by deployment policy (provider-neutral until deployment selection).
- Correlate API command, audit event, outbox event and delivery attempt without logging personal payloads, credentials, access tokens or unnecessary identity attributes.
- External failures must not partially commit a business command. Persist domain state and outbox atomically; async delivery failure is observable/retryable.
- Provider outage and retry behavior require deterministic sandbox/failure-injection tests during Construction. Design consistency is not runtime proof.