Implementation plan / Session plan / Handover RC-1-S28-F10
Handover RC-1-S28-F10 Fix: the harness starts every contract stub after its install, and keeps that install out of the checkout¶
Card: RC-1-S28-F10. Issue: cema-care/his#216. Branch: session/RC-1-S28-F10. Slice: RC-1. This is a round 1 fix of the gate session RC-1-S28, for the gate line "Criterion 1 (ACC-002): the scenario passes in an integrated environment with no manual repair" of the slice gate. The work belongs to RC-1-S26, and the change is in the end-to-end harness (e2e/harness/). There is no decision record: the fix follows the pattern the units' contract tests already use (ContractTools, an install in a copy of the container's own), and it sets no new convention.
The failure and its cause¶
The gate's first run (20261127T122154Z-3184, on a fresh worktree) stopped with "the contract stub of ess did not answer". After that, the units' contract tests in the same checkout failed with ERR_PNPM_ABORTED_REMOVE_MODULES_DIR_NO_TTY. Runner.start_stubs in e2e/harness/lib/runner.py caused both:
- The second and later stubs started before the install had finished. The container ran
pnpm install … && serve adm & serve ess & serve ise & wait. By shell precedence that is(install && serve adm) &, thenserve ess &andserve ise &at once. On a fresh checkoutessandisestarted withoutnode_modules(ERR_MODULE_NOT_FOUND: yaml) and exited. A second run passed only because the first had left the install behind. - The install went into the checkout. The container ran in
contracts/commonof the mounted checkout, with the Playwright image's Node.js and a pnpm store at/tmp/pnpm-storeinside the container. Thenode_modulesit left there points at a store that no longer exists. The units' contract tests (ContractToolsinadm-identityandadm-patient-administration) copycontracts/into their own container and runpnpm install --frozen-lockfileon that copy. pnpm then finds anode_modulesfrom another store, wants to remove it, and stops without a TTY. The host's own pnpm does the same.
What was changed¶
e2e/harness/lib/runner.py:- A new function
stub_script(contracts, work, install, serves)writes the stub container's script. It runs underset -e. It copiescontracts/to/tmp/his-contractswithtar --exclude=node_modules, runs the install in the copy'scommon/, and then starts every serve in the background and waits for them. A failed install ends the container before any stub starts, and the runner then reports the stub that did not answer, as before. start_stubsuses this script and serves each stub from the copy (/tmp/his-contracts/<domain>). The record still names the stub by its folder in the checkout (contracts/<domain>).docker_basetakesread_only=True, which the stub container uses. It mounts the checkout with:ro, so an install into the checkout fails loudly instead of leaving files behind.e2e/harness/test/test_stubs.py(new) runsstub_scriptwithshon the host, with stand-ins for the install and the serves, against a scratchcontracts/that already has anode_modules. Its three tests check three things: every serve finds the install finished, the checkout'scontracts/is left as it was and the copy has nonode_modules, and no serve starts when the install fails.scenario selftestruns it with the other Python tests.e2e/harness/README.md: the paragraph on the contract stubs says how the container installs and starts them.
Checks and their results¶
These ran on this host with HIS_SESSION=RC-1-S28-F10, in this worktree. It is a fresh checkout, and before the run it had no node_modules under contracts/.
| Check | Command | Result |
|---|---|---|
| Before the repair | test_stubs.py with stub_script replaced by the old command (cd contracts/common && install && serve & serve & serve & wait) |
Failed, 3 of 3. The order test saw ['adm after', 'ess before', 'ise before']. The install wrote into the checkout's contracts/common. A failed install did not stop the container |
| After the repair | python3 -m unittest discover -s e2e/harness/test -p "test_*.py" |
15 of 15 passed (the 3 new tests and the 12 of FN-S07) |
| The harness's own tests | e2e/harness/scenario selftest |
Type check clean; Playwright unit tests 13 passed; Python 15 passed |
| The gate line: the slice scenario on a fresh checkout, first try | HIS_SESSION=RC-1-S28-F10 e2e/harness/scenario run e2e/scenarios/RC-1 --strict |
Passed: 12 of 12, outcome passed and the record complete (run 20261129T131823Z-5a43). The three stubs (adm, ess, ise) answered. After the run the checkout still had no node_modules under contracts/ |
The gate line: the units' contract tests in the same checkout, with no git archive |
./gradlew :app:test --tests '*contract*' in services/adm-patient-administration; ./gradlew :mod-adm-001:test --tests '*contract*' in services/adm-identity |
Passed: 6 of 6 contract tests in adm-patient-administration (consumer and provider), and 1 of 1 in adm-identity (PatientIdentityContractTest). They installed the contract tools in their own containers with no repair |
| Static analysis | platform/delivery-pipeline/bin/static-analysis e2e/harness |
No blocking finding |
What the gate line now shows¶
Criterion 1 (ACC-002), "no manual repair": on a fresh checkout, the RC-1 scenario passed on its first run, and the units' contract tests then ran in the same checkout. Neither needed a second run or a git archive export. The next gate session (RC-1-S28-G2) reruns the line. The scenario's 12 of 12 is the same as the last fix sessions' runs. RC-1-E2E-002 still depends on GAP-ADM-012 (#206), as the gate recorded, and this fix does not touch it.
Requirements and test scenarios¶
| Requirement / gate line | Test |
|---|---|
| ACC-002, gate RC-1 criterion 1: no manual repair, every stub after the install | test_stubs.StubScript.test_every_stub_starts_after_the_install |
| ACC-002, gate RC-1 criterion 1: the checkout is left as it was | test_stubs.StubScript.test_the_checkout_is_left_as_it_was |
| ACC-002, gate RC-1 criterion 1: a failed install starts no stub | test_stubs.StubScript.test_no_stub_starts_when_the_install_fails |
| The slice scenario (RC-1-E2E-001 to RC-1-E2E-012), RC-1-E2E-005 the contract walk through the stubs | e2e/scenarios/RC-1, run above |
Differences from the specification or the contract¶
None. No contract, unit or screen changed.
Questions and follow-ups¶
- Follow-up (harness, outside this card): the shell container (
start_shell, inweb/shell) and the runner container (cmd_runandcmd_selftest, ine2e/harness) still runpnpm installin the mounted checkout. They use the image's Node.js and a pnpm store inside the container. In this run that did not break anything the gate runs. But a later hostpnpm install --frozen-lockfileinweb/shellcan stop in the same way (ERR_PNPM_ABORTED_REMOVE_MODULES_DIR_NO_TTY). The same copy-and-install pattern, or a container-onlynode_modulesvolume, would close that too. - No question for a person.