Skip to content

Multi-file validate data: list failing files in the summary (per-file pass/fail) #53

Closed

Description

@cmungall

The multi-file validate data F1 F2 … mode (thanks for #49) is great for batching — we run it over ~2,670 files in CI. One reporting gap shows up at that scale:

Each file gets a Validating <file> header, and failing files get a Validation Issues block under it, but the final summary only says:

Validation Summary:
  Files validated: 2670
  Issues found in 5 file(s) (7 validation issue(s))

…without naming which files. Triaging then means scanning all 2,670 Validating / Validation Issues blocks.

Request

Enumerate the failing file paths in the summary (ideally a per-file pass/fail line). The sibling linkml-term-validator already does exactly this in multi-file mode:

✅ fileA.yaml
❌ fileB.yaml - 1 issue(s):
    ❌ ERROR: …
Summary: 1/2 files failed, 1 total issue(s)

Matching that — at minimum, listing the failing files in the summary — would make large-batch runs much easier to triage.

Optional

An --errors-only / --quiet flag to suppress the Validating <file> line for passing files (2,670 of them is a lot of noise) would complement this nicely.

Running 0.2.1rc1.

Activity

  1. added
    enhancement
    on Jun 18, 2026
  2. github-actions commented on Jun 18, 2026

    @github-actions
    Contributor

    Summary

    Feature request: improve the validate data multi-file summary to enumerate which files failed, not just how many.

    Background

    This is a follow-on to #49 (merged 2026-06-17), which added multi-file validate data F1 F2 … mode. The multi-file loop builds the Validator once and reuses it across all files — a ~6× speedup for bulk CI runs (10 files: ~2.1 s vs ~12 s as separate processes). The reporter gap surfaces at scale: when running across ~2,670 files, the current summary is:

    Validation Summary:
      Files validated: 2670
      Issues found in 5 file(s) (7 validation issue(s))
    

    …with no indication of which 5 files failed. The only way to find them is to scroll through all 2,670 Validating <file> / Validation Issues blocks.

    Relevant code

    The summary logic lives in src/linkml_reference_validator/cli/validate.py, lines 340–353. The root cause is that files_with_issues is just an int counter (line 303) — the file paths are never collected.

    # Current (lines 303, 336, 348–350)
    files_with_issues = 0
    ...
    files_with_issues += 1   # only a count, path is lost
    ...
    typer.echo(f"  Issues found in {files_with_issues} file(s) ({total_results} validation issue(s))")

    Minimal fix

    Change files_with_issues from int to list[Path], then enumerate the failing paths in the summary:

    # Proposed
    failing_files: list[Path] = []
    
    # in the loop:
    if file_results:
        ...
        failing_files.append(data_file)
    
    # in the summary:
    if failing_files:
        typer.echo(f"  Issues found in {len(failing_files)} file(s) ({total_results} validation issue(s)):")
        for f in failing_files:
            typer.echo(f"    ❌ {f}")
        raise typer.Exit(1)
    else:
        typer.echo("  ✅ All validations passed!")
        raise typer.Exit(0)

    This matches the pattern already used by linkml-term-validator:

    ✅ fileA.yaml
    ❌ fileB.yaml - 1 issue(s):
        ❌ ERROR: …
    Summary: 1/2 files failed, 1 total issue(s)
    

    Optional enhancement: --errors-only / --quiet

    A --errors-only flag would suppress the Validating <file> header for passing files (2,670 of them is noise in CI). The suppress would only affect the per-file progress lines — the summary would always be printed. This is a purely additive CLI change; backward-compatible.

    errors_only: Annotated[bool, typer.Option("--errors-only", "-q", help="Only print output for files with issues")] = False
    
    # in the loop:
    if not errors_only:
        typer.echo(f"\nValidating {data_file} against schema {schema_file}")

    Implementation notes

    • The fix to failing_files is a one-liner change; the summary block is ~4 lines.
    • No new dependencies needed.
    • Existing tests in tests/ for multi-file mode (added in feat(cli): accept multiple data files in 'validate data' #49) would need updating to assert the new summary format includes file paths.
    • --errors-only can be a separate, subsequent PR if preferred.

    @dragon-ai-agent please implement the failing-file enumeration in the summary (the minimal fix above) with TDD — write the test first, then update src/linkml_reference_validator/cli/validate.py. Also add --errors-only / --quiet flag as described. Make sure just test passes.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions