Skip to content

Commit 736851b

Browse files
BruceDu521claude
andcommitted
fix: workspace current / list must honor --workspace override (PLA-1590)
Both commands read the persisted workspace directly via `f.Config.GetContext().GetWorkspace()`, so a `--workspace foo` override was silently ignored — `workspace current` reported the persisted workspace and `workspace list` put `*` on the persisted row, not on the override. Caught running the Bucket 6 dev-2 E2E: $ /tmp/zeabur-dev2 workspace switch team-A $ /tmp/zeabur-dev2 --workspace team-B workspace current team-A [...] team ... # wrong — override was team-B This is the same class of bug as the deploy.go F1 finding from the panel review: display source must match the resolved source the rest of the command sees. Switch both commands to `f.CurrentWorkspace()` / `f.CurrentOwnerID()` so they reflect the effective workspace for the invocation. Existing `TestFactory_CurrentOwnerID_OverrideBeatsPersisted` covers the underlying helper; this fix is the consumer side. Verified on dev-2 against api-2.zeabur.dev: $ /tmp/zeabur-dev2 --workspace pla1230 workspace current pla1230-probe-... [69e72943...] team Administrator # ✓ $ /tmp/zeabur-dev2 --workspace pla1230 workspace list * 69e72943... pla1230-probe-... team Administrator # ✓ marker on override Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent b97244f commit 736851b

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

internal/cmd/workspace/current/current.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@ func NewCmdCurrent(f *cmdutil.Factory) *cobra.Command {
2323
}
2424

2525
func run(f *cmdutil.Factory) error {
26-
ws := f.Config.GetContext().GetWorkspace()
26+
// Use the effective workspace (CurrentWorkspace) so the report honours
27+
// a `--workspace` flag override for the current invocation, matching
28+
// what every other command in the process sees. Reading the persisted
29+
// workspace directly would silently lie about the override.
30+
ws := f.CurrentWorkspace()
2731
if ws.IsPersonal() {
2832
label := f.Config.GetUser()
2933
if label == "" {

internal/cmd/workspace/list/list.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,11 @@ func run(f *cmdutil.Factory) error {
3131
return fmt.Errorf("list teams: %w", err)
3232
}
3333

34-
currentID := f.Config.GetContext().GetWorkspace().ID
34+
// Use the effective workspace so the `*` marker tracks a `--workspace`
35+
// flag override, not just the persisted state. Otherwise
36+
// `--workspace foo workspace list` would print `*` on the persisted
37+
// team rather than `foo`.
38+
currentID := f.CurrentOwnerID()
3539

3640
w := tabwriter.NewWriter(os.Stdout, 0, 0, 3, ' ', 0)
3741

0 commit comments

Comments
 (0)