feat(settings): in-place PAT replacement#109
Merged
Merged
Conversation
Add a Replace Token form to Settings > Data > Authentication for PAT users. Validates new token against GitHub /user API before storing. Includes same-token guard, stale-form guard, focus management, and full a11y support (aria-expanded, aria-controls, aria-busy, aria-describedby). Extend the cross-tab StorageEvent handler to detect token replacement and sync across tabs via a lightweight /user fetch with generation counter for rapid-replacement safety. 14 new tests covering the replace-token flow and cross-tab sync.
Adds a note under Personal Access Token Sign-In explaining how to replace an expired or rotated PAT via Settings.
611f3d0 to
cc1cfba
Compare
Adds AbortController to handleReplaceToken — Cancel aborts the in-flight /user fetch, immediately resetting replaceSubmitting via the catch/finally chain. Prevents the form from staying locked when the user cancels during slow API responses. Fixes auth.test.ts: user-preserved test now sets a real user before StorageEvent to prove preservation, not just null-stays-null.
Consumes the response body via r.body.cancel() when the cross-tab /user fetch returns a non-OK status, preventing connection pool drain on repeated events. Also strengthens the input-cleared test to reopen the form and verify the input signal was actually reset, not just that the DOM element was removed.
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.
Summary