Skip to content

Implementation plan / Session plan / Handover RC-3-S17

Handover RC-3-S17 Build: Platform: backup and recovery (slice RC-3)

Card: RC-3-S17. Issue: cema-care/his#73. Branch: session/RC-3-S17. Slice: RC-3. Decision record: ADR-HIS-107. Builds on the contracts of RC-3-S03.

Scope as read

The card covers MOD-ISE-009: - FR-ISE-BCR-001, backups and restore testing; - FR-ISE-BCR-002, disaster recovery; - FR-ISE-BCR-003, degraded operation, downtime and reconciliation; - the test scenarios TEST-ISE-032 to 034; - the safety controls of D02-ISE 11.1 for Failover and restore and Downtime summaries.

The unit did not exist: the folder held only its README.

It also meets the contract point of contracts/ise/README.md, row RC-3-S17: - serve recovery.v1; - back up the stores of his-env, with an immutable copy no production credential can delete; - raise a deletion attempt to security monitoring; - restore into isolation; - two persons for failover; - the five events; - the restoration and closure gates; - checkDowntimeEntry; - the latest summary only, stale after CFG-ISE-025, with ise.downtime-summary-stale.

What was built and where

Everything is in platform/backup-recovery/, except ADR-HIS-107 with its row in the decision record index, and this handover. The unit's platform/backup-recovery/README.md gives how the parts work, the policy actions, the settings, the tooling, the alerts with their runbooks, and the checks.

The service ise-backup-recovery, made once from the service template (services/_template/new-unit.sh --into platform/backup-recovery ise-backup-recovery MOD-ISE-009). Its module mod-ise-009 is package care.cema.his.ise.mod009, schema mod_ise_009, migration V1__recovery.sql. It serves all 31 operations of recovery.v1:

  • Backups:
  • the backup policies, made at start for every data store of the inventory from their tier's defaults (CFG-ISE-015, CFG-ISE-016), and changed under If-Match with the refusals of the specification;
  • the backup sets, with BackupCompleted;
  • the backup status: within policy, RPO at risk, recovery point age, restore test age and overdue;
  • the replication status.
  • RecoveryTests:
  • restore, point-in-time, isolated-recovery, DR and incident-restore tests, only into isolated environments except incident restores;
  • integrity checks, with the objectives of CFG-ISE-017 computed here;
  • the owning teams' application validations, closure with corrective actions, and RestoreTestCompleted.
  • Failovers: the Incident Commander's authorization; a second, different person's confirmation, enforced by the unit; results only after both, except for an automatic failover; no admission when validation failed; gap windows in FailoverCompleted.
  • Downtime:
  • the windows: declaration, activation by the sweep, the restoration gate (validation passed and queues draining), DowntimeDeclared and DowntimeEnded, and closure only with every unresolved item accepted;
  • checkDowntimeEntry, by idempotency key and form number;
  • reconciliation reports and exercise results;
  • summaries: the latest only, distribution checked, stale with the notice to the Incident Commander, release by the Incident Commander, and every read audited.
  • Peers: the integration engine (integration.v1 listInterfaceHealth) for "queues draining", and the D10 notification service (notification.v1 requestNotification), each with the unit's client credentials.
  • observability/backup-recovery.rules.yaml: the alert rules, with a promtool test.

The backup tooling bin/backup-recovery (backup_recovery/, Python standard library and Docker) executes what the service records (ADR-HIS-107 points 2 and 4): - zone up, zone down: the primary store and the recovery zone's object-lock store, two RustFS containers pinned by digest, with separate credentials, and an internal recovery network; - backup: an encrypted logical backup, checksummed and verified, copied to the immutable store by the recovery zone, and recorded; - restore: the immutable copy into an isolated database, with recovery-zone credentials only; checksum, key recovery, record counts, foreign keys and row hashes are recorded; - probe-delete: deletion attempts with the production credential and with the recovery zone's own. Each is refused, and each is sent as a his-security-event.

./gradlew build also runs the tooling's unit tests and the promtool test (task toolChecks). scripts/ends-when.sh is this card's check.

