Repository navigation
Description
Problem
The test job in .github/workflows/main.yaml validates changed KB files with a per-file loop:
# .github/workflows/main.yaml — "Validate changed disorder KB files"
for f in ${{ steps.changes.outputs.kb_disorders_files }}; do
...
just validate "$f"
doneEach just validate "$f" (project.justfile:69) runs three validators, and every one re-parses the full schema (and the term validator also loads OAK adapters, the reference validator may hit the network):
uv run linkml-validate --schema {{schema_path}} --target-class Disease {{file}} # schema
{{term_validator}} validate-data {{file}} -s {{schema_path}} ... # term (+OAK)
{{ref_validator}} validate data {{file}} --schema {{schema_path}} ... # referenceSo cost scales as O(changed_files) × (3 schema loads + OAK + network). linkml-validate alone is ~10 s/file locally; all three together are much more. This is fine for typical curation PRs (a handful of files) but does not scale to large PRs.
Evidence (PR #5078)
The prevalence remodel (#5078) changed 463 disorder files. test (3.13) cleared every other step (scope guard, ruff, term-reference validation, folded-scalar check) and then died at ~1h46m mid-way through the per-file validation loop (runner resource/time exhaustion; steps after it never ran). The data itself is fine — all 463 files validate locally in a single batched linkml-validate call in ~2 min, and the full test suite passes. The failure is purely the per-file loop's cost, not a data error.
Proposed fix: batch the validators (one process over all changed files)
Replace the per-file loop with one invocation per validator over the whole changed-file list, so the schema/OAK are loaded once:
linkml-validate --schema … --target-class Disease F1 F2 … FN(accepts multiple files)linkml-reference-validator validate data F1 … FN …(multi-file;scripts/run_reference_validator.shalready exists and can take multiple files)- term validator batched similarly (may need a version bump for multi-file support)
Expected: the ~77+ min (and growing) per-file phase drops to a few minutes, and large migration PRs stop timing out.
Prior art — how ai4curation/ai-gene-review solved the same problem
- ai4curation/ai-gene-review#1522 — consolidated ~2,670 per-file
linkml-reference-validatorprocesses into a single batchedvalidate data F1..FNcall (run_reference_validator.shtakes multiple files;project.justfileruns references as one batch step; added--no-referencesto the per-file best-practices pass to avoid duplication; bumpedlinkml-reference-validator==0.2.1rc1for multi-file support). ~4.5× locally; ~60 min → a few minutes. - ai4curation/ai-gene-review#1527 — reference-cache warming: pre-populate cache with
full_text_attemptedmarkers so the reference validator stops making per-run network calls (~30× on the reference phase). Complementary to batching; dismech's committedreferences_cache/may benefit from the same treatment.
Suggested steps
- Add a batched validate recipe (e.g.
validate-batch FILES...) that calls each validator once over all files. - Update the three
main.yamlvalidate steps (disorders, comorbidities, history) to pass the full changed-file list to the batched recipe instead of looping. - Confirm the term/reference validators support multi-file input (bump versions if needed, per Enhance phenotype section: Fibrodysplasia Ossificans Progressiva #1522).
- Optionally warm/verify
references_cache/(per Enhance phenotype section: Spondylocarpotarsal Synostosis Syndrome #1527) to remove network calls from CI.
Priority
Medium — not a data-quality issue, but it blocks large migration/refactor PRs from ever passing CI (currently worked around only by admin-merge or scope-override). Fixing it unblocks this whole class of PR and speeds up every run.
Context: surfaced by #5078 (approved, all data valid locally, blocked solely by this timeout).
Activity
github-actions commentedon Jul 1, 2026
Summary
This issue is the CI-facing half of a problem already partly tackled in #4448 ("Speed up validate-all: batch the per-file validation loop"). #4448 targeted the local
just qc/validate-allpath; this issue is about the CI PR-time path (main.yaml's per-changed-file loop), surfaced concretely when PR #5078 (the 463-file prevalence remodel, now approved after 6 rounds ofai4c-agentreview) died at ~1h46m mid-loop with a runner timeout — a pure CI-cost failure, not a data problem (all 463 files validate locally in ~2 min when batched).What's already done (from #4448 → PR #4938)
I checked the current
project.justfile/main.yamlstate directly:validate-schema-all— already batched (linkml-validate ... "${files[@]}",project.justfile:128)validate-terms-all— already batched (project.justfile:395)validate-all(full three-validatorjust qcpath) — still per-file, flagged as the follow-up in Speed up validate-all: batch the per-file validation loop (multi-file now supported by all three validators) #4448's last commentjust validate <file>(project.justfile:69-79) — still per-file, three validators, three schema (re)loads each.github/workflows/main.yaml:141-153— still loopsjust validate "$f"over every changed disorder file (this is the exact loop that killed Remodel prevalence: structured measure_type/prevalence_class/rate slots #5078's CI run)validate-comorbidity,main.yaml:158-169) and it looks likevalidate-history-all(main.yaml:177) is already batched, so history is fine.So the remaining gap is specifically: schema + term + reference validation of the CI changed-file list, not the full-corpus weekly run (#4448's original scope).
Proposed fix (as written in the issue body, confirmed still accurate)
Add a
validate-batch FILES...recipe that runs each of the three validators once over the whole changed-file list, and swap it in for thefor f in ...; do just validate "$f"; doneloops inmain.yamlfor both disorders and comorbidities. This mirrors the patternai4curation/ai-gene-reviewalready validated in production (PR ai4curation/ai-gene-review#1522, ~4.5× speedup, 60 min → a few minutes) and reuses the multi-file support already proven forvalidate-schema-all/validate-terms-allin this repo.One open technical question from #4448 still applies here:
linkml-reference-validatormulti-file support needs the>=0.2.0version (currently pinned>=0.1.8inpyproject.toml), which switches to ruamel's strict CParser (rejects flow-style CURIE lists and duplicate keys — #4448 confirmed the currentkb/*.yamlcorpus is clean, but worth re-checking after 463 new files from #5078).No human assignee on this issue
I don't see anyone assigned, so per the automation policy I'm invoking the autonomous agent below.
@dragon-ai-agent please implement the CI batch-validation fix described in this issue, scoped to the changed-file CI path (not the full local
validate-all, which #4448/PR #4938 partially handled already):validate-batch FILES...(or similarly named) recipe toproject.justfilethat runslinkml-validate, the term validator, and the reference validator each once over the full list of passed files (reuse the batching pattern already working invalidate-schema-all/validate-terms-all), instead of the current single-filevalidaterecipe's per-file three-validator design..github/workflows/main.yaml's "Validate changed disorder KB files" step (~line 141) and "Validate changed comorbidity KB files" step (~line 158) to call the batched recipe once oversteps.changes.outputs.kb_disorders_files/ the comorbidity file list, instead of loopingjust validate "$f"/just validate-comorbidity "$f"per file.linkml-reference-validator's installed/pinned version supports multi-filevalidate data(bumppyproject.tomlpast>=0.1.8to>=0.2.0if needed, per Speed up validate-all: batch the per-file validation loop (multi-file now supported by all three validators) #4448), and add/keep a strict-YAML-parse guard test intests/test_data.pyif not already present, to catch ruamel CParser regressions (flow-style CURIE lists, duplicate keys) across allkb/**/*.yaml.just validate <file>/just validate-comorbidity <file>recipes intact for local per-file debugging — only the CI loop should switch to batched.kb/disorders/*.yaml) that the batched recipe produces equivalent pass/fail results to the per-file loop, then runjust qcbefore opening the PR.Link this PR back to both #5088 and #4448 in the description, since it closes out the CI-side follow-up flagged in #4448's last comment.
CI: batch validate changed KB files instead of per-file loop
CI: batch-validate changed comorbidity KB files (#5091)