Architecture / Decision records / ADR-HIS-047
ADR-HIS-047 End-to-end harness: scenario runner, scenario API and evidence record¶
| Status | Accepted |
| Decided | 2026-11-24 by session FN-S07 |
| Record | Drafted 2026-11-24; approved 2026-11-25 by the Enterprise Architecture Board |
| Where the rule lives | e2e/harness/ (its README.md, scenario, lib/, src/, schema/); the agent instruction file CLAUDE.md, section 3 |
Context¶
Every slice ends with an end-to-end scenario. Its contract session writes the scenario as a failing test, its integrate session makes it pass through the built services and screens, and its gate evidence session runs it and collects the evidence in the form PRS section 17.3 requires (stage gates, section 1; vertical slices, section 1). Card FN-S07 asks for four things: - the runner for those scenarios against the integration environment; - synthetic data builders; - tagging of tests with requirement and test identifiers; - an evidence record with the 17.3 fields.
Some sessions run side by side on one server, each with its own environment (ADR-HIS-043). The host has Docker and JDK 21, but not necessarily Node.js or browsers. A scenario crosses units built from the service template (ADR-HIS-044) and screens in the shell (ADR-HIS-042). The D10 policy decision service does not exist yet.
Options considered¶
- Test tool:
- Playwright Test in TypeScript, for browser and API steps in one test;
- Cypress;
- JUnit with Selenium on the JVM;
- a scenario language (Cucumber).
- Where the runner runs: on the host with a local Node.js and browsers, or in the Playwright image, pinned by digest.
- Who brings up the system under test:
- each scenario, in code;
- Docker Compose services added to the environment;
- a runner on the host that reads a stack description from the scenario folder.
- Evidence record:
- Playwright's HTML report;
- a custom Playwright reporter;
- a separate generator over Playwright's JSON report, the run context and the logs.
Decision¶
- Playwright Test, in TypeScript. One test can drive the shell in a browser and call the units' APIs. Tags (
@FR-ADM-MPI-001) and annotations are first-class, and its JSON report carries both. TypeScript is the language of the web code (ADR-HIS-005), so a scenario reads like the screens it drives. Playwright is Apache-2.0 and maintained by Microsoft. It enters the SBOM throughe2e/harness/pnpm-lock.yaml(DEP-004). Cypress cannot step across origins and APIs as freely. JUnit and Selenium would put screens under a second language. Cucumber adds a layer that nobody asked for. - The runner image is
mcr.microsoft.com/playwright, pinned by digest, at the same version as@playwright/test(1.64.1). Every Node.js step runs in it with host networking: the scenarios, the shell's development server and the harness's own tests. So the host needs nothing beyond what CLAUDE.md already requires, and the browser always matches the library. Host networking lets the container reach the environment's loopback-only ports and the units on the host. It publishes nothing. - A runner on the host, in Python with the standard library only (
lib/runner.py), as the environment's own scripts are. It reads the scenario folder'sstack.json: profile, units, contract stubs, shell, and stub policy decision point. It then: - starts the environment;
- serves each contract stub named, from its folder under
contracts/, with FN-S04'shis-contract serve; - builds and starts each unit with
java -jaron a free port, creating its database ifhis-envdid not; - starts the shell's development server, which includes example screens;
- runs the scenarios;
- stops everything.
Its containers carry the session label, so
his-env resetcleans up after an interrupted run. A unit that is not yet built is left out of the stack. The contract session's scenario then fails on that unit, which is the "fails only because the behaviour is not built" its card asks for. - A stub policy decision point in the runner. It permits by default and records what it is asked. A scenario can make it deny, or fail like an outage, to walk the failure branches of architecture 8.1 and DEC-ESS-018. It goes when the D10 service exists.
- Contract stubs in the stack. Until a unit is built, a scenario can run against the stub of its domain's contract. Contract sessions can then run their slice's scenario across every domain it touches. The unit client reaches a stub by its domain, and the scenario checks that its calls broke no contract.
- The scenario API
@his/e2e-harness.scenario(caseId, title, { covers, defects }, body)is one test case. Fixtures give: - a unit client that sets the IF-ISE-001 headers and a new correlation identifier per call, for a unit or a contract stub;
- the contract stubs' violations and sample events;
- test-realm tokens;
- the policy stub;
- the shell opened at a screen identifier;
- the synthetic data builders;
- evidence attachments.
Scenarios run with one worker and no retries, because the record must show the first outcome.
- Tagging. A test names what it covers as tags, in its title, or both, as CLAUDE.md section 4 says. The identifier kinds are FR, NFR, BR, WF, IF, EVT, UI, CUX, SAFE, ACC and CFG; TEST for the 15.2 catalogue; and session identifiers. A malformed identifier in covers fails when the file loads. The record generator resolves every identifier to where docs/ defines it, either an anchor or the first cell of a table row. It adds the requirements that a cited test scenario's catalogue row names.
- Synthetic data builders, seeded from the run seed and the test case ID, so that any record can be rebuilt. The shapes are those of architecture 6.6, aligned with FHIR R4. Identifiers and codes are in the system urn:his:e2e:synthetic unless the caller names one. Every value built is attached to the test. A slice adds builders for its own entities from section 7.3 of its specifications.
- The evidence record is generated by a separate tool (lib/evidence.py, standard library only). It reads Playwright's JSON report, the runner's run-context.json and the unit logs, and writes:
- evidence.json, against a JSON Schema in the folder;
- evidence.md;
- SHA256SUMS over the record, the attachments and the logs.
Each PRS 17.3 field has a place, mapped in the README:
- the build is the commit plus the git tree id of each component under test;
- the environment includes the image of each backing service;
- the test data classification is always synthetic;
- the logs are the unit log lines found by each call's correlation identifier.
The approver and waivers are given by people: approve and waive write them into the record and refuse a record that changed. A waiver recorded after approval resets the approval to pending, because the approver signed a different outcome. A record is complete when every field is present, every test names a requirement that resolves, the schema validates and the sums match. A failed run can be complete. A build from uncommitted changes, a failure without a defect reference and a skip without a waiver are warnings, which --strict turns into failures for gate runs.
Consequences¶
- Contract sessions write
e2e/scenarios/<SLICE>/stack.jsonand*.scenario.tsagainst this API. Integrate sessions add units to the stack as they are built, and remove the contract stubs those units replace. Gate evidence sessions run the scenarios with--strictand keep the run folder as the gate's evidence. - Playwright and the runner image move together. The README says how.
- The shell is tested through its development server. The production bundle leaves out example screens, and sign-on (UI-ESS-001) is not built yet. When it is, the shell fixture signs in with a test-realm user.
- The evidence record is a file set. PRS 17.3's controlled repository is wherever the gate session keeps it. A record store, if one is wanted later, can ingest
evidence.jsonunchanged. - The stub policy decision point and the template's header names are provisional, like their counterparts in ADR-HIS-044.