Skip to content

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

Handover RC-1-S28-F25 Fix: ess-governance audits ess.cfg.item without the version and before and after values, and outage refusals under an unregistered type

Card: RC-1-S28-F25. Issue: cema-care/his#277. Branch: session/RC-1-S28-F25. Slice: RC-1. This is a round 2 fix of the gate session RC-1-S28-G2. The unit belongs to RC-1-S05 (MOD-ESS-012).

State: the card's work is done as the ruling on #277 scoped it; the gate line still needs the audit service. - Success events now carry the version and before and after values. The audit service accepts them as it is today. - Refusals now go under the refused action's own type, as the ruling on #277 requires (option A). - That ruling has two halves. This card sends the refusals; the audit service must waive what they lack. The ruling names that waiver in services/ess-audit as a fix on that unit and says the ruling "settles RC-1-S28-F25". - So the card's "Ends when" check, nothing quarantined, holds only once that fix lands. Until then the audit service quarantines the refusals as schema-invalid, no longer as an unregistered type. That fix is the first follow-up. - Review round 1 on PR #293 asked for this to be stated plainly, and for the changes below.

The failure

The gate's evidence, in the first comment on #277: run 20261201T000308Z-fa9c at commit 1586d431 quarantined 57 events from ess-governance:

Events Reason Quarantined for
12 ess.cfg.item, outcome success schema-invalid /resourceRef/version, /beforeAfter: "required for administration and configuration (D10-ESS 9.5)"
45 access-check-unavailable unregistered-event-type not in the audit event catalogue

The cause of the first: the unit's kit wrote the change metadata under details, a key the intake schema (contracts/ess/schemas/AuditEventSubmission.v1.schema.json) does not name, so the intake ignored it. The kit also had no way to send the item's version. Every ess.cfg.* success event lacked both, not only the 12 seed events the gate saw. All three types (ess.cfg.item, ess.cfg.extension, ess.cfg.catalogue) are in the category Administration and configuration.

The cause of the second: the kit's PolicyEnforcer audits a refusal under its own type, access-check-unavailable for an outage (outcome failure) or access-denied for a Deny. Neither type is registered. It is the template's default (RC-1-S28-G2 follow-up).

What was changed and where

Only services/ess-governance:

  • Kit (service-kit):
  • AuditRecord has two new components, resourceVersion and fields, with builder methods resourceVersion() and field(), as RC-1-S06 gave the ess-reference kit;
  • AuditEmitter writes the version into resourceRef.version, each of fields as a top-level field (for example approver), and the details as beforeAfter, in place of the ignored details.
  • mod-ess-012 Audit takes the item's version on every call, and refuses a call without the item or its version. It turns a call's details into DE-ESS-013 before_after:
  • before, after and changedFields as given;
  • approver as the event's own approver field;
  • every other detail (state reached, reason, effective date, environment) folded into after, as values of the item after the action. A value given under after wins over a detail of the same name.
  • Every audit site of the module passes the item's version:
  • Configuration versions (ess.cfg.item, ess.cfg.version.*, ess.cfg.emergency.*, ess.cfg.rollback.request and approve): the version's number. before and after are the members of the version the action changed, with their changed field names (ConfigurationService.versionChange). The after also names the item type, key, scope, number, state and package hash. A creation's after is the whole version.
  • Activation and rollback add what is in force before and after, under inForce: the version identifier and content of the version superseded or withdrawn, and of the one now in force.
  • Item types: the registration's revision; 1 for the seed.
  • Rollback decline: the request's revision, with the state before and after.
  • The export changes no item and has none to name. Its event names no item; its after values say what was exported (format, number of versions, offset). The audit service quarantines it for /resourceRef until a person rules how an export is audited: a question below. An earlier commit of this branch named a made-up export identifier at version 1. Review round 1 rejected that, since it puts an item that does not exist into the audit trail.
  • Feature flags (ess.cfg.extension): the version's number, with the flag's content before and after, as before.
  • Extension points, extensions, catalogue entries and decision records: the record's revision after the action; 1 at creation.
  • Tests:
  • AuditCategoryRules (kit test fixtures, new) holds the audit service's rule for Administration and configuration, with its pointers, as RC-1-S28-F17 wrote it in ess-reference. It also reads every audit event of a type prefix from the outbox, start-up seeds included.
  • GovernanceTest checks, after every test of the module, that each ess.cfg.* event the test led to meets that rule. All 87 tests of the module therefore check it.
  • ConfigurationAuditCategoryTest (new) checks the seeds, and walks the three types through their actions (item type, lifecycle to active, a second version, a declined rollback, the export, a decision record drafted and accepted).
  • Four existing assertions now read beforeAfter and approver in place of details.
  • AuditCategoryRules holds two rules, kept apart:
    • administrationMissing is the audit service's check exactly as it is today, including the audit.v1 1.2 markers. It waives nothing for a refusal.
    • administrationRefusalMissingAsRuled is the rule for a refusal as ruled on #277, which the audit service doesn't apply yet: no beforeAfter; no item, or the item with its version; and a decision or decisionUnavailable.
  • GovernanceTest's check after every test requires two things:
    • Today's rule must find exactly the known gaps (knownGap): /beforeAfter on a refusal, plus /resourceRef on a refusal that names no item, and /resourceRef on the export. Any other ess.cfg.* event must have nothing missing.
    • Every refusal must meet the rule as ruled.
  • GovernanceTest now also checks, after every test, that no event uses access-check-unavailable or access-denied.
  • RefusalAuditTest (new) walks two cases:
    • Outage: a list read, a creation and a change of an existing version: ess.cfg.item with decisionUnavailable. The list read and the creation name no item and carry no recordNotCreated; the change names the version at number 1.
    • Deny: an item-type read, a catalogue list and a feature-flag list: ess.cfg.item with the revision, ess.cfg.catalogue and ess.cfg.extension, each with the decision.

