fix: prevent workspace overwrites.#100
Merged
knightedcodemonkey merged 6 commits intonextfrom Apr 26, 2026
Merged
Conversation
Owner
knightedcodemonkey
commented
Apr 26, 2026
- refactor: move repository selection to workspaces drawer.
- closes Implement a UX and data-integrity refactor #98
- fixes Workspace-switch overwrites can happen #97
Contributor
There was a problem hiding this comment.
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 randomidplus a deterministicworkspaceKeyfor 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.
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.