Skip to content

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

Handover RC-1-S28-F14 Fix: the audit catalogue registers the backbone's replay and dead-letter closure, and audit.v1 1.2 lets a refusal state that it had no decision or no record

Card: RC-1-S28-F14. Issue: cema-care/his#220. Branch: session/RC-1-S28-F14. Pull request: cema-care/his#253. Owner session: RC-1-S04. Decision record: ADR-HIS-101.

Comes after RC-1-S28. The issue's first comment holds the gate's evidence: audit-quarantine.csv of the gate run showed: - ise.message.replayed (2) and ise.dead-letter.closed (1), quarantined as "not in the audit event catalogue"; - 45 adm.person.search events from adm-identity, quarantined for lacking decisionId and policyVersion. These were searches refused because no decision came back.

The session ran in three steps. The first run did the catalogue and let any refusal through without a decision. The review (round 1) found that this decided a conflict of the specification that session rule 3 leaves to a person. The exemption was taken out, the question was asked on #220, and the session was blocked. The Security and Privacy Office with the Domain 10 owner ruled on #220 (comment 7276973279): option A. This run implements that ruling. It also carries the audit service's part of the ruling on #224 (comment 7276976245), agreed with RC-1-S28-F18, so that one contract version and one set of migrations cover both.

Scope as read

The work is in services/ess-audit, the unit of RC-1-S04, and in its contract contracts/ess (audit.v1). It has two parts:

  1. register the backbone's event types and find out why they were missing;
  2. give the audit service a way to store a record-access refusal that had no access decision. The ruling sets the way: an optional marker in a compatible minor version of audit.v1, with outcome denied.

Carried for RC-1-S28-F18 (#224, agreed with that session): the same contract version's recordNotCreated marker for a refused creation, and the registration of adm.person.view and adm.person.change as not patient-scoped. F18's own unit is adm-patient-administration, which cannot change the audit service or its contract. Its pull request changes only the emitter.

No emitter is changed here. Each emitter that must now send a marker is listed under the follow-ups.

What was built and where

The cause of the missing types. The generator services/ess-audit/scripts/catalogue-migration.py (RC-1-S04) read only 9.5 rows whose first cell was a single code. D02-ISE 9.5 lists several codes in one cell in most of its rows, for example ise.message.replayed, ise.dead-letter.closed, ise.reconciliation.closed. As a result, 30 of its types were never registered. No other domain was affected.

Part Change
scripts/catalogue-migration.py Reads a comma-separated list of codes in the first cell, each a type of the row's category, and stops on a first cell that mixes codes and other text. It writes only the types no migration of mod-ess-006 registers yet, so its output is the next migration. With nothing new, it says so and writes nothing
mod-ess-006/.../V6__event_catalogue_listed_codes.sql Generated: the 30 missing D02 types at their category's default (235 types in all)
mod-ess-006/.../V7__ise_backbone_registration.sql Registers ise.message.replayed, ise.dead-letter.closed and ise.reconciliation.closed as not patient-scoped, with the reason (GAP-ESS-016 point 2). Each acts on a backbone or integration item, which may concern many patients or none
contracts/ess: schemas/AuditEventSubmission.v1.schema.json, api/audit.v1.openapi.yaml (1.1 to 1.2), TRACE.md, stubs/stub.json (regenerated) Two optional intake markers, each const: true: decisionUnavailable (#220) and recordNotCreated (#224). The ruling says "1.1", but 1.1 is already the forwarding version of RC-3-S01, so the markers are 1.2. That is the next compatible minor version, which is what the ruling asks for
SubmissionValidator, AuditStore For outcome denied only. decisionUnavailable waives decisionId and policyVersion (record access; authorization and emergency access). recordNotCreated is valid only on a refused creation (record change, action create), and there waives the record reference with its version, the changed field names and the patient reference. A marker on any other outcome, recordNotCreated on any other category or action, or decisionUnavailable with a decision, is an error and waives nothing. Both markers are kept in the stored event
mod-ess-006/.../V8__adm_person_view_change_registration.sql adm.person.view and adm.person.change not patient-scoped, with the reasons agreed with F18 (ruling on #224, part 1; GAP-ESS-016 points 2 and 4)
README.md of the unit The validation row, the generator and the catalogue count
ADR-HIS-101 and its row in the decision record index (106 records) The catalogue decision, and the shape of the markers: which fields each waives, on which outcome, and that misuse is an error

Checks and their result

The integration environment ran as HIS_SESSION=RC-1-S28-F14 (his-rc-1-s28-f14), light profile for the unit's build.

Check Command Result
Build and all tests of the unit (the owning session's tests) ./gradlew build in services/ess-audit passed: 93 tests, 0 failures (AuditIntakeTest 23, four of them added by this card), the contract tests among them
The new tests fail before the repair ./gradlew :mod-ess-006:test --tests '*AuditIntakeTest*', with the validator, AuditStore, the schema and V8 as before this run 3 of 23 fail: refusalWithoutDecision and refusedCreationWithoutRecord (the events are quarantined), and patientScopedRegistration (adm.person.view is patient-scoped). With the repair, 23 of 23 pass
Contract check HIS_PIPELINE_BASE=origin/main platform/delivery-pipeline/bin/contract-check contracts/ess lint passed; check passed, "api audit v1: 1.1 -> 1.2"; stubs up to date. This host's Node.js 22.22 is a distribution build without TypeScript support, so the check ran in the pinned node:22.18-bookworm image
The generator against the merged migrations python3 services/ess-audit/scripts/catalogue-migration.py "every published event type is registered (235)"
Slice scenario HIS_SESSION=RC-1-S28-F14 e2e/harness/scenario run e2e/scenarios/RC-1 --fresh --strict Run 20261130T121316Z-f057 on commit cf3bd92 (clean tree): 7 of 15 pass. None of the eight failures is audit intake, and no event was quarantined for a marker. RC-1-E2E-014 and 015 fail on ess-governance's own audit gap, which its events still have (RC-1-S28-F12 handover), as in the earlier run. RC-1-E2E-001, 006, 008, 009, 010 and 011 fail on 503 "Authorization service unavailable": the policy engine (OPA) timed out 89 times, on a host with 4 cores and a load average of 25 to 28 from other sessions' runs (NFR-ESS-001). RC-1-E2E-010 alone got 632 such answers. The earlier run 20261129T190630Z-6961 (commit b5ec7ce) passed 9 of 15, with the same two governance failures and fewer outage failures. A second run on the same commit, 20261130T123702Z-05e3, passed 1 of 15. The host's load average reached 65 to 77 and OPA timed out 497 times, so every case met 503s. It shows only the host. Its tree is marked dirty because this handover was being edited during it (documentation only). A clean pass of the slice needs a host with the capacity NFR-ESS-001 assumes
Static analysis platform/delivery-pipeline/bin/static-analysis services/ess-audit no blocking finding (also over contracts/ess)
Secret scan platform/delivery-pipeline/bin/secret-scan code origin/main HEAD no secret found
Documentation links and site python3 docs/implementation_plan/tools/check_links.py; .venv/bin/mkdocs build 0 broken, 0 duplicate anchors; builds

No dependency was added, so the dependency and image scans have nothing new.

What the gate line now shows

Gate line: criterion 6 (ACC-005) for IF-ESS-008, and criterion 4 for FR-ESS-AUD-001. Its check is the audit quarantine after the slice run (mod_ess_006.quarantine_entry in ess_audit). Run 20261130T121316Z-f057 left 699 entries:

Event type and emitter Gate run (RC-1-S28) Run 20261130T121316Z-f057 (this branch) What clears it
ise.message.replayed, ise.dead-letter.closed (backbone) 2 and 1, quarantined as unregistered None quarantined. ise.dead-letter.closed stored (1); no replay in this run This card (V6, V7) with RC-1-S28-F15 (#254)
adm.person.view refused (denied) reads of encounters that do not exist (adm-patient-administration) 11 quarantined for the patient reference None quarantined. 58 stored This card (V8, #224 part 1)
adm.person.change, a refused registration of a new person (adm-patient-administration, RC-1-E2E-004) 1 1 (denied: no record, changed fields) RC-1-S28-F18 (#267) sends recordNotCreated
Outage refusals, outcome failure, no decision: adm.person.search (adm-identity) 440, adm.person.view (adm-patient-administration 12, adm-identity 4) 45 (adm.person.search) 456 Each emitter sends denied with decisionUnavailable (follow-ups). The count follows the outages of the run
Outage refusals under the template's unregistered access-check-unavailable: ess-reference 185, ess-governance 12, backbone 4 not shown by the gate run 201 The template and each unit's kit audit the refused action's own type, denied, with decisionUnavailable (follow-ups)
Refused creations during an outage: adm.person.change (adm-identity 4, adm-patient-administration 3), adm.encounter.change (2) not shown by the gate run (2 from adm-identity in run 20261129T190630Z-6961) 9 The emitters send both markers (follow-ups; F18 for its unit's decided refusals)
ess-governance ess.cfg.item 24, ess.cfg.catalogue 4, ess.cfg.extension 3 its own gate line (RC-1-S28-F12) 31 ess-governance's own fix (RC-1-S28-F12 handover)
ess.iam.service-identity-misuse (ess-runtime-decision) not shown by the gate run (5 in run 20261129T190630Z-6961) 1 No fix card yet (RC-1-S28-F16 handover)

No entry is quarantined for a reason this branch added or for a marker. The audit service's side of the line is complete: each remaining entry clears when its emitter sends what the rulings ask, or when its own fix is merged. The line itself stays failed until then.

Requirements and test scenarios of the card

Tests are in services/ess-audit/mod-ess-006/src/test/java/care/cema/his/ess/mod006/AuditIntakeTest.java (tags FR-ESS-AUD-001, TEST-ESS-022).

Requirement Test What it shows
FR-ESS-AUD-001 part 6.1 (each domain's types registered, each in one category), TEST-ESS-022 everyPublishedTypeRegistered Every code of every section 9.5 table of the ten specifications is registered in its row's category, including rows that list several codes. The test reads docs/domain_specs itself, so a type a domain publishes later fails it until it is registered. The failure names the generator to run
FR-ESS-AUD-001 part 6.1, part 7 with GAP-ESS-016 point 2; FR-ISE-EVT-002 backboneClosuresRegistered The three closure types are Record change and not patient-scoped, with a reason. A conforming event of each from the backbone, without a patient reference, is stored
FR-ESS-AUD-001 part 4 and AC-06 with D10-ESS 9.5 and DEC-ESS-018 (ruling on #220) refusalWithoutDecision A refusal with decisionUnavailable and no decision is stored, with the marker, for record access (cli.record.view, adm.person.search) and for authorization (ise.gateway.denied). The same refusal without the marker is still quarantined for /decisionId and /policyVersion. The marker on success or failure, with a decision, or as false is quarantined
FR-ESS-AUD-001 AC-06 with D10-ESS 9.5 record change (ruling on #224, part 2) refusedCreationWithoutRecord A refused creation with recordNotCreated and no patient, record or changed fields is stored (cli.entry.create, adm.person.change). A known patient is kept, and an outage refusal of a creation with both markers is stored. Without the marker the event is quarantined, and the marker on success or failure waives nothing. On a refused update (cli.entry.update, action update), and on a refused Break-the-Glass, consent directive, disclosure or record view, the marker is an error, the patient is still required and the event is not stored (review round 3)
FR-ESS-AUD-001 part 7, GAP-ESS-016 point 2 (ruling on #224, part 1) patientScopedRegistration (extended) adm.person.view and adm.person.change are not patient-scoped, with their reason. patientScopedTypeNeedsPatient now uses cli.entry.update and cli.record.view as its patient-scoped examples
FR-ESS-AUD-001 AC-01 everyRegisteredTypeOfEveryDomain (RC-1-S04, unchanged) A conforming event of each of the 235 types is stored and found

Differences from the card, specification or contract

  • Contract change, backward compatible (session rule 4): audit.v1 1.1 to 1.2 adds two optional intake fields, and nothing is removed or tightened. The compatibility check passes.
  • The version number. The ruling on #220 reads: "a new optional field in audit.v1, a compatible minor version 1.1 (for example decisionUnavailable: true)". On main, audit.v1 was already 1.1: RC-3-S01 had added the forwarding under that number (the header of contracts/ess/api/audit.v1.openapi.yaml). Reusing 1.1 would give two different contracts one version, and the compatibility check reports a change only against a new number. 1.2 is the next compatible minor version, which is what the ruling asks for. The number follows from the state of main.
  • recordNotCreated also waives the record reference itself, not only its version. The ruling on #224 reads: "An optional marker ... says the refused action had no record. The audit service then waives version, changed fields and patient reference for that event only." The question it answers named the refused registration's missing fields as /patientRef, /resourceRef and /beforeAfter/changedFields. Of the options, only B kept a reference, by naming "the record the request would have created", at the risk that "the trail names a record that never existed". The ruling chose A over B. A record reference of an action that "had no record" could only be such an invented one, so this run waives it with its version. A reference that is known is still sent and stored. This reading is ADR-HIS-101 point 6, and it is listed under "Needs a person" for confirmation.
  • recordNotCreated is limited to a refused creation: an event of record change with action create (review round 3). The ruling speaks of a refused action that "had no record", and its question was about record change. Every other category names its patient or item even on a refusal, so the patient is not waived there: a refused Break-the-Glass, consent directive, disclosure or record view that sends the marker is quarantined with /recordNotCreated as the reason. Both emitters of #267 send action create (the policy action of Actions.CREATE), so this does not change what F18 sends.
  • Part of #224's card is done here, by agreement with RC-1-S28-F18: the marker, its validation and V8. F18's pull request changes only the emitter.

Questions for a person

None blocks the card. Listed under "Needs a person" in the pull request: the approval of ADR-HIS-101 by the Enterprise Architecture Board; the review of the audit.v1 1.2 change by the Domain 10 lead; and, for the Security and Privacy Office with the Domain 10 owner, confirmation of the two readings of the rulings above (version 1.2; the record reference waived with recordNotCreated; and that marker limited to record change with action create, so that the patient reference is never waived in another category), given on the merged work.

Follow-ups outside the card

  • Emitters that must send the markers. Their events stay quarantined until each one does:
  • the service template's PolicyEnforcer (services/_template, FN-S03), and every unit's copy of the kit. An outage refusal is audited today under the unregistered code access-check-unavailable, with outcome failure. Under the ruling it should be audited under the event type of the action it refused, with outcome denied and decisionUnavailable: true;
  • adm-identity (adm.person.search, outcome failure today);
  • the gateway plugin (ise.gateway.denied; outcome denied is right, the marker is missing);
  • ess-reference, ess-governance and the event backbone (access-check-unavailable);
  • adm-patient-administration: RC-1-S28-F18 (#267) sends recordNotCreated on a decided refusal of a creation. On an outage its refusals still send failure without a marker, which F18 lists as a follow-up of its own.
  • D02 departures from the category default for the other 27 new types (for example whether ise.offline-sync.* or ise.payload.* always concern a patient) are D02's to declare when its build sessions emit them. They are registered at the default until then.
  • Other emitters in the quarantine of run 20261129T190630Z-6961 without a fix card, for the gate's next round:
  • adm-identity's adm.person.change (2: no patient, resource or changed fields; a refused creation sends recordNotCreated);
  • ess-runtime-decision's ess.iam.service-identity-misuse (5: no affected component);
  • adm-patient-administration's adm.encounter.change (1).
  • Host tooling: the host's Node.js (/usr/bin/node 22.22, a Debian build) has no TypeScript support, so his-contract fails there with ERR_UNKNOWN_FILE_EXTENSION. It runs in the pinned image.
  • Design system: none from this session.