Skip to content

feat: make idb source of truth for pr context.#87

Merged
knightedcodemonkey merged 4 commits intonextfrom
bananas
Apr 20, 2026
Merged

feat: make idb source of truth for pr context.#87
knightedcodemonkey merged 4 commits intonextfrom
bananas

Conversation

@knightedcodemonkey
Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings April 19, 2026 19:11
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 shifts GitHub PR “active context” ownership away from repo-scoped localStorage and toward the workspace/IndexedDB model, updating the PR drawer to hydrate active context from the current workspace state and removing the legacy storage implementation.

Changes:

  • Removed the PR drawer localStorage config module and updated drawer controllers to use an in-memory active-context map plus a getPersistedActivePrContext hook.
  • Added app-core helpers to (a) expose the persisted active PR context from current workspace/UI state and (b) clear legacy knighted:develop:github-pr-config:* keys.
  • Added/updated documentation describing storage ownership (PR context in IDB only; localStorage limited to lightweight bootstrap keys).

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/modules/github/pr/drawer/controller/run-submit.js Writes active PR context via setRepositoryActivePrContext after opening a PR.
src/modules/github/pr/drawer/controller/repository-form.js Stops persisting repo-scoped draft PR config; syncs form fields from active context only.
src/modules/github/pr/drawer/controller/public-actions.js Updates disconnect/clear/close flows to clear active context without localStorage config updates.
src/modules/github/pr/drawer/controller/create-controller.js Introduces in-memory active-context storage and loads persisted context via getPersistedActivePrContext.
src/modules/github/pr/drawer/controller/context-sync.js Verifies active PR state using active context; updates/clears in-memory context accordingly.
src/modules/github/pr/drawer/config.js Deleted legacy localStorage-backed PR drawer config implementation.
src/modules/github/byot-controls.js Removes auto-select behavior based on legacy localStorage PR context.
src/modules/app-core/persisted-active-pr-context.js New helper for providing “persisted” active PR context from workspace/UI state.
src/modules/app-core/legacy-pr-config-storage.js New helper to clear legacy PR config localStorage keys.
src/modules/app-core/github-workflows.js Wires getPersistedActivePrContext into PR drawer construction.
src/modules/app-core/github-workflows-setup.js Passes runtime getPersistedActivePrContext through setup.
src/modules/app-core/github-pr-icons.js Extracts PR icon definitions from app.js into a dedicated module.
src/app.js Clears legacy PR config storage on boot; provides getPersistedActivePrContext; moves icons to module.
docs/pr-context-storage-matrix.md Updates matrix/docs to reflect IDB-only PR context ownership.
docs/localstorage-state.md New doc defining allowed localStorage keys and explicitly forbidding PR context.
docs/idb-workspace-state.md New doc defining IDB workspace record ownership, including PR context state.
Comments suppressed due to low confidence (1)

src/modules/github/pr/drawer/controller/context-sync.js:226

  • When PR verification determines the saved PR is no longer open on GitHub, this branch now only clears the in-memory active context. That causes the runtime onActivePrContextChange handler to persist the workspace PR context as inactive, losing the ability to record a closed (or disconnected) state in IndexedDB as described by the new IDB-as-source-of-truth docs. Consider propagating the verified outcome to the runtime layer (e.g., via a dedicated callback or return value) so the workspace record can be updated to closed while preserving the PR number/head/base metadata, instead of treating it as a generic inactive state.
        clearRepositoryActivePrContext(repositoryFullName)
        setSubmitButtonLabel()
        emitActivePrContextChange()
        state.lastActiveContentSyncKey = ''
        abortPendingActiveContentSyncRequest()

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

Comment thread src/modules/github/pr/drawer/controller/repository-form.js Outdated
Comment thread src/modules/github/pr/drawer/controller/public-actions.js Outdated
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

Copilot reviewed 25 out of 25 changed files in this pull request and generated 3 comments.


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

Comment thread src/modules/github/pr/editor-sync.js Outdated
Comment thread src/modules/github/pr/editor-sync.js Outdated
Comment thread src/modules/app-core/persisted-active-pr-context.js
@knightedcodemonkey knightedcodemonkey merged commit ddb1b26 into next Apr 20, 2026
10 of 11 checks passed
@knightedcodemonkey knightedcodemonkey deleted the bananas branch April 20, 2026 00:06
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