Token management improvement #3610

Merged
hj merged 15 commits from token-management-improvements into develop 2026-11-09 21:52:25 +00:00
Member
No description provided.
hj added 7 commits 2026-11-09 16:11:44 +00:00
activity support
Some checks failed
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/changelog Pipeline was successful
ci/woodpecker/pr/lint Pipeline was successful
ci/woodpecker/pr/test Pipeline failed
ci/woodpecker/pr/test-e2e Pipeline was skipped
d8b8419f56
fix tests
Some checks failed
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/changelog Pipeline was successful
ci/woodpecker/pr/lint Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/test-e2e Pipeline failed
bc7b50aa8d
better wait promise abort
Some checks failed
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/changelog Pipeline was successful
ci/woodpecker/pr/lint Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/test-e2e Pipeline failed
6582313d1e
fix e2e
All checks were successful
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/changelog Pipeline was successful
ci/woodpecker/pr/lint Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/test-e2e Pipeline was successful
309168b6bd
minor stylistic updates
Some checks failed
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/changelog Pipeline was successful
ci/woodpecker/pr/lint Pipeline failed
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/test-e2e Pipeline was successful
eba2b3096e
lint
All checks were successful
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/changelog Pipeline was successful
ci/woodpecker/pr/lint Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/test-e2e Pipeline was successful
9d2ea24ca3
Author
Member

/oc review

/oc review
opencode-fix-bot requested changes 2026-11-09 20:22:40 +00:00
Dismissed
opencode-fix-bot left a comment

Greptile-style review — Token management improvement

opencode-agent:job=178:generation=1

Reviewed the full develop (3c09397a) → token-management-improvements (9d2ea24c) diff plus surrounding code. The bulk-revoke queue, current-token/last-active display, and i18n plural strings all look sound, but there are two high-impact defects below that should block merge, plus three medium-impact ones.

P1 — Branch predates develop and would revert #3604 on squash/rebase merge

  • develop at 3c09397a is the merge of #3604 ("Do not send read requests for notifications already read"). The head commit 9d2ea24c does not descend from it (merge-base is 527ef0e4).
  • The develop..head diff therefore deletes exactly what #3604 added: the seen guards in src/stores/notifications.js, the whole test/unit/specs/stores/notifications_read_requests.spec.js regression test (52 lines), and changelog.d/notifications-read-spam.fix.
  • A regular merge commit would preserve both sides, but a squash or rebase merge applies the two-dot diff and silently reintroduces notification read-request spam.
  • Fix: rebase token-management-improvements onto current develop before merging.

P1 — StatusCodeError.statusText change silently disables the unsupported-notification-type fallback

  • src/services/errors/errors.js: statusText changed from the response body (body.error || body.errors || body) to response.statusText (the HTTP reason phrase, e.g. "Bad Request").
  • src/stores/fetchers/notifications_fetcher.js:43 (unchanged by this PR) does error.statusText.includes('Invalid value for enum') and then matchAlls type names out of it to drop unsupported notification types and retry.
  • That check can now never match, so on any backend that rejects an unknown types[] value, notification polling permanently fails and pushes a global error notice on every 10s poll instead of degrading gracefully.
  • Fix: either keep a body-derived field on the error for this check (e.g. have the fetcher match against error.errorData), or restore the old statusText semantics and expose the HTTP phrase under a new name.

P2 — validUntil dates ignore the app locale (Ref passed instead of string)

  • src/components/settings_modal/tabs/security_tab/tokens.js:27,40: const { locale } = useI18n() gives a Ref, but localeService.internalToBrowserLocale(locale) expects a string (every other call site passes this.$i18n.locale). The lookup misses, the Ref flows into toLocaleDateString(), which falls back to the runtime default locale — and the computed never tracks locale changes since .value is never read.
  • Fix: pass locale.value.

P2 — Selection bookkeeping allows confirming an empty revoke queue

  • tokens.js: allSelected is selected.value.size >= tokens.value.length — it ignores usTokens, and is vacuously true when the list is empty (0 >= 0), which enables the "Revoke selected" button with nothing selected.
  • Confirming then runs revokeTokens() with an empty queue: revokeQueue.value.shift() yields undefined, so it calls revokeToken(undefined) → DELETE /api/oauth_tokens/undefined → 404 error alert for a no-op action.
  • Fix: require selected.value.size > 0 for allSelected, compare against the visible allTokens length, and return early when the queue is empty.

