Commit 5917b83
authored
fix(refresh-token): add retry mechanism with back off to emit new AT (#199)
* fix(refresh-token): add retry mechanism with back off to emit new AT
* chore(ci): add jest run
* chore(ci): add build test
* fix(refresh-token): fix retry exhaustion bug, dropzone accept callback, and response.ok handling
* Fix retryWithBackoff exhaustion guard (attempt === maxRetries was dead
code after loop bound change to < maxRetries; errors were silently
swallowed, function returned undefined instead of throwing).
* Fix Dropzone accept callback to call done() on error path, preventing
files from getting stuck in an indeterminate state.
* Use response.ok instead of checking individual status codes, closing
a gap where 4xx codes other than 400 fell through unhandled.
* Add ok property to existing test mocks to match the new response.ok check.
* Export retryWithBackoff and add 5 unit tests covering retry count,
auth error short-circuit, transient recovery, and exponential backoff.
* Add defensive check for missing access_token in refresh response.
* fix(refresh-token): The loop bound is now attempt < maxRetries
* consistent with the exhaustion guard attempt === maxRetries - 1.
With MAX_RETRIES = 5, the function makes exactly 5 attempts
(0 through 4), no dead code.
* fix(refresh-token): improved HTTP error handling1 parent 6a2f18b commit 5917b83
7 files changed
Lines changed: 487 additions & 39 deletions
File tree
- .github/workflows
- src/components
- extra-questions/__test__
- inputs/upload-input-v2
- security
- __tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
14 | 17 | | |
15 | 18 | | |
16 | 19 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
61 | 62 | | |
62 | 63 | | |
63 | 64 | | |
64 | | - | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
65 | 71 | | |
66 | 72 | | |
67 | 73 | | |
| |||
0 commit comments