Skip to content

feat: infores registry validation and RIG schema drift tests - #212

Merged
SkyeAv merged 5 commits into
mainfrom
feat/ingest-registry-validation
Oct 7, 2026
Merged

SkyeAv merged 5 commits into
mainfrom
feat/ingest-registry-validation

Conversation

@SkyeAv

@SkyeAv SkyeAv commented Oct 7, 2026

Copy link
Copy Markdown
Owner

Closes two of the six validation gaps identified against Koza and NCATSTranslator/translator-ingests: emitted infores: CURIEs were only prefix-checked, and the RIG Pydantic mirror was never tested against the released LinkML schema.

Infores Registry Validation

  • New command: tablassert validate-infores classifies every emitted knowledge-source CURIE -- edge primary_knowledge_source, sources[].resource_id, sources[].upstream_resource_ids, node provided_by, and with --rig the RIG document -- against biolink/information-resource-registry's infores_catalog.yaml, the catalog translator-ingests' SOP points at but never checks programmatically.
  • Bundled snapshot: src/tablassert/data/infores_catalog.yaml is vendored from upstream commit a72dbc3b55d5 (2026-10-06), so the default path is offline and deterministic. --registry refresh fetches the live catalog through the bounded-retry net.http_get_text, validates the identifier set BEFORE writing, and caches under the user cache dir; --registry off reports structure only.
  • Advisory default: unregistered CURIEs warn and exit 0, because Tablassert legitimately mints graph-local CURIEs (rig.infores()); repeatable --allow-infores exempts them and --strict exits 1 while any remain, for CI gating. Missing input files exit non-zero in every mode, matching the validate-kgx contract.
  • Core: src/tablassert/infores_registry.py (load_registry_snapshot, validate_infores) plus error code infores-registry-unreadable in src/tablassert/errors.py. Non-JSON NDJSON lines count as malformed and a corrupt --rig yaml raises the coded error; neither can crash the walk with a traceback.

RIG Drift Tests

  • Vendored schema: tests/fixtures/resource_ingest_guide_schema.yaml pins the upstream resource-ingest-guide-schema at commit f870823cfde8.
  • Mirror lockstep: tests/test_rig_schema_drift.py proves every models.RIG* class matches its schema class field-for-field in both directions; RIGConfig's config-only keys (artifact_base_path, artifact_base_url, source_files, ui_explanation) are the documented exceptions, and any new mirror-only key now fails the test instead of drifting silently.
  • Document conformance: tests/_rig_linkml.py is a dependency-free LinkML-subset validator (required slots, unknown-slot rejection, enum membership, scalar types) that validates a real rig.build_rig_document output against the vendored schema. No linkml dependency is added.
  • Staleness guard: a network-marked test refetches the pinned schema and compares semantically; it self-skips offline so the suite stays deterministic.

Docs

  • docs/cli.md gains the nine-command index and a full ## validate-infores section; llms.txt indexes the command and src/tablassert/infores_registry.py; CHANGELOG.md carries an Unreleased entry. The tests/test_docs_cli_coverage.py and tests/test_docs_source_of_truth.py SSOT mappings are updated with the live surface.

Design

  • New command, not validate-kgx flags: the existing biolink gate's report shape and flags stay byte-stable for downstream consumers; the infores axis has its own input (the RIG) and its own failure policy.
  • Accepted caveat: the registry posture is advisory until calibrated against real builds; flipping the default to strict is a one-line follow-up once the allowlist story settles.
  • Deferred: the remaining gap-analysis items (node id_prefixes checks, referential integrity, CURIE syntax in validate_record, ingest-metadata emission) are separate layers.

Testing

  • make check -> exit 0; pytest 1726 passed, 52 skipped, cargo test 127+11+17+1 passed, clippy and ruff clean, pyright 0 errors.
  • New coverage: uv run pytest tests/test_infores_registry.py tests/test_cli_validate_infores.py tests/test_rig_schema_drift.py -q -> 39 passed (snapshot loader error paths, classification units, CLI contract incl. refresh/caching, mirror lockstep, generated-RIG conformance, live staleness fetch).
  • Real CLI exercised: advisory run exits 0 with the warning line, --strict --allow-infores exits 0, --help renders all seven flags.

@coderabbitai

coderabbitai Bot commented Oct 7, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5730094e-19e5-4ed1-b658-223f0140b55b
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@SkyeAv
SkyeAv merged commit 8c29485 into main Oct 7, 2026
5 checks passed
SkyeAv added a commit that referenced this pull request Oct 12, 2026
Cut 19.7.0 and bump the package version in pyproject.toml, CITATION.cff,
and the uv.lock self-package entry.

Minor: validate-infores checks every emitted knowledge-source identifier
against the Translator information-resource registry (#212), and the
pinned biolink-model is bumped to 4.4.6 so BIOLINK_VERSION registers
accurately again and the absorbed population_context_qualifier grants are
dropped (#213).

Changelog:
- Versioned the Unreleased section as 19.7.0 - 2026-10-12 and added the
  missing PR links to the #212 and #213 entries.

Docs: none needed here; the shipped docs updates landed with their own PRs.

Testing:
- make check -> exit 0: ruff clean, pyright 0 errors, pytest 1726 passed /
  52 skipped, cargo test 155 passed, clippy -D warnings clean.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant