Skip to content

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

Handover RC-1-S28-F26 Fix: ess-reference audits refusals during a decision outage under the unregistered type access-check-unavailable

Card: RC-1-S28-F26. Issue: cema-care/his#278. Branch: session/RC-1-S28-F26. Slice: RC-1. This is a round 2 fix of the gate session RC-1-S28-G2. The unit belongs to RC-1-S06.

The card ran twice:

  1. First run: it stopped under rule 3 on the question RC-1-S28-F25 had asked on cema-care/his#277: how a refusal is audited in Administration and configuration.
  2. Second run: it finished the card once the ruling was given: option A, relayed on #277 for the Security and Privacy Office and the Domain 10 owner.

The failure

The gate's evidence is in the first comment on #278, from run 20261201T000308Z-fa9c (audit-quarantine.csv). The audit service quarantined 380 events from ess-reference, each as unregistered-event-type with the type access-check-unavailable.

What was refused. The run's API calls for scenario RC-1-E2E-010 (api-calls.json) hold 400 calls to ess-reference. Every one is GET /v1/codes/validate, and each answered 503 while the decision point timed out. So the 380 events are refused runtime code validations (mod-ess-004 RuntimeService.validate, policy action ess.trm.read).

Where the type came from. The unit's kit PolicyEnforcer audited every refusal itself, under fixed types:

  • an outage as access-check-unavailable, outcome failure;
  • a Deny as access-denied.

Neither type is in the audit catalogue, so every refusal of the unit, of any module, was quarantined.

The ruling it follows

The ruling on #277 is option A, consistent with the ruling on #220 and ADR-HIS-101. A refusal is audited:

  • under the refused action's own event type;
  • with outcome denied;
  • with the decision for a Deny, or decisionUnavailable for an outage.

In Administration and configuration, the intake waives the before and after values of a refusal, since nothing changed. It also waives the item reference and version when the refusal concerns no existing item. That extends recordNotCreated to this category. A refusal of an existing item names it with its version.

What was changed and where

Only services/ess-reference:

  • Kit (service-kit):
  • RefusalAudit (new, kit.policy): the audit event type of the refused action, and a supplier of the current version of the item the check names. The version is read only when the request is refused, so a permitted request, such as a code validation on the hot path, costs no extra query.
  • PolicyEnforcer.require(PolicyCheck, RefusalAudit) replaces require(PolicyCheck), so every call site must name its type, and the compiler checks it. A refusal is audited in its own transaction, as before, as follows:

    • type: the given one;
    • outcome: denied, for both an outage and a Deny;
    • decision: for a Deny, its decision identifier and policy version; for an outage, decisionUnavailable: true and no decision;
    • item: the resource reference, with resourceRef.version when the item exists. When the check names no item, or the item does not exist, recordNotCreated: true, still with the identifier when the check gave one. When the version cannot be read (the query fails, for example on a full connection pool), the item is named by its identifier alone, with neither version nor marker: an existing item is never audited as one that does not exist (review round 1);
    • no before and after values. The reason, which used to be in the event, now goes to the debug log.

    The types access-check-unavailable and access-denied are gone from the unit. - AuditRecord.Builder gets decisionUnavailable() and recordNotCreated(), written as top-level fields. build() refuses either marker on any outcome but denied, and decisionUnavailable next to a decision, as ADR-HIS-101 point 7 does. - mod-ess-004 (terminology), in Access: - Every action is typed ess.trm.content, except ess.trm.failure.report. That action raises an unmapped-code stewardship item, so it is typed ess.trm.map (9.5). - A code system or value set is named with its registration version, the version its own events name (RC-1-S28-F17). The new query is Store.registrationVersion. - A terminology version is named with its version, as its success events name it (AuthoringService). - These name no item: catalogue lists, version creation, value set binding validation and failure reports. - mod-ess-005 (master data), in Access: - The type is the one Governance.auditType gives the kind: ess.mdm.practitioner, ess.reg.change for a registry kind, otherwise ess.mdm.change. With no kind, such as the domain register or a batch, the type is ess.mdm.change. - An entity is named with its current version (Store.at). - A proposal is named with its revision (Governance.proposalRefusal). - These name no item: a proposal submission, a batch, and the list reads. - mod-ess-010 (registry), in Registry: - Every refusal is typed ess.reg.change. - An entry is named with its current version. - A resolution and the list reads name no item. - Tests: - AuditCategoryRules (kit test fixtures) gets refusalErrors. It is the audit service's rule for a refusal of Administration and configuration under the ruling. It also gets refusalsAfter and lastPosition, which read the refusal events written during a test. - ContractTool (mod-ess-004 and mod-ess-010 contract tests) waits up to 3 minutes for the ESS stub to listen, in place of 20 s (checks below). - The new tests are below. MasterDataContractTest.auditEventsMeetIntakeSchema now expects the Deny under ess.mdm.change with its decision, in place of access-denied. It still validates every event against audit.v1 with the ESS stub.

No contract file, dependency, lockfile, migration or setting changed. No decision record: the shape is the ruling's and ADR-HIS-101's. RefusalAudit is a local choice of this unit's kit.

Checks and their result

Light profile as HIS_SESSION=RC-1-S28-F26 (his-rc-1-s28-f26), in services/ess-reference:

Check Command Result
The new tests ./gradlew :mod-ess-004:test --tests '*RefusalAuditTest*' :mod-ess-005:test --tests '*RefusalAuditTest*' :mod-ess-010:test --tests '*RegistryTest.refusals*' 7 of 7 pass: RefusalAuditTest 4 (mod-ess-004), RefusalAuditTest 2 (mod-ess-005), RegistryTest.refusalsAuditedUnderTheirOwnType 1
The kit's refusal item (review round 1) ./gradlew :service-kit:test --tests 'care.cema.his.kit.policy.RefusalItemVersionTest' 3 of 3 pass: an existing item with its version; no item with recordNotCreated; an unreadable version with the identifier alone. With the round-0 PolicyEnforcer, unreadableVersion fails (it said recordNotCreated)
After review round 1 ./gradlew :service-kit:test :mod-ess-004:test --tests '*RefusalAuditTest' :mod-ess-005:test --tests '*RefusalAuditTest' :mod-ess-010:test --tests '*RegistryTest' All pass: service-kit 33 (1 skipped, Kafka), RefusalAuditTest 4 and 2, RegistryTest 9. The full ./gradlew build was tried three times and could not finish locally: this session's PostgreSQL container got a fast shutdown request (docker stop, exit 0) from outside the build every few minutes (14:29, 14:37, 14:43, 14:54 UTC on 2026-12-01). The environments of RC-1-S28-F27 and RC-3-S15 were stopped too, so this is the host, not the unit. Every failure in those runs was "Connection refused" or "the database system is shutting down" at context start. The change of round 1 is the kit's PolicyEnforcer alone. The pipeline's build of the unit (./gradlew build on the light profile, run 46675731403) passed on round 1's commit. Round 2 changes only this handover, plus a merge of main that touches no file of this unit; the local build was stopped the same way again (02:39 UTC on 2026-12-02)
The same tests with main's sources src/main of the kit and the three modules as on origin/main; tests and fixture kept 7 of 7 fail, on the gate's defect. A Deny comes out as access-denied (for example expected: "ess.trm.content" but was: "access-denied"). An outage comes out with outcome failure, so the outage tests find no refusal (Expected size: 1 but was: 0). noUnregisteredTypes counts 2 events of the unregistered types
Build and all tests of the unit, the owning session's included ./gradlew build 181 tests: 178 passed, 1 skipped (the Kafka test of the full profile), 2 failed. Both failures were the audit.v1 consumer tests (TerminologyContractTest and MasterDataContractTest.auditEventsMeetIntakeSchema), with "the stub of contracts/ess did not start". The test gave the stub 20 s to listen. Started by hand at a load average of 54, it listened after 72 s. Their ContractTool (mod-ess-004, mod-ess-010) now waits up to 3 minutes, and returns as soon as the stub answers. Both then passed (2 of 2). They run after the changed assertions, so the Deny under ess.mdm.change is also checked against audit.v1 by the ESS stub. Every other test passed: service-kit 30, mod-ess-004 66, mod-ess-005 40, mod-ess-010 40, app 5
Documentation python3 docs/implementation_plan/tools/check_links.py 0 broken links, 0 duplicate anchors. Static analysis (platform/delivery-pipeline/bin/static-analysis services/ess-reference): no blocking finding

The slice scenario was not run on this host. RC-1-S28-F22 and F25 found that the full profile does not start under the host's CPU steal, and this session saw a load average above 40. This change alters only the content of the audit events of refused requests. Every answer is unchanged: an outage is still a 503 and a Deny still a 403. So no scenario step can pass or fail differently, except through the quarantine. The next gate round, RC-1-S28-G3, runs the scenario.

What the gate line now shows

The line is criterion 6 (ACC-005), IF-ESS-008 audit intake, and criterion 4, FR-ESS-AUD-001 ("every action audited, nothing quarantined"), of slice gate RC-1. Its check is the audit quarantine after the slice run.

Gate events Before Now sent as Intake
380 access-check-unavailable: code validations refused during the outage quarantined, unregistered type ess.trm.content, action ess.trm.read, denied, decisionUnavailable, no decision, the code system with its registration version, no before or after (RefusalAuditTest.outageRefusalOfCodeValidation) registered type. The event names its item and version, so only the before and after waiver of the ruling is needed. That waiver is not yet in services/ess-audit SubmissionValidator (follow-up below). Until it is, these events are quarantined as schema-invalid at /beforeAfter instead of unregistered
Any access-denied (none in the gate run) quarantined, unregistered type the action's own type, with the decision (denyOfVersionRead, the registry and master-data tests) the same waiver
Refusals of a list read, a creation or a report (none in the gate run) quarantined, unregistered type the action's own type, with recordNotCreated (refusalsWithoutAnItem, outageRefusalOfAListRead, denials) needs the ruling's extension of recordNotCreated to Administration and configuration. Today's intake calls the marker malformed outside record change

