Skip to content

test(mcp-management): click and tick the fake clock inside act - #27915

Merged
bolichen97 merged 1 commit into
mainfrom
test/act-warnings-mcp-management
Nov 2, 2026
Merged

bolichen97 merged 1 commit into
mainfrom
test/act-warnings-mcp-management

Conversation

@javenciu

@javenciu javenciu commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: website/src/test/McpManagement.test.tsx stops emitting React act() warnings, so its row leaves website/integration/act-warning-baseline.json and the guard in website/integration/setup.ts checks it like any file outside the list.

Before this change, a run of the file emitted 36 act() warnings (late state updates in McpManagement): a state update landed after the test's last barrier. Because the file is on the baseline, the guard kept those warnings out of the log.

Why it matters

website/docs/testing.md (Rules every test keeps) treats an act() warning as a finding: the update lands after the assertions, so whether the test sees it depends on timing. The baseline is shrink-only, and each file that leaves it is held to the rule from then on.

Not a goal

  • Other files on the baseline (each is its own change).
  • Any change to the components under test.
  • Filtering or silencing the warning; the test waits for the update instead.

What changed (motivation → approach → change)

The tests now wait for the state the late update produces before they finish, so the update lands inside the test's barrier.

  • website/src/test/McpManagement.test.tsx: import { act, render, screen, cleanup, waitFor, fireEvent, within } from '@testing-library/react'
  • website/src/test/McpManagement.test.tsx: /** vi.waitFor ticks the fake clock outside act; this polls the same way, each tick inside act. */
  • website/src/test/McpManagement.test.tsx: await act(async () => { await vi.advanceTimersByTimeAsync(50) })
  • website/src/test/McpManagement.test.tsx: await tickUntil(() => screen.getByText('fresh-mcp'), { timeout: 5000 })
  • website/src/test/McpManagement.test.tsx: await act(async () => { await vi.advanceTimersByTimeAsync(2 * 1000) })
  • website/src/test/McpManagement.test.tsx: await tickUntil(() => screen.getByRole('button', { name: M('share_all_confirm', { count: 2 }) }), { timeout: 5000 })
  • website/src/test/McpManagement.test.tsx: await tickUntil(
  • website/src/test/McpManagement.test.tsx: await tickUntil(() => screen.getByText('fresh-mcp'), { timeout: 5000 })
  • website/integration/act-warning-baseline.json: removed src/test/McpManagement.test.tsx.

Backwards compatibility

Compatible: test-only change.
Removes nothing: a baseline row is a tolerance the guard stops needing, not a capability.

Tests

  • Before (the row removed, the file unchanged): KIROCREW_ACT_STRICT=1 npx vitest run src/test/McpManagement.test.tsx from website/: 7 of 51 tests fail on act() warnings.
  • After: the same command passes 5 runs out of 5 with 0 act() warnings; 51 tests, the same count as before.
  • integration/setup.refactor.determinism.test.ts passes (the baseline stays sorted, unique and existing); npx eslint is clean on the file.

Manual verification

N/A: test-only change; the strict runs above are the check.

Screenshots / video

Why no screenshot: nothing renders; this change touches one test file and a test baseline only.

No issue exists; burn-down of the act() warning baseline that #17673 introduced.

Make website/src/test/McpManagement.test.tsx stop emitting React act() warnings, and drop its row from
website/integration/act-warning-baseline.json so the guard in website/integration/setup.ts checks it.
@javenciu
javenciu requested review from a team and KiroCrewCaptain as code owners November 2, 2026 07:15
@javenciu
javenciu requested a review from bolichen97 November 2, 2026 07:15
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 2, 2026
@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ⏭️ skipped

Revision e9bd2ce683f40c0dc0b4c448aed38469966d8ba2 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 Nov 2, 2026

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ PASS

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

UX-Verdict: PASS

Nothing to check: the change only touches one test file and the act-warning baseline, so no user-visible control changed and no screenshot was needed.

[UX-REVIEWED] e9bd2ce

Description read

[DESCRIPTION-READ] 6faa497cdedb5f52d99417405d63f73145b2c70914d53fac5dee405d09311df1

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 Nov 2, 2026

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

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

Design-Verdict: PASS

Nothing blocks: the change only touches tests, and it removes the warnings at their source by ticking the fake clock inside act instead of hiding them.

Notes

  • tickUntil is a local copy of a pattern other baseline burn-downs will need too. If a second file adds the same helper, move it into one shared test util (next to focusBarrier.ts) rather than copying it again.

[DESIGN-REVIEWED] e9bd2ce

Description read

[DESCRIPTION-READ] 6ee7fd0a3c6d8f2f906411ce0a9364227a87636eeee3682abcf84a5dafcd1ed1

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 Nov 2, 2026

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] e9bd2ce

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

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

@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

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

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] e9bd2ce

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

@bolichen97 bolichen97 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approving at e9bd2ce.

This is test-only. McpManagement.test.tsx moves its clicks and fake-clock ticks inside act:

  • btn.click() and sharing.click() become fireEvent.click.
  • Each bare vi.advanceTimersByTimeAsync is wrapped in act.
  • vi.waitFor under fake timers becomes a new tickUntil helper. It retries the same check, advances the fake clock by 50 ms inside act between tries, and runs the check one last time after its timeout so a failure still reports the real assertion.

Every assertion is unchanged; only how the test waits changes. With the act warnings gone, the file is removed from act-warning-baseline.json, so a new warning there now fails the run.

Gates at this head: 0 failing checks; Design, UX, Opus and GPT pass (First Principles skipped); no review requests changes; mergeable. Only test shards and PR Readiness were still running, and auto-merge waits for them.

@bolichen97
bolichen97 enabled auto-merge (squash) November 2, 2026 08:13
@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 Nov 2, 2026
@bolichen97
bolichen97 merged commit 41cb956 into main Nov 2, 2026
95 checks passed
@bolichen97
bolichen97 deleted the test/act-warnings-mcp-management branch November 2, 2026 08:15
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 2, 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