Console: open a separate tab per operation - #110
Merged
Conversation
Console tabs were keyed by BrewOperationID, which the command center deliberately reuses across successive operations on the same package (install, upgrade, uninstall of `gh` all share one id). Introduce a per-run CommandJobID as the tab identity, with the BrewOperationID kept on CommandJob as its routing key, and route live phase/output updates through a liveJobByOperationID map in the repository. Pure refactor: behaviour is unchanged — a re-run for an id that already has a job still reuses that tab. The next commit fixes that. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a console-tab identity bug by splitting “operation routing identity” (BrewOperationID) from “per-run tab identity” (CommandJobID), so re-running an operation on the same package creates a new tab rather than reusing the old one.
Changes:
- Introduces
CommandJobID(UUID-backed) and updatesCommandJobto carry bothid(tab identity) andoperationID(routing key). - Retypes the console jobs repository, observing protocol, console view model selection/dismiss APIs, and the unimplemented environment stub to use
CommandJobID. - Adds/updates tests, including a regression test asserting “install then uninstall same package” yields two distinct tabs with separate command/output buffers.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| Tests/BrewFeatureConsoleTests/ConsoleViewModelTests.swift | Updates selection/active job assertions to use operationID vs per-tab id and adapts to CommandJobID selection. |
| Tests/BrewFeatureConsoleTests/ConsoleJobsHarness.swift | Adds helpers to bridge operation IDs to the most recent routed CommandJob and to expose ordered operation IDs for assertions. |
| Tests/BrewFeatureConsoleTests/CommandJobTests.swift | Updates CommandJob construction to use operationID: initializer label. |
| Tests/BrewFeatureConsoleTests/CommandJobExportTests.swift | Updates CommandJob construction to use operationID: initializer label. |
| Tests/BrewFeatureConsoleTests/BrewCommandJobsRepositoryTests.swift | Updates repository assertions for CommandJobID and adds regression test for separate tabs on rerun. |
| Sources/BrewRepositoryInterfaces/Protocols/CommandJobsObserving.swift | Retypes observing interface to jobs/orderedIDs/remove keyed by CommandJobID. |
| Sources/BrewRepositoryInterfaces/CommandJob.swift | Adds CommandJobID and splits CommandJob identity (id) from routing key (operationID). |
| Sources/BrewRepositories/BrewCommandJobsRepository.swift | Implements liveJobByOperationID routing map to associate operation updates with a specific tab identity. |
| Sources/BrewFeatureConsole/ViewModels/ConsoleViewModel.swift | Retypes selection and dismissal to CommandJobID, keeping selectedJob derived from repository state. |
| Sources/BrewAppEnvironment/UnimplementedRepositories.swift | Updates unimplemented observing stub to the new CommandJobID-keyed API. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
MikeMcQuaid
approved these changes
Aug 3, 2026
When a job reaches terminal, clear its liveJobByOperationID entry so the next `.running` for that BrewOperationID materializes a fresh tab instead of reviving the finished one. Fixes install-then-uninstall of the same package showing on a single tab titled after the first operation. Adds a regression test asserting two distinct tabs with their own command strings and output buffers. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
graeme
force-pushed
the
fix-console-tab-bug
branch
from
August 4, 2026 09:44
591dc59 to
a5bedbd
Compare
graeme
marked this pull request as ready for review
August 4, 2026 09:48
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.
PR: Console: open a separate tab when an operation id is re-run
Summary
Fixes a console tab uniqueness bug: installing a package and then uninstalling it reused a single tab, still titled after the first operation, with the second operation's output appended to the first. Install and uninstall (or any two operations on the same package) now open two separate tabs.
Changes
CommandJobID, a UUID-backed per-run identity, as the console tab identity. This is distinct fromBrewOperationID, which the command center deliberately reuses across successive operations on the same package.CommandJobnow carries both itsid(the tab) and itsoperationID(the routing key). RetypedCommandJobsObserving,BrewCommandJobsRepository(jobs,orderedIDs,remove), the console view model (selectedID,select,dismiss), and the unimplemented environment stub to the new id.liveJobByOperationIDmap. When a job reaches a terminal phase its entry is cleared, so the next.runningfor that operation id materializes a fresh tab rather than reviving the finished one.Why this split
Two atomic commits. The first is a pure refactor that introduces the identity separation with behaviour preserved. The second makes the single behaviour change (clear the routing entry on terminal) plus its regression test, so the fix is easy to review and revert in isolation.
Testing
scripts/testfull suite green (622 tests across 74 suites).PR checklist