Skip to content

Architecture / Decision records / ADR-HIS-052

ADR-HIS-052 Governance services: the configuration lifecycle controller, content hash and references, resolution, and the provider contract test

Status Accepted
Decided 2026-11-25 by session RC-1-S05
Record Drafted 2026-11-25; approved 2026-11-25 by the Enterprise Architecture Board
Where the rule lives services/ess-governance/ (module mod-ess-012, its migrations, governance/ess-item-types.json, the contract test in mod-ess-012/src/test/java/care/cema/his/ess/mod012/contract/)

Context

Session RC-1-S05 builds MOD-ESS-012 in the governance unit services/ess-governance. That covers the configuration lifecycle (FR-ESS-CFG-001), extension points and feature flags (FR-ESS-CFG-002), and the API catalogue with the decision register (FR-ESS-CFG-003). It serves configuration.v1 and api-catalogue.v1 of the ESS contracts (ADR-HIS-048).

Every domain puts its configuration under this lifecycle, so the choices below bind every later session that registers an item type, reads configuration, publishes a contract or records a decision. The specification leaves these points to the design: - where configuration lives (DEC-ESS-016); - what "production" and "promotion" mean for this one service; - how content names the items it depends on (PR-CFG-001-3); - how a package is identified; - how resolution "as of" a past time works; - how "5 working days" is counted; - how a provider unit passes his-contract verify, whose cases use the contract's examples as they stand.

Decision

  1. One lifecycle controller.
  2. The governance service holds the lifecycle of every configuration version: draft to active, superseded, rolled back or retired.
  3. It records each promotion of an approved package to an environment.
  4. Its his.governance.activation-environment (default production) names the environment whose live configuration it controls. A version is activated only after its approved package was promoted to that environment with the same content hash (BR-ESS-029).
  5. With DEC-ESS-016 hybrid by item type, a domain may keep content locally (contentStore: domain). The version still carries the content as its package.
  6. Where a deployment is production itself, his.governance.authoring-enabled=false refuses drafts, so production is changed only by promotion or by the emergency path (PR-CFG-001-4).
  7. Versions outside Draft are immutable. The service refuses the change, and a database trigger blocks any change to content or hash outside Draft.
  8. Package identity. contentHash is sha256: followed by the SHA-256 of the content's canonical JSON: object members sorted by name, no insignificant whitespace, values as JSON writes them. Any consumer can recompute it from an export (AC-06).
  9. References between items.
  10. Content names another configuration item it depends on as {"configurationRef": {"itemType": "<type>", "itemKey": "<key>"}}, anywhere in the content.
  11. Validation reports a reference to an unregistered type.
  12. Promotion to an environment is refused, with one errors entry per missing item, unless a version of each referenced item (enterprise or the same facility) is approved, active or superseded and was promoted to that environment (PR-CFG-001-3).
  13. Resolution.
  14. Each activation opens an in-force period for the version, and supersession, rollback or retirement closes it. A rollback opens a new period for the restored version, and nothing is deleted (BR-ESS-030).
  15. resolveConfiguration answers the version in force at asOf (default now) for the caller's facility. The order is department (the unit), then facility, then enterprise, limited to the levels the type permits.
  16. Overlap (part 10) is refused against another version of the same item and scope that is active or approved with a scheduled activation. The version active now is not counted: it is superseded when the new one starts (BR-ESS-028).
  17. An activation with a future effective time is scheduled. The unit's scheduler activates it at that time, and each activation locks its row, so several replicas are safe.
  18. The emergency path and review tasks.
  19. Retrospective reviews of emergency changes (part 6.11), decision-record reviews (PR-CFG-003-3) and the approval route of a submitted version (part 6.5) are tasks of the task service (IF-ESS-010). Their task types are ess.emergency-change-review, ess.decision-record-review and ess.configuration-approval, assigned to a role.
  20. Each task has an idempotency key derived from its subject, so a retry creates no second task.
  21. The unit subscribes to TaskStateChanged: a completed review task closes the emergency flag, or records the decision record's review.
  22. "5 working days" counts Monday to Friday in his.governance.working-day-zone (default Asia/Jakarta), with no holiday calendar.
  23. Authorization and MFA.
  24. Every operation asks the policy decision point first, before any facility-bound lookup, so a facility the caller is not permitted answers 403 before 404 (architecture 7.5).
  25. Action codes are ess.cfg.<record>.<verb>. Resource types are ess.ConfigurationItemType, ess.ConfigurationVersion, ess.ConfigurationRollbackRequest, ess.ConfigurationExport, ess.ExtensionPoint, ess.Extension, ess.FeatureFlag, ess.CatalogueEntry, ess.CompatibilityPolicy and ess.DecisionRecord.
  26. The request carries the item type's approval role, whether clinical authority is required, whether the content is clinical, the scope level and, on the emergency path, the second approver. The decision point decides who holds that authority, because roles are not in the token (DEC-ESS-008).
  27. The token's acr is sent as subjectAssurance, and the decision point requires MFA for these administrative functions (NFR-ESS-007).
  28. On the emergency path the decision point also decides for the named second person in their own right (ess.cfg.emergency.second-approve, with requesterId). A step-up signature identifier signs one approval only, and the second approval cannot be dated in the future. IF-ESS-002 cannot yet prove the second person's step-up: that is question Q4 of the handover.
  29. Separation of duties is checked in the unit, since it depends on the record: author against approver, requester against rollback approver and second person, registrant against extension approver, publisher against catalogue status change, author against decision record approver. A service identity never approves.
  30. A partner caller is marked by the Permit's obligation partner-view with attribute partner. It then sees only entries offered to that partner and may not publish or change them (FR-ESS-CFG-003 part 13).
  31. Validation hooks. The hook of Domain 10's own types (ess.configuration / validateConfigurationVersion) runs in the unit. No contract yet fixes how another domain's hook is called, so a type whose hook belongs to another domain fails validation with a finding that says so (fail closed) until one does.
  32. Domain 10's own item types.
  33. At start the unit registers ess.break-glass-permitted-roles (CFG-ESS-006), ess.break-glass-session-window (CFG-ESS-007), ess.break-glass-review-timeframe (CFG-ESS-008), ess.feature-flag and ess.api-deprecation-notice (CFG-ESS-023).
  34. Each gets a first enterprise version under item key default, holding the value section 13 sets, in force from the date it was set (2026-11-17).
  35. The seed only adds what is missing. readCompatibilityPolicy reads the version of ess.api-deprecation-notice in force.
  36. Catalogue and register rules.
  37. An entry the release pipeline publishes starts active, because it reflects deployed contracts (part 6.5). One a person publishes starts proposed.
  38. The notice period is 12 months when the entry is offered to partners or any consumer is external, otherwise 6 (CFG-ESS-023).
  39. A deprecation date in the past, or a planned retirement date inside the notice, is refused (PR-CFG-003-1). So are retirement before the retirement date, a retirement inside the notice, and a retirement with consumers not yet migrated (PR-CFG-003-2).
  40. An exception is accepted only if its approvalRef names an accepted decision record.
  41. Decision record identifiers are <prefix>-NNN per record type: ADR-HIS for architecture decisions and GDR-HIS for governance decisions (his.governance.architecture-prefix, governance-prefix).
  42. Storage and commands.
    • Each record keeps its API representation in a jsonb column beside its key and filter columns. revision is the ETag.
    • A command runs its change, audit event, domain event and Idempotency-Key record in one transaction. A repeated key from the same caller answers the stored outcome.
    • Absent fields are left out, never null.
  43. The provider contract test.
    • his-contract verify runs in the Node.js image node:22.18-bookworm, pinned by digest, on the host network, against the unit started on a random port.
    • It runs one operation at a time. Before each, the test writes a fixture in which the records named by that operation's examples are in the state the operation needs (revision 3, matching the examples' If-Match).
    • The test then checks the events published during the run with his-contract validate-event. A later unit can copy this pattern; the host needs only Docker, as the pipeline's Java build already does.
  44. The unit's copy of the kit gains a Problem errors list and a status override on HisException: version-conflict answers 409 where api-catalogue.v1 names it for different content under an existing version. Missing required query parameters answer validation-failed. This follows the template README: a unit's kit is its own code.

