You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(engine): reject unclosed OS qualifier in include/exclude paths - #3722
Require a closing > before treating a leading <... prefix as an OS qualifier.
Strip a matched qualifier using the actual > position rather than the glob pattern length.
Add regression coverage for <*, <Linux, <Mac, and < in include/exclude path matcher parsing.
Type
fix
Testing
Tests added or updated
Tested locally
./builder test passes
Validation run locally:
./builder server:compile-tests
./builder server:run-aptest — all tests passed (40742714 assertions in 102 test cases)
./builder server:run-engtest — all tests passed (978 assertions in 35 test cases)
./builder server:run-nodetest — all tests passed (24 assertions in 3 test cases)
Note: Str::substr is still noexcept while forwarding to the potentially throwing std::basic_string::substr; this PR avoids the out-of-range call for unclosed qualifiers but intentionally leaves that wider contract unchanged.
Improved handling of operating-system qualifiers in path patterns. Qualifiers are now recognized only when enclosed in matching angle brackets, and matching qualifiers are removed correctly. Unclosed qualifiers remain unchanged and cause path matcher creation to fail, instead of being interpreted as valid qualifiers.
No actionable comments were generated in the recent review.
Walkthrough
The OS qualifier parser now requires a leading < and a closing > before matching a qualifier. Tests cover a matching Linux qualifier and unclosed qualifiers that remain unchanged and cause matcher creation to fail.
Changes: OS qualifier parsing
Layer / File(s)
Summary
Qualifier parsing and tests packages/server/engine-core/apLib/match/api.cpp, packages/server/engine-core/test/match/Glob.cpp
The parser matches the text between < and > as the OS glob and removes the pattern through the closing >. Tests check a matching <Linux*> qualifier and verify that unclosed qualifiers remain unchanged and cause matcher creation to fail.
Malformed include/exclude paths with an unclosed OS qualifier are now rejected or handled as plain globs instead of aborting the task. Regression tests cover the reported inputs, and no merge-blocking risk remains.
Pre-merge checks: 4
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title names the change: an unclosed OS qualifier is now rejected in include/exclude path parsing. The raw summary confirms that parseAndRemoveOsQualifier now requires a closing '>' and that the te…
Linked Issues check
[#3719] The issue requires that a leading < without a closing > must not crash the task. It must be either treated as a plain glob or rejected with a clear error. At head, `parseAndRemoveOsQualifi…
Out of Scope Changes check
The whole-PR diff (merge base 1bf42e1 to head 7ee1751) changes two files. packages/server/engine-core/apLib/match/api.cpp changes only parseAndRemoveOsQualifier: it adds the leading-< and clos…
Full details: Title check
Explanation
The title names the change: an unclosed OS qualifier is now rejected in include/exclude path parsing. The raw summary confirms that parseAndRemoveOsQualifier now requires a closing '>' and that the tests cover unclosed qualifiers such as '<*', '<Linux', '<Mac', and '<'. The objectives link the change to issue #3719, which reports that these malformed paths abort a task. The title is specific and matches the main change, with no unrelated content.
Full details: Linked Issues check
Explanation
[#3719] The issue requires that a leading < without a closing > must not crash the task. It must be either treated as a plain glob or rejected with a clear error. At head, parseAndRemoveOsQualifier (packages/server/engine-core/apLib/match/api.cpp) returns no qualifier when the pattern does not start with < or has no > (pattern.find('>') == Text::npos). The old substr(osMatch.pattern().size() + 2) call that threw std::out_of_range is replaced by pattern.substr(qualifierEnd + 1). That call runs only after a > is found, so qualifierEnd + 1 <= size and the out-of-range path is gone. Closed qualifiers such as <Linux>/home/* still parse the same way as before. The regression test in packages/server/engine-core/test/match/Glob.cpp (Unclosed OS qualifier is not parsed) covers <*, <Linux, <Mac, and <. It checks that the pattern is unchanged and that createPathMatcher returns an error. I did not run the tests. I relied on the author's reported results (server:run-engtest, server:run-aptest). The issue's Str::substrnoexcept problem is not changed. The PR says this is intentional, and the issue's acceptance criteria do not require that change, since the fix avoids the throwing call. Only the filesys source was reproduced in the issue. The code path is shared, so the fix in parseAndRemoveOsQualifier covers it.
Full details: Out of Scope Changes check
Explanation
The whole-PR diff (merge base 1bf42e1 to head 7ee1751) changes two files. packages/server/engine-core/apLib/match/api.cpp changes only parseAndRemoveOsQualifier: it adds the leading-< and closing-> check and changes the removal offset. packages/server/engine-core/test/match/Glob.cpp adds two regression sections for the qualifier parser. Both changes directly implement or test the issue #3719 requirement. No unrelated code, refactoring, or documentation changes appear in the summary.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Reviewing files that changed from the base of the PR and between 1bf42e1 and 7ee1751.
Files selected for processing: 2
packages/server/engine-core/apLib/match/api.cpp
packages/server/engine-core/test/match/Glob.cpp
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
This branch has not been deployed
No deployments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
>before treating a leading<...prefix as an OS qualifier.>position rather than the glob pattern length.<*,<Linux,<Mac, and<in include/exclude path matcher parsing.Type
fix
Testing
./builder testpassesValidation run locally:
./builder server:compile-tests./builder server:run-aptest— all tests passed (40742714 assertions in 102 test cases)./builder server:run-engtest— all tests passed (978 assertions in 35 test cases)./builder server:run-nodetest— all tests passed (24 assertions in 3 test cases)Note:
Str::substris stillnoexceptwhile forwarding to the potentially throwingstd::basic_string::substr; this PR avoids the out-of-range call for unclosed qualifiers but intentionally leaves that wider contract unchanged.Checklist
Linked Issue
Fixes #3719
Summary by CodeRabbit