Skip to content

LEGLINK-922: Add support for ignoring validation results based on configurable rules - #1801

Open
seanmcilvenna wants to merge 1 commit into
devfrom
LEGLINK-922
Open

LEGLINK-922: Add support for ignoring validation results based on configurable rules#1801
seanmcilvenna wants to merge 1 commit into
devfrom
LEGLINK-922

Conversation

@seanmcilvenna

@seanmcilvenna seanmcilvenna commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

🛠️ Description of Changes

Added a configuration-driven validation result ignore capability to the Java Validation service so known non-actionable false positives can be suppressed before they enter the normal validation workflow.

This change:

  • reuses the concepts from categorization for how matching is performed
  • adds a new link.validation-result-ignore-rules configuration section
  • supports matching validation results by:
    • EXPRESSION
    • MESSAGE
    • SEVERITY
    • CODE
  • supports composite matching so a single ignore rule can require multiple field matches
  • filters matching validation results immediately after HAPI validation results are mapped into internal Result objects
  • prevents ignored validation results from being:
    • categorized
    • persisted
    • included in downstream validity calculations

Also added default ignore rules for known Measure Evaluation-generated false positives.

🧪 Testing Performed

Ran targeted Validation service unit tests from the Java reactor:

  • ValidationServiceTest
  • ValidationResultIgnoreServiceTest
  • ReadyForValidationConsumerTest

Ran validation service within docker and performed a validation using Postman with a very large bundle that was generated on the TEST environment, and observed that a bunch of the false positives are no longer included in the response.

🧑‍🔬 Unit Testing

  • I have written or updated unit tests to cover my changes
  • Coverage: 90.9%

📓 Documentation Updated

Plan to update the Keystone documentation on the Validation service's configurability from this change, after the PR has been merged.

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Validation now supports configurable rules that match validation results by field and regular expression. Matching results are filtered after deduplication. Four MeasureReport-related rules and test coverage were added.

Changes

Validation result ignore rules

Layer / File(s) Summary
Ignore-rule configuration
Java/validation/src/main/java/com/lantanagroup/link/validation/configs/*
LinkConfig exposes ignore rules. ValidationResultIgnoreRuleConfig defines recursive matcher settings, regex matching, inversion, and rule metadata.
Rule compilation and filtering
Java/validation/src/main/java/com/lantanagroup/link/validation/services/ValidationResultIgnoreService.java, Java/validation/src/test/java/com/lantanagroup/link/validation/services/ValidationResultIgnoreServiceTest.java
The service compiles configured rules, supports composite and regex matchers, filters matching results, reports the first matching rule ID, and validates matcher configuration.
Validation pipeline wiring and configured rules
Java/validation/src/main/java/com/lantanagroup/link/validation/services/ValidationService.java, Java/validation/src/main/resources/application.yml, Java/validation/src/test/java/com/lantanagroup/link/validation/services/ValidationServiceTest.java, Java/validation/src/test/java/com/lantanagroup/link/validation/services/ReadyForValidationConsumerTest.java
ValidationService filters ignored results after deduplication. The application defines four MeasureReport-related ignore rules. Tests cover rule lookup and empty-result persistence.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Suggested reviewers: edward-miller-lcg, johnbritton, mikeatpinnacle

Sequence Diagram(s)

sequenceDiagram
  participant ValidationService
  participant ValidationResultIgnoreService
  participant ValidationResults
  ValidationService->>ValidationResultIgnoreService: filterIgnored(results)
  ValidationResultIgnoreService->>ValidationResults: evaluate configured matchers
  ValidationResults-->>ValidationResultIgnoreService: matching fields
  ValidationResultIgnoreService-->>ValidationService: filtered results
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The description covers the changes, testing, unit tests, coverage, and planned documentation update.
Title check ✅ Passed The title clearly and concisely describes the configurable validation-result ignore functionality added by the pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch LEGLINK-922

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
Java/validation/src/main/java/com/lantanagroup/link/validation/services/ValidationResultIgnoreService.java (1)

86-99: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add focused matcher branch tests.

Add xUnit tests for an inverted matcher, a composite matcher with requiresAllChildren=false, and SEVERITY and CODE field matching. Keep these tests local and do not use network activity.

As per path instructions, “If/Else or Switch/Case blocks are introduced or modified — ensure each branch has a corresponding unit test.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@Java/validation/src/main/java/com/lantanagroup/link/validation/services/ValidationResultIgnoreService.java`
around lines 86 - 99, Add focused local xUnit tests covering the branches in
ValidationResultIgnoreService.buildMatcher: inverted matching, composite
matching with requiresAllChildren=false, and RegexMatcher field matching for
SEVERITY and CODE. Exercise each behavior through the service’s public API,
avoid network activity, and ensure the modified conditional branches have
corresponding tests.

Source: Path instructions

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@Java/validation/src/main/java/com/lantanagroup/link/validation/services/ValidationResultIgnoreService.java`:
- Around line 44-48: Update the logger.debug call in
ValidationResultIgnoreService to sanitize matchingRule.id(),
result.getExpression(), and result.getMessage() with the repository’s
established sanitizer before passing them as logging arguments. Preserve the
existing blank/default fallback behavior while ensuring every argument is
sanitized before the logger call.

In `@Java/validation/src/main/resources/application.yml`:
- Around line 114-124: Update the validation-result-ignore-rules entries
ignore_measureeval_measure_report_population_description_invalid_version and
ignore_sde_reference_extension to use composite matchers requiring both the
existing EXPRESSION path and the specific known false-positive message or
severity. Update the associated rule tests with nearby errors that match the
path but differ in message or severity, and verify those results are not
ignored.

---

Nitpick comments:
In
`@Java/validation/src/main/java/com/lantanagroup/link/validation/services/ValidationResultIgnoreService.java`:
- Around line 86-99: Add focused local xUnit tests covering the branches in
ValidationResultIgnoreService.buildMatcher: inverted matching, composite
matching with requiresAllChildren=false, and RegexMatcher field matching for
SEVERITY and CODE. Exercise each behavior through the service’s public API,
avoid network activity, and ensure the modified conditional branches have
corresponding tests.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 841d7876-89f5-4431-a1a9-80bb57a0c335

📥 Commits

Reviewing files that changed from the base of the PR and between 9f2bdc7 and 175b7c6.

📒 Files selected for processing (8)
  • Java/validation/src/main/java/com/lantanagroup/link/validation/configs/LinkConfig.java
  • Java/validation/src/main/java/com/lantanagroup/link/validation/configs/ValidationResultIgnoreRuleConfig.java
  • Java/validation/src/main/java/com/lantanagroup/link/validation/services/ValidationResultIgnoreService.java
  • Java/validation/src/main/java/com/lantanagroup/link/validation/services/ValidationService.java
  • Java/validation/src/main/resources/application.yml
  • Java/validation/src/test/java/com/lantanagroup/link/validation/services/ReadyForValidationConsumerTest.java
  • Java/validation/src/test/java/com/lantanagroup/link/validation/services/ValidationResultIgnoreServiceTest.java
  • Java/validation/src/test/java/com/lantanagroup/link/validation/services/ValidationServiceTest.java

Comment on lines +44 to +48
logger.debug(
"Ignoring validation result via rule {}: expression='{}', message='{}'",
StringUtils.defaultIfBlank(matchingRule.id(), "<unnamed>"),
StringUtils.defaultString(result.getExpression()),
StringUtils.defaultString(result.getMessage()));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Sanitize every logging argument before the logger call.

StringUtils.defaultIfBlank and StringUtils.defaultString do not sanitize values. Pass matchingRule.id(), result.getExpression(), and result.getMessage() through the repository sanitizer before logger.debug.

As per path instructions, all logging message arguments must be sanitized before they are passed to logger methods.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@Java/validation/src/main/java/com/lantanagroup/link/validation/services/ValidationResultIgnoreService.java`
around lines 44 - 48, Update the logger.debug call in
ValidationResultIgnoreService to sanitize matchingRule.id(),
result.getExpression(), and result.getMessage() with the repository’s
established sanitizer before passing them as logging arguments. Preserve the
existing blank/default fallback behavior while ensuring every argument is
sanitized before the logger call.

Source: Path instructions

Comment on lines +114 to +124
validation-result-ignore-rules:
- id: ignore_measureeval_measure_report_population_description_invalid_version
description: Ignore known MeasureEval-generated MeasureReport population description extension version warnings
matcher:
field: EXPRESSION
regex: "\\.extension\\[[0-9]+\\]\\[url='http://hl7\\.org/fhir/5\\.0/StructureDefinition/extension-MeasureReport\\.population\\.description'\\]$"
- id: ignore_sde_reference_extension
description: Ignore known MeasureReport.supplementalDataElement.reference extension
matcher:
field: EXPRESSION
regex: "\\.extension\\[[0-9]+\\]\\[url='http://hl7\\.org/fhir/5\\.0/StructureDefinition/extension-MeasureReport\\.supplementalDataElement\\.reference'\\]$"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Constrain these rules to the known false-positive warning.

Each rule matches only EXPRESSION. It can therefore discard any validation error at the same extension path. ValidationResultIgnoreService removes matched results before categorization, persistence, and validity calculation.

Use a composite matcher that requires the target expression and the specific expected message or severity. Add a nearby non-matching error case to the rule tests.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Java/validation/src/main/resources/application.yml` around lines 114 - 124,
Update the validation-result-ignore-rules entries
ignore_measureeval_measure_report_population_description_invalid_version and
ignore_sde_reference_extension to use composite matchers requiring both the
existing EXPRESSION path and the specific known false-positive message or
severity. Update the associated rule tests with nearby errors that match the
path but differ in message or severity, and verify those results are not
ignored.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant