feat(classify): optional priority field for category rules - #663
feat(classify): optional priority field for category rules#663TimeToBuildBob wants to merge 2 commits into
Conversation
When multiple rules match, ranking uses an optional `priority` (alias `weight`) on the rule dict. If omitted, depth-based ranking is unchanged. This lets a shallow rule beat a deeper organizational match without changing default behavior for existing configs.
Greptile SummaryAdds optional
Confidence Score: 5/5The PR appears safe to merge. The previously reported empty-category regression is fixed by skipping empty category paths before ranking, and no blocking failure remains. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[Query category rule] --> B[Parse optional priority or weight]
B --> C{Category path empty?}
C -- Yes --> D[Skip rule]
C -- No --> E{Rule matches event?}
E -- No --> F[Check next rule]
E -- Yes --> G[Rank by explicit priority or category depth]
G --> H[Keep highest-ranked category]
H --> I[Write category to event]
Reviews (2): Last reviewed commit: "fix(classify): skip empty category paths..." | Re-trigger Greptile |
An empty match must not replace Uncategorized. The old depth comparison rejected len 0 against the fallback's len 1; keep that when ranking starts from i64::MIN so negative priorities can still categorize.
|
@greptileai review |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #663 +/- ##
==========================================
+ Coverage 70.81% 78.79% +7.98%
==========================================
Files 51 66 +15
Lines 2916 5523 +2607
==========================================
+ Hits 2065 4352 +2287
- Misses 851 1171 +320 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
CI-green and mergeable (Greptile 5/5) — waiting only on a maintainer click. This PR is ready to merge, but the bot has pull-only access to this repo and can't self-merge — surfacing it here so it isn't lost. The monitoring loop will stop re-flagging it now that this note is posted. |
Optional
priority(aliasweight) on categorize rules, as discussed in #597.{ "type": "regex", "regex": "vim", "priority": 10 }In the reported tree (A matches at depth 1, B→B1 matches at depth 2) A wins if its priority is higher than B1's depth.
Does not change default configs. WebUI editor field and aw-core/Python ranking are separate follow-ups — not closing #597 here.