Skip to content

Fix cleanly-passing products not counted, triggering false no_products_found error#1558

Merged
jordanpadams merged 1 commit intomainfrom
fix/1557-no-products-found-clean-pass
Apr 1, 2026
Merged

Fix cleanly-passing products not counted, triggering false no_products_found error#1558
jordanpadams merged 1 commit intomainfrom
fix/1557-no-products-found-clean-pass

Conversation

@jordanpadams
Copy link
Copy Markdown
Member

🗒️ Summary

Fix no_products_found error incorrectly triggered when a product validates cleanly (zero errors, zero warnings).

In Report.java, numPassedProds was only incremented when problems.size() - ignoreFromTotalCounts > 0. A cleanly-passing product has all its problems classified as GENERAL/EXECUTION category (which increment ignoreFromTotalCounts), so the net count evaluated to <= 0 and the product was never tallied. getTotalProducts() then returned 0, causing ValidateLauncher to fire the false no_products_found error even though the product appeared as PASS in the report.

Fix: Remove the spurious problems.size() - ignoreFromTotalCounts > 0 guard so any non-directory target that passes validation is correctly counted.

🤖 AI Assistance Disclosure

  • No AI assistance used
  • AI used for light assistance (e.g., suggestions, refactoring, documentation help, minor edits)
  • AI used for moderate content generation (AI generated some code or logic, but the developer authored or heavily revised the majority)
  • AI generated substantial portions of this code

Estimated % of code influenced by AI: 50%

⚙️ Test Data and/or Report

Manually verified with a valid PDS4 label and user-supplied schema/schematron:

Before fix:

PASS: file://.../tc_Valid_Product_Resource.xml (urn:nasa:pds:resources:resources:opus::3.0)
ERROR [error.execution.no_products_found] No Products found during Validate execution.
  0 product(s) | 0 product(s) passed | 0 product(s) total

After fix:

PASS: file://.../tc_Valid_Product_Resource.xml (urn:nasa:pds:resources:resources:opus::3.0)
  1 product(s) | 1 product(s) passed | 1 product(s) total

♻️ Related Issues

Fixes #1557
Refs #1548, #1458

🤓 Reviewer Checklist

Reviewers: Please verify the following before approving this pull request.

Documentation and PR Content

  • Documentation: README, Wiki, or inline documentation (Sphinx, Javadoc, Docstrings) have been updated to reflect these changes.
  • Issue Traceability: The PR is linked to a valid GitHub Issue
  • PR Title: The PR title is "user-friendly" clearly identifying what is being fixed or the new feature being added, that if you saw it in the Release Notes for a tool, you would be able to get the gist of what was done.

Security & Quality

  • SonarCloud: Confirmed no new High or Critical security findings.
  • Secrets Detection: Verified that the Secrets Detection scan passed and no sensitive information (keys, tokens, PII) is exposed.
  • Code Quality: Code follows organization style guidelines and best practices for the specific language (e.g., PEP 8, Google Java Style).

Testing & Validation

  • Test Accuracy: Verified that test data is accurate, representative of real-world PDS4 scenarios, and sufficient for the logic being tested.
  • Coverage: Automated tests cover new logic and edge cases.
  • Local Verification: (If applicable) Successfully built and ran the changes in a local or staging environment.

Maintenance

  • Backward Compatibility: Confirmed that these changes do not break existing downstream dependencies or API contracts (or that breaking changes are clearly documented).

…s_found error

In Report.java, numPassedProds was only incremented when
problems.size() - ignoreFromTotalCounts > 0. A product validating with
zero errors/warnings has all its problems classified as GENERAL/EXECUTION
(incrementing ignoreFromTotalCounts), so the net count was <= 0 and the
product was never tallied. getTotalProducts() returned 0, causing
ValidateLauncher to fire the false no_products_found error.

Remove the spurious problems count condition so any non-directory target
that passes is correctly counted.

Fixes #1557
Refs #1548, #1458

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@jordanpadams jordanpadams requested a review from a team as a code owner March 30, 2026 21:17
@jordanpadams jordanpadams added the bug Something isn't working label Mar 30, 2026
@jordanpadams jordanpadams self-assigned this Mar 30, 2026
@jordanpadams jordanpadams added the bug Something isn't working label Mar 30, 2026
@jordanpadams
Copy link
Copy Markdown
Member Author

Confirmed locally that this works for valid files.

$ validate-4.1.0-SNAPSHOT/bin/validate --target ../pds4-information-model/model-lddtool/src/test/resources/data/update_version/github931/tc_Valid_Product_Resource.xml --schema ../pds4-information-model/export/PDS4_PDS_1Q00.xsd --schematron ../pds4-information-model/export/PDS4_PDS_1Q00.sch --skip-context-validation

PDS Validate Tool Report

Configuration:
   Version      4.1.0-SNAPSHOT
   Date         2026-04-01T22:01:01Z
   CLI args     --target ../pds4-information-model/model-lddtool/src/test/resources/data/update_version/github931/tc_Valid_Product_Resource.xml --schema ../pds4-information-model/export/PDS4_PDS_1Q00.xsd --schematron ../pds4-information-model/export/PDS4_PDS_1Q00.sch --skip-context-validation

Parameters:
   Targets                        [file:/Users/jpadams/proj/pds/pdsen/workspace/pds4-information-model/model-lddtool/src/test/resources/data/update_version/github931/tc_Valid_Product_Resource.xml]
   User Specified Schemas         [file:/Users/jpadams/proj/pds/pdsen/workspace/pds4-information-model/export/PDS4_PDS_1Q00.xsd]
   User Specified Schematrons     [file:/Users/jpadams/proj/pds/pdsen/workspace/pds4-information-model/export/PDS4_PDS_1Q00.sch]
   Severity Level                 WARNING
   Recurse Directories            true
   File Filters Used              [*.xml, *.XML]
   Data Content Validation        on
   Product Level Validation       on
   Max Errors                     100000
   Registered Contexts File       /Users/jpadams/proj/pds/pdsen/workspace/validate/validate-4.1.0-SNAPSHOT/resources/registered_context_products.json



Product Level Validation Results

  PASS: file:/Users/jpadams/proj/pds/pdsen/workspace/pds4-information-model/model-lddtool/src/test/resources/data/update_version/github931/tc_Valid_Product_Resource.xml (urn:nasa:pds:resources:resources:opus::3.0)
        1 product validation(s) completed

Summary:

  1 product(s)
  0 error(s)
  0 warning(s)

  Product Validation Summary:
    1          product(s) passed
    0          product(s) failed
    0          product(s) skipped
    1          product(s) total

  Referential Integrity Check Summary:
    0          check(s) passed
    0          check(s) failed
    0          check(s) skipped
    0          check(s) total


End of Report
Completed execution in 1639 ms

@jordanpadams jordanpadams merged commit f251415 into main Apr 1, 2026
3 checks passed
@jordanpadams jordanpadams deleted the fix/1557-no-products-found-clean-pass branch April 1, 2026 22:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Validate does not count cleanly-passing products, incorrectly triggering no_products_found error

1 participant