Skip to content

ID-119: Add non-must-support element check (CRD conf-10/13, PAS conf-12)#785

Open
abhinandan2012 wants to merge 1 commit into
inferno-framework:mainfrom
abhinandan2012:id-119-non-ms-element-check
Open

ID-119: Add non-must-support element check (CRD conf-10/13, PAS conf-12)#785
abhinandan2012 wants to merge 1 commit into
inferno-framework:mainfrom
abhinandan2012:id-119-non-ms-element-check

Conversation

@abhinandan2012

@abhinandan2012 abhinandan2012 commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Implements the Da Vinci Burden Reduction client-side conformance rule that client requests SHALL NOT contain non-must-support elements (CRD conf-10, conf-13, PAS conf-12).

The change extends the inferno-core must-support DSL with a new analysis step that enumerates non-must-support elements from a profile and reports any that are populated in the resource(s) under test.

What changed

  • lib/inferno/dsl/must_support_metadata_extractor.rb

    • New non_must_support_elements enumerates non-must-support, non-required profile elements whose parent is the resource root or a must-support element. Entries are tagged must_support: false.
    • must_supports[:elements] now holds both must-support and non-must-support entries in a single list, matching the design decision in the ticket ("keep everything in one structure").
  • lib/inferno/dsl/must_support_assessment.rb

    • New public DSL method non_must_support_elements_present(resources, profile_url, ...). Same signature shape as missing_must_support_elements (validator, metadata, requirement_extension, and customization block all supported).
    • Internal must_support_elements and must_support_extensions accessors now filter out entries flagged must_support: false so the existing "missing MS" path is unaffected.
    • New present_non_must_support_elements reuses the existing resource_populates_element? navigation.
    • New unexpected_extensions walks the resource (and non-extension children) for extension URLs that are not in the must-support extensions list. Sub-extensions of an MS complex extension are intentionally not recursed into, since they belong to that extension's own definition (for example, ombCategory inside us-core-race).
  • spec/inferno/dsl/must_support_assessment_spec.rb

    • 12 new examples for the assessment path: pure-MS request passes, populated non-MS elements flagged, multiple non-MS at once, legacy metadata is a no-op (backwards compatibility), unknown extensions flagged, versioned canonical URLs matched, MS complex-extension internals ignored, unknown extensions on non-extension sub-elements flagged, empty input handled, explicit must_support: true honored.
    • 2 new examples on the extractor: shape of non_must_support_elements and merge into must_supports[:elements].

Backwards compatibility

Critical for the ticket and exercised by a dedicated spec:

  • Any metadata entry without an explicit must_support flag is treated as must_support: true. Existing metadata (which carries no flag) keeps the same behavior under the existing must-support checks.
  • The new check is a no-op when the supplied metadata contains zero must_support: false entries. Older metadata never carried such entries, so calling the new DSL against it returns an empty list rather than reporting spurious extension violations.

Tests

bundle exec rspec
bundle exec rubocop

UI testing steps

These steps exercise the new DSL end-to-end through the Da Vinci CRD Client v2.2.1 Test Suite. They require the companion davinci-crd-test-kit branch id-119-integration-non-ms-check (helper plus a new test wired into the order-sign group).

Prerequisites

  • Local checkout of inferno-core on branch id-119-non-ms-element-check.
  • Local checkout of davinci-crd-test-kit on branch id-119-integration-non-ms-check, with its Gemfile pointing at the inferno-core checkout via gem 'inferno_core', path: '../inferno-core'.

Start the kit

The UI is then at http://localhost:4567.

Running the CRD Client and Server Suites Against Each Other

Running Suites Against Each Other.

Run the client suite

  1. Open http://localhost:4567 and create a session of "Da Vinci CRD Client v2.2.1 Test Suite" (any US Core option).
  2. From the Preset dropdown in the upper left, select "Run against the CRD Server Suite".
  3. Run group 1.1 Registration. It should pass.

Drive an order-sign hook

  1. Run client group 1.2.6 order-sign until the "User Action Required" dialog appears.
  2. In the CRD Server suite tab(s), run the matching server group 3.6 order-sign to invoke the hook against Inferno's mock client.
  3. Return to the client tab and click the continuation link in the "User Action Required" dialog. Attest to card display in the second dialog that appears.

Where to see the change

After step 3, navigate to:

1 Hook Invocation
  1.2 Hooks
    1.2.6 order-sign
      1.2.6.3 Requests

The new test appears as:

  • ID: crd_v221_hook_request_no_non_ms
  • Position in the UI tree: 1.2.6.3.04
  • Title: "Client hook requests contain no non-must-support elements"
  • Verifies requirements: hl7.fhir.us.davinci-crd_2.2.1@conf-10, hl7.fhir.us.davinci-crd_2.2.1@conf-13

Click the test row to expand the detail panel. Results are visible in three
places:

  1. The status icon next to the test row (pass, fail, or skip).

  2. The summary line directly under the test title in the collapsed row (for example, "Requests 1, 2, 3, 4, 5, and 6: Hook request resources contained non-must-support elements. See Messages for details.").

  3. The Messages tab inside the expanded detail panel. Each violation is listed as a separate row of type error, in the format:

    (Request N) Prefetch Template '<template_name>' - non-must-support element present: <path or extension url>

    Bundles add a Bundle entry M segment to the prefix.

    Soft-fallback warnings (for example, when a profile cannot be loaded for metadata extraction) appear as warning rows in the same panel and do not fail the test on their own.

Expected results

  • Test passes (green check) when none of the captured prefetch resources populate any non-must-support element of the corresponding CRD profile.
  • Test fails (red x) with one Messages entry per violation when at least one resource populates at least one non-MS element or carries an extension URL not declared as must-support in the profile.
Screenshot 2026-06-02 at 1 55 42 PM

…t compliance with Da Vinci CRD and PAS requirements
@codecov

codecov Bot commented Jun 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.84%. Comparing base (cb3a0ff) to head (fc787ac).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #785      +/-   ##
==========================================
- Coverage   84.85%   84.84%   -0.01%     
==========================================
  Files         297      297              
  Lines       14020    14018       -2     
  Branches     1977     1977              
==========================================
- Hits        11896    11894       -2     
  Misses       2116     2116              
  Partials        8        8              
Flag Coverage Δ
frontend 79.49% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant