Implementation plan / Session plan / Handover RC-1-S28-F31
Handover RC-1-S28-F31 Fix: ess-audit's contract tests cannot install the contract tools when contracts/common/node_modules exists in the checkout¶
Card: RC-1-S28-F31. Issue: cema-care/his#284. Branch: session/RC-1-S28-F31. Slice: RC-1. This is a round 2 fix of the gate session RC-1-S28-G2. The unit belongs to RC-1-S04. It makes the repair that RC-1-S28-F29 made in adm-identity. No new decision record: the change is in one unit's test code and shapes no later session.
The failure¶
The issue's first comment holds the gate's evidence (commit 1586d431). ConsumerContractTest (FR-ESS-AUD-003, the stubs of IF-ESS-010, IF-ESS-012 and IF-ISE-006) stopped at initializationError: "could not install the contract tools: ERR_PNPM_ABORTED_REMOVE_MODULES_DIR_NO_TTY". ContractTools.start copied the whole of contracts/ into its Node.js container with cp -r, the host's contracts/common/node_modules included, and then ran pnpm install --frozen-lockfile without CI=true. Another pnpm, with another store, made that node_modules, so pnpm wanted to purge it. With no terminal to ask on, it aborted.
Reproducing the failure on this host showed a second way the same checkout breaks the unit's contract tests. AuditContractTest (IF-ESS-008) runs his-contract on the host's Node.js whenever contracts/common/node_modules exists and the version is 22.18 or later. This host's Node.js is 22.22.1, but it was built without TypeScript support (process.features.typescript is false). It refuses src/cli.ts with ERR_UNKNOWN_FILE_EXTENSION, and the test failed. The gate's hosts had a Node.js that runs .ts, so the gate did not see this. But it is the same gate line, the same unit and the same condition, so it is repaired here.
What was changed and where¶
Only services/ess-audit/mod-ess-006/src/test/java/care/cema/his/ess/mod006/contract/:
ContractTools: the copy into the container leaves out everynode_modulesfolder of the checkout (tar --exclude=node_modulesfrom/srcto/tmp/contracts, underset -o pipefail). The tools are installed from the lockfile alone. Host modules can never be used in the container anyway: their links point into the host's store, and native packages are built for the host. The container also getsCI=true, so pnpm never waits on a prompt.AuditContractTest.hostNodeUsable: the test now asks the tool instead of reading the version. The host's Node.js is used only ifcontracts/common/node_modulesexists andnode src/cli.ts helpsucceeds. Otherwise the tool runs in the pinned image, as it already did whencontracts/commonwas not installed. That path already removednode_modulesbefore it installed.ContractToolsTest(new):installsBesideAForeignNodeModulescopies the repository'scontracts/into a temporary folder and plants a foreigncommon/node_modules/.modules.yamlthat names anotherstoreDir. It then starts the tools on that copy and runshis-contract help.hostNodeUsedOnlyWhenItRunsTheToolgiveshostNodeUsablean installedcommonwhose tool exits with an error, and a missing folder. Both must be refused.
Neither test depends on what the checkout it runs in has installed.
No production code, contract, dependency, lockfile or setting changed.
Checks and their result¶
Light profile as HIS_SESSION=RC-1-S28-F31 (his-rc-1-s28-f31), in services/ess-audit:
| Check | Command | Result |
|---|---|---|
| The new install test before the repair | ./gradlew :mod-ess-006:test --tests '*ContractToolsTest*' with ContractTools as on main |
Fails: "could not install the contract tools: … ERR_PNPM_ABORTED_REMOVE_MODULES_DIR_NO_TTY" |
| The host Node.js check before the repair | corepack pnpm install --frozen-lockfile in contracts/common on the host, then ./gradlew build --rerun-tasks --continue with only ContractTools repaired |
Fails: AuditContractTest: "his-contract verify failed: … ERR_UNKNOWN_FILE_EXTENSION … cli.ts" (host Node.js 22.22.1, no TypeScript support). ConsumerContractTest and the new install test passed |
The gate line, after the repair: build and every test in a checkout with contracts/common installed (the owning session's tests) |
The same, with both repairs | Passed: 95 tests, 0 failures, 1 skipped (service-kit 28 with 1 skipped, mod-ess-006 64 with 2 new, app 3). AuditContractTest passed: its four his-contract verify runs report "verify: passed" (in the pinned image). ConsumerContractTest 2 of 2 passed |
| Secret scan | platform/delivery-pipeline/bin/secret-scan code origin/main HEAD |
No secret found, in the files or the commits |
| Documentation | python3 docs/implementation_plan/tools/check_links.py; .venv/bin/mkdocs build |
0 broken links, 0 duplicate anchors; the site builds |
One earlier full build failed in service-kit only: HttpPolicyDecisionClientTest.permit, with the host's load average near 10. Run again alone it passed, and it passed in the full build above. The gate report records the kit check's short-timeout tests as failing under load ("only the kit check's 300 ms tests fail"). That is not this card's work: see the follow-ups.
The slice scenario ran but stopped before its first case, for a reason that is on main and outside this card. I ran HIS_SESSION=RC-1-S28-F31 e2e/harness/scenario run e2e/scenarios/RC-1 --fresh --strict on commit db19ca85 (run 20261201T191942Z-bd71). The full profile started and every unit started, including ess-audit, which the scenario builds from this branch. Provisioning finished. The harness then refused to start the gateway: "the gateway's model does not check for this run: api ise.contract-catalogue: unit gateways has no address in environment e2e". RC-3-S13 (#264, merged 2026-11-30) added that API to platform/gateways/model/apis.toml with unit = "gateways", and the RC-1 stack (e2e/scenarios/RC-1/stack.json) gives the harness no unit gateways to address. So the RC-1 scenario stops the same way on main, whatever this change does. This change is in the ess-audit unit's test sources only: nothing the scenario builds, starts or calls is different. The environment his-rc-1-s28-f31 was reset at the end.
What the gate line now shows¶
The line is criterion 3 (the unit's contract tests under session rule 5) and criterion 6 (ACC-005, IF-ESS-008 interface conformance) of slice gate RC-1. The gate runs it in one checkout of all folders. In that checkout, ConsumerContractTest now installs its tools and runs, whatever contracts/ holds in node_modules. AuditContractTest no longer depends on the host's Node.js being able to run TypeScript. Both are shown by ContractToolsTest and by the unit's build above in a checkout with contracts/common installed. The next gate round, RC-1-S28-G3, no longer needs the git archive export for ess-audit.
Requirements and test scenarios of the card¶
| Requirement | Test | What it shows |
|---|---|---|
| ACC-005 (gate criterion 6) and session rule 5 (criterion 3), for the consumer contracts of FR-ESS-AUD-003 (NFR-ESS-011) | ContractToolsTest.installsBesideAForeignNodeModules (tagged contract, ACC-005, FR-ESS-AUD-003, NFR-ESS-011) |
The contract tools install and run beside a foreign contracts/common/node_modules |
| ACC-005 and session rule 5, for IF-ESS-008 | ContractToolsTest.hostNodeUsedOnlyWhenItRunsTheTool (also tagged IF-ESS-008) |
The provider contract test uses the host's Node.js only when it runs the tool |
| FR-ESS-AUD-003 (IF-ESS-010, IF-ESS-012, IF-ISE-006 consumers) | ConsumerContractTest (RC-3-S04, unchanged) |
Runs again in the gate's kind of checkout; the stubs record no violation |
| FR-ESS-AUD-001 to 003 (IF-ESS-008) | AuditContractTest (RC-1-S04, its host check changed) |
Runs in the gate's kind of checkout on any host; verify and event validation pass |
Questions and follow-ups¶
- None for a person.
- Follow-ups outside the card:
- As RC-1-S28-F29 noted, the Java units each carry their own copy of the contract tools helper. Each copies
contracts/its own way, and some decide on the host's Node.js by its version alone. A shared helper in the service template (services/_template/, FN-S03's folder) that excludesnode_modulesand checks the host's Node.js by running the tool would keep the next unit from repeating both defects. - The RC-1 slice scenario cannot start its gateway on main (above):
ise.contract-catalogue(RC-3-S13) routes to the unitgateways, which no RC-1 run gives an address. The repair belongs to RC-3-S13's folder (platform/gateways: for example, leave the API out of an environment that does not run the catalogue service) or to the RC-1 stack and harness, not to ess-audit. RC-1-S28-G3 will meet it first, and its gate run will need it repaired. service-kit'sHttpPolicyDecisionClientTestfails now and then under host load (the gate's "300 ms tests"). That is the kit's timeout, which belongs to the template.