Update patch policy logic when OR is used#45622
Conversation
Generated automatically with cmd/maintained-apps.
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.
Tip: disable this comment in your organization's Code Review settings.
WalkthroughThis PR updates installer metadata in three maintained-app JSON files. Codex CLI Windows is updated from version Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@ee/maintained-apps/outputs/codex-cli/windows.json`:
- Line 7: The patched SQL string's boolean precedence is wrong: the OR between
the two path checks is evaluated after the AND, so the machine path is not
subjected to the version check. Update the "patched" value (the SQL in the
patched field) so the version_compare(...) < 0 is applied to both install
paths—either by grouping the two path checks in parentheses and then ANDing the
version check, or by applying version_compare to each path expression
separately—so both 'C:\Program Files\Codex CLI\codex.exe' and the AppData path
are only considered unpatched when their version is < 0.130.0.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: a599809f-8acd-47f1-840f-0f39b63a1794
📒 Files selected for processing (3)
ee/maintained-apps/outputs/codex-cli/windows.jsonee/maintained-apps/outputs/cursor/darwin.jsonee/maintained-apps/outputs/cursor/windows.json
Ensure the appended AND version_compare(...) binds across the entire WHERE condition by wrapping the WHERE clause body in parentheses before generating the patched query. Implemented in pkg/patch_policy/patch_policy.go, updated tests in pkg/patch_policy/patch_policy_test.go (added an OR-condition test) and adjusted expected queries in ee/maintained-apps tests and the Codex CLI windows.json output to match the new parenthesized form. Also retained existing percent-escaping behavior for LIKE patterns.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #45622 +/- ##
=======================================
Coverage 66.74% 66.75%
=======================================
Files 2744 2744
Lines 219316 219320 +4
Branches 10831 10831
=======================================
+ Hits 146393 146401 +8
+ Misses 59697 59693 -4
Partials 13226 13226
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Closing in favor of #45646. |
This pull request improves the safety and correctness of SQL query generation for patch policies, particularly when handling complex
WHEREclauses that includeORconditions. It also updates the application manifests for Cursor and Codex CLI to their latest versions.SQL Query Generation Improvements:
WHEREclause in parentheses when appending version checks. This ensures correct SQL operator precedence, especially when the original condition containsOR.WHEREclause conditions, and a new test case was added for queries withORconditions. [1] [2] [3] [4] [5]Application Manifest Updates:
cursor/darwin.json) and Windows (cursor/windows.json) to version 3.4.20, including new installer URLs, hashes, and patch queries. [1] [2]codex-cli/windows.json) to version 0.130.0, with new installer URL, hash, and a corrected patch query that now uses the safer query generation logic.These changes make the patch policy system more robust against SQL logic bugs and keep the application manifests up to date.
Summary by CodeRabbit
Chores
Bug Fixes
Tests