← Back to Pull requests

Add parser, response validator and digest auth tests; restore data type tests from #449 #547

Closed
unknown closed this pull request without merging on Nov 03, 2026 16:51 UTC
View on GitHub
unknown unknown commented on Oct 31, 2026 11:33 UTC
Author

Adds unit tests for the HL7v2 and NCPDP readers, the HL7v2 response validator and the digest authenticator, and brings over the data type tests from #449 so they can land sooner.

New unit tests

What the tests cover:

  • Readers: separators and encoding characters, empty fields, repetitions and subcomponents, NCPDP transaction groups, count and counter fields, and field names that differ between versions.

  • Validator: ER7 and XML ACKs, custom ACK codes, control-ID lookups from the encoded message or from a map variable, and rejection of a DOCTYPE in an XML response.

  • Digest: the full challenge and response flow for MD5, MD5-sess, auth and auth-int, plus stale nonces, replayed and too-high nonce counts, and each invalid-directive path.
  • | Class | Before (Sonar) | After (local JaCoCo) | Test file |
    |---|---|---|---|
    | ER7Reader | 0% | 99.5% lines / 92.7% branches | ER7ReaderTest.java (new) |
    | NCPDPReader | 0% | 99.4% / 91.1% | NCPDPReaderTest.java (new) |
    | HL7v2ResponseValidator | 2.8% | 99.4% / 92.0% | HL7v2ResponseValidatorTest.java (new) |
    | DigestAuthenticator | 7.4% | 91.5% / 86.5% | DigestAuthenticatorTest.java (15 tests added) |

    Data type tests from #449

    Cherry-picked from @mgaffigan's maint/restore-tests with -x, authorship and sign-off kept:

  • Restore some of the disabled Tests (HL7 serializer, password and value replacer tests renamed to Test so the build picks them up)

  • Re-add the EDI serializer tests using new fixtures

  • Re-add the NCPDP tests, expanded to include a D.0 response and checks that converting back gives the original message

  • Re-add the DICOM tests with sample instances

  • Drop the dead main()-style test entrypoints
  • These sample-message tests pin realistic round trips, including the XML-to-message direction. The reader tests above cover edge cases the samples don't reach. Four reader tests that only repeated what the fixtures already check were dropped in the last commit. testTransactionGroups stays, because every NCPDP fixture has a single transaction.

    142 data type, digest, password and value-replacer tests pass locally on JDK 17.

    Diff: 269 lines (+201 / -68) across 3 files Reviewer: jonbartels Review duration: 4637m
    All Vouch review confidence checks passed
    Residual risk 0.26 = Change Risk (0.63) × (1 − Review Confidence (0.58)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.63 · 269 lines diff across 3 files
    0.63
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    57%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.335
    Shallow Review Depth shallow_review_depth
    0.289
    Sensitive Paths sensitive_paths
    0.063
    Real PR Conversation Timeline
    1 comments
    "Review active on #547"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 58.0% reviewed sensitive_module
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 62.6% (MEDIUM) · Higher = larger blast radius
    62.6%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 58.0% · Lower = rushed or shallow review
    58.0%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 26.3% · Safe to merge
    26.3%