So the emitter half of the line is done: no ess-reference refusal uses an unregistered type, and each event meets the ruling's rule in the tests. The line holds once the intake half is merged.

Requirements and test scenarios of the card

Requirement Test
FR-ESS-AUD-001 AC-06 with D10-ESS 9.5 and the rulings on #220 and #277: a refusal during an outage is audited under its action's type, denied, decisionUnavailable; IF-ESS-008 (gate criterion 6); FR-ESS-TRM-002 mod-ess-004 RefusalAuditTest.outageRefusalOfCodeValidation (the gate's case), noUnregisteredTypes
FR-ESS-AUD-001 AC-06: a Deny names its decision and the item with its version; FR-ESS-TRM-001 RefusalAuditTest.denyOfVersionRead
FR-ESS-AUD-001 AC-06 with the ruling on #277: a refusal that concerns no existing item says recordNotCreated RefusalAuditTest.refusalsWithoutAnItem (mod-ess-004); RefusalAuditTest.outageRefusalOfAListRead, denials (mod-ess-005, FR-ESS-MDM-001)
The same for the registry, FR-ESS-REG-001 RegistryTest.refusalsAuditedUnderTheirOwnType
ARC-8.4, IF-ESS-008: the unit's audit events meet audit.v1 MasterDataContractTest.auditEventsMeetIntakeSchema (RC-1-S06, updated)

Every test is tagged FR-ESS-AUD-001 and IF-ESS-008, with the module's requirement.

Done differently from the specification or contract

The audit.v1 contract (session rule 4). The description of recordNotCreated in contracts/ess/schemas/AuditEventSubmission.v1.schema.json (audit.v1 1.2) allows the marker only on a refused create in record change; "on any other outcome, category or action it is an error and waives nothing". This unit now sends it on refusals in Administration and configuration that concern no existing item: list reads, batches, failure reports, registry resolves, proposal submissions. That follows the ruling on #277, option A, which extends recordNotCreated to this category and names the change "audit.v1 description (compatible)". The schema itself is unchanged: the field is still const: true, so the events validate against it, as MasterDataContractTest.auditEventsMeetIntakeSchema checks with the ESS stub. Only the description and the audit service's rule must follow. contracts/ess and services/ess-audit are not this card's folders, and the ruling puts that change outside these cards, so it is not made here. It is card RC-1-S28-F33 (#315).

Two points of reading, under the ruling:

  • A read of a code system or value set names the artifact with its registration version, since the item exists. It does not say recordNotCreated.
  • An item named by identifier that does not exist says recordNotCreated, and keeps the identifier. The decision is asked before existence is checked, so the refusal does not tell the caller whether it exists. An item whose version cannot be read is named by identifier alone, with no marker (above).

Questions for a person, and the other half of the gate line

No question is left. The card ends when the failed gate line's check passes, and that needs the audit side of the ruling on #277 too. The ruling puts it outside this card, and it is now filed as two fix cards:

  • RC-1-S28-F32 (#314): services/ess-audit SubmissionValidator waives the before and after values of a refusal in Administration and configuration, and the item reference and version with recordNotCreated;
  • RC-1-S28-F33 (#315): the audit.v1 description of recordNotCreated says the same.

By the repository owner's revised decision on #278, this card closes with its emitter half: this pull request says "Closes #278", and #278 is no longer blocked. The gate line's quarantine check moves with RC-1-S28-F32, which gate round 3 (RC-1-S28-G3) also waits on. On this unit's side, the events meet the ruling's intake rule in the tests (AuditCategoryRules.refusalErrors).

Note for F32 and F33. The two units send different events for a refusal that names no item. ess-reference sends recordNotCreated: true with no resourceRef.version. ess-governance (RC-1-S28-F25, merged) sends no recordNotCreated on any refusal: its RefusalAudit and GovernanceRefusals say audit.v1 does not allow it there. So the intake rule must accept a refusal in Administration and configuration without before and after values in both forms, or F25's events must change to match. AuditCategoryRules.refusalErrors in this unit's test fixtures is the form ess-reference meets.

Follow-ups outside the card

  • services/ess-audit SubmissionValidator and the audit.v1 description (by the ruling on #277; now cards RC-1-S28-F32, #314, and RC-1-S28-F33, #315, see above): for a refusal (denied) in Administration and configuration, waive the before and after values. With recordNotCreated, also waive the item reference and version, for any action, not only create in record change. Until it is merged, ess-reference's refusals are quarantined for /beforeAfter, or as a malformed recordNotCreated, instead of as an unregistered type. The rule to copy is AuditCategoryRules.refusalErrors.
  • Template (services/_template, FN-S03's owner): the same kit change (RefusalAudit, the markers). Units made from it later would otherwise inherit access-check-unavailable and access-denied (RC-1-S28-G2 follow-up).
  • Audit write under load: during RC-1-E2E-010 the unit log has 15 "could not record the audit of a refused request", from a full connection pool (HikariPool-1 - Connection is not available). Each request was refused, but its audit event was never written. That concerns FR-ESS-AUD-001 ("every action audited") apart from the quarantine. It is for the unit's owner or the next gate round.