Files
kandev/apps/backend/internal/github/gh_client_test.go
T
José Almeida 14c19ea538 feat(web): add CI hover popover on PR top-bar button (#846)
* feat(github): plumb CI popover fields + branch protection cache

Adds RequiredReviews/UnresolvedReviewThreads/ChecksTotal/ChecksPassing
to TaskPR + PRStatus. Extends the GraphQL PR query with reviewThreads
to populate UnresolvedReviewThreads on every poll. New branch_protection.go
holds an in-memory TTL cache + BranchProtectionFetcher interface;
PATClient/GHClient implement REST/CLI lookups so SyncTaskPR can resolve
required_approving_review_count for the PR's base branch. SyncTaskPR
preserves existing counts when a lightweight (GraphQL) sync returns 0
so the popover doesn't flap during the polling cycle.

* feat(github): mock controller hooks for CI popover e2e

Extends associateTaskPR to accept review/check counts, required_reviews,
and unresolved_review_threads, and switches to ReplaceTaskPR so re-POSTing
the same task drives the popover live-refresh path. Adds POST /pr-feedback
to seed PRFeedback (checks/reviews/comments) keyed by a deterministic
synthetic head_sha, and PUT /auth-health to flip the mock client's
authenticated flag for the "Reconnect GitHub" branch. Mock client gains
ReplaceCheckRuns/ReplaceReviews/ReplaceComments helpers and an
authenticated field that defaults to true.

* feat(web): CI hover popover on PR top-bar button

Hovering the PR top-bar button now reveals a popover with
Passed/In-Progress/Failed counts, a workflow-rollup list under the
non-empty buckets (with "open on GitHub" + "+ ctx" affordances on
failed rows), a review-state row ("Approved 1 / 2 required"), and
unresolved-comments count. Click on the button keeps the existing
"open PR detail panel" behavior so shipped tests stay green.

PRFeedback is lazy-fetched on hover-open via a new SWR-style hook
backed by a 20-entry LRU cache slice; the popover refetches whenever
the underlying TaskPR's updated_at changes (the WS handler already
applies poll deltas). Bucket logic + workflow grouping live in a
small util with vitest coverage. The aggregate-popover variant for
multi-PR tasks ships but the multi-PR trigger preserves its existing
DropdownMenu so per-row click → addPRPanel still works.

* test(e2e): pr-topbar-popover scenarios A–F covering CI popover

11 specs covering: count rows + zero-bucket hiding, workflow rollup
with (N/M passed) badge under Failed, review row + unresolved comments,
hover open + leave close, failed-row open/+ctx affordances, header
external link, "No checks have started" empty state, "Reconnect GitHub"
auth-lost branch, and live count updates on a re-associate.

Adds api-client helpers (mockGitHubSeedPRFeedback, mockGitHubSetAuthHealth,
extended mockGitHubAssociateTaskPR) and SessionPage popover accessors.

* fix(github): address bot review comments on CI popover

- branch_protection.go: evict stale entries on read so the cache map
  cannot grow unbounded over a long-running deployment; rewrite the
  comment to drop the inaccurate singleflight claim (no dedup logic
  exists, concurrent misses race harmlessly to set()).
- gh_client.go: replace fragile strings.Contains "HTTP 404" with an
  isNotFoundErr helper that tolerates the formats current and future
  gh CLI versions use ("HTTP 404", "404 Not Found", "status: 404").
- graphql.go: extend reviewThreads with totalCount and attribute the
  un-fetched tail to the unresolved bucket so PRs with >100 threads
  don't silently undercount in the popover.
- pr-ci-popover.tsx: drop the dead "icon" initializer in PRReviewRow
  (every branch overwrites it). Memoize useAddCheckToContext so
  PRWorkflowRow's reference equality stays stable across renders.
- pr-topbar-button.tsx: collapse the duplicate JSDoc on
  usePopoverInteractions.

* fix(github): address remaining bot review comments + tests

Real correctness fixes:
- Replace the "0/0 means counts omitted" heuristic with an explicit
  PRStatus.ChecksPopulated flag so the rich REST sync can clear stale
  totals when checks are removed from a PR upstream.
- Refresh tp.BaseBranch from status.PR on each SyncTaskPR so a
  retargeted PR's branch-protection lookup keys off the new branch.
  Persist base_branch in UpdateTaskPR.
- Cache 403 from /branches/.../protection (token lacks Administration:
  Read scope) the same way as 404 — otherwise every poller tick burns
  rate-limit quota retrying. Both PATClient and GHClient.
- usePRCIPopover: refetch on every popover-open transition (not just
  on updated_at change), via a wasEnabledRef gate. Restores the
  intended SWR semantics that the lastSyncedRef-only guard suppressed.
- groupChecksByWorkflow: prefer the URL of a job matching the group's
  bucket so clicking a "failed" workflow row navigates to a failing
  job, not an earlier passing one.

Tests:
- branch_protection_test.go: cache hit/miss/TTL/eviction, error
  not cached, no-rule cached, client-without-fetcher path.
- pat_client_test.go: TestPATClient_FetchBranchProtection table-test
  for 200/200-with-null/404/403/500.
- service_test.go: ChecksPopulated preserve-on-zero, accept real
  zero, base-branch retarget, change-publish for the new fields.

* refactor(github): trim associateTaskPR + drop unreachable PRAggregatePopover

- mock_controller.go: extract associateTaskPRRequest struct,
  buildTaskPRFromRequest, and ensureMockPRForRequest helpers so the
  handler is back under the 80-line Go limit.
- pr-ci-popover.tsx: remove unreachable PRAggregatePopover export.
  Multi-PR tasks currently use the existing DropdownMenu trigger
  (no hover popover), so the aggregate component was dead code.

* fix(github): drop unused anchorRef + tests for is{NotFound,Forbidden}Err

- pr-topbar-button.tsx: anchorRef was leftover from the dropped
  click-to-pin onInteractOutside guard. Removed.
- gh_client_test.go: tests for the new isNotFoundErr / isForbiddenErr
  helpers covering each accepted format and a few non-matches so a
  future gh CLI wording change is caught.

* fix(github): UnresolvedReviewThreadsPopulated guard + drop unreachable nil checks

- service.go: mirror the ChecksPopulated/preserve dance for
  UnresolvedReviewThreads. The REST single-PR poller (getPRStatus)
  doesn't fetch review threads, so without this guard every REST
  sync would clobber the GraphQL-populated value to 0 and emit a
  spurious github.task_pr.updated event. The GraphQL path
  (convertBatchedPRResult) sets the new flag.
- branch_protection.go: drop unreachable s == nil / fetcher == nil
  checks. fetchRequiredReviews is only invoked from SyncTaskPR on a
  service constructed via NewService, which always initialises the
  cache. After a successful type assertion, the interface value
  cannot be nil; the !ok branch already covers nil-interface inputs.
- service_test.go: new TestSyncTaskPR_UnresolvedThreads_PreservesOnLightweightSync
  covers the regression. Existing NewFieldsPublishEvent threads-change
  case updated to set UnresolvedReviewThreadsPopulated.

* refactor(web): drop CI popover progress bar — last-updated is enough

The animated progress bar was visual noise; the "updated Ns ago"
timestamp tells the user the same thing without the indicator. Footer
also hides entirely until the first fetch lands so an empty popover
doesn't show a useless "" line.

* fix(web): background-sync PRFeedback so popover is fresh on first hover

The on-hover SWR fetch was the only refresh path, so opening the popover
showed the previously-cached value while a new fetch raced behind it —
visibly stale until the refetch landed. The button icon, by contrast,
updates the moment a github.task_pr.updated WS push lands.

Add a usePRFeedbackBackgroundSync hook mounted at the PRTopbarButton
that subscribes to the same pr.updated_at change signal and refetches
PRFeedback into the cache in the background. The popover hook still
fires an on-open refetch as a safety net for the very first hover
(before any sync). No extra polling — fetches are gated on real
TaskPR changes, matching the icon's cadence.

* feat(web): CI status chip in chat status bar + tweak elapsed label

- New <PRStatusChip> renders a compact colored circle in the chat
  status bar (left of the TodoIndicator, just above the input). Hover
  opens the same PRCIPopover anchored to the chip's top edge so the
  card expands upward — matching the user's "open bottom-up" ask. The
  chip mounts the background-sync hook so the popover is fresh on
  first hover even when the top-bar PR button isn't visible.
- elapsedLabel: "just now" → "updated just now" so the footer reads
  the same regardless of how recently the cache was refreshed.

