fix(issue): warn that list counts are not scoped to the release: filter - #1528
fix(issue): warn that list counts are not scoped to the release: filter#1528jared-outpost[bot] wants to merge 2 commits into
Conversation
The Sentry issues-list endpoint applies query filters when selecting which groups match, but its per-group seen-stats (count/userCount/firstSeen/ lastSeen) remain period-wide totals across every value of a release: filter. A caller running `issue list --query 'release:"X"'` therefore sees counts that over-report the release contribution, and --sort freq/user rank by those same unscoped counts. Detect count-unscoped filter keys (currently release:) via the search query AST and surface a note: in the human footer, and as a machine- readable `_countScope` field in the JSON envelope. Points callers at the events endpoint for filter-scoped counts. Fixes #1518
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
The silent catch in unscopedCountFilterKeys tripped the check:errors ratchet (new silent catch beyond baseline). Log the parse failure at debug level instead — an unparseable query has no detectable keys and the API returns a proper 400.
|
ci was red on `check:errors` — the new `catch {}` in `unscopedCountFilterKeys` tripped the silent-catch ratchet (1 → 2 in `search-query.ts`). Fixed by logging the parse failure at `log.debug` instead of swallowing it; an unparseable query has no keys to detect and the API returns a proper 400 anyway. The Unit Tests / CI Status failures were the downstream cascade from that same lint job (the issue list tests themselves passed, 59/59). |
|
ci is green except `warden: security-review`, which failed with an infrastructure error, not a code finding:
The companion `warden` check ran the same `security-review` skill on this commit and reported 0 findings ("No issues found. | security-review | 0"). Lint & Typecheck, Unit Tests, and CI Status all pass on 50d463c. I do not have permission to re-request the warden check (it is a GitHub App check, not a rerunnable Actions workflow — `rerequest` returns 403). A maintainer can re-run it from the Checks tab, or it will re-run on the next push. No code change is warranted. |
|
Jared, why are we not fixing the counts instead?? |
What
sentry issue list --query 'release:"X"'correctly restricts which issuegroups are returned, but the
count/userCountit displays are period-widetotals across every release, not the counts matching the release filter.
Nothing in the output signals this, so a release-scoped triage silently
over-reports, and
--sort freq/--sort userrank by the same unscoped counts.Root cause
The Sentry issues-list endpoint's per-group seen-stats (
count,userCount,firstSeen,lastSeen) honor thestatsPeriodbut are not scoped toarbitrary query filters like
release:. The events endpoint returns correctlyscoped values, but the issues endpoint's stats are not filter-aware. The factor
is not constant (it depends on how a group is distributed across releases), so
the numbers can't be corrected after the fact.
Fix
Rather than silently over-report, mark the counts as unscoped — the minimal,
defensible path the issue itself proposes under "Expected":
unscopedCountFilterKeys(query)insearch-query.tsparses the query AST(recursing into paren groups) and returns the count-unscoped filter keys
present. Currently that set is
{ release }; it's trivial to extend.issue listsurfaces a warning when such a filter is active and the countsare shown:
not scoped to the
release:filter (and, for--sort freq/user, that theordering follows the unscoped counts), pointing at the events endpoint.
_countScopefield in the envelope(
{ _type, filters, fields, message }), following the existing_searchSyntaxinjection precedent.No behavior change when the query has no count-unscoped filter, and the note is
suppressed in JSON when
--fieldscollapses the count fields away.Tests
test/lib/search-query.test.ts—unscopedCountFilterKeysacross plain,in-list, paren-group, case-insensitive, dedup, free-text, and unparseable
inputs.
test/commands/issue/list.test.ts— JSON envelope gains/omits_countScope;human output appends/omits the note (incl. the
--sort freqclause).pnpm vitest run test/lib/search-query.test.ts test/commands/issue/list.test.ts→ 138 passed.
tsc --noEmitclean.Closes #1518