Skip to content

feat: add --[no-]track-sessions flag to lessen session label strictness#3614

Merged
mgxd merged 13 commits into
nipreps:maint/25.2.xfrom
mgxd:feat/track-sessions
Mar 9, 2026
Merged

feat: add --[no-]track-sessions flag to lessen session label strictness#3614
mgxd merged 13 commits into
nipreps:maint/25.2.xfrom
mgxd:feat/track-sessions

Conversation

@mgxd

@mgxd mgxd commented Feb 18, 2026

Copy link
Copy Markdown
Collaborator

Addresses #3613 #3601 #3581

Supersedes #3606

Adds a new command line option --track-sessions (and to disable, --no-track-sessions) to explicitly control the use of session ID within the workflow.

If enabled, requested or found session(s) propagated:
working directory -> fmriprep_25_2_wf/sub_01_ses_pre_wf/
FreeSurfer ID -> sub-01_ses-pre
Constrained filtering -> filtering by session is not allowed

If disabled, requested or found session(s) omitted:
working directory -> fmriprep_25_2_wf/sub_01_wf/
FreeSurfer ID -> sub-01
Free filtering

@mgxd

mgxd commented Feb 18, 2026

Copy link
Copy Markdown
Collaborator Author

@coryshain @juansanchezpena @bpinsard - if able and available, would be very helpful to have some of you to test this to ensure it works with your use cases

@juansanchezpena

juansanchezpena commented Feb 18, 2026 via email

Copy link
Copy Markdown

@codecov

codecov Bot commented Feb 18, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.11650% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 73.82%. Comparing base (16a8b29) to head (93ffeb5).
⚠️ Report is 18 commits behind head on maint/25.2.x.

Files with missing lines Patch % Lines
fmriprep/config.py 91.30% 1 Missing and 1 partial ⚠️
fmriprep/workflows/tests/layouts.py 90.47% 2 Missing ⚠️
Additional details and impacted files
@@               Coverage Diff                @@
##           maint/25.2.x    #3614      +/-   ##
================================================
+ Coverage         73.27%   73.82%   +0.55%     
================================================
  Files                60       61       +1     
  Lines              4856     4924      +68     
  Branches            630      633       +3     
================================================
+ Hits               3558     3635      +77     
+ Misses             1156     1149       -7     
+ Partials            142      140       -2     

☔ 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.

@coryshain

Copy link
Copy Markdown

It seems like this works so far! At least, the pipeline hasn't crashed where it used to. I'll keep you updated if this changes. Thank you so much! One quick UI question: is the "track-sessions" setting only ever needed if --subject-anatomical-reference = sessionwise? If so, would it be possible for the system to just infer whether to allow filtering on sessions based on which type of anatomical reference is requested, rather than requiring a new CLI arg?

@mgxd

mgxd commented Feb 18, 2026

Copy link
Copy Markdown
Collaborator Author

Great to hear! No, the --track-sessions option is a separate behavior, essentially encoding more information about the current run. However, because #3495 introduced limitations on previous methods of processing, and since 25.2.x is designated as an LTS version, --no-track-sessions is an effort to re-enabling this with minimal disruption for ongoing processing.

However, for the next minor release (26.0.x), we can revisit this implementation (started some discussion in #3607)

@effigies effigies left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM.

@mgxd

mgxd commented Feb 23, 2026

Copy link
Copy Markdown
Collaborator Author

@juansanchezpena were you able to try this patch out?

@bpinsard

Copy link
Copy Markdown
Collaborator

Sorry for the delay and thanks for PR.

I didn't test it with real data, but as it does the same thing as #3588 that I tested while reusing freesurfer longitudinal data, it should cover our usecase.

Do we have a way to write tests for the different usecases?

@juansanchezpena

juansanchezpena commented Feb 24, 2026 via email

Copy link
Copy Markdown

@effigies

effigies commented Mar 2, 2026

Copy link
Copy Markdown
Member

To test this one, we probably need to build out a workflow in https://github.com/nipreps/fmriprep/blob/master/fmriprep/workflows/tests/test_base.py, and then verify that certain nodes exist, e.g., sub_01_ses_pre_wf vs sub_01_wf.

mgxd and others added 9 commits March 6, 2026 15:28
This function was already closely tied to config attributes, so seems logical to include
alongside the config rather than the cli module.
This change also simplifies testing, as processing groups can be 1) tested much easier and
2) set without needing to call `parse_args`
this should probably be tracked on a per-subject setting, not global.
@mgxd mgxd requested a review from effigies March 9, 2026 14:30

@effigies effigies left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM.

Comment thread fmriprep/workflows/tests/test_base.py Outdated
Comment thread fmriprep/config.py
@mgxd mgxd marked this pull request as ready for review March 9, 2026 16:03
@mgxd mgxd merged commit 467a29c into nipreps:maint/25.2.x Mar 9, 2026
24 checks passed
@mgxd mgxd deleted the feat/track-sessions branch March 9, 2026 17:08
@bpinsard bpinsard mentioned this pull request Mar 9, 2026
@juansanchezpena

juansanchezpena commented Mar 10, 2026 via email

Copy link
Copy Markdown

@effigies

Copy link
Copy Markdown
Member

We'll be releasing a new version (25.2.5) once #3625 is merged. We're pretty confident in it, but if you find a bug, we can always push another fix. :-)

@juansanchezpena

juansanchezpena commented Mar 10, 2026 via email

Copy link
Copy Markdown

effigies added a commit that referenced this pull request Mar 10, 2026
25.2.5 (March 10, 2026)

Bug-fix release in the 25.2.x series.

This release restores compatibility with the treatment of multi-session data with
older versions of fMRIPrep by providing the ``--no-track-sessions`` flag.
Future versions of fMRIPrep may have different default behaviors for multi-session data,
so please report any issues you encounter with either setting of this flag
or multi-session data in general.

* FIX: Reuse fewer config options when using ``--config-file`` (#3625)
* FIX: Missing logger (#3624)
* FIX: Avoid overwriting codecarbon output (#3623)
* FIX: Sanitize plus signs in from entities in workflow names (#3604)
* ENH: add ``--[no-]track-sessions`` flag to lessen session label strictness (#3614)
@tsalo tsalo changed the title feat: add `--[no-]track-sessions flag to lessen session label strictness feat: add --[no-]track-sessions flag to lessen session label strictness Mar 17, 2026
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.

5 participants