inspector/clients/web/src/lib
Repository files (latest commit first)
Filename Latest commit message Latest commit date
cliffhall 463227c947 fix(auth): make snapshot-and-clear one atomic storage step (#2144)
Copilot review round 18. Three of its findings were the same check-then-act:
`planOAuthRevocation` is asynchronous, so the gap between its reads and the
following `storage.clear()` is still a window — shorter than the network one
closed in round 13, but the same shape. An OAuth completion landing at any of
those awaits saved a grant the clear then destroyed.

`OAuthStorage.takeRevocationSnapshot(serverUrl)` reads what revocation needs
and clears the server in ONE synchronous pass over the in-memory state, with
the persist after the mutation. `clearAndPlanRevocation` replaces
`planOAuthRevocation`, and there is no separate `clear` call left in any
caller — the clear cannot be forgotten or reordered.

The snapshot returns values unparsed, deliberately: schema validation is pure
and belongs after the mutation, since running it inside would reintroduce the
`await` this exists to remove.

Two consequences worth naming. A failure of the take-and-clear now REJECTS
rather than returning an outcome, because the state was not cleared and the
caller's contract is that it was; both clients already have a rejection path.
And cross-process atomicity is explicitly not claimed — nothing in this store
takes a lock, every mutation is a read-modify-write over a loaded snapshot, and
`clear` alone always had that property.

Also from round 18:

- The CLI's budget check ran before considering `plan.outcome`, so a key that
  needed no network was reported as budget-exhausted — warning that a grant may
  be live when that key held none.
- A disconnect failure after a successful clear was reported as "could not
  clear OAuth state" in both clients. It now goes to the disconnect channel,
  and the success is still reported.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0177mPHAdECD18nLLCTwR5rh
Signed-off-by: cliffhall <cliff@futurescale.com>
2026-08-28 07:40:52 -04:00
..
appElicitationController.test.ts fix(apps): bind app elicitations to the connection that made them 2026-08-22 22:55:43 -04:00
appElicitationController.ts fix(apps): bind app elicitations to the connection that made them 2026-08-22 22:55:43 -04:00
authToken.test.ts chore(web): address Copilot review on #2127 2026-08-26 18:24:09 -04:00
authToken.ts chore(web): move App.tsx's module-level block into files (#2127) 2026-08-26 18:07:40 -04:00
browserTabVisibility.test.ts refactor(web): sharpen the src/lib vs src/utils rule and move misfiled modules (#1784) 2026-07-25 22:24:30 -04:00
browserTabVisibility.ts refactor(web): sharpen the src/lib vs src/utils rule and move misfiled modules (#1784) 2026-07-25 22:24:30 -04:00
clearServerOAuthState.test.ts fix(auth): refuse a grant whose authorization server cannot be established (#2144) 2026-08-28 06:18:58 -04:00
clearServerOAuthState.ts fix(auth): make snapshot-and-clear one atomic storage step (#2144) 2026-08-28 07:40:52 -04:00
downloadFile.test.ts refactor(web): sharpen the src/lib vs src/utils rule and move misfiled modules (#1784) 2026-07-25 22:24:30 -04:00
downloadFile.ts refactor(web): rename "History" tab/feature to "Protocol" (#1623) 2026-07-09 19:04:54 -04:00
environmentFactory.test.ts refactor: migrate to RemoteOAuthStorage for web OAuth handling 2026-07-03 13:11:13 -07:00
environmentFactory.ts refactor: migrate to RemoteOAuthStorage for web OAuth handling 2026-07-03 13:11:13 -07:00
oauthResume.test.ts fix(web): drop a pre-#2001 selectedToolName on OAuth resume 2026-08-17 00:19:22 -04:00
oauthResume.ts fix(web): drop a pre-#2001 selectedToolName on OAuth resume 2026-08-17 00:19:22 -04:00
protocolReplay.test.ts fix(web): read the literal, not the parsed number; project cursors and tool args 2026-08-27 04:56:22 -04:00
protocolReplay.ts fix(web): refuse a raw-JSON tool argument the schema would retype (#2171) 2026-08-27 22:57:29 -04:00
publishAppDocument.test.ts fix(web): move the app origin off 6276, bound the publish route 2026-08-24 08:45:40 -04:00
publishAppDocument.ts feat(web): honor _meta.ui.domain with a dedicated app origin 2026-08-24 08:45:40 -04:00
refreshingPersist.test.ts fix(auth): stop a config-only PUT deleting stored secrets (#2084) 2026-08-22 23:30:17 -04:00
refreshingPersist.ts fix(auth): stop a config-only PUT deleting stored secrets (#2084) 2026-08-22 23:30:17 -04:00
remoteOAuthStorage.test.ts refactor: migrate to RemoteOAuthStorage for web OAuth handling 2026-07-03 13:11:13 -07:00
remoteOAuthStorage.ts fix(auth): guard OAuth-storage async paths against unhandled rejections 2026-07-08 10:59:40 -04:00
webProxiedFetch.test.ts test(auth): cover the no-window guard in getWebProxiedFetch (#2144) 2026-08-28 01:00:42 -04:00
webProxiedFetch.ts feat(auth): revoke OAuth tokens at the authorization server on clear (#2144) 2026-08-28 00:48:57 -04:00