No contract file, dependency, lockfile, migration or setting changed. No decision record was written: the layout follows the intake schema and RC-1-S28-F17's kit.

Refusals (ruling on #277, option A, after the ruling on #220):

  • Kit: RefusalAudit (new, in policy) is the unit's answer to the question "which event type does a refusal of this action go under, and which item does it name?". PolicyEnforcer audits every refusal with outcome denied:
  • for an outage, with decisionUnavailable and no decision; for a Deny, with the decision;
  • under the type that RefusalAudit gives, not the kit's unregistered access-check-unavailable (outcome failure) or access-denied;
  • naming the existing item with its version, or no item;
  • never with recordNotCreated. audit.v1 allows it only on Record change with action create, and on any other category it is an error. Extending it to this category, as the ruling says, needs the contract and the audit service first. Until then a refused creation names no item, like a list read;
  • with no beforeAfter, since nothing changed. The refusal reason used to go there, but the intake schema has no field for it, so it is now logged instead. A Deny's decision record keeps the reason.

The kit's default RefusalAudit (the template's behaviour) still says access-denied. A unit gives its own bean. - mod-ess-012 GovernanceRefusals (new) is this unit's RefusalAudit: - Event type: ess.cfg.catalogue for catalogue entries, the compatibility policy and decision records; ess.cfg.extension for extension points, extensions and feature flags; ess.cfg.item for everything else. - Version: the same as the success events give: a configuration version's number, and the revision of a rollback request, item type, catalogue entry, decision record, extension point or extension. It is read only when a request is refused. - Items: a creation, a list read, a query, the export, or an identifier the caller's facility does not see name no item.

Checks and their result

Light profile as HIS_SESSION=RC-1-S28-F25 (his-rc-1-s28-f25), in services/ess-governance:

