Skip to content

feat: fail the --qc study on edges whose subject and object are the same CURIE - #229

Merged
SkyeAv merged 1 commit into
docs/table-taxon-anchorfrom
feat/qc-self-loop-edges
Oct 21, 2026
Merged

SkyeAv merged 1 commit into
docs/table-taxon-anchorfrom
feat/qc-self-loop-edges

Conversation

@SkyeAv

@SkyeAv SkyeAv commented Oct 21, 2026 •

Copy link
Copy Markdown
Owner

Adds a self-loop-edges assertion to the build-kg --qc stage-7 study so an edge whose subject and object are the same CURIE fails the build instead of shipping.

Study assertion

  • Check: study._scan_ndjson tallies non-empty string pairs where subject == object in the existing single edge pass, and study_kgx reports them as self-loop-edges with the repeated CURIE and per-CURIE count (examples capped like the other checks).
  • Scope: blank, null, or absent slots stay under incomplete-edges, and non-string slots are not flagged, so one broken edge never reports under two assertions.

Design

  • Error, not removal: the legacy studyKGtsvs.pl never checked this, and every other study assertion reports and exits 1. Reporting shows which mapping collapsed (two cell spellings resolving to one CURIE, or one cell in both slots) rather than silently deleting rows.
  • Accepted caveat: intentionally reflexive assertions fail a --qc build too. Measured on MULTIOMICS_KG_3.0.0: 195 of 1,257,627 edges (0.0155%), 154 biolink:regulates and 39 biolink:correlated_with.

Docs

  • docs/cli.md --qc row and CHANGELOG.md (Unreleased) updated.

Testing

  • uv run pytest -> 1258 passed, 1 skipped
  • uv run pytest tests/test_study.py -n 0 --no-cov -> 38 passed
  • uv run ruff check . / uv run ruff format --check . / uv run pyright -> clean
  • Rust untouched; cargo not run locally.

Questions for the reviewer

  • Autoregulation. Should biolink:regulates self-loops (a gene regulating itself) be exempt, or is failing the build the right default?
  • Error vs. drop. Should this stay a study failure, or also drop the rows at the section level before write?

@SkyeAv
SkyeAv added this pull request to stack #230 October 21, 2026 20:19
@coderabbitai

coderabbitai Bot commented Oct 21, 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: d9eb7315-6a7b-4da7-841f-45a8b5773ec2
  • Autofix · 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 86fdf12 into main Oct 21, 2026
6 checks passed
SkyeAv added a commit that referenced this pull request Oct 22, 2026
Cut 22.2.0 and bump the package version in pyproject.toml,
CITATION.cff, and uv.lock.

Minor: the --qc study stage fails the build on self-referential
edges via a new self-loop-edges assertion (#229); eq/ne reindex
filters can match cells with a Polars regex behind a default-off
regex key (#232, #233, #234); source.reindex can filter rows by
identifier membership with join/antijoin semi/anti hash joins
(#236). Docs: the Taxon Filtering link in the table config
reference now matches its section (#228, #231).

Changelog:
- Versioned the Unreleased section as 22.2.0 - 2026-10-22.
- Added PR links to the three Added entries (#229; #232, #233,
  #234; #236).
- Added the missing Fixed entry for the Taxon Filtering docs link
  (#228, #231).

Docs: none needed here; the shipped docs changes are covered by
the changelog entries above.

Testing:
- make check -> ruff, ruff format, pyright, pytest, cargo test,
  cargo clippy -D warnings: all green.
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