Skip to content

Add CI check that fails when a PR loses an ENVO ID - #1681

Merged
matentzn merged 3 commits into
masterfrom
qc-no-lost-envo-ids
Oct 26, 2026
Merged

matentzn merged 3 commits into
masterfrom
qc-no-lost-envo-ids

Conversation

@matentzn

Copy link
Copy Markdown
Collaborator

Adds an id_preservation job to CI that fails if a PR loses an ENVO ID. This is how #1675 happened: #1631 dropped 145 classes and nobody noticed in review because GitHub hides large diffs.

How it works:

  • On every PR, the job checks out the base commit next to the PR merge result and runs make check-lost-ids ID_CHECK_BASE=....
  • For each side it collects every ENVO IRI that has an rdfs:label in ENVO's own sources: envo-edit.owl without its imports, the pattern modules and the NMDC template. These are the same files that go into envo-base.owl.
  • Any term labelled on base but not on head fails the job, and the log lists each lost ID with its label.

I check for labels rather than declarations because ROBOT adds a type to anything still referenced, so a stripped class that's still used as a parent would otherwise slip through. Obsoleting a term passes (it keeps its IRI and its "obsolete …" label). So does moving a term between the edit file and a module, or dropping foreign declarations. Terms that appear only in import modules don't count. There's no allowlist: ENVO IDs don't get deleted, they get obsoleted.

Tested locally in odkfull:v1.6:

#1677 removes 8 unlabelled ENVO declarations and would pass, because the check only tracks labelled terms.

Once this is merged, someone with admin rights needs to make id_preservation a required status check in branch protection. Otherwise it only warns.

Part of #1675

Compares the labelled ENVO terms in ENVO's own sources (edit file without
imports, pattern modules, NMDC template) on the PR base and on the PR merge
result. Any term that disappears or loses its label fails the job.
Obsoletion passes because obsolete terms keep their IRI and label.

Replayed against #1631 this fails with the 160 terms lost in #1675.

Part of #1675

@turbomam turbomam left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @nico. I support this PR.

I reran the check from this branch in odkfull:v1.6 against three pairs of commits and got what the description claims:

The skip for a file missing on one side also worked for the template that c6730c4 removed.

I would liek to suggest on change before merging: the workflow's pull_request trigger is filtered to branches: [ master ], so a pull request whose base is another branch never runs the job. The wetland biome was in that position until this morning. Dropping the filter under pull_request closes the gap.

Note that master has no branch protection at all today (the branches/master/protection endpoint returns 404), so until a rule requires pull requests and this job, a direct push to master skips it.

The pull_request trigger was limited to master, so stacked pull requests
got neither ontology_qc nor id_preservation. Each layer is now checked
against its own base.
@matentzn

Copy link
Copy Markdown
Collaborator Author

@turbomam agreed on the pull_request filter, I'll drop it. That also gets ontology_qc running on stacked PRs, so you won't need to retarget to master to get CI. Each layer gets checked against its own base, which is what we want.

On protection: master does have a rule. The endpoint just 404s if you don't have admin on the repo. It requires PRs and an up-to-date ontology_qc, plus resolved conversations. I'll add id_preservation as a required check once this is merged.

@matentzn
matentzn requested a review from turbomam October 26, 2026 13:44

@turbomam turbomam left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @matentzn. I agree, I was wrong about master having no branch protection. I checked with the GitHub API's branch protection endpoint for master, and it returned a 404 because I don't have admin on this repo.

Thanks for adding the loss of IDs check. I'll probably add something like this to other projects I work on.

@matentzn
matentzn merged commit e41b055 into master Oct 26, 2026
3 checks passed
@matentzn
matentzn deleted the qc-no-lost-envo-ids branch October 26, 2026 17:04
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.

2 participants