Skip to content

fix(engine): reject unclosed OS qualifier in include/exclude paths - #3722

Open
sanketpatel32 wants to merge 2 commits into
rocketride-org:developfrom
sanketpatel32:fix/RR-3719-unclosed-os-qualifier
Open

sanketpatel32 wants to merge 2 commits into
rocketride-org:developfrom
sanketpatel32:fix/RR-3719-unclosed-os-qualifier

Conversation

@sanketpatel32

@sanketpatel32 sanketpatel32 commented Dec 4, 2026 •

Copy link
Copy Markdown

Summary

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

Checklist

  • Commit messages follow conventional commits
  • No secrets or credentials included
  • Wiki updated (if applicable)
  • Breaking changes documented (if applicable)

Linked Issue

Fixes #3719

Summary by CodeRabbit

  • Bug Fixes
    • 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.

@coderabbitai

coderabbitai Bot commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

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.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested labels: bug, module:server

Merge Risk: Minimal · up to 7ee17

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: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed 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 Passed [#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 Passed 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 &lt; without a closing &gt; 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 &lt; or has no &gt; (pattern.find('&gt;') == 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 &gt; is found, so qualifierEnd + 1 &lt;= size and the out-of-range path is gone. Closed qualifiers such as &lt;Linux&gt;/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 &lt;*, &lt;Linux, &lt;Mac, and &lt;. 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::substr noexcept 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-&lt; and closing-&gt; 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.

Share

Recent review info

Run configuration

Commits

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

An include or exclude path with an unclosed OS qualifier like <* aborts the task

1 participant