Skip to content

fix: prevent workspace overwrites.#100

Merged
knightedcodemonkey merged 6 commits intonextfrom
bananas
Apr 26, 2026
Merged

fix: prevent workspace overwrites.#100
knightedcodemonkey merged 6 commits intonextfrom
bananas

Conversation

@knightedcodemonkey
Copy link
Copy Markdown
Owner

Copilot AI review requested due to automatic review settings April 26, 2026 15:53
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR moves repository selection to the Workspaces drawer and refactors workspace identity/persistence so that switching repos/workspaces doesn’t overwrite other workspace records (fixing the integrity issues described in #97/#98).

Changes:

  • Add a repository selector + repo-scoped filtering to the Workspaces drawer; make the Open PR drawer repository control read-only.
  • Refactor workspace identity from deterministic id (repo/head-derived) to a stable random id plus a deterministic workspaceKey for dedupe/lookup.
  • Add guards around PR editor sync / context transitions to avoid applying late or cross-repo updates; expand Playwright coverage and shard CI.

Reviewed changes

Copilot reviewed 38 out of 39 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/modules/workspace/workspaces-drawer/drawer.js Adds repository filter UI/logic and “start new context” option.
src/modules/workspace/workspace-tab-helpers.js Introduces createWorkspaceRecordId() and toWorkspaceRecordKey(); removes repo/head-derived ids.
src/modules/workspace/workspace-storage.js Normalizes records to include workspaceKey.
src/modules/github/pr/editor-sync.js Adds shouldApplySyncResult hook to gate sync application.
src/modules/github/pr/drawer/controller/ui-state.js Forces PR drawer repository select to always be disabled; adds resetStatus().
src/modules/github/pr/drawer/controller/run-submit.js Plumbs repositoryFullName through PR opened / commit pushed callbacks.
src/modules/github/pr/drawer/controller/repository-form.js Makes repository select display-only with a Workspaces-managed placeholder.
src/modules/github/pr/drawer/controller/public-actions.js Consolidates “clear active context” logic with repo-aware helper.
src/modules/github/pr/drawer/controller/events.js Removes repository-select change handler (repo no longer selected here).
src/modules/github/pr/drawer/controller/create-controller.js Adjusts hydration/persisted context logic and exposes resetStatus.
src/modules/github/byot-controls.js Removes localStorage-backed repo selection; adds “Select repository from Workspaces” placeholder and clearing helper.
src/modules/app-core/workspace-sync-controller.js Includes workspaceKey in snapshots; stops rekeying identity via repo/head.
src/modules/app-core/workspace-save-controller.js Adds preserveRecordId controls and dedupes by workspaceKey.
src/modules/app-core/workspace-pr-session-handoff-controller.js Uses random workspace ids for fresh locals and ensures workspaceKey is written.
src/modules/app-core/workspace-controllers-setup.js Wires new toWorkspaceRecordKey and metadata persistence options.
src/modules/app-core/workspace-context-controller.js Updates restore logic to prefer by id or workspaceKey; tweaks drawer refresh behavior.
src/modules/app-core/pr-context-transition.js New: computes PR context transitions (activate/ignore/mark closed/inactive).
src/modules/app-core/pr-context-state.js New: PR context predicates (identity, mismatches, closed-status detection).
src/modules/app-core/pr-context-state-change-handler.js New: centralized PR-context change handler used by workflows.
src/modules/app-core/pr-context-records.js New: helper to persist “closed” status across matching records.
src/modules/app-core/persisted-active-pr-context.js Loosens persisted-context validation (no longer requires prTitle).
src/modules/app-core/github-workflows.js Adds Workspaces repo selector wiring, sync gating, and repo-aware reconciliation.
src/modules/app-core/github-workflows-setup.js Plumbs new dependencies (syncActiveWorkspaceRepositoryScope, clear repo selection).
src/modules/app-core/app-bindings-startup.js Metadata persistence now configures head-branch persistence to preserve ids.
src/index.html Adds repository selector to Workspaces drawer; updates PR drawer status copy.
src/app.js Adds workspace repo scope state and new PR-context state handling + archiving behavior.
playwright/rendering-modes/workspace-graph.spec.ts New: moves/expands workspace graph-related tests.
playwright/rendering-modes/core.spec.ts Removes extracted workspace-graph tests and fixes helper import path.
playwright/rendering-modes/auto-render-scope.spec.ts New: isolates auto-render scope test.
playwright/helpers/app-test-helpers.ts Adds ensureWorkspacesDrawerClosed; updates BYOT connect helper for new flow.
playwright/github-pr-drawer/open-pr-confirmation.spec.ts New: Open PR confirmation coverage.
playwright/github-pr-drawer/github-pr-drawer.helpers.ts New: shared helpers + IndexedDB utilities for PR/workspace tests.
playwright/github-pr-drawer/active-context-switch.spec.ts New: extensive integrity regression tests for workspace switching.
playwright/github-byot-ai.spec.ts Updates repo selection test to use Workspaces drawer flow; asserts repo select disabled.
docs/pr-context-storage-matrix.md Updates documented workspace-restore selection rules for repo/no-repo scope.
.github/workflows/playwright.yml Splits Chromium E2E into 2 shards to reduce wall-clock time.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/modules/github/byot-controls.js
Comment thread src/app.js
Comment thread src/modules/app-core/github-workflows.js Outdated
Comment thread src/modules/workspace/workspaces-drawer/drawer.js
@knightedcodemonkey knightedcodemonkey merged commit eb5a1cd into next Apr 26, 2026
6 checks passed
@knightedcodemonkey knightedcodemonkey deleted the bananas branch April 26, 2026 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants