Skip to content

fix(ui): synchronize watch-run UI state on file removal - #10941

Merged
sheremet-va merged 40 commits into
vitest-dev:mainfrom
hi-ogawa:ui-explorer-reconcile
Aug 17, 2026
Merged

sheremet-va merged 40 commits into
vitest-dev:mainfrom
hi-ogawa:ui-explorer-reconcile

Conversation

@hi-ogawa

@hi-ogawa hi-ogawa commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

Description

Previously UI state management had no stale task management and the stale data in StateManager and ExplorerTree both affected stale UI display.

This PR wires around stale entities cleanup through onCollected and onTestRemoved events to fix the issue. Also scattered some explanatory comments in existing code where I had a trouble with following the flow.

Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • It's really useful if your PR references an issue where it is discussed ahead of time. If the feature is substantial or introduces breaking changes without a discussion, PR might be closed.
  • Ideally, include a test that fails without this PR but passes with it.
  • Please, don't make changes to pnpm-lock.yaml unless you introduce a new test example.
  • Please check Allow edits by maintainers to make review process faster. Note that this option is not available for repositories that are owned by Github organizations.

Tests

  • Run the tests with pnpm test:ci.

Documentation

  • If you introduce new functionality, document it. You can run documentation with pnpm run docs command.

Changesets

  • Changes in changelog are generated from PR name. Please, make sure that it explains your changes in an understandable manner. Please, prefix changeset messages with feat:, fix:, perf:, docs:, or chore:.

hi-ogawa and others added 3 commits July 10, 2026 16:20
The UI explorer mirror was append-only, so watch re-runs left ghost
test nodes when tests were removed or their type changed, and deleting
or renaming a file left a ghost file node because onTestRemoved was
never forwarded to the client.

- reconcile each collected file's mirror subtree (drop-and-recreate on
  type change, prune removed children) via onCollected
- prune stale position-based idMap entries on re-collection
- forward onTestRemoved over the websocket and remove the file node

Co-authored-by: OpenCode (claude-opus-4-8) <noreply@opencode.ai>
The onTestRemoved payload is the server's slashed filepath, which is
byte-identical to the file node's filepath and the state.filesMap key,
so normalizing before comparison was redundant and inconsistent with
state.removeFile's direct lookup.

Co-authored-by: OpenCode (claude-opus-4-8) <noreply@opencode.ai>
File deletion fires onTestRemoved without scheduling a rerun, so unlike
test removal there is no endRun/collect to refresh explorerTree.summary.
removeFileByPath updated the tree and rows but left the counts stale, so
tests-entry kept showing the deleted file's tests. Recompute the summary
after removal so the dashboard totals reflect the deletion.

Co-authored-by: OpenCode (claude-opus-4-8) <noreply@opencode.ai>
@netlify

netlify Bot commented Aug 13, 2026

Copy link
Copy Markdown

Deploy Preview for vitest-dev ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit e38ae38
🔍 Latest deploy log https://app.netlify.com/projects/vitest-dev/deploys/6a82911031dd6500088aa09d
😎 Deploy Preview https://deploy-preview-10941--vitest-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

hi-ogawa and others added 5 commits August 13, 2026 15:20
@hi-ogawa hi-ogawa changed the title fix(ui): update watch-run UI state on file removal fix(ui): synchronize watch-run UI state on file removal Aug 13, 2026
hi-ogawa and others added 2 commits August 13, 2026 17:56
Co-authored-by: OpenCode <noreply@opencode.ai>
Co-authored-by: OpenCode <noreply@opencode.ai>
hi-ogawa and others added 17 commits August 17, 2026 13:41
Co-authored-by: OpenCode <noreply@opencode.ai>
Co-authored-by: OpenCode <noreply@opencode.ai>
Co-authored-by: OpenCode <noreply@opencode.ai>
Co-authored-by: OpenCode <noreply@opencode.ai>
Co-authored-by: OpenCode <noreply@opencode.ai>
Co-authored-by: OpenCode <noreply@opencode.ai>
Co-authored-by: OpenCode <noreply@opencode.ai>
Co-authored-by: OpenCode <noreply@opencode.ai>
Co-authored-by: OpenCode <noreply@opencode.ai>
Co-authored-by: OpenCode <noreply@opencode.ai>
Co-authored-by: OpenCode <noreply@opencode.ai>
Co-authored-by: OpenCode <noreply@opencode.ai>
Co-authored-by: OpenCode <noreply@opencode.ai>
Co-authored-by: OpenCode <noreply@opencode.ai>
hi-ogawa and others added 12 commits August 17, 2026 15:22
Co-authored-by: OpenCode <noreply@opencode.ai>
Co-authored-by: OpenCode <noreply@opencode.ai>
Co-authored-by: OpenCode <noreply@opencode.ai>
Co-authored-by: OpenCode <noreply@opencode.ai>
Co-authored-by: OpenCode <noreply@opencode.ai>
Co-authored-by: OpenCode <noreply@opencode.ai>
Co-authored-by: OpenCode <noreply@opencode.ai>
Co-authored-by: OpenCode <noreply@opencode.ai>
}

/** Stage selected files as local placeholders for logs emitted during collection. */
clearFiles([project, path]: SerializedTestSpecification): void {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

this is drive-by refactoring.

@hi-ogawa
hi-ogawa marked this pull request as ready for review August 17, 2026 07:42
@sheremet-va
sheremet-va merged commit 30c21e6 into vitest-dev:main Aug 17, 2026
25 of 28 checks passed
@hi-ogawa
hi-ogawa deleted the ui-explorer-reconcile branch August 17, 2026 09:17
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 1, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Removing/commenting-out a test does not update the UI sidebar tree

2 participants

Sponsor
SponsoredKunjungi sekarang
Promo