Repository navigation
test(studio): the run slot and run state tested directly, and the results of a run in another workspace are not offered for export - #765
Merged
Conversation
…ults of a run in another workspace are not offered for export Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NxVy8Kr2nZk8HoMNcxZPFF
…ace is taken with its slot, and one folder in two spellings is one workspace Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NxVy8Kr2nZk8HoMNcxZPFF
# Conflicts: # CHANGELOG.md
4 tasks
jay23606
added a commit
to jay23606/flutter-probe
that referenced
this pull request
Nov 17, 2026
…ults of a run in another workspace are not offered for export (AlphaWaveSystems#765) ## Summary The run state machine is now tested directly (`studio/run_slot_test.go`), with `-race`: the run slot (`claimRun`, `releaseRun`, `CancelRun`, `runActive`) and the state a run leaves in `RunState`. - The slot moves free, claimed, cancelled, released: a second claim is refused and does not disturb the first; `CancelRun` stops the run's context but keeps the slot until the run ends, twice or with no run is harmless; a release frees it and stops the context; a new run is not born cancelled. - 64 concurrent starts: exactly one wins. - A run that cannot start (a scope that matches nothing, a path outside the folders) gives its slot back, and no connection is refused before the slot is taken. - Finish after cancel (real run on a blocked fake device): finished, no step in flight, the reason `run cancelled`, slot free; a late cancel changes nothing; the next run starts clean (no old error, results or finished flag). - Cancel while starting: the run ends as cancelled and leaves nothing to export. - Workspace changes mid-run (below). ## Found and fixed The results kept for Export were attributed to the workspace open **when the run finished**. Open another folder while a run goes and the finished run's results were offered for export there, with JUnit names relative to the wrong folder. `executeRun` now notes the workspace it started in and `keepForExport` keeps nothing when it is not the open one at the end. Re-opening the same workspace during a run keeps the results (a test). ## Mutants Eleven, all killed: claim does not refuse a second run, release keeps the slot, release does not stop the context (needed a test line; added), a run starts without a connection, a run that cannot start keeps the slot, finish leaves the current step, finish does not mark finished, finish drops the error, begin keeps the old state, a run of another workspace is kept, CancelRun does nothing. "Lane results" has no Studio counterpart (Studio runs one device); the multi-device lanes are the CLI's and are tested there. ## Test plan - [x] `go test -race` on the new tests (count=3) and the export tests; mutants as above - [x] disclosure scan ## Review fixes - The workspace check and the keep are one step under `a.mu`, which `SetWorkspace` and `useWorkspace` also hold while they change the workspace and clear the export; a test forces the interleaving through a seam and a change that arrives between the two leaves nothing kept. - The run's workspace is taken with its slot (`claimRun`), not in `executeRun` after the path check; a test switches with `useWorkspace` after the claim. - Both the open and the starting workspace are compared in one spelling (cleaned, links resolved): a trailing slash, a dot segment or a link to the same folder is the same workspace (tests). - The report base held after a kept run is asserted. Mutants killed: compare and keep under separate locks, the raw spelling compared, SetWorkspace/useWorkspace not clearing the export, the run's workspace not recorded at claim, a wrong report base.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The run state machine is now tested directly (
studio/run_slot_test.go), with-race: the run slot (claimRun,releaseRun,CancelRun,runActive) and the state a run leaves inRunState.CancelRunstops the run's context but keeps the slot until the run ends, twice or with no run is harmless; a release frees it and stops the context; a new run is not born cancelled.run cancelled, slot free; a late cancel changes nothing; the next run starts clean (no old error, results or finished flag).Found and fixed
The results kept for Export were attributed to the workspace open when the run finished. Open another folder while a run goes and the finished run's results were offered for export there, with JUnit names relative to the wrong folder.
executeRunnow notes the workspace it started in andkeepForExportkeeps nothing when it is not the open one at the end. Re-opening the same workspace during a run keeps the results (a test).Mutants
Eleven, all killed: claim does not refuse a second run, release keeps the slot, release does not stop the context (needed a test line; added), a run starts without a connection, a run that cannot start keeps the slot, finish leaves the current step, finish does not mark finished, finish drops the error, begin keeps the old state, a run of another workspace is kept, CancelRun does nothing.
"Lane results" has no Studio counterpart (Studio runs one device); the multi-device lanes are the CLI's and are tested there.
Test plan
go test -raceon the new tests (count=3) and the export tests; mutants as above🤖 Generated with Claude Code
https://claude.ai/code/session_01NxVy8Kr2nZk8HoMNcxZPFF
Review fixes
a.mu, whichSetWorkspaceanduseWorkspacealso hold while they change the workspace and clear the export; a test forces the interleaving through a seam and a change that arrives between the two leaves nothing kept.claimRun), not inexecuteRunafter the path check; a test switches withuseWorkspaceafter the claim.