Consequences

  • Owning domains register their item types with registerConfigurationItemType. They read configuration with resolveConfiguration and follow ConfigurationChanged, and they name dependencies with configurationRef.
  • The release pipeline (D02) promotes by hash before an approver activates.
  • The policy decision service (RC-1-S16, RC-1-S17) registers the resource types and actions above, the approval roles of each item type, the MFA rule on subjectAssurance and the partner-view obligation.
  • The task service (RC-1-S15) registers the three task types and the roles enterprise-architecture-board and data-governance-council.
  • A hook contract for other domains' validation, a holiday calendar for working days, and a notification channel for deprecation notices (IF-ESS-009, RC-2) are follow-ups. Until then hooks fail closed, working days skip weekends only, and notices are recorded on the consumer and in audit.
  • The seeded owner organizations are placeholders until the master-data register (RC-1-S07) holds the Domain 10 bodies.

Alternatives considered

  • One governance instance per environment, with packages imported into the next. Rejected: configuration.v1 has no import operation, and promotion is recorded on the version the pipeline promotes.
  • A content hash over the stored bytes. Rejected: it depends on member order and whitespace, so an independent consumer could not recompute it.
  • Dependencies declared on the item type. Rejected: a type cannot know which instances of other items a given version refers to. A reference inside the content can be checked per package.
  • One verify run against one fixture for every operation. Impossible: the examples name the same version in Draft, In Review, Approved and Active.