Skip to content

Fix broadcast list unwrapping and mixed positional list handling#89

Merged
minghangli-uni merged 1 commit intomainfrom
fixup-single-plain-list
Feb 1, 2026
Merged

Fix broadcast list unwrapping and mixed positional list handling#89
minghangli-uni merged 1 commit intomainfrom
fixup-single-plain-list

Conversation

@minghangli-uni
Copy link
Copy Markdown
Collaborator

This is a follow-up fixup PR to #88, which unintentionally corrupted some previously working behaviours.

1. single item list broadcasting produces incorrect results

Before this change, when a scalar parameter was provided as a single element yaml list - a common pattern for broadcasting across multiple branches, the existing generator preserved the list shape instead of unwrapping it to scalar, such as given,

    config.yaml:
      walltime:
        - 5:00:00

the generator output became,

walltime:
  - 5:00:00

This is not the intended semantics for scalar parameters. The current PR fixes this issue by treating a single element list as a broadcasted scalar and unwrapping it to,

walltime: 5:00:00

2. Nested yaml list-of-lists handling during list merges

The existing list-merge logic treated an outer list wrapper as a single positional element in the base list, such as,

input:
  - - a.nc
    - b.nc

was interpreted as replacing the first element of the base list input[0] with the list [a, b], resulting in,

input:
  - [a.nc, b.nc]
  - ocean_hgrid.nc
  - ocean_mosaic.nc
 ...

This PR fixes the issue by unwrapping the broadcast wrapper from [[a, b]] to [a, b] before merging or cleaning, so the above update now correctly produces,

input:
  - a.nc
  - b.nc
  - ocean_mosaic.nc
...

3. Support mixed positional inventories with PRESERVE / REMOVE markers

For this special case which mixes positional inventories, such as below the inner list does not include all maps inside but can be a special marker (REMOVE / PRESERVE), it does not get per-branch selection correctly.

submodels:
  - - PRESERVE
    - input:
        - - a.nc
          - b.nc

@minghangli-uni minghangli-uni self-assigned this Feb 1, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Feb 1, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.98%. Comparing base (3c2558e) to head (bb95ba4).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #89      +/-   ##
==========================================
+ Coverage   98.96%   98.98%   +0.01%     
==========================================
  Files          15       15              
  Lines         679      692      +13     
  Branches      160      165       +5     
==========================================
+ Hits          672      685      +13     
  Misses          3        3              
  Partials        4        4              

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

@minghangli-uni minghangli-uni merged commit 7f03180 into main Feb 1, 2026
24 checks passed
@minghangli-uni minghangli-uni deleted the fixup-single-plain-list branch February 1, 2026 22:21
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