Skip to content

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

Handover RC-1-S28-F15 Fix: the event backbone's audit events name the item version, and ise.config.changed gives the values before and after

Card: RC-1-S28-F15. Issue: cema-care/his#221. Branch: session/RC-1-S28-F15. Owner session: RC-1-S13. Comes after RC-1-S28.

The issue's first comment holds the gate's evidence. 35 ise.config.changed events from ise-event-backbone were quarantined as schema-invalid, with two errors: /resourceRef/version and /beforeAfter ("required for administration and configuration (D10-ESS 9.5)"). These are in audit-quarantine.csv of the gate record. The second comment comes from RC-1-S28-F14 (PR #253, still open as this session ran). It asks this fix to send the item version on the backbone's ise.message.replayed and ise.dead-letter.closed too. The audit catalogue files both under record change, which also requires the version. This session does that.

What was built and where

Everything is under platform/event-backbone/.

Part Change Where
Item version Migration V3__item_version.sql adds version bigint not null default 1 to topic (DE-ISE-009 register entry), replay and delivery_exception (DE-ISE-010). Each starts at 1 and goes up by one with each change of the item mod-ise-004/src/main/resources/db/mod_ise_004/
Kit AuditRecord has resourceVersion (builder resourceVersion(String) and (long)). AuditEmitter sends it as resourceRef.version and leaves it out when unset. The shape is the one RC-1-S06 gave services/ess-reference's kit, without that kit's other additions service-kit/src/main/java/care/cema/his/kit/audit/
ise.config.changed TopicRegistry.write reads the stored entry and compares every attribute of the register row: owning domain, producer, kind, classification, ordering key, retention, tier, status and consumers. On a change it raises the version in the same upsert (returning version). It audits the new version, changedFields (the fields that actually changed; every field on a creation), after (the entry as applied) and, on an update, before (the entry as it was). A register entry holds no secret mod-ise-004/.../catalogue/TopicRegistry.java
ise.message.replayed A request is version 1. A decision raises the version under the row lock that authorize already takes (update … set version = version + 1 … returning version, replacing set status = status). Completion raises it with the status change. Each audit names the version after its change mod-ise-004/.../replay/Replays.java
ise.dead-letter.closed The closure raises the delivery exception's version and the audit names it. A dead letter sent again by a replay also raises its version (state Sent), which is not audited mod-ise-004/.../deadletter/DeadLetters.java, Replays.java
README The register row, and a paragraph on item versions platform/event-backbone/README.md

Tests (mod-ise-004/src/test/java/care/cema/his/ise/mod004/): - AuditCategoryRules holds the category rules of services/ess-audit's SubmissionValidator.categoryErrors for administration and configuration, and for record change. It uses the same pointers, so a failure reads as the quarantine would. It also reads the backbone's audit events for one item from the outbox. - RegisterTest.creationAuditedWithVersionAndValues and changeAuditedWithBeforeAndAfter are new. - ReplayControlTest.sensitiveNeedsBoth and closure now also check the audits of the replay (versions 1 to 4) and of the closure (version 2).

No dependency, contract or lockfile changed.

Checks and their result

The integration environment ran as HIS_SESSION=RC-1-S28-F15 (his-rc-1-s28-f15).

Check Command Result
The test before the repair ./gradlew :mod-ise-004:test --tests '*RegisterTest' --tests '*ReplayControlTest', light profile, with the new tests and the old main code (V3 and the code changes taken out) 15 tests, 4 failed. creationAuditedWithVersionAndValues failed with ["/resourceRef/version", "/beforeAfter"], the gate's two errors. changeAuditedWithBeforeAndAfter failed because there is no version. closure failed with ["/resourceRef/version"], and sensitiveNeedsBoth because the replay's audits had no version
The unit's build and every test, after ./gradlew cleanTest build --no-build-cache in platform/event-backbone, light profile Passed: 75 tests, none failed. The 2 skipped are the Kafka tests (KafkaBackboneTest, the Kafka pairs of BrokerReplacementTest), as for RC-1-S13. EventOperationsContractTest ran and passed
The gate line: audit quarantine after the slice scenario HIS_SESSION=RC-1-S28-F15 e2e/harness/scenario run e2e/scenarios/RC-1 --fresh --keep on commit a7f322f, full profile, then the gate's query on ess_audit (mod_ess_006.quarantine_entry by emitter, reason and type; audit_event by type) ise.config.changed: 35 stored, 0 quarantined (the gate run had 35 quarantined). The stored events carry resourceRef.version and beforeAfter.after, with detailExcluded false. The backbone's only quarantined events are 2 ise.message.replayed and 1 ise.dead-letter.closed, as unregistered-event-type: F14 registers both types. Their resourceRef now carries the version (1, 2; 2), so they meet record change once F14 merges. There are also 3 access-check-unavailable events (follow-ups)
The slice scenario The same run, 20261129T204245Z-4fc1 5 of 15 passed, with the host at a load average of 26 to 28. Each failure is one RC-1-S28-F12 recorded on main. 014 and 015 fail only on their soft audit checks of ess-governance (F12's gap). 009 fails only on its soft check of #220. 002, 004, 006, 007, 010, 011 and 013 fail on 503s: adm-identity, ess-reference and the gateway refused closed on policy decisions later than 250 ms (the units' logs hold 351 "policy decision point did not answer in time" lines: 174 in adm-identity, 143 in ess-reference, 18 in adm-patient-administration, 11 in ess-governance, 3 in the backbone, 1 each in ess-coordination and ess-audit). That is the decision-latency shortfall the gate reports (NFR-ESS-001). RC-1-E2E-008 (the backbone's interface checks) and 012 (degraded operation with the backbone's operations down) passed. See the rerun below
Rerun of the cases that failed on decisions The same with --grep "RC-1-E2E-0(02|04|06|07|11|13)", run 20261129T211239Z-38e4 1 of 6 passed: RC-1-E2E-011 (reliability: a consumer and then the broker fail, and no transaction, event or audit record is lost or applied twice). The host's load average rose to 50 during the run. 002 failed on a 503 from the identity service, 004 on a 503 where a 403 was expected, 006 and 007 on screen elements that did not appear, and 013 on recoverability. The logs again hold late decisions (11 in adm-identity, 6 in ess-governance, 4 in ess-reference), and the broker outage of 011 had just ended. None of these flows calls the backbone synchronously, and the backbone's own cases pass (008, 012, and 011 here). So I record them as the host-load shortfall F12 also met, not as an effect of this fix. The next gate round runs the scenario again (card)
Static analysis platform/delivery-pipeline/bin/static-analysis platform/event-backbone No blocking finding
Secret scan platform/delivery-pipeline/bin/secret-scan code origin/main HEAD and docs No secret found in either
Documentation links and site python3 docs/implementation_plan/tools/check_links.py; .venv/bin/mkdocs build 0 broken links, 0 duplicate anchors; the site builds (one warning, in RC-1-S12's handover, which was there before)

What the gate line now shows

Gate line: criterion 6 (ACC-005), IF-ESS-008, and criterion 4, FR-ESS-AUD-001, of slice gate RC-1. For this emitter's ise.config.changed it now holds. Every register creation reaches the audit trail with the entry's version and its values after, and every register change adds its values before. The next gate round (RC-1-S28-G2) should find no ise.config.changed in the quarantine. The backbone's ise.message.replayed and ise.dead-letter.closed stay quarantined as unregistered until RC-1-S28-F14 merges. After that, they meet the record change rules.

Requirements and test scenarios

Requirement, rule Test
FR-ESS-AUD-001, D10-ESS 9.5 administration and configuration (item and version, before and after values): ise.config.changed on creation RegisterTest.creationAuditedWithVersionAndValues
The same, on a change of a register entry; FR-ISE-EVT-001 section 12 (retention and access changes audited) RegisterTest.changeAuditedWithBeforeAndAfter: retention and consumers changed, version raised by one, before and after, changedFields exactly the two; applied again, no version and no audit
FR-ESS-AUD-001, D10-ESS 9.5 record change (item version, changed fields): ise.message.replayed; FR-ISE-EVT-002 section 12 ReplayControlTest.sensitiveNeedsBoth: create, two decisions and the execution give versions 1 to 4. The dead letter sent by the replay is version 2
The same, ise.dead-letter.closed ReplayControlTest.closure: version 2
FR-ISE-EVT-001 (unchanged register changes nothing) RegisterTest.creationAuditedOnce, unchanged and passing

The card has no test scenario of section 15.2 of its own. TEST-ISE-020 (ReplayControlTest) still passes.

Differences from the card, specification or contract

  • The register now audits a change of kind, owning domain or ordering key too. Before this fix, only owner, retention, classification, tier, status and consumers counted as a change. The other three were written but a change to them went unaudited. FR-ISE-EVT-001 section 12 asks for topic creation, ownership, retention and access changes, and D10-ESS 9.5 asks for before and after values. An entry's audited values should be the whole entry, so every attribute of the row is compared.
  • changedFields names what changed. Before, an update listed all six attributes whatever had changed, and a creation listed topic. Now an update lists the fields that differ, and a creation lists every field it set.
  • The version is a counter of the item's changes. The specification asks for the item's version, not its form. The backbone's items had none. A counter per item is the simplest version that is unique and ordered for one item. It is local to this unit, so no decision record is needed.
  • No contract changed. resourceRef.version and beforeAfter.before and after are already in contracts/ess (AuditEventSubmission.v1).

Questions for a person

None.

Follow-ups outside the card

  • RC-1-S28-F14 (#220, PR #253): once it registers ise.message.replayed and ise.dead-letter.closed, the backbone's events of both types meet record change, as shown above. Nothing more is needed from this unit.
  • The backbone's replay and dead-letter audits send more than the schema's beforeAfter members (reason, subscription, source, replaySensitive, role, decision, sent, held, failed). The audit service drops them and marks the event detailExcluded (PR-AUD-001-4), as it should. Some of these belong in fields of their own, for example the reason. The next card on platform/event-backbone should move them there or drop them.
  • access-check-unavailable from the backbone and from other units (3 from ise-event-backbone in this run, also ess-reference, ess-governance and ess-coordination): the kit's refusal audit when the policy decision point does not answer in time has an event type that is not in the audit event catalogue. It is the refusal-without-decision gap of #220 (RC-1-S28-F14), seen here on the backbone's ise.subscription-counts.read.
  • Schema registrations (FR-ISE-EVT-002 section 12): the register rewrites each topic's event types and versions (topic_schema) at start, but a change to them is not audited as part of the entry. If the next card on the unit takes it, it can add the event types to the entry's audited values.