fix(integrations): keep Jira reads working past token expiry and persist created issues#465
Open
therealbrad wants to merge 3 commits into
Open
fix(integrations): keep Jira reads working past token expiry and persist created issues#465therealbrad wants to merge 3 commits into
therealbrad wants to merge 3 commits into
Conversation
… expiry Issue reads (hover/details) borrow any connected user's OAuth token via getAdapter without passing a userId. Token refresh was gated on that caller userId, so a borrowed read could never refresh an expired token — reads started failing ~1 hour after the admin connected, until some user-scoped request refreshed the token. Two fixes: - Refresh on behalf of the token's owner (auth.userId on the auth row) when no caller userId is supplied, and persist the rotated token. - Track each cached OAuth adapter's access-token expiry and evict it once lapsed, so the next read rebuilds and refreshes instead of being served a stale, expired-token adapter from cache. Adds regression tests for both the borrowed-token refresh and the cache eviction on expiry.
create-issue stored the issue title in the `name` column and left the columns the UI actually reads — externalKey, externalUrl, externalStatus, status, priority, and issue-type fields — empty, populating only the `data` JSON blob. So issues created through the create flow rendered without their key, Jira link, status, or hover badge across lists, the Issues page, and the case editor. Now populate the same first-class columns a synced/webhooked issue gets (mirrors SyncService.issueFields), on both the create and update branches of the upsert, so a created issue is indistinguishable from a synced one. Adds a regression test asserting the persisted columns (key in name, externalKey/Url/Status, status, issue type).
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.
Description
Three fixes to the Jira OAuth integration, surfaced while UAT-ing the per-user OAuth flow on a local dev build against a real Atlassian app + Jira Cloud:
Reads no longer break ~1 hour after the admin connects. Issue reads (hover / details) borrow any connected user's OAuth token via
getAdapterwithout passing auserId. Token refresh was gated on that (absent) calleruserId, and the adapter cache returned the expired-token adapter before any refresh check — so read-without-login worked for an hour, then started failing withFailed to get accessible resourcesuntil some user-scoped request refreshed the token. Now the borrowed token refreshes on the token owner's behalf (auth.userId), and cached OAuth adapters are evicted once their access token expires so the next read rebuilds and refreshes.Issues created through the create flow now render correctly.
create-issuewrote the issue title into thenamecolumn and left the columns the UI actually reads —externalKey,externalUrl,externalStatus,status,priority, and issue-type fields — empty, populating only thedataJSON blob. Created issues therefore appeared with no key, no Jira link, no status, and no hover badge across lists, the Issues page, and the case editor. They now get the same first-class columns a synced/webhooked issue gets (mirrorsSyncService.issueFields).i18n: the "single-use Magic Link" sign-in button label is translated across all locales (a Crowdin sync had reverted it to English).
Related Issue
N/A — found during local UAT of the per-user Jira OAuth flow.
Type of Change
How Has This Been Tested?
Describe the tests you ran to verify your changes:
Details:
IntegrationManager.test.ts), and for the created-issue column persistence (create-issue/route.test.ts).pnpm precommitis green — 9788 unit tests passing, lint + format clean.Test Configuration:
Checklist
Screenshots (if applicable)
N/A
Additional Notes
Two operational notes for production OAuth (not code in this PR), also surfaced during UAT: