Skip to content

test: pin the credit pill's fast-poll refetchInterval wiring - #25992

Merged
KiroCrewCaptain merged 1 commit into
mainfrom
test/credit-pill-fast-poll
Oct 30, 2026
Merged

KiroCrewCaptain merged 1 commit into
mainfrom
test/credit-pill-fast-poll

Conversation

@RohanK6

@RohanK6 RohanK6 commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: A test fails if the Kiro credit pill stops polling fast while its reading is still warming.

#22387 made the credit pill re-poll quickly after a reopen: website/src/shell/topbar/kiroUsageReadout.tsx:41 passes kiroUsageRefetchInterval(...) as the ['kiro-usage'] query's refetchInterval. kiroUsageRefetchInterval.test.ts covers that helper as a pure function, but nothing covers that the pill calls it. Swapping the wiring back to refetchInterval: 30_000 keeps every test green (item 2 of #25933).

Why it matters

Without a test on the wiring, a refactor of the hook can drop the fast poll silently, and a reopened pill goes back to a spinner that waits a full 30 seconds for each warming read.

Not a goal

What changed (motivation → approach → change)

helper pinned, wiring not → mount the real hook and read the interval its query resolves.

  • New website/src/test/kiroUsageReadout.fastPoll.test.tsx mounts useKiroUsageReadout under a QueryClientProvider with api.sessionsUsage and api.kirocrewConfig mocked.
  • It reads the observer's refetchInterval for the ['kiro-usage'] query and resolves it against the live query: KIRO_USAGE_WARMING_POLL_MS for a warming (null) reading and for a failed read, KIRO_USAGE_STEADY_POLL_MS once a reading lands.
  • It reads the option instead of watching a timer tick, so it does not race react-query's own scheduling.

Backwards compatibility

Compatible: test-only change; no product code is touched.

Removes nothing: one new test file, nothing else changes.

Tests

kiroUsageReadout.fastPoll.test.tsx, 3 tests:

  • polls fast while the cache is still warming
  • polls fast while the read fails before kiro-cli is ready
  • drops to the steady cadence once a reading lands

Mutation: with lines 41-46 replaced by refetchInterval: 30_000,, the two warming tests fail (expected 30000 to be 2500) and the steady one still passes. Restored, 3 passed.

Repeats 10/10. Shuffled with App.shell.owners.test.ts (seeds 4242, 77, 9001): 7 passed each. eslint, tsc -p tsconfig.app.json and npm run build pass.

Proof: not provable -- frontend test (prove.py runs Python only)

Manual verification

N/A — unit coverage sufficient; the mutation above is the check that the test pins the wiring.

Related Issues

Refs #25933

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

Contribution License Agreement

Contributions are accepted under the project's Apache-2.0 license; see the Licensing section of CONTRIBUTING.md.

@RohanK6
RohanK6 requested review from a team and KiroCrewCaptain as code owners October 29, 2026 23:16
@RohanK6
RohanK6 requested a review from dodgeblaster October 29, 2026 23:16
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 29, 2026
@github-actions

github-actions Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ⏭️ skipped

Revision 0b7e98f426e6dc34b84866a5674df12610084779 ships no reviewable capability (docs, tests or generated files only), so there is nothing to inventory. Does not block merge.

@github-actions

github-actions Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ PASS

UX-level review of 0b7e98f426e6dc34b84866a5674df12610084779 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

UX-Verdict: PASS

Nothing to check. The PR only adds a test file and changes nothing a user can see, so the missing screenshots leave no evidence gap.

[UX-REVIEWED] 0b7e98f

Description read

[DESCRIPTION-READ] 7c3b9e5ae3a60fa8138c28fe7aaf4fb62a27615097032044d5ebd5a1c8f72edf

That sha256 names everything this verdict read: the PR description, plus the 3 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of 0b7e98f426e6dc34b84866a5674df12610084779 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

Test-only change. It adds a regression pin on the existing wiring, removes nothing and renders nothing new.

[DESIGN-REVIEWED] 0b7e98f

Description read

[DESCRIPTION-READ] fcd3a0ece14250af8a28f253901acb0624b1cd3284488cdf9cdedb554b3e7319

That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 0b7e98f426e6dc34b84866a5674df12610084779 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 0b7e98f

Verdict parsed from the review's SHA-scoped output markers for commit 0b7e98f426e6dc34b84866a5674df12610084779.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 0b7e98f426e6dc34b84866a5674df12610084779 false-positive: <reason, 20 to 500 characters>

@github-actions

github-actions Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 0b7e98f426e6dc34b84866a5674df12610084779 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 0b7e98f

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 0b7e98f426e6dc34b84866a5674df12610084779 false-positive: <reason, 20 to 500 characters>

kiroUsageRefetchInterval.test.ts covers the cadence helper as a pure
function, but nothing covered that the credit pill's useQuery calls it.
Swapping the wiring for refetchInterval: 30_000 kept every test green.

Mount useKiroUsageReadout and read the interval its kiro-usage query
resolves: the warming cadence for a null reading and for a failed read,
the steady cadence once a reading lands. With the wiring swapped for
30_000, the two warming cases fail.

Refs #25933
@RohanK6
RohanK6 force-pushed the test/credit-pill-fast-poll branch from 8b9d505 to 0b7e98f Compare October 29, 2026 23:47
@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Oct 30, 2026
@KiroCrewCaptain
KiroCrewCaptain enabled auto-merge (squash) October 30, 2026 01:08

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tier 1 auto-approve: test (1 files). Criteria: no conflict, no requested changes, security path denylist clean, design-doc gate clean, security checklist all-NO, no reviewer-lane findings, readiness signal fresh for this head SHA, declared category matches the diff. Category: test-only; pins the credit pill's fast-poll refetch interval wiring.

@KiroCrewCaptain
KiroCrewCaptain merged commit 1615105 into main Oct 30, 2026
94 checks passed
@KiroCrewCaptain
KiroCrewCaptain deleted the test/credit-pill-fast-poll branch October 30, 2026 01:08
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants