Fix Jira credentials clearing on forbidden task reads (#5757)

Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
Jinwoo Hong
2026-06-18 20:22:01 -07:00
committed by GitHub
co-authored by Orca
parent b8f2f95100
commit e3ca72b2b5
4 changed files with 25 additions and 2 deletions
@@ -390,4 +390,16 @@ describe('createJiraSlice credential errors', () => {
expect(store.getState().jiraStatus.credentialError).toBeUndefined()
})
})
it('keeps Jira connected when an issue read hits endpoint-level forbidden access', async () => {
const store = createTestStore()
store.setState({
jiraStatus: { connected: true, viewer: null, selectedSiteId: 'site-1' }
})
jiraListIssues.mockRejectedValueOnce(new Error('Forbidden'))
await expect(store.getState().listJiraIssues('assigned', 30)).resolves.toEqual([])
expect(store.getState().jiraStatus.connected).toBe(true)
})
})
+3 -1
View File
@@ -55,7 +55,9 @@ function evictStaleEntries<T>(
function looksLikeAuthError(error: unknown): boolean {
const msg = error instanceof Error ? error.message : String(error)
return /authenticat|unauthorized|forbidden|401|403/i.test(msg)
// Why: Jira 403 commonly means endpoint/project access is denied while the
// saved token is still valid; do not flip Settings back to disconnected.
return /authenticat|unauthorized|401/i.test(msg)
}
type InflightJiraReadRequest<T> = {