From 143e0d3f71b843f1705eff4c723a35757f48c0a0 Mon Sep 17 00:00:00 2001 From: cliffhall Date: Fri, 3 Jul 2026 13:20:29 -0400 Subject: [PATCH] test+docs: add inspectorTabs test; document mid-session auth modules MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add a dedicated `inspectorTabs.test.ts` (was relying only on incidental coverage from App.test.tsx) — covers the tab-id constants and both branches of the `isInspectorTabId` type guard; 100% per-file. - AGENTS.md: extend the `core/auth/` structure-tree entry to describe the new mid-session recovery modules (challenge parsing, scope union, shared OAuth UX copy, force-reauthorization) and the node loopback callback flow. Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_01DZyeWManYTvcXxjcrhxSQc --- AGENTS.md | 8 +++-- clients/web/src/utils/inspectorTabs.test.ts | 38 +++++++++++++++++++++ 2 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 clients/web/src/utils/inspectorTabs.test.ts diff --git a/AGENTS.md b/AGENTS.md index 1b84fa8f..12500c43 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -22,9 +22,13 @@ inspector/ │ ├── tui/ # TUI client (Ink + React, tsup bundle) │ ├── launcher/ # Shared launcher (relative imports into sibling build/ outputs) ├── core/ # Shared core code (no package.json — consumed via the `@inspector/core` vite alias) -│ ├── auth/ # OAuth: state machine, providers, discovery, storage +│ ├── auth/ # OAuth: state machine, providers, discovery, storage; +│ │ # mid-session recovery (challenge.ts WWW-Authenticate +│ │ # parsing, scopes.ts SEP-2350 scope union, oauthUx.ts +│ │ # shared copy, mcpAuth.ts force-reauthorization) │ │ ├── browser/ # Browser-side OAuth (sessionStorage, BrowserNavigation) -│ │ ├── node/ # Node-side OAuth (NodeOAuthStorage, OAuthCallbackServer) +│ │ ├── node/ # Node-side OAuth (NodeOAuthStorage, OAuthCallbackServer, +│ │ │ # runner-interactive-oauth loopback callback flow) │ │ └── remote/ # Remote OAuth storage (delegates to the remote server) │ ├── json/ # JSON utilities and parameter/argument conversion │ ├── logging/ # Silent pino logger singleton diff --git a/clients/web/src/utils/inspectorTabs.test.ts b/clients/web/src/utils/inspectorTabs.test.ts new file mode 100644 index 00000000..ebd7b696 --- /dev/null +++ b/clients/web/src/utils/inspectorTabs.test.ts @@ -0,0 +1,38 @@ +import { describe, it, expect } from "vitest"; +import { + INSPECTOR_SERVERS_TAB, + INSPECTOR_TAB_IDS, + isInspectorTabId, +} from "./inspectorTabs"; + +describe("inspectorTabs", () => { + it("names the Servers tab, which is not a liftable inspector tab", () => { + expect(INSPECTOR_SERVERS_TAB).toBe("Servers"); + expect(INSPECTOR_TAB_IDS).not.toContain(INSPECTOR_SERVERS_TAB); + }); + + it("enumerates the liftable inspector tabs", () => { + expect(INSPECTOR_TAB_IDS).toEqual([ + "Apps", + "Tools", + "Prompts", + "Resources", + "Tasks", + "Logs", + "History", + "Network", + ]); + }); + + it("isInspectorTabId returns true for every enumerated tab", () => { + for (const tab of INSPECTOR_TAB_IDS) { + expect(isInspectorTabId(tab)).toBe(true); + } + }); + + it("isInspectorTabId returns false for non-inspector tab values", () => { + expect(isInspectorTabId(INSPECTOR_SERVERS_TAB)).toBe(false); + expect(isInspectorTabId("")).toBe(false); + expect(isInspectorTabId("Bogus")).toBe(false); + }); +});