Skip to content

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

Handover RC-1-S28-F4 Fix: ess-runtime-decision runs as Tier 1

Card: RC-1-S28-F4. Issue: cema-care/his#209. Branch: session/RC-1-S28-F4. Slice: RC-1. Round 1 fix of the gate session RC-1-S28, readiness finding F-01. The unit belongs to RC-1-S16. No decision record: the fix takes no architecture decision.

The failure

The gate found that services/ess-runtime-decision/app/src/main/resources/application.yaml set his.unit.tier: 2. Architecture 5.2 makes the runtime decision services "Tier 1, stateless, scaled horizontally". NFR-ESS-004 says authentication, policy decision and consent decision inherit the Tier 1 objective as dependencies of Tier 1 workflows. The kit reads the tier in one place, AuditEmitter.checkBuffer. When the audit buffer is full (DEC-ESS-018, architecture 8.4):

  • a Tier 1 unit carries on, with its outbox as the local durable log;
  • any other unit refuses its protected actions as unavailable.

At Tier 2, a long audit outage would therefore have stopped the identity, policy decision and consent services that every Tier 1 workflow depends on.

What was changed and where

  • services/ess-runtime-decision/app/src/main/resources/application.yaml: his.unit.tier: 1, with a comment that cites architecture 5.2, NFR-ESS-004 and DEC-ESS-018.
  • services/ess-runtime-decision/app/src/test/java/care/cema/his/ess/app/UnitTierTest.java: a new test of the whole unit. It runs on the unit's own configuration and does not override the tier. It has two cases:
  • the unit declares Tier 1;
  • with the audit buffer full (capacity 3, audit service away), a protected action still commits, and every buffered audit event is delivered once the audit service is back.
  • services/ess-runtime-decision/README.md: one paragraph on the unit's tier and the test that holds it.

The kit, the modules and the contracts are unchanged. No dependency was added, and no lockfile changed.

Checks and their results

On the light profile, in services/ess-runtime-decision:

Check Result
./gradlew :app:test --tests '*UnitTierTest' before the fix 2 tests, 2 failed: expected: 1 but was: 2, and HisException: Audit is unavailable; the action cannot be recorded now.
The same after the fix 2 passed
./gradlew build after the fix Passed
./gradlew build --rerun-tasks (all modules at once) service-kit 31 (1 skipped), mod-ess-001 89 (3 skipped), mod-ess-003 39, app 7: all passed. mod-ess-002: 13 of 94 failed, each with 503 "policy decision service unavailable", the cold-engine failure of RC-1-S28-F6 (#212).
./gradlew :mod-ess-002:test --rerun-tasks alone 94 passed

The mod-ess-002 failures cannot come from this change. That module's tests do not have the app module's application.yaml on their classpath, and they pass when run alone. The engine does not warm up in time when all the modules' tests run at once, which is the problem F6 fixes.

Slice scenario. HIS_SESSION=RC-1-S28-F4 e2e/harness/scenario run e2e/scenarios/RC-1, full profile. On this fresh checkout the first run stopped before any test: the ess contract stub could not find the package yaml, the harness defect of RC-1-S28-F10 (#216). After pnpm install --frozen-lockfile in contracts/common (with CI=true) and in contracts/ess, adm and ise, no files changed and the scenario ran:

  • Run 1: 9 of 12 passed (001, 003, 004, 005, 008, 010 to 013).
  • RC-1-E2E-002 failed as at the gate: provisional after "unsure" where GAP-ADM-012 requires active, fix RC-1-S28-F1 (#206).
  • RC-1-E2E-006 and 007, which passed at the gate, failed with 503 on calls that adm-patient-administration made 25 s after RC-1-E2E-004 had killed and restarted ess-runtime-decision. Its log shows the cause: "policy decision point did not answer in time (680 ms), denying". The restarted decision service was still cold, which is again F6.
  • The tier played no part in this run. AuditEmitter logs "audit buffer full" whenever the tier is consulted, and no unit logged it. The code therefore ran exactly as it would have at Tier 2.
  • Run 2, on the stack run 1 left behind: stopped in provisioning ("MOD-ESS-001 did not provision e2e.registrar.a in the realm within 60 s"). No test ran. The next run started from his-env reset and passed this step.
  • Run 3, after his-env reset (evidence 20261129T061519Z-1a7a): 10 of 12 passed, RC-1-E2E-007 included.
  • RC-1-E2E-002 failed as above (F1).
  • RC-1-E2E-006 failed again with 503s on GET /adm/v1/encounters: adm-patient-administration's decision call timed out after the restart in RC-1-E2E-004.
  • Again, no unit logged "audit buffer full".
  • Run 4, a comparison with the tier set back to 2 in the working tree only (never committed). Another session (RC-1-S28-F2) was running its full environment on the same 4-CPU host at the same time. The load average rose to about 30, the units ran out of database connections (CannotGetJdbcConnectionException), and nearly every test failed. That says nothing about the tier, so the run was stopped and the tier set back to 1.

A clean side-by-side comparison of 006 against main was therefore not obtained. The case that this change does not cause 006's 503s rests on the code: his.unit.tier is read only when the audit buffer is full, and no run ever filled it. The gate saw 006 pass. Since the gate, main has gained RC-3-S06 (adm-patient-administration), and the run order and host load vary between runs. The next gate round should look at 006 together with F6.

Requirements and test scenarios of the card

Requirement Test
FR-ISE-PLT-002 criticality tiering, for this unit UnitTierTest "the runtime decision services unit runs as Tier 1" (tags FR-ISE-PLT-002, NFR-ESS-004)
NFR-ESS-004 Tier 1 dependencies inherit Tier 1; DEC-ESS-018 UnitTierTest "with the audit buffer full, the unit's protected actions carry on" (tags FR-ISE-PLT-002, NFR-ESS-004, DEC-ESS-018)

What the gate line now shows. The line is Criterion 4 (ACC-001), the traceability matrix row of FR-ISE-PLT-002. ess-runtime-decision now declares Tier 1, and its Tier 1 behaviour under a full audit buffer is tested. The row stays Not met until two more things are done: adm-identity and ess-reference declare Tier 1 (fixes RC-1-S28-F3, #208, and RC-1-S28-F5, #211), and the RC-1 catalogue entries are registered (runbooks, section 6). The next gate session, RC-1-S28-G2, records it again.

Done differently from the specification or contract

Nothing.

Questions and follow-ups

  • No question for a person.
  • For RC-1-S28-F6 (#212): the decision service is cold after a restart as well as at first start. In runs 1 and 3, adm-patient-administration's 680 ms decision timeout denied calls 25 s after RC-1-E2E-004 had restarted ess-runtime-decision. RC-1-E2E-006 failed both times, and RC-1-E2E-007 once. A warm-up that F6 adds before readiness should also cover the restart.
  • For RC-1-S28-F10 (#216): the stubs still fail on a fresh checkout until contracts/common is installed by hand, and pnpm refuses that install without a terminal unless CI=true is set.