inspector/specification
Repository files (latest commit first)
Filename Latest commit message Latest commit date
cliffhall b159c75b88 fix(auth): guard every lock removal, not just release, and stop promising expiry (#2082)
Copilot review round 5. Both comments upheld; the first is a real hole in
round 4's own fix.

**The ownership guard was in the wrong place, and overclaimed.**

Round 4 checked ownership and then called `release()`. Two problems:

- Check-then-act. The `stat` and the `rmdir` were separate async steps, so a
  waiter could replace the directory in between and we deleted the winner's
  fresh lock anyway — the very thing the check was added to prevent.
- Skipping `release()` on a mismatch left proper-lockfile's record registered
  in its `locks` map, and its `signal-exit` handler `rmdirSync`s every
  registered lock with **no ownership check of its own**. An exit during that
  window deleted the winner too.

The guard now lives in `options.fs`, which is the single seam *both* removal
paths route through — `removeLock` on release, and the exit handler. It
refuses to remove a directory whose inode and birth time are not the ones
recorded at acquire, and reports the refusal as success so the library's
bookkeeping forgets the lock either way (leaving it registered is what hands
the exit handler a record pointing at the winner's directory).

The check is a `statSync` immediately followed by an `rmdirSync`, with no
`await` between them, so nothing in this process can interleave. **It still
does not close the race** — it is check-then-act across processes, which needs
the compare-and-swap Node does not expose — and saying it "closes the
destructive half outright" was wrong. file-lock.ts, README.md,
specification/v2_servers_file.md and AGENTS.md now all say it narrows the
window rather than closing it. AGENTS.md carries the negative instruction
alongside round 4's, since this is the third round spent on an overclaim.

**"It expires on its own after 10s" is false for the ENOTEMPTY case** the new
test exercises. Stale takeover reclaims through the same `rmdir`, which also
cannot remove a non-empty directory — so nothing clears it, and every later
save fails ELOCKED against it. `releaseAdvice` now branches: by-hand removal
for ENOTEMPTY, expiry for everything else.

Tests: a real child process demonstrates the exit handler removing a
replacement lock (with an **empty** directory — a non-empty one makes
`rmdirSync` fail ENOTEMPTY, which is how the first draft of this test passed
for the wrong reason). The release-failure test now asserts the message says
"by hand" and does not promise expiry. The shim's `rmdirSync` arm carries a
justified `v8 ignore`: it is reachable only from a real process exit, and its
logic is `removeIfMine`, covered through the async arm.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JTHVxSu8AUgHRLvo1ntZ8H
Signed-off-by: cliffhall <cliff@futurescale.com>
2026-08-23 11:10:48 -04:00
..
diagrams refactor(version): single-source the version from the root package.json 2026-07-10 17:31:21 -04:00
screenshots docs(apps): specify the v2 Apps tab (#1265) 2026-04-29 17:22:59 -04:00
README.md docs(spec): add V2 Auth landing page and canonicalize spec top menus (closes #1605) 2026-07-02 17:20:06 -04:00
v1_problems.md docs(spec): add V2 Auth landing page and canonicalize spec top menus (closes #1605) 2026-07-02 17:20:06 -04:00
v2_auth.md Auth hardening CI gaps + SDK consolidation: EMA leg 2 / scopes (#1527) (#1725) 2026-07-19 22:36:21 -04:00
v2_auth_ema.md feat: surface and decode the OAuth id_token in Connection Info (#2019) 2026-08-15 18:33:41 -04:00
v2_auth_hardening.md chore: upgrade the MCP TypeScript SDK from 2.0.0-beta.5 to 2.0.0 2026-08-12 08:34:08 -04:00
v2_auth_mid_session.md refactor(web): sharpen the src/lib vs src/utils rule and move misfiled modules (#1784) 2026-07-25 22:24:30 -04:00
v2_auth_sdk_consolidation.md chore: upgrade the MCP TypeScript SDK from 2.0.0-beta.5 to 2.0.0 2026-08-12 08:34:08 -04:00
v2_auth_smoke_testing.md Auth hardening CI gaps + SDK consolidation: EMA leg 2 / scopes (#1527) (#1725) 2026-07-19 22:36:21 -04:00
v2_catalog_launch_config.md docs(spec): add V2 Auth landing page and canonicalize spec top menus (closes #1605) 2026-07-02 17:20:06 -04:00
v2_cli_tui_launcher.md Merge remote-tracking branch 'origin/v2/main' into 1579-wave-1 2026-07-09 09:41:08 -04:00
v2_new_spec_impact.md Auth hardening CI gaps + SDK consolidation: EMA leg 2 / scopes (#1527) (#1725) 2026-07-19 22:36:21 -04:00
v2_scope.md Removed Zustand storage, cleanup up auth storage IO interfaces, implementations, and usage. 2026-07-04 21:56:45 -07:00
v2_screenshots.md docs(spec): add V2 Auth landing page and canonicalize spec top menus (closes #1605) 2026-07-02 17:20:06 -04:00
v2_server.md docs(spec): add V2 Auth landing page and canonicalize spec top menus (closes #1605) 2026-07-02 17:20:06 -04:00
v2_servers_file.md fix(auth): guard every lock removal, not just release, and stop promising expiry (#2082) 2026-08-23 11:10:48 -04:00
v2_storage.md docs(spec): describe tool selection by row key, not name 2026-08-17 00:23:26 -04:00
v2_ux.md feat: surface and decode the OAuth id_token in Connection Info (#2019) 2026-08-15 18:33:41 -04:00
v2_ux_components.md Removed Zustand storage, cleanup up auth storage IO interfaces, implementations, and usage. 2026-07-04 21:56:45 -07:00
v2_ux_features.md docs(spec): add V2 Auth landing page and canonicalize spec top menus (closes #1605) 2026-07-02 17:20:06 -04:00
v2_ux_handlers.md docs(spec): add V2 Auth landing page and canonicalize spec top menus (closes #1605) 2026-07-02 17:20:06 -04:00
v2_ux_interfaces.md docs(spec): describe tool selection by row key, not name 2026-08-17 00:23:26 -04:00
v2_ux_interfaces_phase_0_4_inventory.md refactor(web): sharpen the src/lib vs src/utils rule and move misfiled modules (#1784) 2026-07-25 22:24:30 -04:00
v2_ux_interfaces_plan.md chore: close a batch of quality-gate & tidy gaps (#1785 #1787 #1789 #1790 #1767) (#1792) 2026-07-26 10:43:11 -04:00
v2_ux_storybook.md docs(spec): add V2 Auth landing page and canonicalize spec top menus (closes #1605) 2026-07-02 17:20:06 -04:00
v2_web_client.md docs(spec): add V2 Auth landing page and canonicalize spec top menus (closes #1605) 2026-07-02 17:20:06 -04:00

Inspector V2 Brief

Brief | V1 Problems | V2 Scope | V2 Tech Stack | V2 UX | V2 Auth | V2 New Spec Impact

Table of Contents

Motivation and Context

The existing Inspector is hard to maintain for a number of reasons. We decided to create a more maintainable Inspector from the ground up, that retains the deterministic boundary of operation, but exposes a plugin architecture.

Track Protocol Conformance

  • Identify any gaps in V1 inspector
  • Track which features are covered
  • Implement to parity and fill gaps
  • Provide conformance testing in CI

Improve Maintainability

  • Clearer separation of concerns
  • Smaller, reusable components

Provide Extensibility

  • Plugin SDK / API
  • Third parties cand develop/maintain their own plugins for features such as
    • LLM usage
    • Evals
    • Multiple server connections
    • Apps playground
    • Testing of registry configuration
    • Interface with registry

Proper Documentation

  • One big README won't cut it anymore
  • Published documentation in MDX should
    • Render in style of spec
    • Kept up to date
    • Cover all features
    • Discuss troubleshooting strategies
    • Provide detailed contribution guidance that explains architecture and expected idioms