Skip to content

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

Handover RC-1-S28-F17 Fix: ess-reference's terminology and master-data audit events carry the item version

Card: RC-1-S28-F17. Issue: cema-care/his#223. Branch: session/RC-1-S28-F17. Slice: RC-1. Round 1 fix of the gate session RC-1-S28. The unit belongs to RC-1-S06 (MOD-ESS-004) and RC-1-S07 (MOD-ESS-005, MOD-ESS-010). Comes after RC-1-S28-F5.

The failure

The issue's first comment holds the gate's evidence. After the gate run, the audit service had quarantined 14 ess.trm.content and 11 ess.mdm.change events from ess-reference as schema-invalid, with one error each: /resourceRef/version, "the version is required for administration and configuration (D10-ESS 9.5)". These are in audit-quarantine.csv of the gate record.

D10-ESS 9.5 makes the item reference and version, the before and after values and the approver mandatory for the category Administration and configuration. Every audit event type of this unit's own actions is of that category: ess.trm.content, ess.mdm.change, ess.mdm.practitioner and ess.reg.change. The audit service checks this in SubmissionValidator.categoryErrors (services/ess-audit).

What was found

Most of the unit's audit calls already named the version: terminology versions, entity publication and seed loads. Three call sites did not:

Call site Event Why there was no version
mod-ess-004 CatalogueService.register ess.trm.register (ess.trm.content): registration of a code system or value set, made by mod-ess-010's registry at start-up A catalogue entry had no version at all
mod-ess-005 Seed.run ess.mdm.domain.register (ess.mdm.change): the register of master-data domains at start-up The call named no version
mod-ess-005 Governance.auditProposal and auditDecision ess.mdm.proposal.submit, .approve, .reject (and the same of ess.mdm.practitioner and ess.reg.change) A proposal to create an entity has no entity version until it is approved. A rejection, and a batch decision, set no entity version

The gate's 14 and 11 are the start-up registrations: the gate's run made no change proposal. The new test found one more gap that the gate run never reached. The decision on a proposal (approve, reject) sent no before or after values, so it would have been quarantined with /beforeAfter as well. It is the same gate line, the same category and the same code, so this session fixes it too.

What was changed and where

All in services/ess-reference:

  • Catalogue entry version (mod-ess-004):
  • migration V2__artifact_registration_version.sql adds registration_version integer not null default 1 to mod_ess_004.artifact;
  • Store.upsertArtifact raises it by one when a registration changes what is stored, and returns it. A registration that changes nothing leaves it as it is. The comparison covers title, classification, owner, steward and licence. It also covers the safety relevance and the binding behaviour while a steward has not yet confirmed the relevance; after that confirmation, a registration no longer changes those two;
  • CatalogueService audits ess.trm.register with that version.
  • Master-data domain register (mod-ess-005 Seed): ess.mdm.domain.register names version 1. An entry of the register is only ever inserted (Store.registerDomain, on conflict do nothing), so 1 is its only version.
  • Proposals and decisions (mod-ess-005 Governance): a new itemRef names the item and its version for every proposal audit:
  • where the action concerns an entity version, the entity at that version. That is the version a change starts from, the version an approval published, or, for a rejected change or retirement, the version left in force (Store.latest);
  • where there is no entity version (a creation not yet approved or rejected, a batch), the proposal itself (ess.ChangeProposal) at its revision, the version its ETag carries. The entity, where known, goes in beforeAfter.entityId. The batch submission already did this.

Before, a decision with no entity version gave the proposal's identifier under the entity's resource type; that is gone. - Decision values (Governance.auditDecision): beforeAfter.before.state and after.state (for example proposed to approved). - The tiers of ADR-HIS-094 (b.tier(STEWARDSHIP_TIER)) are kept on every call site, as RC-1-S28-F5 asked. - Tests: - service-kit/src/testFixtures/.../kittest/AuditCategoryRules.java (new) holds the audit service's rule for Administration and configuration, with its pointers. A failing test therefore reads as the quarantine would. It also reads a unit's audit events from its outbox, start-up seeds included; - mod-ess-004 GovernedVersionsTest.auditedWithItemVersion (new): every ess.trm.content event of a registration, a registration again unchanged, one with a new title, a value set, a published version and its export meets the rule. A registration's version goes 1, 1, 2; - mod-ess-005 GovernedMasterDataTest.auditedWithItemVersion (new): every ess.mdm.domain.register of the start-up seed names version 1. Every ess.mdm.change event of a creation, its approval, a change, its rejection and a rejected creation meets the rule, and each names the item and the version given above. - README.md: which version each audited action names, and the test rule for a new audited action. - Review round 1, the pipeline: the unit's build failed on two cases of service-kit's HttpPolicyDecisionClientTest, a file this change does not touch. Its client allowed the stub decision point 300 ms. On the shared self-hosted runner (load average 40 to 70), the first call of a test, with the client's warm-up, timed out and came back as an outage. permit then read "not permitted", and deny read "unavailable". The test now: - allows 2 seconds; - answers the "late" case after 5 seconds, so that case still times out; - gives its HTTP server a thread per request, so that the next case's request no longer waits behind the sleeping late answer.

It proves the same things. The 4 cases pass. - Review round 2, the pipeline: service-kit's LateDecisionTest failed the same way. Its client allowed 250 ms, and on the loaded runner it sometimes gave up before its request reached the stub. The Deny and outage assertions then held for the wrong reason, and "asked once" counted 0 requests. Its fix is the same: 2 seconds; the body's first part at once and the rest after 5 seconds, so it still ends after the timeout; a thread per request. The kit's other waits are for a cache or a poll, not deadlines. All 30 kit tests pass (1 skipped: the Kafka test of the full profile).

