Implementation plan / Session plan / Handover RC-1-S28-F19
Handover RC-1-S28-F19 Fix: ess-coordination's ess.wfl.task audit events carry the task's version and changed fields¶
Card: RC-1-S28-F19. Issue: cema-care/his#225. Branch: session/RC-1-S28-F19. Slice: RC-1. Round 1 fix of the gate session RC-1-S28. The unit belongs to RC-1-S15 (MOD-ESS-008).
The failure¶
The issue's first comment holds the gate's evidence. After the gate run, the audit service had quarantined one ess.wfl.task event from ess-coordination as schema-invalid, with two errors:
/resourceRef/version: "the version is required for record change (D10-ESS 9.5)";/beforeAfter/changedFields: "the changed field names are required for record change (D10-ESS 9.5)".
The event is in audit-quarantine.csv of the gate record.
The audit event catalogue registers ess.wfl.task in the category Record change (services/ess-audit, V2__event_catalogue.sql). D10-ESS 9.5 makes the record reference with its version, and the changed field names, mandatory for that category. SubmissionValidator.categoryErrors checks this on intake.
What was found¶
The unit's kit (service-kit) could not send either field:
AuditRecordhad no version, soresourceRefwas only{type, id};AuditEmittersent the change metadata asdetails. The intake schema (contracts/ess/schemas/AuditEventSubmission.v1.schema.json) is open, sodetailswas accepted but ignored: it names nodetailsmember, and the audit service stores only the fields it names.
Every task action of mod-ess-008 TaskService was audited this way:
- creation, including the tasks the unit makes itself (workflow task steps, skip approvals, pathway conflict reviews, notification operations);
- claim, release and start;
- completion, a completion recorded for the owning domain to confirm, and its confirmation;
- cancellation;
- reassignment and reprioritization;
- recovery;
- escalation of an overdue task;
- return to the queue.
The gate's run made one task, so it found one event. Every other task action would have been quarantined the same way.
What was changed and where¶
All in services/ess-coordination:
- Kit (
service-kit,care.cema.his.kit.audit): AuditRecordgainsresourceVersionandchangedFields, with their builder methods;AuditEmittersends the version asresourceRef.version, and the changed field names asbeforeAfter.changedFieldswhen there are any;detailsis still sent as before. Nothing else in the unit's events changes.- Task audit (
mod-ess-008): support/Audit.changeis the audit of a record change. It takes the record's version after the change and the record before and after: the task's document and its internal fields. It sends the version, and the names of the top-level fields set, changed or removed.updatedAtand the presentedversionare left out, since they change with every action.historyis named, because every action adds an entry to it. So the list is never empty;TaskServiceaudits every action above through it, with the revisionTaskStorereturns: 1 at creation, then the revision after the update, the one the task's ETag then carries.returnToQueuenow keeps the revisionstore.updatereturns;- no values are sent. For Record change, the audit service keeps only the names (
PrivacyRules: before and after values would be dropped and the event markeddetailExcluded), and the task's history holds the values (FR-ESS-AUD-001 part 13). - Tests:
service-kit/src/testFixtures/.../kittest/AuditCategoryRules.recordChangeMissing(new) holds the audit service's rule for Record change, with its pointers. A failing test reads as the quarantine would. It is the Record change counterpart of the Administration and configuration rule that RC-1-S28-F17 wrote iness-reference;mod-ess-008TaskAuditTest(new) has two tests:everyTaskAuditIsARecordChangewalks creation, claim, release, start, reassignment, reprioritization, cancellation, completion, recovery, return to the queue on suspension, and overdue escalation. Everyess.wfl.taskevent meets the rule, names the task's revision after the change, and names the expected fields, with no values;completionToConfirmcovers a completion recorded for the owning domain to confirm, and its confirmation.
README.md: the audit of tasks, and the rule for a new audited task action.- Review round 1, the pipeline: the unit's build failed on one case of
service-kit'sHttpPolicyDecisionClientTest, a file this change does not touch. It is the failure RC-1-S28-F17 found iness-reference: on the shared self-hosted runner, the client's 300 ms timeout ran out on a test's first call, so a Permit read as an outage. This unit'sHttpPolicyDecisionClientTestandLateDecisionTestnow matchess-reference's fixed versions: - the client allows 2 seconds;
- the late answer comes after 5 seconds, so that case still times out;
- the stub serves each request on its own thread.
They prove the same things. The kit's 28 tests pass (1 skipped: the Kafka test of the full profile).
Outside the unit: this handover. No contract, dependency, lockfile or migration changed. No decision record: how the unit names a task's version and changed fields is a choice local to this unit, and its README records it.
Checks and their results¶
Light profile, in services/ess-coordination:
| Check | Result |
|---|---|
TaskAuditTest on main's code (main sources of service-kit and mod-ess-008 put back, the test and fixture kept) |
Both tests fail with the gate's pointers: /resourceRef/version and /beforeAfter/changedFields on every ess.wfl.task event |
| The same tests after the fix | Pass |
./gradlew build --continue after the fix |
135 tests: 134 passed, 1 skipped (the Kafka test of the full profile), 0 failed. This includes RC-1-S15's TaskCoordinationTest and WorkflowExecutionTest, which still read details, and the unit's contract tests |
platform/delivery-pipeline/bin/static-analysis services/ess-coordination |
Did not finish: stopped after 15 minutes while the shared host's load average was 35 to 53. The pipeline runs it on the pull request |
python3 docs/implementation_plan/tools/check_links.py |
0 broken |
The gate line's check: the audit quarantine after the slice scenario.
Two runs of HIS_SESSION=RC-1-S28-F19 e2e/harness/scenario run e2e/scenarios/RC-1 --keep --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 other sessions, and its load average rose from 2 to 35 to 53 during the runs. Neither run got as far as the units:
| Run | How far it got |
|---|---|
| first (08:36) | his-env start full failed: the telemetry container was not healthy in time |
20261130T085850Z-069a |
his-env start full failed: the schema registry was not healthy in time |
So this session has no quarantine query after the scenario, and the scenario cases did not run here. Those halves of "Ends when" are therefore not shown here. What stands in for them:
- the new test applies the audit service's own Record change rule to every task action, and the action the gate's run made (a task's creation) is among them;
- the change touches only what the unit's audit events carry:
resourceRef.versionandbeforeAfter. It changes no API answer and 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 and queries the quarantine.
Requirements and test scenarios of the card¶
| Requirement | Test |
|---|---|
| FR-ESS-AUD-001 and D10-ESS 9.5, Record change: record reference with version, and the changed field names | TaskAuditTest.everyTaskAuditIsARecordChange, TaskAuditTest.completionToConfirm (mod-ess-008). Tags FR-ESS-AUD-001, IF-ESS-008, FR-ESS-WFL-002, TEST-ESS-029 |
IF-ESS-008 audit intake (gate criterion 6, ACC-005): the unit's ess.wfl.task events are accepted |
The same tests, plus the quarantine after the slice scenario (above) |
| FR-ESS-WFL-002 part 12 and AC-05 (RC-1-S15): tasks audited with actor, reason, previous and new assignee | RC-1-S15's TaskCoordinationTest.reassignmentAudited and lifecycle, unchanged and passing |
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.wfl.task it now holds: every task audit event names the task with its version and the changed field names, so the audit service accepts it. The next gate round, RC-1-S28-G2, should find no ess-coordination ess.wfl.task row in the quarantine.
Done differently from the specification or contract¶
Nothing.
Questions and follow-ups¶
- No question for a person.
- The unit's other audit event types fail their categories too, but the gate run did not reach them. They fall outside this card, which names
ess.wfl.task. A gate run that exercises them would quarantine them:
| Event type | Category | Where | What it lacks |
|---|---|---|---|
ess.wfl.definition |
Administration and configuration | mod-ess-008 ConfigurationChangedHandler |
resourceRef.version, beforeAfter.before/after |
ess.wfl.instance |
Administration and configuration | mod-ess-008 WorkflowService |
resourceRef.version, beforeAfter.before/after |
ess.iam.account |
Administration and configuration | mod-ess-007 SettingsService |
resourceRef.version, beforeAfter.before/after |
ess.ntf.escalation |
Record change | mod-ess-007 NotificationService |
resourceRef.version, beforeAfter.changedFields |
ess.ntf.delivery |
Disclosure and exchange | mod-ess-007 |
recipient, legalBasis |
- The kit now carries
resourceVersionandchangedFields, andAudit.changeshows the pattern. - Administration and configuration also needs before and after values, which the kit cannot send yet; the
ess-referencekit (RC-1-S28-F17) shows how. - Which legal basis a notification delivery names is a question for the specification owner, not an agent.
The two mod-ess-007 types belong to RC-2's sessions on the unit (RC-2-S03).
- The kit's details is still sent and still ignored by the audit service. A later session on the unit could drop it once every event carries its category fields. RC-1-S15's tests read it today.
- TaskService.returnToQueue adds the assignee-unavailable flag to a task with no queue without an audit event. That is a record change of the task. Whether the system's flagging of a task needs an audit event is not settled here.
- For the template (services/_template, FN-S03) and every unit made from it: service-kit's HttpPolicyDecisionClientTest and LateDecisionTest still have the short timeouts in the other units. Now ess-reference and this unit have failed on them on the shared runner; take over the fixed versions.
- For the template (services/_template, FN-S03): every unit that emits Record change or Administration and configuration events now has its own copy of the audit service's category rules in its tests (this unit, ess-reference, platform/event-backbone, ess-runtime-decision). As RC-1-S28-F17 noted, the template could carry them.