sofhiaazzhr Claude Opus 5.5 commited on
Commit
94de89b
·
1 Parent(s): db195e3

[NOTICKET] fix(aggregate): RANKING description is for median rankings only

Browse files

- The RANKING paragraph (#10) read as "any ranking goes here"; on the
relative_last6_months_id eval case 5.4 mini once pulled raw rows and ranked them with
analyze_aggregate instead of grouping in the query (Rifqi, audit A1-F7)
- Now: only a median ranking sets sort_by/top_n here; a sum/avg/count/min/max ranking
is a grouped retrieve_data with order_by + limit, matching planner.md:107
- sort_by example changed from is_bad_actor_sum to pa_median
- Median rankings (units by PA, sections by MTTR): analyze_aggregate + sort_by + top_n
6/6, same as before; 6 avg/count ranking eval cases 6/6 via retrieve_data;
relative_last6_months_id 3/3 via retrieve_data
- Full suite 403 passed, 6 pre-existing failures

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Files changed (1) hide show
  1. src/tools/analytics/aggregation.py +6 -4
src/tools/analytics/aggregation.py CHANGED
@@ -72,7 +72,7 @@ class AggregateInput(BaseModel):
72
  )
73
  sort_by: str | None = Field(
74
  None,
75
- description='Output column to rank the groups by, e.g. "is_bad_actor_sum" '
76
  "(<column>_<func>); the aggregated column's own name works when it has one "
77
  "function. Omit to keep group-key order.",
78
  )
@@ -98,9 +98,11 @@ returned. A plain sum / average / count / min / max per group is computed \
98
  INSIDE the retrieve_data query (group_by + agg), over every matching row; it \
99
  does not come here.
100
 
101
- RANKING — for "which X has the most / least", set sort_by to the aggregate's \
102
- output column (`<column>_<func>`, with ascending=true for "least") and top_n. \
103
- Unsorted, the groups come back in key order and the top ones are not first.
 
 
104
 
105
  DON'T USE WHEN:
106
  - it summarizes a column with no grouping -> analyze_descriptive
 
72
  )
73
  sort_by: str | None = Field(
74
  None,
75
+ description='Output column to rank the groups by, e.g. "pa_median" '
76
  "(<column>_<func>); the aggregated column's own name works when it has one "
77
  "function. Omit to keep group-key order.",
78
  )
 
98
  INSIDE the retrieve_data query (group_by + agg), over every matching row; it \
99
  does not come here.
100
 
101
+ RANKING — only a MEDIAN ranking comes here: "which X has the highest / lowest \
102
+ median" sets sort_by to `<column>_median` (ascending=true for "lowest") and top_n; \
103
+ unsorted, the groups come back in key order and the top ones are not first. A \
104
+ ranking by sum / average / count / min / max is a grouped retrieve_data with \
105
+ order_by + limit — never pull raw rows to rank them here.
106
 
107
  DON'T USE WHEN:
108
  - it summarizes a column with no grouping -> analyze_descriptive