Outside the unit: this handover. No contract, dependency or lockfile changed. No decision record: the versions are a choice local to this unit, and they are written down in its README.

Checks and their results

Light profile, in services/ess-reference:

Check Result
The two new tests on main's code (main sources of mod-ess-004 and mod-ess-005 put back, migration removed) Both fail, with the gate's pointer: Expecting empty but was: ["/resourceRef/version"]
The same tests after the fix Pass
./gradlew build --continue after the fix 174 tests: 171 passed and 1 skipped (the Kafka test of the full profile). The 2 contract tests that failed did so with the stub of contracts/ess did not start: the stub had 20 seconds to start while the host's load average was 31
Those 2 contract tests again (TerminologyContractTest, MasterDataContractTest) Pass: 22 and 30 cases. They also send the unit's audit events to the ESS stub, which records no violation of the audit intake schema
python3 docs/implementation_plan/tools/check_links.py 0 broken

The gate line's check: the audit quarantine after the slice scenario. Six runs of HIS_SESSION=RC-1-S28-F17 e2e/harness/scenario run e2e/scenarios/RC-1 --keep (the first with --fresh), full profile, after CI=true pnpm install --frozen-lockfile in contracts/common, ess, adm and ise. The 4-CPU host was shared with the CI runners and another session's build, and its load average was 18 to 77 throughout. No run got as far as the scenario cases:

Run (evidence folder) How far it got
20261130T041812Z-b9d1, …042527Z-bead, …045808Z-23f7, …054417Z-83fd his-env start full failed: Keycloak (twice) or Kafka (twice) was not healthy within 420 seconds
20261130T042658Z-7632 ess-reference applied its migrations (mod_ess_004 to v2) and started in 200 seconds, after the harness's 240-second readiness wait had run out
20261130T050133Z-d375 ess-reference, ess-runtime-decision, ess-audit and ess-coordination started; ess-governance did not become ready in time

ess-reference started twice against the full stack's ess-audit, in the fifth and sixth rows. Its start-up registrations are what the gate found quarantined. The gate's query on ess_audit afterwards:

Gate run (RC-1-S28) After this fix
ess-reference rows in mod_ess_006.quarantine_entry 25 (ess.trm.content 14, ess.mdm.change 11), /resourceRef/version 0
Stored ess.mdm.change ess.mdm.domain.register 0 11, each with resourceRef.version 1
Stored ess.trm.content ess.trm.register 0 68 (34 entries × 2 starts), each with resourceRef.version 1; the second start changed nothing, so no version rose (registration_version 1 on all 34 entries)
Stored seed loads (ess.mdm.change 14, ess.mdm.practitioner 1, ess.reg.change 49) stored stored, each with its version

The only quarantined row in that environment was one ess-runtime-decision event, which RC-1-S28-F16 (#222, PR #257) fixes.

Because of the host's load, the slice scenario's cases did not run in this session. That half of "Ends when" is therefore not shown here. The change touches only how audit events name the item, and the version of a catalogue entry. It changes no API answer, no event other than audit, and nothing the scenario cases assert on. The unit's own tests, contract tests included, all pass. The next gate round, RC-1-S28-G2, runs the scenario in full.

Requirements and test scenarios of the card

Requirement Test
FR-ESS-AUD-001 and D10-ESS 9.5, Administration and configuration: item reference and version, before and after values, approver GovernedVersionsTest.auditedWithItemVersion (mod-ess-004), GovernedMasterDataTest.auditedWithItemVersion (mod-ess-005); tags FR-ESS-AUD-001, IF-ESS-008, with FR-ESS-TRM-001 and FR-ESS-MDM-001 and their TEST-ESS-015 and TEST-ESS-019 from the class
IF-ESS-008 audit intake (gate criterion 6, ACC-005): the unit's events are accepted The same tests, plus the contract tests' audit intake check against the ESS stub, and the quarantine after the slice scenario (above)

What the gate line now shows. The line is criterion 6 (ACC-005), IF-ESS-008, and criterion 4, FR-ESS-AUD-001, of slice gate RC-1. For ess-reference it now holds. Every audit event of the unit's own actions names the item with its version, and a decision also gives its before and after values. The gate's 25 quarantined events are now accepted and stored. The next gate round, RC-1-S28-G2, should find no ess-reference row in the quarantine. The line's other emitters have fix sessions of their own: F14, F15, F16, F18 and F19.

Done differently from the specification or contract

Nothing.

Questions and follow-ups

  • No question for a person.
  • For the template (services/_template, FN-S03): every unit that emits Administration and configuration or Record change events now has its own copy of the audit service's category rule in its tests (this unit, platform/event-backbone from RC-1-S28-F15, services/ess-runtime-decision from RC-1-S28-F16). The template could carry one in its test fixtures.
  • For the template (services/_template, FN-S03) and every unit made from it: service-kit's HttpPolicyDecisionClientTest (300 ms) and LateDecisionTest (250 ms) have the same short timeouts and single-threaded stubs. They can fail on a loaded runner the same way. Take over this unit's versions.
  • A registration that changes nothing is still audited, with the version unchanged, each time the unit starts. That is accepted by the audit service. Whether an unchanged re-registration should be audited at all is not decided here.