P2 — Revoking the current session token leaves the client half-logged-in

  • The new table (including bulk "Revoke selected") lets the user revoke the current token — styled -danger but with no extra handling. After a successful self-revoke the store drops the token from the list while useOAuthStore().userToken stays set, so subsequent API calls fail with auth errors instead of a clean logout/redirect.
  • Fix: exclude the current token from bulk selection, or force logout + redirect after the current token is revoked.

Merge readiness: 3/5

Capped by the two P1s. Rebase onto develop and restore a body-derived error channel for the fetcher check, and this is in good shape — the queue/retry flow, plural strings, and ConfirmModal wiring all check out.

### Greptile-style review — Token management improvement opencode-agent:job=178:generation=1 Reviewed the full `develop` (`3c09397a`) → `token-management-improvements` (`9d2ea24c`) diff plus surrounding code. The bulk-revoke queue, current-token/last-active display, and i18n plural strings all look sound, but there are two high-impact defects below that should block merge, plus three medium-impact ones. ### P1 — Branch predates `develop` and would revert #3604 on squash/rebase merge - `develop` at `3c09397a` is the merge of #3604 ("Do not send read requests for notifications already read"). The head commit `9d2ea24c` does **not** descend from it (merge-base is `527ef0e4`). - The `develop..head` diff therefore deletes exactly what #3604 added: the `seen` guards in `src/stores/notifications.js`, the whole `test/unit/specs/stores/notifications_read_requests.spec.js` regression test (52 lines), and `changelog.d/notifications-read-spam.fix`. - A regular merge commit would preserve both sides, but a squash or rebase merge applies the two-dot diff and silently reintroduces notification read-request spam. - **Fix:** rebase `token-management-improvements` onto current `develop` before merging. ### P1 — `StatusCodeError.statusText` change silently disables the unsupported-notification-type fallback - `src/services/errors/errors.js`: `statusText` changed from the response body (`body.error || body.errors || body`) to `response.statusText` (the HTTP reason phrase, e.g. `"Bad Request"`). - `src/stores/fetchers/notifications_fetcher.js:43` (unchanged by this PR) does `error.statusText.includes('Invalid value for enum')` and then `matchAll`s type names out of it to drop unsupported notification types and retry. - That check can now never match, so on any backend that rejects an unknown `types[]` value, notification polling permanently fails and pushes a global error notice on every 10s poll instead of degrading gracefully. - **Fix:** either keep a body-derived field on the error for this check (e.g. have the fetcher match against `error.errorData`), or restore the old `statusText` semantics and expose the HTTP phrase under a new name. ### P2 — `validUntil` dates ignore the app locale (Ref passed instead of string) - `src/components/settings_modal/tabs/security_tab/tokens.js:27,40`: `const { locale } = useI18n()` gives a `Ref`, but `localeService.internalToBrowserLocale(locale)` expects a string (every other call site passes `this.$i18n.locale`). The lookup misses, the Ref flows into `toLocaleDateString()`, which falls back to the runtime default locale — and the computed never tracks locale changes since `.value` is never read. - **Fix:** pass `locale.value`. ### P2 — Selection bookkeeping allows confirming an empty revoke queue - `tokens.js`: `allSelected` is `selected.value.size >= tokens.value.length` — it ignores `usTokens`, and is vacuously `true` when the list is empty (`0 >= 0`), which enables the "Revoke selected" button with nothing selected. - Confirming then runs `revokeTokens()` with an empty queue: `revokeQueue.value.shift()` yields `undefined`, so it calls `revokeToken(undefined)` → `DELETE /api/oauth_tokens/undefined` → 404 error alert for a no-op action. - **Fix:** require `selected.value.size > 0` for `allSelected`, compare against the visible `allTokens` length, and return early when the queue is empty. ### P2 — Revoking the current session token leaves the client half-logged-in - The new table (including bulk "Revoke selected") lets the user revoke the `current` token — styled `-danger` but with no extra handling. After a successful self-revoke the store drops the token from the list while `useOAuthStore().userToken` stays set, so subsequent API calls fail with auth errors instead of a clean logout/redirect. - **Fix:** exclude the current token from bulk selection, or force logout + redirect after the current token is revoked. ### Merge readiness: 3/5 Capped by the two P1s. Rebase onto `develop` and restore a body-derived error channel for the fetcher check, and this is in good shape — the queue/retry flow, plural strings, and `ConfirmModal` wiring all check out.
Merge branch 'develop' into token-management-improvements
All checks were successful
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/changelog Pipeline was successful
ci/woodpecker/pr/lint Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/test-e2e Pipeline was successful
11e160fe41
review
Some checks failed
ci/woodpecker/pr/test-e2e Pipeline is pending
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/changelog Pipeline was successful
ci/woodpecker/pr/lint Pipeline failed
ci/woodpecker/pr/test Pipeline was canceled
ca04842c4d
lint
All checks were successful
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/changelog Pipeline was successful
ci/woodpecker/pr/lint Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/test-e2e Pipeline was successful
6263736e45
Author
Member

