Skip to content

fix: reload active pr context when readding pat.#51

Merged
knightedcodemonkey merged 2 commits intomainfrom
bananas
Mar 31, 2026
Merged

fix: reload active pr context when readding pat.#51
knightedcodemonkey merged 2 commits intomainfrom
bananas

Conversation

@knightedcodemonkey
Copy link
Copy Markdown
Owner

Copilot AI review requested due to automatic review settings March 31, 2026 18:52
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

Fixes #41 by ensuring that when a user removes their GitHub PAT and later re-adds it, the app preferentially selects the repository that has a saved active PR context, allowing the existing PR verification + push-commit mode rehydration flow to run without manual repo switching.

Changes:

  • Add a helper to locate the first writable repository that has a valid saved active PR context in localStorage.
  • Update repo auto-selection logic (when no stored selection exists) to prefer the repo with an active PR context.
  • Add Playwright coverage for PAT remove → re-add flows (PR open vs PR closed).

Reviewed changes

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

File Description
src/modules/github-pr-drawer.js Exports findRepositoryWithActivePrContext() to detect which writable repo has an active PR context saved.
src/modules/github-byot-controls.js Uses the new helper to choose the initial repo when no prior repo selection exists (notably after PAT deletion clears selection).
playwright/github-pr-drawer.spec.ts Adds tests validating active PR context rehydration after PAT remove/re-add, including closed-PR deactivation behavior.

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

@knightedcodemonkey knightedcodemonkey merged commit 57138c8 into main Mar 31, 2026
5 checks passed
@knightedcodemonkey knightedcodemonkey deleted the bananas branch March 31, 2026 19:08
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.

Active PR context is not rehydrated after PAT is removed and re-added

2 participants