Check Command Result
The new tests with main's sources (src/main of kit and module as on origin/main, tests and fixture kept) ./gradlew :mod-ess-012:test --tests '*ConfigurationAuditCategoryTest*' 2 of 2 fail, each with the gate's pointers ["/resourceRef/version", "/beforeAfter"]: the seed's ess.cfg.item-type.register and the lifecycle's first event
The same with the repair same 2 of 2 pass
The refusal test with the kit's PolicyEnforcer and auto-configuration as on the first commit of this branch ./gradlew :mod-ess-012:test --tests '*RefusalAuditTest*' 2 of 2 fail: an event under access-denied, and no event under the action
The same with the repair same 2 of 2 pass
The module, with the repair ./gradlew :mod-ess-012:test 87 tests. The first run had 1 failure: the seed test's filter on the actor, which the test now leaves out. Every other test passed, each with the category check after it. The new test class then passed on its own
Build and all tests of the unit (the owning session's included) ./gradlew build The first run failed only service-kit HttpPolicyDecisionClientTest.permit and deny. These are the 300 ms timing tests that failed the pipelines of RC-1-S28-F22 and F23 on this host; this change does not touch the client. As in F23, the Permit and Deny reading tests now use a second client with a 5 s timeout, and the outage tests keep 300 ms. Then ./gradlew :service-kit:test: 28 tests, 0 failed, 1 skipped (the Kafka test of the full profile). Every other test of the build passed: app 3, mod-ess-011 1, mod-ess-012 87, with ConfigurationContractTest
Build and all tests, after review round 1 ./gradlew build, then ./gradlew :mod-ess-012:test app 3, mod-ess-011 1 and service-kit 28 (1 skipped) pass. In mod-ess-012, the build's run had 1 failure: the seed test read earlier tests' export events without allowing their known gap. With that fixed, a second run passes all 89 tests. The first round's build had failed the timing test HttpPolicyDecisionClientTest.permit under a load average of about 70; it passed on a second run and passes here
Static analysis platform/delivery-pipeline/bin/static-analysis services/ess-governance no blocking finding
Documentation python3 docs/implementation_plan/tools/check_links.py 0 broken links, 0 duplicate anchors

The slice scenario was not run on this host. The gate host's CPU steal (RC-1-S28-G2: 67%) stops the full profile from starting, as RC-1-S28-F22 found twice. This change alters only the content of audit events. No answer to any request changes, and no scenario step asserts on it 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 With this change
12 ess.cfg.item success (/resourceRef/version, /beforeAfter) quarantined stored: version and before or after values, checked against the audit service's rule (ConfigurationAuditCategoryTest; GovernanceTest's check after every test). The same holds for every other ess.cfg.* success event
45 access-check-unavailable (and any access-denied) quarantined, unregistered type sent under ess.cfg.item, ess.cfg.extension or ess.cfg.catalogue, outcome denied, decisionUnavailable, without beforeAfter, as the ruling on #277 requires (RefusalAuditTest). They are stored only once the audit service waives beforeAfter and the missing item for refusals in this category, as the ruling's follow-up says (below). Until then the audit service quarantines them as schema-invalid, no longer as unregistered-event-type

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); IF-ESS-008 (gate criterion 6) ConfigurationAuditCategoryTest.seedsCarryVersionAndValues, everyActionCarriesVersionAndValues (tags FR-ESS-AUD-001, IF-ESS-008, FR-ESS-CFG-001 to 003; TEST-ESS-030); GovernanceTest.everyConfigurationAuditMeetsItsCategory after every test of the module
FR-ESS-CFG-001 part 12, FR-ESS-CFG-002 AC-02 (flag before and after), FR-ESS-CFG-003 part 12 ConfigurationLifecycleTest.lifecycleAudited, promotionRecorded, the rollback test; ExtensionPointsTest.featureFlagChangeAudited; CatalogueAndDecisionsTest (deprecation)
FR-ESS-AUD-001 AC-06 with the rulings on #220 and #277 (option A): refusals audited under the action's type as denied, with decisionUnavailable for an outage RefusalAuditTest.outageRefusals, denyRefusals; GovernanceTest.everyConfigurationAuditMeetsItsCategory after every test

The tests of the owning session RC-1-S05, and those of every later session on the unit, are part of ./gradlew build above.

Done differently from the specification or contract

  • The export. The specification names the export as an audited action of ess.cfg.item, but the export has no item, and the category requires one. Its event names no item and stays quarantined until the question below is answered.
  • Refusals. They are sent without the before and after values, and some without an item, as the ruling on #277 requires. The audit service does not accept that yet: see the first follow-up.

Questions and follow-ups

  • Follow-up on services/ess-audit (needed before the gate line can pass): implement the waiver that the ruling on #277 (option A) gives, in SubmissionValidator, for events of Administration and configuration with outcome denied:
  • beforeAfter is not required;
  • resourceRef is not required when the event names no item (a list read, a query, a creation);
  • an item that is named still needs its version.

If recordNotCreated is to apply to this category, as the ruling says, the audit.v1 description of that marker must change first. That change is compatible and belongs to the ess contract. This unit then needs no change: a refused creation already names no item. AuditCategoryRules.administrationRefusalMissingAsRuled in this unit's test fixtures holds the ruled rule. Once the fix lands, knownGap in GovernanceTest loses its refusal entries. RC-1-S28-F26 (ess-reference) and F27 (the backbone) follow the same ruling. - Question for the Domain 10 owner with the Security and Privacy Office: how is the configuration export audited? The export (ess.cfg.export, FR-ESS-CFG-001 part 6.13) is an audited action of ess.cfg.item, in Administration and configuration, but it concerns no item and has no version. Today its event is quarantined for /resourceRef, as it was before this card: all ess.cfg.* events were. The options are the same waiver as for a refusal that concerns no item, or a type of another category for it. Not on the gate's evidence; knownGap in GovernanceTest holds it. - Template (services/_template, FN-S03): the same kit change (resourceVersion, fields, beforeAfter in place of details), and the category rules in its test fixtures. This adds to the template follow-ups of RC-1-S28-F17, F19, F22 and F23.