Skip to content

Implementation plan / Session plan / Handover RC-1-S28-F29

Handover RC-1-S28-F29 Fix: adm-identity's contract tests cannot install the contract tools when contracts/common/node_modules exists in the checkout

Card: RC-1-S28-F29. Issue: cema-care/his#282. Branch: session/RC-1-S28-F29. Slice: RC-1. This is a round 2 fix of the gate session RC-1-S28-G2. The unit belongs to RC-1-S08; it comes after RC-1-S28-F22, the round's other fix on the unit. 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). PatientIdentityContractTest (IF-ADM-001) 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. That node_modules was made by another pnpm with another store (its .modules.yaml names the host's store), so pnpm wanted to purge it, found no terminal to ask on, and aborted. Any checkout where contracts/common was installed fails this way, as CLAUDE.md section 3 tells contract work to install it.

What was changed and where

Only services/adm-identity/mod-adm-001/src/test/java/care/cema/his/adm/mod001/contract/:

  • ContractTools: the copy into the container leaves out every node_modules folder of the checkout (tar --exclude=node_modules from /src to /tmp/contracts, under set -o pipefail), so the tools are installed from the lockfile alone. Host modules are never usable in the container in any case: their links point into the host's store, and native packages are built for the host. The container also gets CI=true, so pnpm never waits on a prompt.
  • ContractToolsTest (new): copies the repository's contracts/ into a temporary folder, plants a foreign common/node_modules/.modules.yaml (another storeDir), starts the tools on it and runs his-contract help. It does not depend on what the checkout it runs in has installed.

No production code, contract, dependency, lockfile or setting changed. The same defect in adm-patient-administration and ess-audit is the work of RC-1-S28-F30 and RC-1-S28-F31, and is not touched here.

Checks and their result

Light profile as HIS_SESSION=RC-1-S28-F29 (his-rc-1-s28-f29), in services/adm-identity:

Check Command Result
The gate's failure, reproduced The old install command in node:22.18-bookworm, on a copy of contracts/ with a host pnpm install in common (pnpm 10.34.9), and again with only the planted .modules.yaml Both: ERR_PNPM_ABORTED_REMOVE_MODULES_DIR_NO_TTY, exit 1
The new test before the repair ./gradlew :mod-adm-001:test --tests '*ContractToolsTest*' with ContractTools as on main Fails: "could not install the contract tools: … ERR_PNPM_ABORTED_REMOVE_MODULES_DIR_NO_TTY"
The new test after the repair the same Passes
The gate line: build and all tests in a checkout with contracts/common installed (the owning session's tests) pnpm install --frozen-lockfile in contracts/common on the host, then ./gradlew build --rerun-tasks Passed: 162 tests, 0 failures, 1 skipped (the Kafka adapter test of the full profile). service-kit 36, mod-adm-001 112 (1 new), mod-adm-003 9, app 5. PatientIdentityContractTest passed: "verify of patient-identity.v1: 68 cases, 0 failed"
Static analysis platform/delivery-pipeline/bin/static-analysis services/adm-identity no blocking finding
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

The slice scenario was attempted and did not run. HIS_SESSION=RC-1-S28-F29 e2e/harness/scenario run e2e/scenarios/RC-1 --fresh --strict on commit be7a65fc (run 20261201T110256Z-7fbb): his-env start full failed, Keycloak unhealthy. A second his-env start full alone failed the same way after 6.5 minutes, with Keycloak still starting and a load average of 14 to 15 on the host's 4 CPUs from other work. That is the host failure RC-1-S28-G2 and RC-1-S28-F22 report, whose dedicated gate host is still waiting for the service owner. No scenario case ran on this change. The change is in the unit's test sources only: nothing the scenario builds, starts or calls is different. The environment his-rc-1-s28-f29 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-ADM-001 interface conformance) of slice gate RC-1, which the gate runs in one checkout of all folders. In that checkout PatientIdentityContractTest now installs its tools and runs, whatever contracts/ holds in node_modules: shown by ContractToolsTest (fails on main, passes now) and by the unit's build above in a checkout with contracts/common installed, where PatientIdentityContractTest passed. The next gate round, RC-1-S28-G3, no longer needs the git archive export for this unit. adm-patient-administration and ess-audit still need it until F30 and F31 are merged.

Requirements and test scenarios of the card

Requirement Test What it shows
ACC-005 (gate criterion 6) and session rule 5 (criterion 3), for IF-ADM-001 (FR-ADM-MPI-001) ContractToolsTest.installsBesideAForeignNodeModules (tagged contract, ACC-005, FR-ADM-MPI-001) The contract tools install and run beside a foreign contracts/common/node_modules
FR-ADM-MPI-001 to 005, FR-ADM-XRF-001, FR-ADM-XRF-002 (IF-ADM-001) PatientIdentityContractTest (RC-1-S08, unchanged) Runs again in the gate's kind of checkout; its verify and event validation pass

Questions and follow-ups

  • None for a person.
  • Follow-up outside the card: the other Java units' contract tests copy contracts/ in other ways (cp -r with CI=true pnpm install, or removing node_modules first). Each works, but they are eight copies of one helper. A shared test helper in the service template (services/_template/, FN-S03's folder) would keep the next unit from repeating the defect.