Skip to content

Conversation

@berland
Copy link
Contributor

@berland berland commented Jan 5, 2026

If no arguments are given in the config file to DESIGN_MATRIX, a TypeError would be displayed:

TypeError: argument should be a str or an os.PathLike object where __fspath__ returns a str, not 'dict'
This commit adds detection and a test for this case.

Issue
Resolves #12570

Approach
🧠

  • PR title captures the intent of the changes, and is fitting for release notes.
  • Added appropriate release note label
  • Commit history is consistent and clean, in line with the contribution guidelines.
  • Make sure unit tests pass locally after every commit (git rebase -i main --exec 'just rapid-tests')

When applicable

  • When there are user facing changes: Updated documentation
  • New behavior or changes to existing untested code: Ensured that unit tests are added (See Ground Rules).
  • Large PR: Prepare changes in small commits for more convenient review
  • Bug fix: Add regression test for the bug
  • Bug fix: Add backport label to latest release (format: 'backport release-branch-name')

@berland berland self-assigned this Jan 5, 2026
@berland berland added the improvement Something nice to have, that will make life easier for developers or users or both. label Jan 5, 2026
@berland berland added this to SCOUT Jan 5, 2026
@berland berland moved this to Ready for Review in SCOUT Jan 5, 2026
@berland berland added bug backport version-18.0 release-notes:bug-fix Automatically categorise as bug fix in release notes labels Jan 5, 2026
@berland berland force-pushed the detect_empty_design_matrix_args branch from 5ee71fb to 118aad8 Compare January 5, 2026 14:38
@berland berland moved this from Ready for Review to Fast Track in SCOUT Jan 5, 2026
@berland berland removed this from SCOUT Jan 5, 2026
@codecov-commenter
Copy link

codecov-commenter commented Jan 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.56%. Comparing base (2a0015b) to head (b6f070c).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #12571      +/-   ##
==========================================
- Coverage   90.58%   90.56%   -0.02%     
==========================================
  Files         435      435              
  Lines       29929    29931       +2     
==========================================
- Hits        27110    27108       -2     
- Misses       2819     2823       +4     
Flag Coverage Δ
cli-tests 37.36% <100.00%> (+<0.01%) ⬆️
gui-tests 68.65% <100.00%> (-0.03%) ⬇️
performance-and-unit-tests 73.92% <100.00%> (-0.02%) ⬇️
test 38.11% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

Copy link
Contributor

@xjules xjules left a comment

Choose a reason for hiding this comment

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

Nice one @berland ! 🚀

@codspeed-hq
Copy link

codspeed-hq bot commented Jan 5, 2026

CodSpeed Performance Report

Merging #12571 will not alter performance

Comparing berland:detect_empty_design_matrix_args (b6f070c) with main (6681256)

Summary

✅ 22 untouched

Copy link
Contributor

@xjules xjules left a comment

Choose a reason for hiding this comment

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

Actually, there is a bug in lark Schema config. Let's fix that instead:

def design_matrix_keyword() -> SchemaItem:

@berland
Copy link
Contributor Author

berland commented Jan 6, 2026

Actually, there is a bug in lark Schema config. Let's fix that instead:

You mean it is not respecting the argc_min=1? I guess it should yes.

@berland berland force-pushed the detect_empty_design_matrix_args branch from 89938f9 to b8389b2 Compare January 6, 2026 08:06
@berland
Copy link
Contributor Author

berland commented Jan 6, 2026

Actually, there is a bug in lark Schema config. Let's fix that instead:

You mean it is not respecting the argc_min=1? I guess it should yes.

Hopefully fixed now!

self, line: Sequence[FileContextToken]
) -> Sequence[FileContextToken | dict[FileContextToken, FileContextToken]]:
n = self.options_after
if not line:
Copy link
Contributor

Choose a reason for hiding this comment

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

nice!

@berland
Copy link
Contributor Author

berland commented Jan 6, 2026

Related bug: #12578

from ert.config.parsing.config_schema_item import SchemaItem


def test_argc_min():
Copy link
Contributor

Choose a reason for hiding this comment

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

test_schema_argc_min_invalid?

parse_contents("OPTIONS", schema, "dummy_filename")


def test_argc_min_with_options_after():
Copy link
Contributor

Choose a reason for hiding this comment

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

test_schema_argc_min_with_options_after?

Copy link
Contributor

@xjules xjules left a comment

Choose a reason for hiding this comment

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

Small suggestion for test names improvements, but otherwise 🏅

@berland berland force-pushed the detect_empty_design_matrix_args branch 2 times, most recently from f8c5290 to 3283353 Compare January 6, 2026 11:29
@berland berland enabled auto-merge (rebase) January 6, 2026 11:29
@berland berland disabled auto-merge January 6, 2026 11:37
This solves a missing error message when e.g. DESIGN_MATRIX keyword is
used with no arguments - a list with an empty dict was returned in the
parser, leading to argc_min=1 to be accepted when it should not.
@berland berland force-pushed the detect_empty_design_matrix_args branch from 3283353 to b6f070c Compare January 6, 2026 11:40
@berland berland enabled auto-merge (rebase) January 6, 2026 11:41
@berland berland merged commit 2041366 into equinor:main Jan 6, 2026
34 checks passed
@scout-team-app
Copy link

scout-team-app bot commented Jan 6, 2026

Successfully created backport PR for version-18.0:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport version-18.0 bug improvement Something nice to have, that will make life easier for developers or users or both. release-notes:bug-fix Automatically categorise as bug fix in release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ert crashes failing to create DesignMatrix from dict

3 participants