/oc review

/oc review
opencode-fix-bot left a comment

Greptile-style review — Token management improvement

opencode-agent:job=179:generation=1

Reviewed the full develop (3c09397a) → token-management-improvements (6263736e) diff plus surrounding code and the live discussion. No new findings.

Prior review follow-up

The earlier REQUEST_CHANGES review (against 9d2ea24c) raised five defects. I verified each against the current head — all are addressed:

  • Rebase / #3604 revert risk — fixed. The branch now merges current develop (merge-base is 3c09397a), so the seen guards, the notifications_read_requests.spec.js regression test, and the changelog fragment are intact.
  • Unsupported-notification-type fallback — fixed. src/stores/fetchers/notifications_fetcher.js and src/stores/admin_settings.js now match against the body-derived errorData field instead of the HTTP reason phrase.
  • validUntil locale Ref — fixed. tokens.js now passes locale.value to internalToBrowserLocale.
  • Empty revoke queue confirmable — fixed. allSelected requires selected.size > 0 and revokeTokens returns early on an empty queue.
  • Current-session token revocable — fixed. The table renders no checkbox or revoke button for the current token, and bulk select only covers non-current tokens.

Current head

The bulk-revoke queue with retry/backoff, current-token/last-active display, usTokens/tokens split, i18n plural strings, and ConfirmModal wiring all check out. Remaining observations (leftover false literals in login_form.js:45 and oauth.js setClientData, dead methods.revokeToken, cosmetic MFA heading changes) are behavior-neutral and below the reporting bar.

Findings

None. No P0/P1/P2 defects found in the current diff.

Merge readiness: 5/5

Production-ready with no known findings. Approve.

### Greptile-style review — Token management improvement opencode-agent:job=179:generation=1 Reviewed the full `develop` (`3c09397a`) → `token-management-improvements` (`6263736e`) diff plus surrounding code and the live discussion. No new findings. ### Prior review follow-up The earlier `REQUEST_CHANGES` review (against `9d2ea24c`) raised five defects. I verified each against the current head — all are addressed: - **Rebase / #3604 revert risk** — fixed. The branch now merges current `develop` (merge-base is `3c09397a`), so the `seen` guards, the `notifications_read_requests.spec.js` regression test, and the changelog fragment are intact. - **Unsupported-notification-type fallback** — fixed. `src/stores/fetchers/notifications_fetcher.js` and `src/stores/admin_settings.js` now match against the body-derived `errorData` field instead of the HTTP reason phrase. - **`validUntil` locale Ref** — fixed. `tokens.js` now passes `locale.value` to `internalToBrowserLocale`. - **Empty revoke queue confirmable** — fixed. `allSelected` requires `selected.size > 0` and `revokeTokens` returns early on an empty queue. - **Current-session token revocable** — fixed. The table renders no checkbox or revoke button for the `current` token, and bulk select only covers non-current tokens. ### Current head The bulk-revoke queue with retry/backoff, current-token/last-active display, `usTokens`/`tokens` split, i18n plural strings, and `ConfirmModal` wiring all check out. Remaining observations (leftover `false` literals in `login_form.js:45` and `oauth.js` `setClientData`, dead `methods.revokeToken`, cosmetic MFA heading changes) are behavior-neutral and below the reporting bar. ### Findings None. No P0/P1/P2 defects found in the current diff. ### Merge readiness: 5/5 Production-ready with no known findings. Approve.
hj merged commit 443d848da4 into develop 2026-11-09 21:52:25 +00:00
hj deleted branch token-management-improvements 2026-11-09 21:52:25 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
pleroma/pleroma-fe!3610
No description provided.