Submission Hub — the corporate broker-submission front door
The Submission Hub (board #27) is the corporate front door of the insurer: a broker submits a risk, the exposure dossier is captured, it is triaged for completeness/appetite, and qualified submissions are routed on to Underwriting (#12). It is built as a module inside ktayl-core — the modular-monolith decision (a new business domain is a module, not a new service) — schema-per-module (submission, Flyway V12), hexagonal, boundaries enforced by ApplicationModules.verify().
:::note SUB-01 (this) is the first slice: intake → exposure dossier → triage → route, with sanctions screening at the front door. The live M2M handoff to the underwriting service is SUB-02. :::
What's deployed (SUB-01)
| Piece | As-built |
|---|---|
| State machine | Submission aggregate: `RECEIVED → TRIAGED → ROUTED |
| Exposure dossier | exposure_item rows per submission — site, country, TIV/currency, occupancy, loss-history, CAT flag (the #27 scope: sites/values/loss-history/geo-CAT). |
| Triage | an append-only submission_triage log (decision ROUTE/DECLINE/RETURN, completeness score, appetite flag, actor) — the auditable intake decision. |
| Published interface | submission.api — SubmissionIntake (register/addExposure/triage/route/clearScreeningHold) + SubmissionQuery (findById/list) + SubmissionView, a @NamedInterface so Distribution (#13) / Underwriting (#12) consume it in-process (no intra-monolith HTTP). |
| REST | /v1/submissions (register POST /, POST /{id}/exposures, /triage, /route, /clear-hold, list, get) — GROUP_Underwriting-gated; clear-hold needs GROUP_Compliance. |
Sanctions screening at the front door (compounds RC-02)
The headline control: the insured is screened at the earliest possible point — intake. register() calls the S1 ScreeningGate at a new intake gate (in-process, via screening.api only):
- a
HOLD(a sanctions/PEP match or a fail-closed engine outage) → the submission is still captured but flagged (screening_hold, with the auditalertId), androute()is refused with409until a compliance officer clears it (clear-hold,GROUP_Compliance) — HITL, the gate never auto-clears. - an
ALLOW→ the submission flows normally.
This is the same ScreeningGate proven live at bind (S2) and wired at payment (S4) — the screening investment now guards the funnel from its very first touch (intake) through bind and payment. Fail-closed is inherited: a yente outage holds the submission rather than letting an unscreened party through.
Verified live (2026-11-17)
Deployed to dev (ktayl-core:4bbc7cd, 1/1 healthy — so Flyway V12 migrated on boot; a failed migration crashes the pod). Smoke-probed from in-cluster:
GET /v1/submissionswithout a token →401(authentication enforced).GET /v1/submissionswith a valid but wrong-group token →403— theGROUP_Underwritinggate is live (an ungated/v1/policieswith the same token returns200, confirming the token + routing are sane, so the403is the gate, not a transport error).
Gotcha (same stale-pod race as S1/S2): during the rollout overlap the probe briefly hit the old image (which has no
/v1/submissionsroute) and got a misleading404; on the converged new-digest pod it is the correct403. Always verify the group-gate on the pod matching the new image digest.
The behavioral flow (register → exposure → triage → route; and a HOLD at intake blocks route) is covered by the L2 Testcontainers integration + the L3 contract tests (mvn verify = 165 tests, 37 new) that gate every merge.
Boundaries & invariants
- Server-side authority (the gate is in the application layer), fail-CLOSED, HITL to clear a hold, append-only triage log.
- In-process cross-module calls via the published
@NamedInterfaceonly (submission →screening.api) —ApplicationModules.verify()+HexagonalArchitectureTestsgreen; no boundary weakening.
SUB-02 — live handoff to underwriting (#12), dev + prod
Route no longer just records locally — it hands the ROUTED submission off to the underwriting service (POST /v1/submissions), creating a real UW submission from the exposure dossier. route() transitions + saves locally first, then maps the dossier and calls underwriting via the UnderwritingPort (hexagonal); on a handoff failure the submission stays ROUTED with a null uw_submission_ref (retryable, the call returns 502), on success it records the returned uw_submission_ref.
- Increment 1 (dev) — the handoff, unauthenticated (dev underwriting's API auth is OFF). Live-verified: a routed dev submission creates a UW submission in the dev underwriting service.
- Increment 2 (prod M2M) — underwriting's API auth is ON in prod, so the handoff authenticates with an OAuth2 client-credentials bearer. A
UnderwritingTokenProvidermints + caches an Authentik token scopedunderwriting:write(clientktayl-core-uw-m2m), enabled only whenunderwriting.oauth2.client-idis set → dev stays unauthenticated (no client-id), the same artifact authenticates in prod. The token endpoint is the Authentik ingress host (reuses the existing egress allowance — no netpol change); underwriting validates signature + scope, so the issuer host is irrelevant. Creds come from Vault (secret/platform/ktayl-core-underwriting) via an ESOExternalSecret→UNDERWRITING_OAUTH_*env. The M2M pattern mirrors underwriting→ktayl-core (ADR-016).
Prod acceptance (live): from ktayl-core-prod, the ktayl-core-uw-m2m client mints a token and POST /v1/submissions against underwriting-prod returns 201 (a real UW submission created); the same call without a bearer returns 401 — proving the handoff is authenticated and auth is enforced. Prod is on ktayl-core:604c7d3, 2/2, Synced/Healthy.
Module source: ktayl-core (src/main/java/com/ktayl/core/submission). The modular-monolith rationale lives in ktayl-core/docs (ADR-004..011).