Skip to content

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

Handover RC-1-S28-F7 Fix: The gateway's rendered configuration is stale against the contracts on main

Card: RC-1-S28-F7. Issue: cema-care/his#213. Branch: session/RC-1-S28-F7. Owner session: RC-1-S12. Failure report: RC-1-S28, round 1. Gate lines: slice gate RC-1 criterion 4 (ACC-001) FR-ISE-GWY-001, and criterion 6 (ACC-005) IF-ISE-001.

What was wrong

The gate found two failures in platform/gateways. They have separate causes.

  1. Stale rendering. rendered/reference/ is made from the contract stubs in contracts/adm, contracts/ess and contracts/ise. Those contracts gained operations after RC-1-S12: ADM 1.1 (RC-1-S28-F2), ESS audit and the ISE APIs. Nothing re-rendered this folder, because the pipeline runs this unit's job only when platform/gateways itself changes. As a result:
  2. bin/gateways render --env reference --check failed on 7 contract documents and internal/apisix.yaml;
  3. so did test_model.TestReferenceModel.test_rendered_files_current, and with them ci.sh;
  4. the committed routes lacked 51 operations of APIs the gateway publishes.
  5. The 404s in T12. The test bed renders its own configuration when it runs, so its routes were current. But T12Contracts.test_provider_contract_through_the_gateway ran his-contract verify contracts/adm over every ADM API. contracts/adm now also holds scheduling, flow, adt, beds and transfers, the APIs of RC-2 and RC-3. No gateway publishes those yet (model/apis.toml), so the gateway answered their cases 404 "No API is published at this path". In this session's first run, 378 of 527 cases failed this way. The issue named correctTransfer and changeResponsibility because they were the last cases in the truncated output. The gateway did the right thing: a route exists only for a published contract (FR-ISE-GWY-001 part 3). The test was checking more than the gateway publishes.

What was changed (all in platform/gateways/)

  • rendered/reference/ re-rendered with bin/gateways render --env reference: 267 routes (221 before). It adds 46 operations of the published APIs and removes none. Examples:
  • ADM: unmergePersons, transitionEncounter, runConsentCheck, queryDemographics;
  • ESS audit: evidence holds, forwarding, disposal;
  • ISE: change records, capacity models.
  • model/apis.toml, after the model check below (review round 1): 5 operations excluded and 8 audit actions set.
  • test/unit/test_model.py: a new test, TestReferenceModel.test_every_contract_operation_has_a_committed_route. It fails when an operation of a published contract on main has no route in the committed apisix.yaml, and its message lists the missing operations.
  • test/testbed/test_gateway.py: T12 now passes --operation for each ADM operation the test bed's model publishes at the internal gateway (published_operations, 41 operations). It asserts that the set contains readPerson and leaves out correctTransfer. T06Versions.test_unpublished_path_not_found still shows that an unpublished path gets 404.
  • README.md: says that T12 verifies the published ADM operations, and that the unit must be re-rendered after a published contract changes.

No decision record: nothing here changes how the unit is built.

The model check of the new operations (review round 1)

The contracts on main had 51 new operations in APIs the gateway publishes. A re-render alone would have published them with the model's defaults, so each was checked against its contract text (contracts/<domain>/api/*.yaml) for the model's exclude, actions, degraded_read and restricted settings.

  • exclude, service-to-service only. In each case the contract names only service identities as callers, so the operation is not published at a gateway, like submitAuditEvent:
Operation Callers named by the contract
ess.audit.submitForwardingReceipts The Domain 2 forwarding pipeline, over the mutually authenticated service channel (FR-ESS-AUD-003 part 13)
ise.secrets.checkNodeCertificate The integration engine and the gateways, at connection (FR-ISE-KEY-003)
adm.patient-identity.recordIdentityReview adm-patient-administration, under its service identity (INT-ADM-001)
adm.patient-identity.recordDemographicChange adm-patient-administration, under its service identity (INT-ADM-001)
adm.encounters.validateEncounterContext The ordering and charge capture services of Domains 3, 4, 5 and 9, with a scoped service identity (IF-ADM-003)

Each of these follows from the contract, and not publishing it is the closed default, so no rule 3 question arises. - actions, where the method's default would misstate the audit action: - queryDemographics (PDQ) and crossReferenceIdentifier (PIX): query. Both are read-only and audited as adm.person.search; - validateForwardingRule: query. It answers findings and changes nothing; - runReviewView: query. Its path ends in a parameter, but it runs a view over many records; - readAuditEventForwarding, readForwardedRecord and readScalingPolicy: view. Each reads one record under a sub-path; - resendForwardingFailures: update. It returns existing failed records to pending. - Defaults kept: - runConsentCheck stays update: the contract says it links the valid directives found and records pending references, so it changes the registration; - the other 37 operations' defaults match their contracts. GET lists and reports are query and GET by identifier is view. Commands on an existing record (transitions, corrections, sign-off, approval, release) are update. New records (placeEvidenceHold, startDisposalRun, createChangeRecord, publishCapacityModel, reportIdentityWorkItem, unmergePersons) are create. - degraded_read and restricted: none of the new operations was given either setting. The reference model declares no Tier 1 degraded read: RC-1-S12's Q3 and Q5 are still open, and bin/gateways check refuses degraded_read outside the test bed. restricted only matters for a degraded read. So every new read is refused during a policy outage, the fail-closed default of D02-ISE 9.1.

Checks and their result

Check Command Before After
Rendering current bin/gateways render --env reference --check 8 stale files current
Unit tests python3 test/run.py --unit 17 of 19 (test_rendered_files_current, and the new test, which listed the missing operations) 21 of 21
Test bed HIS_SESSION=RC-1-S28-F7 python3 test/run.py --testbed (full profile, his-rc-1-s28-f7) 28 of 29; T12: verify: FAILED (378 of 527), the failures shown all 404 on unpublished ADM APIs, and none remain once only published operations are verified 29 of 29
Everything the pipeline runs HIS_SESSION=RC-1-S28-F7 platform/gateways/ci.sh stopped at the render check passed: model checked (267 routes), rendering current, 50 of 50 tests
Static analysis platform/delivery-pipeline/bin/static-analysis platform/gateways no blocking finding
Secret scan platform/delivery-pipeline/bin/secret-scan code origin/main no secret

Slice scenario. e2e/scenarios/RC-1 does not run the gateway: it routes the screens' gateway paths itself (SCREEN_ROUTES, #217), so this change cannot affect it. It was not run again here.

What the gate lines now show

  • Criterion 4, FR-ISE-GWY-001: platform/gateways/ci.sh passes. TEST-ISE-007 and TEST-ISE-039 pass in the test bed, and the committed configuration routes every operation of the APIs the gateway publishes.
  • Criterion 6, IF-ISE-001: the provider contract cases of every published ADM operation pass through the gateway. This covers credential, validation, facility denial and the correlation identifier.

Requirements and tests

Requirement Test
FR-ISE-GWY-001 part 3: routes only from published contracts, and every published operation routed test_model.TestReferenceModel.test_every_contract_operation_has_a_committed_route (new), test_rendered_files_current; T06Versions.test_unpublished_path_not_found
FR-ISE-GWY-001 part 13: service-to-service operations not published test_model.TestReferenceModel.test_service_only_operations_not_published (new), test_policy_decision_not_published
FR-ISE-GWY-001 behaviour 8: the audit action states what the operation does test_model.TestReferenceModel.test_post_queries_audited_as_queries (new)
IF-ISE-001 through the gateway T12Contracts.test_provider_contract_through_the_gateway (now limited to the published operations)
TEST-ISE-007, TEST-ISE-039 unchanged, pass (T01 to T11)

Differences from the specification or the contracts

None. No contract changed.

Questions for a person

None.

Follow-ups outside the card

  • Delivery pipeline (platform/delivery-pipeline/lib/plan.py, FN-S05): the pipeline does not run the platform/gateways job when contracts/adm, contracts/ess or contracts/ise changes, so the same drift will come back after the next contract change. There are two choices:
  • run the gateway's render check on contract changes, and have a gateway session re-render after the merge;
  • render rendered/ in the deploy step instead of committing it. This is a GitOps choice for ADR-HIS-062's owner.

A contract session cannot re-render here itself, since it does not own this folder. - Gateway, later slices (RC-2, RC-3): publish the ADM scheduling, flow, adt, beds and transfers APIs in model/apis.toml, with their tier, patient data and patient parameter, when their slices need them at the gateway. Until then T12 skips them. - Gateway in the slice scenario: still #217 (RC-1-S26 follow-up of RC-1-S12).