Skip to content

Simplify PR context model: remove Disconnect action and drop disconnected state #99

@knightedcodemonkey

Description

@knightedcodemonkey

Problem

Our current PR context model includes disconnected plus a dedicated Disconnect button. This creates extra transition paths and persistence branches that increase complexity and contribute to state/race bugs during workspace switching.

At the same time, we now have a stricter Workspaces UX:

  1. Select repository scope
  2. Select stored/starter context
  3. Click Open to apply state

Given this model, Disconnect is redundant with existing local actions.

Proposal

Remove the Disconnect action and eliminate prContextState = disconnected.

Use only:

  • active
  • inactive
  • closed

Local lifecycle behavior should be:

  • Start a new context from Workspaces for repo/local initialization.
  • Remove workspace from Workspaces for local deletion.
  • Close PR for remote lifecycle change on GitHub.

Why

  • Reduces state-machine surface area.
  • Removes ambiguous local-only “disconnect” semantics.
  • Aligns UI with explicit Open-driven state application.
  • De-risks overwrite/merge issues caused by extra transition branches.

Scope

  • Remove Disconnect button and handler wiring in PR context UI/workflows.
  • Remove disconnectActivePrContext public action path.
  • Remove disconnected from supported PR state enum/normalization.
  • Remove restore/hydration conditions that special-case disconnected.
  • Keep Close PR on GitHub behavior unchanged.
  • Keep Workspaces “Start new context for ” behavior as explicit local initialization path.

Data migration

On load/normalize:

  • Map persisted prContextState: disconnected to inactive.
  • Preserve other metadata fields as-is (repo, head, prNumber, prTitle, tabs).

Optional follow-up:

  • One-time rewrite to persist migrated state back to IDB.

Acceptance criteria

  • No Disconnect control is rendered anywhere.
  • No runtime path writes prContextState = disconnected.
  • Existing disconnected records are treated as inactive on restore.
  • Switching/opening workspaces works with only active|inactive|closed.
  • First-time repo init still works via Workspaces starter option + Open.
  • Lint/typecheck pass.
  • Playwright suite updated and green after removing disconnected scenarios.

Test updates

  • Delete/replace tests for:
    • “Active PR context disconnect uses local-only confirmation flow”
    • “Reopening a disconnected workspace…”
    • all “targetState: disconnected” integrity scenarios
  • Add/adjust tests for:
    • starter-context Open flow (no stored contexts)
    • remove-workspace local lifecycle
    • close PR + reopen behavior without disconnected branch
    • cross-repo active/inactive/closed integrity

Docs updates

Update docs to remove disconnected references:

  • pr-context-storage-matrix.md
  • idb-workspace-state.md

Risks

  • Legacy persisted records containing disconnected state.
  • Assumptions in tests/helpers expecting disconnected->active restore behavior.

Rollout plan

  1. Implement disconnected->inactive normalization and keep backward compatibility.
  2. Remove Disconnect UI/action.
  3. Remove disconnected branches in runtime/persistence.
  4. Update tests/docs.
  5. Run full lint/build/Playwright validation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions