Skip to content

Comments

[ENH] Inheritance Principle: Advise against value overloading. Plan to deprecate support for overloading for BIDS 2.0#1834

Merged
effigies merged 1 commit intobids-standard:masterfrom
Lestropie:inheritance_discourage_overloading
Jun 11, 2025
Merged

[ENH] Inheritance Principle: Advise against value overloading. Plan to deprecate support for overloading for BIDS 2.0#1834
effigies merged 1 commit intobids-standard:masterfrom
Lestropie:inheritance_discourage_overloading

Conversation

@Lestropie
Copy link
Collaborator

Re-commit of b7a3ab6 that was rejected as a late addition to #1807; re-posting here for separate review as suggested.

I've become progressively convinced that the ability to overload metadata fields via Inheritance is a major source of the disparity in opinions about the Inheritance Principle. Regardless of whether you like or hate it, where I think there should be consensus is that overloading should not be intentionally used, even if BIDS 1.x explicitly permits it and it was used as one of the key demonstrative examples.

The proposed change hopefully also helps to contextualise why the subsequent text is a complex but necessary set of rules.

@codecov
Copy link

codecov bot commented May 24, 2024

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.04%. Comparing base (40af25c) to head (a4a1fab).
⚠️ Report is 921 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1834   +/-   ##
=======================================
  Coverage   88.04%   88.04%           
=======================================
  Files          16       16           
  Lines        1380     1380           
=======================================
  Hits         1215     1215           
  Misses        165      165           

☔ View full report in Codecov by Sentry.
📢 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@effigies
Copy link
Collaborator

Seems reasonable to me. If there's consensus here, it would be ideal to raise a validator warning and to provide a tool to remove overrides from datasets automatically, with validation being the more important.

@Lestropie
Copy link
Collaborator Author

provide a tool to remove overrides from datasets automatically

Good idea; added to my list.

@effigies
Copy link
Collaborator

Tagging as needs implementation. Recommendations without validator warnings will have essentially no impact.

@effigies
Copy link
Collaborator

I created bids-standard/bids-validator#117 to track implementation. I think this would be a good first issue for a new contributor to the validator.

@effigies
Copy link
Collaborator

effigies commented Jun 4, 2025

xref bids-standard/bids-2-devel#65

@effigies effigies added the copenhagen For discussion in Copenhagen label Jun 4, 2025
the Principle defines the *order of precedence* of such metadata content;
this is necessary for resolution of conflicts if the same metadata field
contains different values in different metadata files
(though it is RECOMMENDED to avoid such overloading).
Copy link
Collaborator

Choose a reason for hiding this comment

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

since in BIDS 2.0 we make it not allowed (ERROR), we could also relax (completely remove?) the order of precedence statement since it would not matter, right? or should we leave it in to disambiguate implementations robust operation and say that e.g. top level (most common) definition takes precedence?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The mechanisms relating to determination of the order of metadata files remains relevant, not for .json but for other metadata extensions. For formats where it is only the "nearest" metadata file that applies, there has to be no ambiguity about which is "nearest".

Copy link
Collaborator

Choose a reason for hiding this comment

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

well, while it is just a WARNING it remains relevant even for JSONs . Even when it would be ERROR, it would be nice to describe expected behavior in case of non-compliance, but I think it would not be possible if we relax requirements and allow multiple files at the same level to provide it.

@yarikoptic yarikoptic self-requested a review June 11, 2025 09:33
@yarikoptic yarikoptic self-assigned this Jun 11, 2025
@effigies effigies self-assigned this Jun 11, 2025
Copy link
Collaborator

@yarikoptic yarikoptic left a comment

Choose a reason for hiding this comment

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

Small change for a human, big leap for humanity!

It would have been nice to

  • assess the impact of such a change on existing datasets (openneuro). I guess the easiest way is to just run validator and see how many hit that new WARNING
  • provide "upgrade" functionality (#1984) which would address the warning (help to move metadata down the hierarchy if encountered).

@yarikoptic yarikoptic changed the title Inheritance Principle: Advise against overloading Inheritance Principle: Advise against value overloading. Plan to deprecate support for overloading for BIDS 2.0 Jun 11, 2025
@yarikoptic
Copy link
Collaborator

I adjusted title to provide more context when used in CHANGELOG. Please review @Lestropie @effigies

Copy link
Collaborator

@effigies effigies left a comment

Choose a reason for hiding this comment

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

LGTM. @yarikoptic Does your latest comment require a change to this text now, or is it more tagged for BIDS 2.0? I think the order of precedence statement should not be removed until it's an error to conflict.

@effigies
Copy link
Collaborator

Implementation: bids-standard/bids-validator#214

@effigies effigies merged commit 089142f into bids-standard:master Jun 11, 2025
2 checks passed
@Lestropie
Copy link
Collaborator Author

It would have been nice to

ohbm/hackathon2025#13 if successful would provide a more tailored tool for detecting these.

@effigies
Copy link
Collaborator

Cc @ericearl

@effigies effigies changed the title Inheritance Principle: Advise against value overloading. Plan to deprecate support for overloading for BIDS 2.0 [ENH] Inheritance Principle: Advise against value overloading. Plan to deprecate support for overloading for BIDS 2.0 Aug 26, 2025
Copilot AI added a commit that referenced this pull request Dec 17, 2025
- Add migrate.py module with base migration framework including Migration class, MigrationRegistry, and decorators
- Add migrations.py with three specific migrations:
  - standardize_generatedby: Convert pre-standard provenance to GeneratedBy (BEP028)
  - fix_inheritance_overloading: Check for deprecated inheritance overloading patterns (PR #1834)
  - fix_tsv_entity_prefix: Check for missing entity prefixes in TSV files (PR #2281)
- Add CLI commands: 'bst migrate list', 'bst migrate run', 'bst migrate all'
- Add comprehensive tests for migration framework and specific migrations
- All tests passing (24 tests total)

Co-authored-by: yarikoptic <39889+yarikoptic@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

copenhagen For discussion in Copenhagen inheritance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants