Implementation plan / Session plan / Handover RC-1-S28-F3
Handover RC-1-S28-F3 Fix: adm-identity runs as Tier 1¶
Card: RC-1-S28-F3. Issue: cema-care/his#208. Branch: session/RC-1-S28-F3. Slice: RC-1. Round 1 fix of the gate session RC-1-S28, readiness finding F-01. The unit belongs to RC-1-S08. Comes after RC-1-S28-F2. Decision record: ADR-HIS-096, on ADR-HIS-094.
The failure¶
The gate found that services/adm-identity/app/src/main/resources/application.yaml set his.unit.tier: 2. Architecture 5.2 gives the identity unit "Tier 1 lookup". The kit reads the tier in one place, AuditEmitter.checkBuffer. When the audit buffer is full (DEC-ESS-018), 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 patient search, resolution and registration's duplicate check.
What was decided¶
RC-1-S28-F5 found that ess-reference held Tier 2 stewardship, and wrote ADR-HIS-094: a unit declares the tier of its most critical paths, and an audited action of a lower tier declares its own.
The first version of this pull request made the whole unit Tier 1. The review (round 1) did not accept that reading, and the specification settles the point:
- NFR-ADM-003 and DEC-ADM-014 name this unit's Tier 1 services: MPI lookup and resolution, and emergency and rapid registration. Architecture 5.2 says "Tier 1 lookup".
- Identity stewardship (work items, resolution, merge, unmerge, attribution, sign-off), the correction of an identifier entered in error, and matching administration are not among them.
- DEC-ESS-018 (2) has protected actions that are not Tier 1 block on a full buffer.
ADR-HIS-096 records the result:
- the unit is Tier 1;
- lookup, resolution and registration carry on with a full buffer;
- stewardship and administration declare Tier 2 and are refused with nothing saved;
- the reads of identity matches stay Tier 1, because adm-patient-administration lists, as part of registration, the review items it raised;
- a Tier 2 command checks capacity before it does anything, since attribution, for example, calls adm-patient-administration before its audit is written.
This is read from the specification, so there is no question for a person.
What was changed and where¶
All in services/adm-identity:
app/src/main/resources/application.yaml:his.unit.tier: 1, with a comment.service-kit:AuditRecordhas an optionaltier, as in ess-reference (ADR-HIS-094). It is not part of the audit event.AuditEmitterdecides onmax(record tier, unit tier).AuditEmitter.checkCapacity(tier)refuses an action of that tier up front.mod-adm-001:AuditTrail.stewardship()is a Tier 2 view of the trail (STEWARDSHIP_TIER = 2), andrequireCapacity()checks capacity up front.- The audits that go through
stewardship():Stewardship(reported work items, resolution, the return of deferred items, the stewardship report),Merges(merge, unmerge, the unmerge request, attribution, sign-off, the merge reads),Benchmarks.start,PersonCommands.correctIdentifier, andReviewRouter.routeReported, the routing of a reported pair. - The commands that call
requireCapacity()after authorization and the idempotent replay:Stewardship.reportandresolve,Merges.unmerge,attributeandsignOff,Benchmarks.start,PersonCommands.correctIdentifier. - Refusal audits keep the unit's tier.
- Tests:
app/.../UnitTierTest.java(new), on the unit's own configuration: the unit declares Tier 1. With the audit buffer full (capacity 3), a patient search answers 200, and the duplicate check and a new person go through. Theiradm.person.searchandadm.person.changeaudits are delivered once the buffer drains.mod-adm-001/.../AuditBufferTierTest.java(new), with two cases:- with a full buffer, search, the duplicate check, registration, a No. RM and a person read carry on;
- a reported work item, a steward's resolution, an identifier correction, a matching benchmark and a merge read each answer 503 "Audit is unavailable", and the registration's lookup of identity matches still answers. Nothing is saved: the item stays pending, the person's version is unchanged, and no match is created. Once audit is back, the resolution goes through.
service-kit/.../AuditBufferTest.java: in a Tier 1 unit, a Tier 2 record andcheckCapacity(2)are refused while the unit's tier carries on; a record cannot raise its tier above its unit's.README.md: the unit's tier and the rule.
Outside the unit: ADR-HIS-096 and its row in the decision record index, and this handover. No contract changed, no dependency was added, and no lockfile changed.
Checks and their results¶
On this session's light profile, in services/adm-identity:
| Check | Result |
|---|---|
./gradlew :app:test --tests '*UnitTierTest' before the fix |
2 tests, 2 failed: expected: 1 but was: 2, and the search answered 503 unavailable, "Audit is unavailable; the action cannot be recorded now." |
| The same after the fix | 2 passed |
./gradlew :mod-adm-001:test --tests '*AuditBufferTierTest' with STEWARDSHIP_TIER set to 1 (no Tier 2 declarations) |
The stewardship case fails: the work item is accepted (201) |
./gradlew build --rerun-tasks after review round 1 |
Passed: service-kit 36 (1 skipped, the Kafka test of the full profile), mod-adm-001 106, mod-adm-003 9, app 5 |
python3 docs/implementation_plan/tools/check_links.py |
0 broken |
A first full build failed in PatientIdentityContractTest with ERR_PNPM_ABORTED_REMOVE_MODULES_DIR_NO_TTY. While that build ran, this session had installed contracts/common on the host, for the slice scenario's stubs (RC-1-S28-F10). The contract test copies contracts/ into its container and runs pnpm install there, and that install refused to replace the host's node_modules without a terminal. With the host's node_modules moved aside, the build passed. See the follow-ups.
Slice scenario, first version (before F6). HIS_SESSION=RC-1-S28-F3 e2e/harness/scenario run e2e/scenarios/RC-1, full profile, each run after his-env reset. contracts/common, ess, adm and ise were installed first with CI=true pnpm install --frozen-lockfile, as in RC-1-S28-F4. No other session's stack was running, but the host's load average was 10 to 18.
- Run 1 (evidence
20261129T104033Z-55c3): 10 of 12 passed. RC-1-E2E-003 and 004 failed with 503 "Authorization service unavailable", and 004 got 503 where it expected 403. Those are policy decision timeouts, and adm-identity logged 61 "did not answer in time" denials. - Run 2 (evidence
20261129T105320Z-157e): 11 of 12 passed, RC-1-E2E-001 to 005, 007, 008 and 010 to 013. RC-1-E2E-006 failed: the screen never showed "Registration complete". As in F4's runs 1 and 3, this came after RC-1-E2E-004 had restarted the decision service, with 46 decision timeouts in adm-identity's log. - In neither run did any unit log "audit buffer full", so the tier was never consulted. The failures are the decision service's warm-up and timeouts under load, which is fix RC-1-S28-F6 (#212). F6 was merged to main (#240) after these runs, so they ran without it. They are not caused by this change. Every test failed in one run and passed in the other, and RC-1-E2E-002, the failure of F1, now passes.
Slice scenario after review round 1, on a base that includes F6 (#240) and F11's gateway (ADR-HIS-095). Evidence 20261129T153645Z-c8d0. The scenario now has 13 tests, with RC-1-E2E-009, the gateway. 10 of 13 passed: RC-1-E2E-001 to 005, 007 and 010 to 013.
- RC-1-E2E-006 failed as before: the screen never showed "Registration complete".
- RC-1-E2E-008 got 503 where it expected 200.
- RC-1-E2E-009 got 503 "Authorization service unavailable" through the gateway.
- adm-identity logged 69 "did not answer in time" denials from the policy decision point.
- The full stacks of RC-1-S28-F12 and F13 ran on the same 4-CPU host throughout, with a load average of 17 to 20.
- No unit logged "audit buffer full", and none answered "Audit is unavailable". So neither the unit's tier nor the new Tier 2 refusals came into play: no request was refused by this change.
The failures are decision timeouts under host load. A clean run of the slice needs a host that is not shared by three full stacks. The next gate round, RC-1-S28-G2, runs it again.
Requirements and test scenarios of the card¶
| Requirement | Test |
|---|---|
| FR-ISE-PLT-002 criticality tiering, for this unit | UnitTierTest "the identity unit runs as Tier 1" (tags FR-ISE-PLT-002, NFR-ADM-003, DEC-ESS-018) |
| NFR-ESS-004 Tier 1 dependencies inherit Tier 1, and NFR-ADM-003 MPI lookup and resolution at Tier 1; DEC-ESS-018 | UnitTierTest "with the audit buffer full, patient search, the duplicate check and registration carry on, and their audits are kept"; AuditBufferTierTest "with the audit buffer full, search, the duplicate check, registration and a No. RM carry on" |
| DEC-ESS-018 (2) and NFR-ADM-003: protected actions that are not Tier 1 block (stewardship of FR-ADM-MPI-003 to FR-ADM-MPI-005, the correction of FR-ADM-XRF-001, benchmarks) | AuditBufferTierTest "with the audit buffer full, stewardship and administration are refused with nothing saved, until audit is back"; AuditBufferTest lowerTierActionBlocksWhenFull, cannotRaiseTier |
What the gate line now shows. The line is Criterion 4 (ACC-001), the traceability matrix row of FR-ISE-PLT-002. With this change, all three units it named declare Tier 1: adm-identity here, ess-runtime-decision (RC-1-S28-F4) and ess-reference (RC-1-S28-F5). For adm-identity, the tests show that, with a full audit buffer, lookup, resolution and registration carry on while stewardship and administration block. The row stays Not met for its other cause: no RC-1 catalogue entry is 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-F10 (#216): the stubs need
contracts/common/node_moduleson the host. That folder then breaks this unit's contract test, which copiescontracts/into its container and runspnpm installthere without a terminal. The container install should setCI=trueor leave the host'snode_modulesout of the copy (ContractToolsin mod-adm-001; other units' contract tooling likely has the same problem). - For the template (
services/_template, FN-S03): take overAuditRecord.tierandAuditEmitter.checkCapacityso that every unit has them. - For ess-runtime-decision (RC-1-S16, after RC-1-S28-F4): its administrative actions still carry on at unit-wide Tier 1, as F5 noted. The same rule applies there.