ADR-HIS-107 records the decisions, with options, rationale, risks and review date, and has its row in the decision record index (105 records). ADR-HIS-106 reached main with RC-3-S14 (#259) while this pull request was open, and ADR-HIS-101 and 105 are taken by the open pull requests #253 (RC-1-S28-F14) and #257 (RC-1-S28-F16), so this record is ADR-HIS-107. It was checked free against origin/main and every open pull request on 2026-11-30. The index count will conflict with them; whichever merges later brings it up.

Beyond the template, two other changes in the folder: - The kit's HttpPolicyDecisionClientTest gives its client 2 s and its late answer 4 s, as platform/observability's copy does (handover RC-3-S09, review round 4). With the template's 300 ms, the Permit and Deny cases failed twice here: the host's load average was 44 on 4 processors. The unit's own timeout stays 250 ms (CFG-ISE-031). - Four reviewed false positives of static analysis are marked nosemgrep with their reason beside them: - the S3 Content-MD5 header that object-lock writes require; - the two urlopen calls to the session's own unit and stores; - the XML parsing of the build's own test reports in scripts/lib/ends_when.py.

Checks and their result

The integration environment ran as HIS_SESSION=RC-3-S17 (his-rc-3-s17), light profile, and was reset afterwards.

Check Command Result
Build and every test ./gradlew build in platform/backup-recovery passed (step 1 of ends-when.sh, with --rerun-tasks). mod-ise-009: 29 tests (25 module, 1 tooling end to end, 3 contract). service-kit: 34, 1 skipped (the Kafka adapter test, full profile only, as in every unit). app: 3. toolChecks: 6 unit tests of the tooling, and the promtool test of the alert rules
Provider contract test RecoveryContractTest.providerContract (in the build) his-contract verify contracts/ise of the 31 operations of recovery.v1: passed. validate-event of the BackupCompleted, RestoreTestCompleted, FailoverCompleted, DowntimeDeclared and DowntimeEnded events published: passed
Consumer contract tests queueHealthConsumer, notificationConsumer Against his-contract serve contracts/ise and contracts/ess: no violation
TEST-ISE-032 for real BackupToolTest (in the build) passed. The unit's test database (15 tables, 75 rows) was backed up encrypted, verified, and copied under a compliance retention. It was restored on the internal recovery network with recovery-zone credentials only, all five checks passed, in 57 s. Deleting the locked version was refused with the production credential (403 InvalidAccessKeyId) and with the recovery zone's own (403 AccessDenied, compliance retention). The copy restored again afterwards
Ends when HIS_SESSION=RC-3-S17 platform/backup-recovery/scripts/ends-when.sh passed, every step (below)
Scans platform/delivery-pipeline/bin/dependency-scan, image-scan, static-analysis on platform/backup-recovery; secret-scan code origin/main Dependency scan: 368 components, 0 blocking (3 medium); gate --coverage passed. Image his/backup-recovery: 0 blocking (15 low, 117 medium). The first image scan stopped at the scanner's own analysis deadline under the host's load, and the second passed. Static analysis: no blocking finding, after marking the four reviewed false positives above. Secret scan: no secret in code, documentation or the commits. No security exception added
Documentation check_links.py; mkdocs build 0 broken links, 0 duplicate anchors; the site builds

The steps of ends-when.sh: 1. ./gradlew build --rerun-tasks. 2. From the reports, every acceptance criterion of the three requirements, each test scenario and each verification of the two safety-critical functions has a passing test (table below). 3. The change touches only platform/backup-recovery/, ADR-HIS-107 with its index row, and this handover.

Requirements and test scenarios

The Java tests are in mod-ise-009/src/test/java/care/cema/his/ise/mod009/. Their display names start with what they cover.

Requirement, criterion Tests
FR-ISE-BCR-001 AC-01: restore evidence with integrity and application validation BackupAndRestoreTest "a restore into an isolated environment passes only with its integrity checks and the owning team's application validation ..."; BackupToolTest
FR-ISE-BCR-001 AC-02: deletion with compromised production credentials fails; isolated recovery BackupToolTest (the object-lock store refuses the production credential and the recovery zone's own; the copy restores with recovery-zone credentials only, on an internal network); BackupAndRestoreTest "an isolated recovery passes only when it used the immutable copy and recovery-zone credentials alone, and no operation of the API deletes or changes a backup ..."
FR-ISE-BCR-001 AC-03: each store has a verified backup within its policy "each data store's status shows a verified backup within its policy ..."; "every data store, the configuration repository and the secret store has a backup policy ..."
FR-ISE-BCR-001 AC-04: ledgers restored complete and unaltered "a restore of the audit or financial ledger passes only when a ledger-chain check confirms it ..."; BackupToolTest (ledger-chain from every row hash)
FR-ISE-BCR-001 parts 1 to 8, PR-BCR-001-1 to 3, section 10, section 12 the policy, backup, status, failure, isolation and idempotency tests of BackupAndRestoreTest; test/test_rules.py (alerts)
FR-ISE-BCR-002 AC-01: DR test meets RTO and RPO per tier DisasterRecoveryTest "a full DR exercise per tier is Planned, passes when the approved RTO and RPO are met ..."; "... missed a tier's RTO, fails ..."
FR-ISE-BCR-002 AC-02: Tier 1 failover meets objectives "a Tier 1 failover is measured against the approved RTO and RPO, admitted only after integrity and access validation ..."
FR-ISE-BCR-002 AC-03: without vendor-only access "a DR exercise that needed vendor-only access ... fails"; the DR exercise test
FR-ISE-BCR-002 AC-04: reconciliation matches or lists every item "after a failover in a downtime window, FailoverCompleted names the window and the gap ..., and the outage window's reconciliation closes only when every entry is matched or listed and accepted as an exception"
FR-ISE-BCR-002 part 8, PR-BCR-002-3: two persons "a failover needs the Incident Commander and a second authorized person who is not the Incident Commander ..."; "an automatic failover ... recorded after the event"
FR-ISE-BCR-002 part 1, PR-BCR-002-1: replication lag "replication of Tier 1 and 2 data is reported against the tier's RPO ..."
FR-ISE-BCR-003 AC-01: critical workflows usable during an outage DowntimeTest "with the integration engine and the notification service unavailable, declaring downtime, filing summaries, reading them and checking entries keep working ..." (this unit's part; see "Differences")
FR-ISE-BCR-003 AC-02: back-entry with duplicate prevention and provenance "a back-entered entry that matches one already checked ... is a duplicate ..."; "the reconciliation period closes only when each owning domain has reported and accepted ..."
FR-ISE-BCR-003 AC-03: summary with generation time, for authorized staff "only the latest generation of a unit's summary is kept; authorized staff of the unit read it with its generation time once the Incident Commander released it ..."
FR-ISE-BCR-003 AC-04: exercise report and corrective actions "a downtime exercise records the departments, results and corrective actions ..."
FR-ISE-BCR-003 part 4, part 5, BR-ISE-024, PR-BCR-003-1 "the Incident Commander declares downtime ..."; "restoration is not confirmed before ..."; "a summary older than its staleness limit is marked stale and the Incident Commander is told once per generation ..."
EVT-ISE-009, 010, 011, 017; NFR-ISE-009 RecoveryContractTest (verify, validate-event, both consumers)

Test scenarios: - TEST-ISE-032: BackupToolTest, and the FR-ISE-BCR-001 tests of BackupAndRestoreTest: - restore from backup with integrity and application validation; - deletion of the immutable copy with production credentials fails; - restore with recovery-zone access only. - TEST-ISE-033: DisasterRecoveryTest, a full DR exercise per tier without vendor-only access, reconciled afterwards. - TEST-ISE-034: DowntimeTest: - the outage of the unit's own partners; - summaries, back-entry and reconciliation; - an exercise with ward, emergency, pharmacy, laboratory and theatre.

Safety (D02-ISE 11.1). The controls are built as specified, and their verifications pass. Step 2 of ends-when.sh checks each by its tests. - Failover and restore: the measured recovery point, the published gap window, integrity validation before traffic, the restoration gate and downtime reconciliation. - Downtime summaries: generation time shown, the staleness limit with its notice, the latest generation only, and distribution monitoring.

No existing safety control was changed. The hazard log is the clinical safety register (architecture 13, CMP-CLI-012), so this session had no entry to update. The card names no safety review.

Non-functional: - NFR-ISE-005: the policy decision point on every operation, and 503 on its outage. Two-person rules are enforced in the unit. Restores use recovery-zone credentials only. The decryption key is never in production. The scans are clean. - NFR-ISE-009: provider and consumer contract tests. - NFR-ISE-012: the kit's correlation identifiers and traces; a correlation identifier per tooling run, also on its security events; the metrics and alert rules of the README. - NFR-ISE-016: UTC instants with Z. - NFR-ISE-018: the unit has no screen. UI-ISE-009 and 010 (RC-3-S22) use the words of FR-ISE-BCR-003 section 11.

Done differently from the specification or contract, and why

  • A deletion attempt is a security event, not SecurityAlertRaised (ADR-HIS-107 point 5). SecurityAlertRaised is platform/observability's event, and its 1.1 category list has no immutable-copy-deletion. The tooling sends his-security-event records (category immutable-copy-deletion) over IF-ISE-006. observability's rule set must raise the alert (follow-up).
  • Backups in a development environment are logical (pg_dump), not pgBackRest (point 2). his-env's PostgreSQL has no WAL archiving, and this card cannot change FN-S02's folder. pgBackRest and Velero remain the production design of row 17, behind the same API.
  • Replication lag is the age of the recovery point (point 6). There are no replicas. As a result a Tier 1 store with only daily backups shows its RPO at risk, which is what CFG-ISE-015 intends.
  • Tiers come from the unit's inventory: architecture 5.2, and Tier 1 where it gives none (point 3). The service catalogue has the tiers at run time; reading them is a follow-up.
  • The retention baseline is read as daily at least 35 days, monthly at least 12 months, maximum at most 13 months (D06-HIM 7.3).
  • "Queues draining" (point 7) means: no in-service interface holds a backlog it cannot deliver. Without the integration engine, restoration cannot be confirmed (503).
  • Entry duplicates are matched against entries already checked with this unit. Domains must check their offline and queued transactions here too: an entry this unit never saw cannot be matched.
  • The DowntimeWindow answer carries version and an ETag (point 9), not in the contract's schema. The RC-3 scenario reads them.
  • Audit types of the downtime steps: ADR-HIS-107 point 10.
  • FR-ISE-BCR-003 AC-01 covers a partner outage across the HIS. This unit's part is tested: declaration, summaries and checks keep working without the integration engine and the notification service. The whole of it is RC-3-S24's.

Review round 1

The review asked for four changes: - Automatic failover could be claimed by any request. A failover is now recorded as automatic only when every service of its scope is listed in his.backup-recovery.automatic-failover.services. Otherwise it is 400, and the failover waits for both authorizations (FR-ISE-BCR-002 part 8, PR-BCR-002-3). The list is empty by default; the deployment names the services designed for it (follow-up). - The test proved no refusal. DisasterRecoveryTest "a failover is recorded as automatic only for services designed for it ..." refuses adm-patient-administration, and a scope that mixes it with a designed service. The automatic case now uses a configured service. - A missing second authorization was not flagged. An automatic failover without its second authorization after automatic-failover.confirmation-within (1 hour) is counted in his_failover_confirmation_overdue by the sweep, logged, and alerted by the new rule FailoverConfirmationOverdue, with its promtool case. Tested in the automatic failover test. - The pull request named ADR-HIS-106. It now names ADR-HIS-107.

Contract changes

None. The unit serves recovery.v1 1.0 and publishes the five events at 1.0 as RC-3-S03 fixed them. version on a downtime window is an extra field the schema allows.

Questions for a person

None blocks this session. The open questions of RC-3-S03 that touch this unit stand: - Q2: who opens the reconciliation period. The unit opens it at the Incident Commander's confirmation, as the contract does. - Q4: DowntimeEnded at confirmation. The unit publishes it then.

Follow-ups outside the card

  • platform/observability:
  • add the Wazuh rule for his-security-event with action immutable-copy.delete and detail category immutable-copy-deletion, raising the alert of category immutable-copy-deletion of security-monitoring.v1;
  • import platform/backup-recovery/observability/backup-recovery.rules.yaml in rules.json;
  • add backup-recovery to his.observability.security.sources.
  • Deployment (platform/deployment-topology or a later session on this unit):
  • pgBackRest with WAL archiving to the primary repository, and a copy job to the object-lock store of the DR site that records through recovery.v1;
  • Velero for cluster state;
  • set his.backup-recovery.integration.* and notification.* with the unit's client credentials;
  • list in his.backup-recovery.automatic-failover.services the services designed for automatic failover;
  • add ise-backup-recovery to the service catalogue.
  • Harness (FN-S07 owner), as RC-3-S03 noted: RC-3-E2E-005 calls this unit by folder name, and the harness starts only services/ units. The scenario also needs real backups before readBackupStatus shows withinPolicy for adm_patient_administration: run bin/backup-recovery backup in the stack first.
  • FN-S02: his-env makes databases only for services/*, so ise_backup_recovery is made by the test kit (as platform/observability noted).
  • D10 policy content: grant the actions of the README by role. ise.downtime-summary.read goes to clinical staff of the unit, with released=true. ise.recovery-test.validate goes to the team of serviceId. ise.failover.confirm goes to the second authorized persons.
  • D10 notification type ise.downtime-summary-stale (contracts/ise README), with recipient role ise.incident-commander.
  • Domain 1 (as RC-3-S03 noted): supply the summaries of CFG-ADM-029 with submitDowntimeSummary, and check back-entered entries with checkDowntimeEntry.
  • Contracts (ISE owner): the version of a downtime window could be documented in recovery.v1 at the next minor version.
  • Design system: none.