Verify runpath does not contain a file - #14370
Conversation
|
Should this be backported? |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #14370 +/- ##
==========================================
+ Coverage 90.81% 90.96% +0.15%
==========================================
Files 497 495 -2
Lines 36063 36112 +49
==========================================
+ Hits 32751 32851 +100
+ Misses 3312 3261 -51
Flags with carried forward coverage won't be shown. Click here to find out more.
|
There was a problem hiding this comment.
🟡 Changes recommended
The validation mishandles legacy placeholders and can both miss invalid prefixes and reject unrelated paths.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds early RUNPATH validation to prevent files from being used as directory prefixes.
Changes:
- Validates static RUNPATH components.
- Adds tests for file and directory prefixes.
File summaries
| File | Description |
|---|---|
src/ert/config/model_config.py |
Adds RUNPATH prefix validation. |
tests/ert/unit_tests/config/test_model_config.py |
Tests static prefix validation. |
Review details
Suppressed comments (1)
src/ert/config/model_config.py:142
- This comprehension does not stop at the first dynamic component and only the combined path is checked. Thus
base/<IENS>/laterchecks the unrelatedbase/later, whilebase/file/child/<IENS>misses thatfileis an existing regular file because the combined path does not exist. Walk each prefix until the first token and reject any existing non-directory prefix.
# stops when entering first dynamic part
static_parts = [part for part in parts if not _TOKEN_REGEX.search(part)]
- Files reviewed: 2/2 changed files
- Comments generated: 2
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
e267345 to
1de8b48
Compare
There was a problem hiding this comment.
🟡 Changes recommended
The validation can reject valid dynamic paths and miss files in earlier static components.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 2
- Review effort level: Balanced
|
(maybe already fixed, but ensure the string "PosixPath" is not part the user experience) |
1de8b48 to
b2ee759
Compare
There was a problem hiding this comment.
🟡 Changes recommended
The first-token stopping behavior needs targeted regression coverage.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Balanced
b2ee759 to
b3cf6f6
Compare
Raise an error if the static parts of the runpath provided by user is not a valid directory.
b3cf6f6 to
95733a6
Compare
Issue
Resolves #14265
Approach
If the user provide a runpath, where parts of the runpath contain an existing file,
this is not a valid directory and a config error is thrown.
git rebase -i main --exec 'just rapid-tests')When applicable
merge screenshot-PR in ert-testdata before merging this PR.