* fix(web): chip color was missing — use static class map for Tailwind JIT

\`getPRStatusColor().replace("text-", "bg-")\` produced class strings at
runtime, which Tailwind's content scanner doesn't pick up — the chip
rendered with no background. Replace with a static lookup so each
literal `bg-*` class appears in the source and gets compiled into the
bundle.

* fix(web): chip uses currentColor SVG so the dot actually renders

The previous bg-* approach relied on Tailwind compiling the literal
class strings. Even with a static map some palette entries (notably
bg-muted-foreground) didn't surface as a usable utility, so the chip
remained transparent. Apply getPRStatusColor's text-* class to the
button wrapper and fill an SVG circle with currentColor — the text-*
utilities are already compiled (PRTaskIcon uses them) so the dot
is guaranteed to render in the right color.

* fix(web): redesign PR status chip — clipboard icon + status glyph

- Move chip to right of TodoIndicator (was left).
- Render as "[clipboard icon] [status glyph]" instead of a bare circle:
  passed → green CircleCheck, failed → red CircleX, in_progress →
  yellow Loader2 (spinning), merged/neutral → muted dot. Status icons
  reuse already-compiled text-* utilities so colors render reliably.

* fix(github): ReviewCount = approved-reviewer count + ReviewCountsPopulated guard

Two bugs feeding the popover's "Approved (0)" misreport:

- Semantic: REST path set ReviewCount to len(reviews), which double-counts
  authors who left multiple reviews and includes COMMENTED rows. Replace
  with countApprovedReviewers — distinct authors whose latest review
  state is APPROVED. GraphQL converter gets the parallel
  countApprovedReviewerNodes helper and also populates PendingReviewCount
  from ReviewRequests.TotalCount (was unset, so the chip's "(K requested)"
  suffix was always missing).

- Clobber: GraphQL polls used to write ReviewCount/PendingReviewCount=0
  on every cycle because the converter never set them. Add
  ReviewCountsPopulated to PRStatus and gate SyncTaskPR's writes on it
  the same way ChecksPopulated already does, so a partial sync path
  preserves the persisted values instead of resetting them to zero.

* fix(web): popover nitpicks (icon, review row, indent, badge)

- Chip icon: ClipboardCheck → ListCheck.
- PRReviewRow always renders (drop the early-return). Fresh PRs with
  no approvals + no protection rule now show "Awaiting review" instead
  of vanishing.
- Indent workflow rows under the In Progress / Failed group headers
  (pl-5) so the hierarchy reads more clearly.
- In-progress workflow badge: "0/1 ran" → "1 running". The old phrasing
  hid whether the job had even started.

* feat(web): stacked pass-rate progress bar in CI popover

Mirrors TodoIndicator's progress bar at the top of the CI section, but
split into three coloured segments:
  green (passed) | yellow (in_progress) | red (failed)
sized proportionally to each bucket's count. The label reads
"Pass rate · K/N (P%)" so the user gets the same at-a-glance summary
TODOs shows. Skipped/cancelled-but-not-failed jobs aren't counted —
the bar always reflects the actionable picture.

* fix(web): right-align review counts + drop chip hover bg

- Move approval/required counts to the right edge of the review row
  ("Approved" on the left, "1 / 2" on the right), mirroring the
  bucket-row layout. The "(K requested)" suffix becomes a "· K requested"
  trailing fragment on the right side.
- PRStatusChip: drop hover:bg-accent/50 so the trigger doesn't grow a
  background plate when the popover is open.

* fix(web): switch CI chip icon to IconChecklist

* fix(github): clear bot review-comment backlog

Real correctness fixes:
- pr-status-chip: pending checks / pending review now beat
  checks_state === "success" in chipStatus precedence — a PR with
  CI green but reviewers outstanding is no longer rendered as
  "passed".
- branch_protection: drop the unreachable Reset() method.
- pr-topbar-button: stop double-mounting usePRFeedbackBackgroundSync;
  the chip already covers it.
- use-pr-ci-popover: dedupe key combines prFeedbackKey + updated_at
  so switching tasks with same-timestamp PRs still refetches.
- use-pr-ci-popover: drop stale comment about the removed progress bar.

Refactor:
- client_helpers + graphql: extract reviewSample +
  latestReviewStateByAuthor helper so the three near-identical
  per-reviewer dedup loops share one implementation.

Tests:
- countApprovedReviewers + reduceReviewSummary unit tests.
- TestSyncTaskPR_ReviewCounts_PreservesOnLightweightSync +
  AcceptsRealZero mirror the existing ChecksPopulated guards.
- groupChecksByWorkflow distinct-URL test verifies the failed-job
  URL-selection fix.
- branch_protection TTL tests now use testing/synctest — instant
  virtual time, no real-sleep flake on CI.

* fix(web): clicking the CI chip no longer closes the popover

HoverCard treats the trigger button as outside the content's bounding
box, so a click on the chip fired Radix's onPointerDownOutside and
auto-closed the popover. Add a triggerRef + onPointerDownOutside guard
on HoverCardContent that filters out clicks landing on the trigger —
clicking the chip is now a no-op while the popover stays open via hover.
2026-05-11 16:55:58 +01:00

374 lines
10 KiB
Go

package github
import (
"errors"
"testing"
"time"
)
func TestIsNotFoundErr(t *testing.T) {
cases := []struct {
name string
err error
want bool
}{
{"nil", nil, false},
{"HTTP 404", errors.New("gh api: HTTP 404"), true},
{"HTTP 404 with suffix", errors.New("gh: HTTP 404: Not Found (404)"), true},
{"404 Not Found", errors.New("404 Not Found"), true},
{"status: 404", errors.New("request failed (status: 404)"), true},
{"unrelated 500", errors.New("HTTP 500: server error"), false},
{"unrelated text", errors.New("connection refused"), false},
{"403 not 404", errors.New("HTTP 403: Forbidden"), false},
}
for _, tc := range cases {
t.Run(tc.name, func(t *testing.T) {
if got := isNotFoundErr(tc.err); got != tc.want {
t.Fatalf("isNotFoundErr(%v) = %v, want %v", tc.err, got, tc.want)
}
})
}
}
func TestIsForbiddenErr(t *testing.T) {
cases := []struct {
name string
err error
want bool
}{
{"nil", nil, false},
{"HTTP 403", errors.New("gh api: HTTP 403"), true},
{"403 Forbidden", errors.New("403 Forbidden"), true},
{"status: 403", errors.New("request failed (status: 403)"), true},
{"404 not 403", errors.New("HTTP 404"), false},
{"500 not 403", errors.New("HTTP 500"), false},
}
for _, tc := range cases {
t.Run(tc.name, func(t *testing.T) {
if got := isForbiddenErr(tc.err); got != tc.want {
t.Fatalf("isForbiddenErr(%v) = %v, want %v", tc.err, got, tc.want)
}
})
}
}
func TestParseTimePtr(t *testing.T) {
tests := []struct {
name string
input string
wantNil bool
}{
{"empty string", "", true},
{"valid RFC3339", "2025-01-15T10:30:00Z", false},
{"invalid format", "not-a-date", true},
{"date only", "2025-01-15", true},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got := parseTimePtr(tt.input)
if tt.wantNil {
if got != nil {
t.Errorf("expected nil, got %v", *got)
}
return
}
if got == nil {
t.Fatal("expected non-nil, got nil")
}
})
}
}
func TestParseTimePtrValue(t *testing.T) {
got := parseTimePtr("2025-06-15T14:30:00Z")
if got == nil {
t.Fatal("expected non-nil")
}
expected := time.Date(2025, 6, 15, 14, 30, 0, 0, time.UTC)
if !got.Equal(expected) {
t.Errorf("got %v, want %v", *got, expected)
}
}
func TestParseRepoURL(t *testing.T) {
tests := []struct {
name string
url string
wantOwner string
wantRepo string
}{
{
"standard API URL",
"https://api.github.com/repos/myorg/myrepo",
"myorg", "myrepo",
},
{
"short path",
"owner/repo",
"owner", "repo",
},
{
"single segment returns empty",
"onlyone",
"", "",
},
{
"empty",
"",
"", "",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
owner, repo := parseRepoURL(tt.url)
if owner != tt.wantOwner {
t.Errorf("owner = %q, want %q", owner, tt.wantOwner)
}
if repo != tt.wantRepo {
t.Errorf("repo = %q, want %q", repo, tt.wantRepo)
}
})
}
}
func TestConvertGHPR(t *testing.T) {
raw := &ghPR{
Number: 42,
Title: "Test PR",
URL: "https://github.com/owner/repo/pull/42",
State: "OPEN",
HeadRefName: "feature-branch",
HeadRefOid: "abc123def456",
BaseRefName: "main",
IsDraft: true,
Mergeable: "MERGEABLE",
Additions: 100,
Deletions: 50,
CreatedAt: time.Date(2025, 1, 1, 0, 0, 0, 0, time.UTC),
UpdatedAt: time.Date(2025, 1, 2, 0, 0, 0, 0, time.UTC),
ReviewRequests: []ghRequestedReviewer{
{TypeName: "User", Login: "alice-reviewer"},
{TypeName: "Team", Slug: "core-platform"},
},
Author: struct {
Login string `json:"login"`
}{Login: "alice"},
}
pr := convertGHPR(raw, "owner", "repo")
if pr.Number != 42 {
t.Errorf("number = %d, want 42", pr.Number)
}
if pr.State != "open" {
t.Errorf("state = %q, want open", pr.State)
}
if pr.HeadBranch != "feature-branch" {
t.Errorf("head_branch = %q, want feature-branch", pr.HeadBranch)
}
if pr.HeadSHA != "abc123def456" {
t.Errorf("head_sha = %q, want abc123def456", pr.HeadSHA)
}
if !pr.Draft {
t.Error("expected draft = true")
}
if !pr.Mergeable {
t.Error("expected mergeable = true")
}
if pr.Additions != 100 {
t.Errorf("additions = %d, want 100", pr.Additions)
}
if len(pr.RequestedReviewers) != 2 {
t.Fatalf("requested reviewers = %d, want 2", len(pr.RequestedReviewers))
}
if pr.RequestedReviewers[0].Type != reviewerTypeUser {
t.Errorf("first reviewer type = %q, want %q", pr.RequestedReviewers[0].Type, reviewerTypeUser)
}
if pr.RequestedReviewers[1].Type != reviewerTypeTeam {
t.Errorf("second reviewer type = %q, want %q", pr.RequestedReviewers[1].Type, reviewerTypeTeam)
}
if pr.MergedAt != nil {
t.Error("expected nil MergedAt")
}
}
func TestConvertGHPR_Merged(t *testing.T) {
raw := &ghPR{
Number: 1,
State: "CLOSED",
MergedAt: "2025-01-10T12:00:00Z",
Author: struct {
Login string `json:"login"`
}{Login: "bob"},
}
pr := convertGHPR(raw, "owner", "repo")
if pr.State != prStateMerged {
t.Errorf("state = %q, want merged", pr.State)
}
if pr.MergedAt == nil {
t.Error("expected non-nil MergedAt")
}
}
func TestConvertGHPR_NotMergeable(t *testing.T) {
raw := &ghPR{
Number: 1,
State: "OPEN",
Mergeable: "CONFLICTING",
Author: struct {
Login string `json:"login"`
}{Login: "alice"},
}
pr := convertGHPR(raw, "owner", "repo")
if pr.Mergeable {
t.Error("expected mergeable = false for CONFLICTING")
}
}
func TestConvertGHPR_MergeStateStatus(t *testing.T) {
tests := []struct {
name string
rawEnum string
want string
}{
{"clean", "CLEAN", "clean"},
{"blocked", "BLOCKED", "blocked"},
{"dirty", "DIRTY", "dirty"},
{"behind", "BEHIND", "behind"},
{"unknown", "UNKNOWN", "unknown"},
{"empty", "", ""},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
raw := &ghPR{
Number: 1,
State: "OPEN",
MergeStateStatus: tt.rawEnum,
Author: struct {
Login string `json:"login"`
}{Login: "alice"},
}
pr := convertGHPR(raw, "owner", "repo")
if pr.MergeableState != tt.want {
t.Errorf("MergeableState = %q, want %q", pr.MergeableState, tt.want)
}
})
}
}
func TestConvertGHRequestedReviewers(t *testing.T) {
raw := []ghRequestedReviewer{
{TypeName: "User", Login: "alice"},
{TypeName: "Team", Slug: "my-team"},
{TypeName: "Team", Name: "fallback-team-name"},
{TypeName: "User"},
}
got := convertGHRequestedReviewers(raw)
if len(got) != 3 {
t.Fatalf("requested reviewers = %d, want 3", len(got))
}
if got[0] != (RequestedReviewer{Login: "alice", Type: reviewerTypeUser}) {
t.Errorf("unexpected first reviewer: %#v", got[0])
}
if got[1] != (RequestedReviewer{Login: "my-team", Type: reviewerTypeTeam}) {
t.Errorf("unexpected second reviewer: %#v", got[1])
}
if got[2] != (RequestedReviewer{Login: "fallback-team-name", Type: reviewerTypeTeam}) {
t.Errorf("unexpected third reviewer: %#v", got[2])
}
}
func TestGHStderrIndicatesRateLimit(t *testing.T) {
cases := []struct {
stderr string
want bool
}{
{"GraphQL: API rate limit already exceeded for user ID 12345.", true},
{"You have exceeded a secondary rate limit.", true},
{"abuse detection mechanism triggered", true},
{"network: connection refused", false},
{"", false},
}
for _, c := range cases {
if got := ghStderrIndicatesRateLimit(c.stderr); got != c.want {
t.Errorf("ghStderrIndicatesRateLimit(%q) = %v, want %v", c.stderr, got, c.want)
}
}
}
func TestGHClient_InspectRateStderr_MarksGraphQL(t *testing.T) {
tracker := NewRateTracker(nil, nil)
c := NewGHClient().WithRateTracker(tracker)
c.inspectRateStderr([]string{"pr", "view", "1"}, "GraphQL: API rate limit already exceeded")
if !tracker.IsExhausted(ResourceGraphQL) {
t.Errorf("expected graphql exhausted")
}
}
func TestGHClient_InspectRateStderr_MarksSearchForSearchEndpoints(t *testing.T) {
tracker := NewRateTracker(nil, nil)
c := NewGHClient().WithRateTracker(tracker)
c.inspectRateStderr([]string{"api", "search/issues"}, "API rate limit exceeded")
if !tracker.IsExhausted(ResourceSearch) {
t.Errorf("expected search exhausted")
}
}
func TestResourceForGHArgs(t *testing.T) {
cases := []struct {
name string
args []string
want Resource
}{
// REST endpoints under `gh api <path>` go to Core, not GraphQL.
// This is the regression: previously every gh api failure was
// attributed to GraphQL unless the path started with search/.
{"api repos REST", []string{"api", "repos/o/r/pulls/1"}, ResourceCore},
{"api user REST", []string{"api", "user"}, ResourceCore},
{"api rate_limit REST", []string{"api", "rate_limit"}, ResourceCore},
// Documented exceptions still resolve to their dedicated buckets.
{"api graphql", []string{"api", "graphql"}, ResourceGraphQL},
{"api search/issues", []string{"api", "search/issues"}, ResourceSearch},
{"api search/repositories", []string{"api", "search/repositories"}, ResourceSearch},
// Non-`api` subcommands are GraphQL — gh implements pr/issue/repo
// against the GraphQL API.
{"pr view", []string{"pr", "view", "1"}, ResourceGraphQL},
{"issue list", []string{"issue", "list"}, ResourceGraphQL},
{"repo view", []string{"repo", "view"}, ResourceGraphQL},
// Defensive defaults for malformed argv.
{"empty", nil, ResourceCore},
{"api only", []string{"api"}, ResourceCore},
}
for _, tc := range cases {
t.Run(tc.name, func(t *testing.T) {
if got := resourceForGHArgs(tc.args); got != tc.want {
t.Errorf("resourceForGHArgs(%v) = %s, want %s", tc.args, got, tc.want)
}
})
}
}
// Regression: a 429 on `gh api repos/...` (REST) must mark Core, not GraphQL.
// Previously this would pause the GraphQL PR monitor incorrectly.
func TestGHClient_InspectRateStderr_RestEndpointMarksCore(t *testing.T) {
tracker := NewRateTracker(nil, nil)
c := NewGHClient().WithRateTracker(tracker)
c.inspectRateStderr([]string{"api", "repos/o/r/pulls/1"}, "API rate limit exceeded")
if !tracker.IsExhausted(ResourceCore) {
t.Errorf("expected core bucket exhausted for REST endpoint")
}
if tracker.IsExhausted(ResourceGraphQL) {
t.Errorf("REST 429 must not pause graphql bucket")
}
}