Skip to content

Architecture / Decision records / ADR-HIS-095

ADR-HIS-095 A slice's end-to-end stack runs the real gateway, rendered from platform/gateways for each run with the settings of the specification

Status Accepted
Decided 2026-11-29 by session RC-1-S28-F11
Record Drafted 2026-11-29; approved 2026-11-30 by the Enterprise Architecture Board
Where the rule lives e2e/harness (lib/runner.py gateway_spec, gateway_environment, Stack.start_gateway; the gateway fixture and shell.gateway in src/index.ts); e2e/scenarios/RC-1 (stack.json, gateway/e2e.toml, provision/)

Context

The outcome of slice RC-1 is "an authenticated user registers a patient through the gateway". The gate of the slice found that the scenario called the units directly (fix RC-1-S28-F11, issue #217). So IF-ISE-001's acknowledgement, error handling and outage behaviour had been shown only in the gateway's own test bed. That test bed puts fake units behind the gateway and shortens its times.

The harness (ADR-HIS-047, ADR-HIS-076) runs the units as processes on the host, each on a port allocated for the run. Its shell.gateway stood in for the gateway: it sent each screen call to the unit a list of paths named. The gateway of ADR-HIS-062 is APISIX, configured from the model in platform/gateways by bin/gateways render. The rendered configuration listens on fixed ports (9443, 9091), and its upstream addresses are per environment.

Three things had to be settled: - how the stack gets a gateway configured for addresses that change with every run; - how it gets there without a test bed's shortcuts; - how it reaches the units without fixing a host port, which the integration environment never does (ADR-HIS-043).

Decision

  1. A stack names its gateway with "gateway": {"environment": "<file>", "gateway": "internal"}. The file is a gateway environment in the scenario folder, in the form of platform/gateways/model/environments/. The integrate and contract sessions of the slice own it, with the rest of the folder.
  2. The runner renders platform/gateways for each run. It fills in the unit addresses (${unit.<name>}, ${address.<name>}), the environment's settings and the provisioning's secrets. It loads the model with the gateway unit's own code and checks it as bin/gateways check checks any environment. The test bed's overrides (overrides, settings, contract_dirs) are therefore refused. The gateway runs with the values of CFG-ISE-001, CFG-ISE-031 and CFG-ESS-025 and the client registrations of clients.toml. Without an image, the run uses the reference environment's. The routes come from the contracts of the checkout, as they do for every environment.
  3. The gateway runs as the reference Deployment runs it: read-only, with conf/ from the image. It runs on the host network, as the units' sidecars do, and reaches the units, Keycloak and telemetry on loopback. The rendering's fixed listeners (HTTP 9080, HTTPS 9443, status 7085, metrics 9091) would collide with another session's run. So the runner moves them, in the run's copy only, to loopback ports allocated for the run, and turns off APISIX's control API (gateway_listeners). Each listener must be found exactly as rendered, so a change to the rendering stops the run instead of leaving a fixed port. A bridge network with published ports was tried first: the shared host's firewall drops traffic from Docker's bridges to the host, so that gateway could not reach the units. It failed closed, 503 "Authorization service unavailable", as it must. The server certificate is made for each run. Its key stays outside the run folder, which a gate commits, and reaches the gateway as an environment variable. The runner's Node.js trusts the certificate. Upstreams are plain HTTP, as everywhere else in the integration environment.
  4. The provisioning makes the gateway's service identity (the environment's identity.client_id). It makes it a client in the realm and a service identity in MOD-ESS-001 that may ask for decisions. It also puts that identity in the audience of the staff sign-on client's tokens. The gateway accepts only tokens meant for it, and Keycloak introspects a token only for a client in its audience.
  5. A scenario chooses its path call by call. gateway("<domain>") calls through the gateway, and unit("<name>") calls the unit directly. Once the stack has a gateway, shell.gateway sends every screen call to it. The slice's own story goes through the gateway. The cases that show that a unit enforces again at its own boundary keep calling the unit directly (IF-ISE-001: "services enforce again at their own boundary").
  6. One gateway per run. RC-1 runs only the internal gateway, because the slice has no partner channel. A slice with partners names partner in a stack of its own, or the harness grows a list.

Consequences

  • The RC-1 scenario now registers a patient through the gateway (RC-1-E2E-001, RC-1-E2E-006), and RC-1-E2E-009 shows IF-ISE-001 end to end with the real decision service and audit service. The test bed of platform/gateways stays the place for what needs fake units or shortened times: cached Permits, the 15-minute downtime prompt, and the partner channel (TEST-ISE-039).
  • A change to the gateway's model or Lua shows up in the slice's scenario as well as in the test bed. A drift between the model and the contracts fails the run's model check, not only ci.sh.
  • The non-functional cases (RC-1-E2E-010 to 013) still call the units directly. Measuring NFR-ISE-001 with the gateway in the path is a change to those cases (follow-up in the handover of RC-1-S28-F11).
  • The run depends on how platform/gateways renders its listeners. If the rendering changes them, the run stops with the listener it could not find, and gateway_listeners follows the change. A setting for the listeners in the gateway's environment model would remove this coupling (follow-up for the gateway unit).
  • Units outside the stack are given an address that refuses. The gateway then answers their routes "unavailable" (FR-ISE-GWY-001 part 10), which is the truth for that stack.