Skip to content

v2 lint: check that identifiers are globally unique - #606

Draft
dweindl wants to merge 2 commits into
PEtab-dev:mainfrom
dweindl:v2_unique_ids
Draft

dweindl wants to merge 2 commits into
PEtab-dev:mainfrom
dweindl:v2_unique_ids

Conversation

@dweindl

@dweindl dweindl commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

Adds CheckGloballyUniqueIds to the default v2 validation tasks. It reports IDs that are defined more than once or coincide with a model entity, together with the places where they are defined, e.g. `a` (observable placeholder of `o1`, observable placeholder of `o2`).

Definitions are condition, experiment, observable, model and placeholder IDs, mapping table petabEntityIds (except identity and annotation-only rows), and parameter table IDs that aren't mapped entities. A parameter table entry for a model entity refers to that entity and is no clash. Annotation-only mapping table rows must not refer to model entities, since such rows are for entities that are not in any model. Duplicates within a single table are still reported by CheckUniquePrimaryKeys.

Adds CheckPlaceholdersOnlyUsedInOwnObservable: placeholders must not be used in other observables, condition targets or target values, or measurement overrides, and noise placeholders must not be used in the observable formula.

The new tasks replace CheckObservablesDoNotShadowModelEntities (now deprecated) in the default validation tasks, and the checks in CheckMappingTable for petabEntityIds that are defined elsewhere or referenced in the model.

For multi-model problems, both tasks run on the full problem, so table entries are compared across all models. IDs from the condition, experiment, observable and parameter tables only clash with the entities of the models they are used with (based on Problem.split_by_model). Mapping table IDs, model IDs and IDs not used with any model are compared with the entities of all models.

Neither the benchmark collection (converted with petab1to2) nor the PEtab v2 test suite has such clashes.

Closes #555.

🤖 Generated with Claude Code

@dweindl dweindl self-assigned this Nov 17, 2026
@codecov-commenter

codecov-commenter commented Nov 17, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.80220% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.19%. Comparing base (d7e9e98) to head (aacc56d).

Files with missing lines Patch % Lines
petab/v2/lint.py 97.80% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #606      +/-   ##
==========================================
+ Coverage   80.03%   80.19%   +0.16%     
==========================================
  Files          70       70              
  Lines        8419     8498      +79     
  Branches     1541     1560      +19     
==========================================
+ Hits         6738     6815      +77     
- Misses       1189     1194       +5     
+ Partials      492      489       -3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dweindl
dweindl force-pushed the v2_unique_ids branch 2 times, most recently from ae6230c to b60d6aa Compare November 17, 2026 11:27
dweindl and others added 2 commits November 17, 2026 15:33
Add `CheckGloballyUniqueIds`. Condition, experiment, observable, model
and placeholder IDs, mapping table `petabEntityId`s and parameter IDs
must be defined only once and must not be model entity IDs. Parameter
table entries for model entities or mapped entities are references,
not definitions.

The task replaces `CheckObservablesDoNotShadowModelEntities` in the
default validation tasks, which is deprecated, and the overlapping
checks in `CheckMappingTable`.

Closes PEtab-dev#555.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`CheckGloballyUniqueIds` now runs on the full problem of multi-model
problems. Table entries are compared across all models. IDs from the
condition, experiment, observable and parameter tables only clash with
the entities of the models they are used with; mapping table IDs, model
IDs and unused IDs are compared with all models. Each clash is reported
once. Annotation-only mapping table rows must not refer to model
entities.

Add `CheckPlaceholdersOnlyUsedInOwnObservable`: placeholders must not
be used in other observables, the condition table or measurement
overrides, and noise placeholders must not be used in the observable
formula.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

v2: linter doesn't check that placeholder IDs are unique

2 participants