refactor: untangle the codebase so a typical change lands in one place #60

Merged
marti merged 90 commits from feature/untangle-codebase into develop 2026-11-16 22:55:33 +01:00
Owner

Summary

A pass over the whole repo asking "should these pieces change together?": every place a change had to land in several files, a module depended on something more volatile, or a special case stood in for the design. Plus removing comments that restate the code, and rewriting tests that could not catch a real bug.

Where things live now (new modules marked +):

 packages/shared/src/
+├── server-rules.ts      # server-config checks: API create/update, pool backstop, admin form
+├── links.ts             # URLs the API and SPA exchange: OIDC codes, OAuth return, server pages, loopback
+├── normalize.ts         # slug / variable-key normalising for the forms
 ├── runner.ts            # process keys (build + parse, PROBE_USER_ID), shared limits, envelopes
 └── servers.ts           # ServerCard, exposedToolName, named field schemas
 apps/api/src/
+├── lib/mcp-endpoint.ts  # one session registry + route for /mcp and /mcp/admin
+├── lib/cursor.ts, db-errors.ts
+├── plugins/maintenance.ts   # all background jobs (was routes/oauth/maintenance.ts)
 └── services/
+    ├── visibility.ts    # which servers/tools a (user, client) sees: list, call, portal, client pages
+    ├── server-views.ts  # serverCard, toToolInfo
+    ├── variable-values.ts   # apply value-only bodies (instance, test, user values)
+    ├── deps.ts          # ServiceDeps: services own their audit + events
+    ├── settings.ts, tool-calls.ts
+    ├── auth/sign-out.ts # disable, admin reset, own password change
+    ├── oauth/resources.ts   # the two OAuth resources, from one table
+    └── gateway/failures.ts  # what a user sees when an upstream call fails

Events now say what changed, and listeners own the reaction (services no longer call upstreams.invalidate*):

flowchart LR
  w[service write, after commit] -->|server.changed| s[/mcp sessions re-list/]
  w -->|server.runtime.changed| p[pool restarts processes]
  w -->|server.runtime.changed| r[maintenance reconciles runner keys]
  w -->|access.changed userIds| p2[pool drops only lost access]
  w -->|user.server.changed| p3[pool restarts the user's process]
  w -->|user.server.changed| f[refresher lists their tools]
  p -->|upstream.tools.listed| s

A server context carries typed blockers; status, the admin setupNeeded, the gateway's not-ready text and the Test button only word them. The SPA refreshes centrally after every write, and a remove endpoint declares the id it deletes.

Bugs fixed along the way:

  • renaming a server, changing its icon or a tool switch restarted all its processes; an access-list or group change restarted processes of users who kept access
  • variable-definition-only changes left stale stored tool lists on lazy servers
  • a refused upstream OAuth refresh reached the agent as "connection closed" instead of "authorize again"
  • the Logs tab could fail with "runner response too large"
  • the runner page showed the connection-test process as a user with the nil UUID
  • admin setupNeeded missed an instance value that no longer decrypts
  • a disabled account signing in over OIDC was told SSO is not configured
  • stopping a shared runner process dropped every cached view of its server in the SPA

Evidence

  • Before: baseline npm test: shared 7, api 366, runner 53 (+2 skipped), web 170.
    After: nix develop -c ./scripts/ci.sh passes: lint, typecheck, shared 19, api 370, runner 55 (+2 skipped, network-only), web 175, build, npm audit 0 vulnerabilities. drizzle-kit reports no schema drift from the shared enums.
  • Tests now go through routes instead of internals (event spies, hand-fired events, direct service calls removed). New coverage: the OIDC callback against a fake IdP, a disabled server leaving /mcp, /mcp recording grant activity, /readyz 503, registration and password rate limits. New tests were checked by breaking the matching production code and watching them fail.
  • PKCE is now checked against the RFC 7636 vector instead of the server's own s256.

Merge Danger

Door: two-way, apart from the two data migrations.

  • 0013_command_names rewrites mcp_servers.command from absolute paths to binary names (what a protocol 1 runner stored).
  • 0014_last_error_install_only clears last_error on servers whose install did not fail: connect errors now live only in the tool-list row.

Blast Radius: deployment

  • Runner protocol is now 2: the API refuses a runner of another version, so the API and runner images must be upgraded together.
  • INSTALL_TIMEOUT_SECONDS now bounds the whole install, not each command.
  • Wire additions: PUT /api/admin/servers/:id/values (new admin MCP tool set_server_values), RunnerProcess.kind, AuthState.adminMcpUrl. DELETE /api/me/servers/:id/oauth on a server without per-user sign-in answers 400. With OIDC off its routes are not registered (generic 404). A few error texts changed.
  • trail check reports 7 hits, all word matches inside drizzle snapshot JSON and migration SQL, not conflicts with the learnings.

Left on purpose: splitting ServerForm into create/edit, reserving the mcphub slug (needs a data migration first), a full encrypted-column registry (a test now fails if key rotation misses an *_encrypted column).

🤖 Generated with Claude Code

## Summary A pass over the whole repo asking "should these pieces change together?": every place a change had to land in several files, a module depended on something more volatile, or a special case stood in for the design. Plus removing comments that restate the code, and rewriting tests that could not catch a real bug. Where things live now (new modules marked `+`): ```diff packages/shared/src/ +├── server-rules.ts # server-config checks: API create/update, pool backstop, admin form +├── links.ts # URLs the API and SPA exchange: OIDC codes, OAuth return, server pages, loopback +├── normalize.ts # slug / variable-key normalising for the forms ├── runner.ts # process keys (build + parse, PROBE_USER_ID), shared limits, envelopes └── servers.ts # ServerCard, exposedToolName, named field schemas apps/api/src/ +├── lib/mcp-endpoint.ts # one session registry + route for /mcp and /mcp/admin +├── lib/cursor.ts, db-errors.ts +├── plugins/maintenance.ts # all background jobs (was routes/oauth/maintenance.ts) └── services/ + ├── visibility.ts # which servers/tools a (user, client) sees: list, call, portal, client pages + ├── server-views.ts # serverCard, toToolInfo + ├── variable-values.ts # apply value-only bodies (instance, test, user values) + ├── deps.ts # ServiceDeps: services own their audit + events + ├── settings.ts, tool-calls.ts + ├── auth/sign-out.ts # disable, admin reset, own password change + ├── oauth/resources.ts # the two OAuth resources, from one table + └── gateway/failures.ts # what a user sees when an upstream call fails ``` Events now say what changed, and listeners own the reaction (services no longer call `upstreams.invalidate*`): ```mermaid flowchart LR w[service write, after commit] -->|server.changed| s[/mcp sessions re-list/] w -->|server.runtime.changed| p[pool restarts processes] w -->|server.runtime.changed| r[maintenance reconciles runner keys] w -->|access.changed userIds| p2[pool drops only lost access] w -->|user.server.changed| p3[pool restarts the user's process] w -->|user.server.changed| f[refresher lists their tools] p -->|upstream.tools.listed| s ``` A server context carries typed `blockers`; status, the admin `setupNeeded`, the gateway's not-ready text and the Test button only word them. The SPA refreshes centrally after every write, and a remove endpoint declares the id it deletes. Bugs fixed along the way: - renaming a server, changing its icon or a tool switch restarted all its processes; an access-list or group change restarted processes of users who kept access - variable-definition-only changes left stale stored tool lists on lazy servers - a refused upstream OAuth refresh reached the agent as "connection closed" instead of "authorize again" - the Logs tab could fail with "runner response too large" - the runner page showed the connection-test process as a user with the nil UUID - admin setupNeeded missed an instance value that no longer decrypts - a disabled account signing in over OIDC was told SSO is not configured - stopping a shared runner process dropped every cached view of its server in the SPA ## Evidence - **Before:** baseline `npm test`: shared 7, api 366, runner 53 (+2 skipped), web 170. **After:** `nix develop -c ./scripts/ci.sh` passes: lint, typecheck, shared 19, api 370, runner 55 (+2 skipped, network-only), web 175, build, `npm audit` 0 vulnerabilities. drizzle-kit reports no schema drift from the shared enums. - Tests now go through routes instead of internals (event spies, hand-fired events, direct service calls removed). New coverage: the OIDC callback against a fake IdP, a disabled server leaving `/mcp`, `/mcp` recording grant activity, `/readyz` 503, registration and password rate limits. New tests were checked by breaking the matching production code and watching them fail. - PKCE is now checked against the RFC 7636 vector instead of the server's own `s256`. ## Merge Danger **Door:** two-way, apart from the two data migrations. - `0013_command_names` rewrites `mcp_servers.command` from absolute paths to binary names (what a protocol 1 runner stored). - `0014_last_error_install_only` clears `last_error` on servers whose install did not fail: connect errors now live only in the tool-list row. **Blast Radius:** deployment - Runner protocol is now 2: the API refuses a runner of another version, so the API and runner images must be upgraded together. - `INSTALL_TIMEOUT_SECONDS` now bounds the whole install, not each command. - Wire additions: `PUT /api/admin/servers/:id/values` (new admin MCP tool `set_server_values`), `RunnerProcess.kind`, `AuthState.adminMcpUrl`. `DELETE /api/me/servers/:id/oauth` on a server without per-user sign-in answers 400. With OIDC off its routes are not registered (generic 404). A few error texts changed. - `trail check` reports 7 hits, all word matches inside drizzle snapshot JSON and migration SQL, not conflicts with the learnings. Left on purpose: splitting ServerForm into create/edit, reserving the `mcphub` slug (needs a data migration first), a full encrypted-column registry (a test now fails if key rotation misses an `*_encrypted` column). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Process and runner keys were built in access.ts and taken apart by string
slicing in the pool, by a separate regex in reconcile, by split(".") in the
runner admin route and server logs, and by slice(0, 36) in the runner. The
probe's nil UUID was copied in three places.

packages/shared/src/runner.ts now owns the format: processKey, installerKey,
parseRunnerKey, processOwner and PROBE_USER_ID. A server context carries its
typed owner, so the pool, gateway, portal and refresher no longer re-derive it.

Fixes the runner admin page listing the probe process as a user with the nil
UUID as its id.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Writes both called upstreams.invalidate* directly and emitted an event the
pool also listened to, and the events were too coarse for the pool to tell a
rename from a new package. Renames, icon changes and tool switches killed
every process of a server; an access change killed the per-user processes of
users who kept access; a group change killed members' processes on every
server.

- server.changed now means what a server lists or shows changed;
  server.runtime.changed means what its processes start with changed (or it
  was deleted). Only the latter restarts processes and reconciles the runner.
- access.changed always names the users; the pool drops only the processes
  of those who can no longer reach the server.
- Hiding a server emits user.tools.changed, not user.server.changed.
- user.server.configured is gone: the refresher lists on user.server.changed
  (when the server is ready for the user), so emitters no longer have to
  fire two events in order.
- Services no longer call invalidateServer/invalidateUser; tests assert the
  emitted events, and the pool's reactions are tested on the real pool.
- settings.changed is typed from InstanceSettings; unused payload fields go.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The /mcp gateway, tool test calls and the refresher needed more than the
UpstreamPool contract, so they downcast app.upstreams with an instanceof
check and carried 'upstreams | null' and 'toolRefresh | null' paths that only
existed for the small test double. The full contract now lives in
services/contracts.ts, the test double implements all of it, and the
refresher always exists.

buildApp no longer starts the refresh schedule behind a NODE_ENV check;
main.ts starts it after listening, so tests never race a timer. The gateway
takes the app as its deps instead of two hand-built copies.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Instance and user values were decrypted by three copies of the same code
(access.ts and two loaders in upstream/context.ts), and whether a server runs
one process per user was restated in the admin detail, in SQL for the
portal activity page, and by building fake contexts in runner reconcile. The
refresher used the probe's nil UUID as 'no user'.

access.ts now exports resolveVariable, isPerUser and loadServerContexts,
whose null user reads what every user shares. The admin list's setupNeeded
reads that context instead of its own query, so it agrees with /mcp on a
required instance value that can no longer be decrypted (it showed nothing to
fix while users saw 'unavailable').

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Cutting a user off was spread over four places: disabling destroyed sessions
in the admin service but revoked grants from an event listener filed under
the OAuth routes (audited with no actor), an admin reset did both itself, and
a user's own password change had the route revoke grants while the service
destroyed sessions. signOutEverywhere (services/auth/sign-out.ts) now does
both for all three, and the own-password change audits inside its service.

routes/oauth/maintenance.ts registered no routes and ran every periodic job,
including the upstream OAuth flow purge hidden inside the OAuth AS cleanup.
It is now plugins/maintenance.ts with one named job per purge, and its timer
starts from main.ts like the tool refresh schedule.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sessions, admin API tokens, the admin MCP's internal call and OAuth access
tokens each selected the same seven user columns and built AuthUser field by
field, while AuthUser itself copied the shared Me schema the routes return.
AuthUser is now Me, and signedInUserColumns plus toMe in auth/accounts.ts
are the one mapping; services import Me from shared instead of the Fastify
augmentation module, which pulls in the refresher and the OpenAPI plugin.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The two endpoints were near-copies: the JSON-RPC error helper, the
initialize check, the session lookup and 404, the header copy-over, hijack
and the 500 fallback in the routes, and session creation, the per-user cap,
closeWhere and the idle sweep in the two session classes. lib/mcp-endpoint.ts
now holds both; each endpoint brings only its authentication and its server.

mcphub names itself to clients and upstream servers with the API's package
version instead of four copies of a hard-coded one. The /mcp instructions no
longer claim descriptions start with the server's name, which the gateway
stopped doing. A session's grant is never null since MCP keys went, so the
client-access branch for it is gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every pgEnum restated the values of a shared schema (role, user status,
transport, runtime, install status, variable scope, start mode, upstream
OAuth mode, tool call status), and two shared enums were inline in object
schemas. A value added on one side only now fails to typecheck instead of
failing at runtime. drizzle-kit reports no schema change.

The schema now imports @mcphub/shared, so the db:* scripts resolve it from
source like dev and db:seed already did.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A server's presentation fields were declared separately in ServerSummary and
PortalServer and copied field by field into six API mappers; a new field had
to be added to all of them. ServerCard in shared now holds them, both schemas
extend it, and serverCard() is the one mapper. toToolInfo and the
'catalog tools of one kind' query move to services/server-views.ts, so the
admin service no longer imports the portal for them. The <slug>__<tool> name
and its validity rule come from shared instead of three template strings and
a gateway-only regex.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every write already marks auth, portal and admin queries stale
(invalidateAfterWrites), so the per-mutation invalidateQueries lists were
redundant. Route guards now read auth state through loadAuthState, which
refetches it when stale, so no caller has to await an invalidation before
navigating after a password or role change. removeQueries for deleted
items' detail queries stays.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
lib/queryKeys.ts is merged into lib/queries.ts: every key is built next to
its fetcher and taken from its factory (xxxQuery().queryKey) elsewhere, and
SERVER_STATE_ROOTS lives with the keys it describes. The UI filter types move
out of lib/endpoints.ts, which now takes the shared request body and query
schemas instead of hand-written shapes. Polling intervals live in queries.ts
(the portal list polls while a check runs, the runner page states the real
interval), the dashboard's recent errors are a plain query instead of an
infinite one with a one-caller limit, and the API token list uses
apiTokensQuery, collapsed into features/admin/ApiTokens.tsx for its one caller.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
lib/optimistic.ts (useOptimisticMutation with cachePatch/listPatch) backs
every switch that flips before the server answers: cancel, snapshot, patch,
and on failure either undo that one change or restore the snapshot. The
copies in usePortalMutations.ts, useServerMutations.ts and AccessProfiles.tsx
use it; useSetClientProfiles moves to usePortalMutations.ts with the other
portal mutations.

components/UpstreamSignIn.tsx holds the upstream OAuth start and disconnect
flow and its Authenticate/Reconnect button for both the admin section and
the portal. The portal disconnect now stores the answer through the portal
store helper instead of patching the cache by hand.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Tool kinds come from ToolKind.options with one label map, exposed tool names
use TOOL_SEPARATOR, roles and user statuses use Role and UserStatus, the
server form uses Transport, and input limits come from the shared schemas
(profile and token names, setup token and display name, current password,
user search). The server form takes its defaults from the shared schemas'
parse, and the authorization parameter check reports the contract's own
message instead of a hand-written list of reserved names.

New in packages/shared: normalize.ts with toSlug and toVariableKey, used by
the server form and the .mcp.json import. toSlug no longer leaves a trailing
dash after cutting to 32 characters.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
components/ToolCallActivity.tsx is the one body of the admin and portal
activity pages (server and status filters from ToolCallStatus, empty state,
table, load more); the pages only pick their queries, header and extra user
filter. components/ListControls.tsx FilterBar owns the phone toggle, the
grid and Clear filters for the activity pages and the audit log, and counts
active filters from the filter object instead of listing the keys twice.

lib/form.ts holds every form helper (focusFirstInvalid, friendlyMessage,
schemaFields next to the API error glue); the auth pages use
focusFirstInvalid instead of their own copies, and the role choices move to
features/admin/users/roles.ts.

portalState now decides whether a per-user sign-in is needed and whether the
user has to act, which MyServersPage used to recompute. The admin status
badge's comment no longer claims it uses the portal's words.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Removed with no callers: PortalStatusBadge, EnabledBadge, currentPath,
DisabledButton and the deprecated AdminTable alias. issuePathToField is no
longer exported. BulkMenu loses the serverId and ariaLabel its one call never
passed, UserPicker loses the single flag its one filter caller can apply
itself, and ServerForm's VariableText (a near copy of FormTextField with an
unused type prop) gives way to FormTextField with small and transform.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Logs exist for stdio servers only: the server page's tab list decides it,
falls back to Overview for a logs URL on a remote server, and LogsTab no
longer repeats the check. "No one yet" comes from noAccess, which both the
access summary and the Overview tile use. Transport labels live in one map
for the Overview tile and the form's select. The In my MCP switch is one
component for the server card and the server page, picker-versus-ids
comparisons share sameIds, and the Variables tab builds definitions with
the server form's toVariableInput.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Message, request and response sizes, the kill grace, the install log size
and the install timeout ceiling now live in packages/shared/src/runner.ts;
the runner enforces them and the API derives its timeouts and buffers from
them instead of copying numbers by comment.

Two bugs go with it. GET /logs/:serverId returns the newest lines that fit
in MAX_LOGS_RESPONSE_BYTES, so a server with chatty per-user processes no
longer breaks the Logs tab with "runner response too large". And
INSTALL_TIMEOUT_SECONDS bounds the whole install from its request, as
documented, instead of each installer command, so the API (which waits for
the ceiling plus cleanup time) never gives up on an install the runner may
still be running.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
RunnerProcessList and RunnerLogList join the protocol in packages/shared;
the runner's routes return them and Ok, its errors are typed as ApiError,
and the API parses errors with ApiError instead of a cast.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
InstallRequest is StdioConfig's runtime, package, version and command plus
the server id, with the per-runtime package rule, so the runner's own
VERSION and COMMAND regexes and its second validate() pass go, as does the
API's COMMAND_NAME copy (StdioConfig now exports CommandName and MAX_ARGS).
SpawnRequest takes its env keys and values from VariableKey and the
variable value schema, and its arg limit from Arg plus one value, so a
valid server's args fit; the API refuses a longer spawn itself with a clear
message instead of the runner's generic close.

InstallResult.command is now the executable's name rather than the
runner's internal absolute path, which the API only cut back to the name.
commandName() still reads rows written with the old path. This changes the
wire, so RUNNER_PROTOCOL_VERSION is 2.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The API reads RUNNER_PROTOCOL_VERSION from /healthz. A mismatch fails
ensureRunning at once with a log line naming both versions, and the admin
runner page shows it as the runner's error. Reconcile's 404 "older runner"
branch only existed because nothing checked the version, so it goes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
RunnerService was a hand-kept mirror of RunnerClient; it is now the
client's public surface, so a new endpoint touches the shared schemas, the
runner route and the client (plus fakeRunner, which the compiler points
at). status() returns the shared RunnerState instead of an ad hoc Omit.

Dead weight goes with it: the pass-through call() wrapper, the http
client's auth switch that only existed for /healthz (the runner ignores the
header there), and RunnerTransport's pid and exit fields, written but never
read. The contracts.ts pointer to the long gone plugins/runner.ts is fixed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
processes.ts and packages.ts each spawned a detached child as its uid,
killed its group on exit and destroyed lingering pipes after 2 s, and each
built the base environment (PATH, HOME, TMPDIR, LANG, proxy). Both now use
spawnContained (proc.ts) and sandboxEnv (env.ts); which variables win stays
as it was.

The order of stopping processes, uninstalling, stopping again and
forgetting keys was a convention every route had to follow; removeServer
and forget in app.ts now own it, and ProcessManager.killServer goes.

Also: exports used only in their own file are no longer exported, comments
that restated the code are gone, and the Dockerfile no longer says mcphub
applies the runner's container config.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
runner-client.test.ts copied the runner's test token, fixture path, runner
setup and spawn frame builder. The runner's startRunner can now listen on a
unix socket as in production, and the API test imports it with the rest of
apps/runner/test/helpers.ts, as it already imported the runner's sources.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The runner's WebSocket close codes (1008, 1011, 4000) and the `error`
control frame were protocol the header in shared/runner.ts did not
mention; the codes are now RunnerCloseCode in shared and the header lists
both. Timestamps use the shared Timestamp schema.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- main.ts retried runner start-up with its own backoff around
  ensureRunning, which retried with another backoff inside. The client now
  checks once (checkRunning) and main.ts owns the retries, logging why the
  runner is not ready (unreachable or another protocol version).
- The kernel enum was written in RunnerHealth, RunnerStatus and the runner;
  RunnerKernel in shared is the one definition.
- Rows installed by a protocol 1 runner held an absolute path in
  mcp_servers.command, which commandName() cut back to a name on every read.
  Migration 0013 rewrites them once, so the column always holds the binary
  name and is read as it is.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Radix renders a second, screen-reader copy of a toast a frame after it
appears, so getByText on the description found two elements whenever that
frame had passed. Since the page no longer waits for refetches before the
toast, that happened about one run in three.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
db-errors and cursor lived under services/admin although api-tokens and
client access needed them; client access kept its own weaker copy of the
unique-violation check, governance its own LIKE escape, and users and
governance two copies of the page slicing. They are lib/db-errors.ts and
lib/cursor.ts (escapeLike, likePattern, pageOf) now, and Actor/actorOf, used
by every audited write, live with audit().

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every client-access write (server switch, tool switch, bulk by kind) branched
on profile versus client by hand, each with its own pair of tables and the
inverted server semantics (a profile lists allowed servers, a client blocked
ones), and repeated the 'follows profiles: 409' check. SwitchTables now owns
that per owner, switchTables() decides once whether a client's own switches
may be written, and clientRules() is the one 'profiles if any, else own
switches' decision for both /mcp and the access overview.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
/mcp and /mcp/admin were each spelled out in config (resource URIs), in the
metadata module (two document builders and two URL builders), in the
well-known routes, in the gateway's bearer check (ternaries on the
audience), in the authorization request (an admin-on check of its own) and
in the consent code (a '/mcp/admin' suffix check), and the 'admin MCP is
switched on' check was written three times. services/oauth/resources.ts now
names each resource once with its path and name, and derives its URI,
metadata path and URL, document, and whether it is offered.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Drop @fastify/sensible: nothing used its helpers.
- Remove the unused shared schemas AdminChangePasswordBody and PageQuery,
  and ProfileParams (equal to IdParams).
- Make exports that only their own module uses module-private, and drop
  the isPublicAddress, schema and UpstreamError re-exports.
- Drop the `now` parameters of the purge jobs and the `max` default of
  createDb that no caller used, and the consent id length check the route
  schema already enforces.
- Redact the internal auth header by its constant, and use Me directly
  instead of the AuthUser alias.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Name the events services emit now (server.runtime.changed, user.server.changed),
move two doc comments back onto the declarations they describe, and say what
destroyUserSessions, user disable/delete and per-user processes actually do.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The gateway's listing timeout and the pool's connect timeout were two
hand-written Promise.race blocks with their own timers; withTimeout in
upstream/errors.ts now serves both. ServerRow was declared in three modules;
access.ts owns it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
updateServer decided whether to delete the stored tool lists before it wrote
the variables, so a change to variable definitions alone set toolsMayChange
too late and a lazy server kept answering tools/list from the old listing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The duplicate-key, unknown {{KEY}}, args, URL-host and client-id rules
were written in the API's validation, again in the SPA's form check and
template panel, and a third time in the pool's args backstop. They now
live in packages/shared/src/server-rules.ts (serverRuleIssues and
templateUse) and all four places call them.

Behaviour: the form now refuses unknown and misplaced keys before
sending instead of after the API answers; the API also refuses an update
that blanks the client id while a stored client secret stays (the form
already did); a duplicate key reads 'KEY is already defined above'.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AuditEvent.targetType was a free string: the API wrote nine types and the
audit page labelled seven, so access profiles and API tokens showed raw.
AuditTargetType now types audit(), the column and the wire, and the page's
label table must name every type.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The OIDC error codes, the upstream OAuth return path and its query, and
the loopback redirect hosts were typed out on both sides. They now live in
packages/shared/src/links.ts: OidcLoginError and oidcLoginErrorPath,
serverPagePath, withUpstreamOAuthOutcome and readUpstreamOAuthOutcome, and
isLoopbackHost.

Fixes: a disabled account signing in over OIDC was told single sign-on is
not configured; the code is now oidc_account_disabled with a message that
says the account is disabled. The consent screen no longer calls 127.x
hosts other than 127.0.0.1 loopback, matching the API, which refuses http
on them at registration anyway. The loopback set stays 127.0.0.1, [::1]
and localhost (RFC 8252 7.3 and 8.3; MCP clients register localhost).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
LATEST_VERSION and gitRepositoryUrl join isGitPackage in shared; the
admin form's .mcp.json import, the overview tab and the runner use them
instead of typing "latest" and "git+". AuthState now carries
adminMcpUrl, so the automation page no longer builds /mcp/admin from the
MCP URL.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PageQuery and PAGE_SIZE serve the three paged queries and the SPA;
ToolName the two tool path params and isValidToolName; VariableValue the
user and test value bodies and the spawn env; ServerName, ServerDescription
and ServerVariables both the create and the update body. VariableKey and
the {{KEY}} template share one pattern and VARIABLE_KEY_MAX, which
normalize.ts imports. PortalServer.oauth.mode is UpstreamOAuthMode without
none, and RunnerStatus takes its health fields from RunnerHealth.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
RunnerState, used only by the API's runner client, moves there, which
breaks the import cycle between shared/runner.ts and shared/admin.ts.
shared declares itself free of side effects, so the runner's tsup bundle
drops the modules it does not import (auth, admin, portal, links, rules):
88.8 kB to 76.3 kB. A separate @mcphub/shared/runner export is not needed
for that.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The exit log now reads a process's last stderr lines from ProcessLogs
instead of a second 200-line buffer per child; a short-lived run's
lines may include the end of the run before it under the same key. An
invalid key on attach closes with RunnerCloseCode.policy (still 1008).
InstallerIdentity and proc.ts's RunAs were the same {uid, gid}; RunAs is
the one type and ProcessIdentity extends it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ToolCallTable rebuilt shared exposedToolName under the same name; it is
now calledToolName on top of the shared one. ServerPage repeated the
portal server list's polling rule with a literal interval; the query's
own rule applies. The Disconnect confirmation is one DisconnectButton in
UpstreamSignIn, used by the admin's and the portal's sign-in blocks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
RoleBadge and the role select read ROLE_LABEL, and the new-user form
takes its role default from CreateUserBody. The login page's NOTICES
table had one entry: the route accepts notice=setup_done only and the
page takes a setupDone flag.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Forms validated in three ways: schemaFields with friendlyMessage, schemas
handed to TanStack Form with their raw Zod messages (the account page's
name came out as Zod's text), and a hand-written name check on the group
page. The plain wording is now a Zod error map installed at startup, so a
schema's own message (the contract's link rules, the sign-in copy) still
wins and every path reads the same. Forms hand their schema to TanStack
Form; schemaFields, friendlyMessage and the server form's link-field
exception are gone. The login and setup forms pipe into LoginBody and
SetupBody instead of copying the email and password rules, so their
email message is now the common one. The group page checks name,
description and SSO group with UpdateGroupBody and shows the message on
the field.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
invalidateAfterWrites delayed its refetch with setTimeout(0) only so
that four callers could remove a deleted item's detail first. The API
client now reports which successful writes were DELETEs, and the refresh
drops every query whose key holds the deleted id before refetching. The
timer and the four removeQueries call sites are gone, and a deleted
server's tools, access and logs views are dropped too instead of being
refetched into a 404.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The portal and admin activity routes and the audit route each wrote the
same safeParse-or-no-filters function; filterSearch in lib/navigation.ts
builds it from the shared query schema.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The client-access route declared both response shapes inline and the SPA
re-declared them. They now live in packages/shared/src/portal.ts and both
sides import them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Why a server cannot serve a user was worked out four times: buildContext's
status, the pool's probeBlocker, the admin summary's setupNeeded and the
gateway's notReadyReason each re-checked values, install and OAuth state.
buildContext now returns a structured blockers list and derives status from
it; the other three only word that list, so a new blocker lands once.

probeBlocker moves out of the pool, next to loadProbeContext with its admin
wording. The pool's probe() now takes the probe context like callProbeTool,
the caller (testServer, callToolAsAdmin) loads it and checks blockers, and
both share one throwaway-connection block. testServer's 404 comes from the
context load, so the pool's own 'Server not found' result is gone.
buildContext takes the process owner separately from the token owner, so
loadProbeContext no longer patches oauth.owner after the fact.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The gateway's tools/call and the admin and portal test calls each wrote the
same three sentences for a failed call, and the rule that a per-user
process's failure detail is the user's to read was spelled out in the test
calls, the status tool and the user's activity list. gateway/failures.ts
now holds describeCallFailure, failureDetailIsUsers and storedErrorForUser
(with the stored-error constants); the callers only map the result to an
AppError, a tool error or a JSON-RPC error.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The admin's tool switch, the user's hide switches and the client's rules
were loaded and combined separately by the gateway's tools/list, tools/call
and status tool, the client access views and the portal's tool counts, and
the <serverId>/<tool> key was written inline six times. services/visibility.ts
now holds toolKey, AccessRules, loadToolSwitches and visibility(), and every
caller reads serverShown/toolShown from it. The client access page builds
its tool rows from toToolInfo, and rulesOf no longer re-decides in
clientRules a branch it already took.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Admin services audited inside the transaction and emitted after the commit,
while the portal's and the client access routes left both to the route,
after the commit, so every new portal write had to remember two steps and
its audit row was not transactional. Portal and client-access writes now
take a deps object with events (services/deps.ts, which AdminDeps extends)
and an Actor, audit in their transaction and emit afterwards; the
routes/me/* handlers only translate HTTP. Resolving a client or profile
target, with its audit action and the event it emits, moves into the
client-access service.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- The pool's own listener registry (onToolsChanged, ToolsChangedEvent) is
  now the HubEvents entry upstream.tools.listed; the contract method and
  its test fake go.
- listTools reads a lazy server's stored list itself instead of taking it
  from the gateway, so the lazy rule lives in one place.
- invalidateServer/invalidateUser leave the contract: the pool's event
  listeners are the only callers. Tests drop connections by emitting the
  events the app emits.
- Portal server views take a deps object with the refresher, so every
  response (the upstream OAuth sign-out included) can show checking; the
  /check route answers its 404 from an access check instead of building a
  whole PortalServer first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- resolveVariable takes where a user-scope value comes from (a user's own
  row, the admin's test value, or nothing), so the probe context and the
  admin's variable view stop decrypting test values by hand.
- perUserServerIds(db, ids) in access.ts replaces the hand-written
  server-plus-variables loads in the user's activity list and runner
  reconciliation.
- stdioConfigOf(server) maps a stored row to its StdioConfig for the server
  detail, the template re-check on update and the install request.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- RESOURCES records whether a resource needs an administrator and which
  instance setting switches it on. Consent, the audit flag, isOffered and
  the well-known documents (including their cache policy and the list of
  resources) read it instead of comparing names to "admin" and "mcp".
- getInstanceSettings and updateInstanceSettings move to services/settings.ts,
  so the OAuth resources stop depending on an admin service.
- listToolCalls moves to services/tool-calls.ts (its page helpers to
  lib/cursor.ts), so the user's activity page stops importing the admin
  governance module.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PUT /api/admin/servers/:id/values (set_server_values) takes the same body
as the user's and the test values (SetInstanceValuesBody), sets or clears
instance values only, forgets the stored tool lists, restarts the processes
and audits server.values.update by key. The admin Variables tab saves
through it instead of resending the whole definition list with PATCH.

VariableInput.value stays: packages/shared/src/runner.ts derives the
longest variable value from it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The runner route queried the database itself and copied getServerLogs'
process-to-user enrichment. services/admin/runner.ts now holds the status
with slugs and emails, restart and kill (with their audit), and the
processKindOf/userEmails helpers getServerLogs uses too; the route only
translates HTTP and the parseKey wrapper goes.

RunnerProcess gains the same kind as a server log's process (shared, user
or test, one RunnerProcessKind enum), and the runner page labels the
connection test's process instead of calling it shared.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- lib/tokens.ts: safeEqual takes Buffers too (the OAuth client secret and
  the upstream flow's session check stop hand-rolling timingSafeEqual),
  bearerToken replaces two copies of the Bearer regex, and lastUsedDue
  replaces two LAST_USED_RESOLUTION_MS copies.
- loadActiveUser moves next to toMe in auth/accounts.ts, out of the API
  token module; createFirstAdmin uses hasAnyUser.
- loadServerContextForUser (loadServerContexts(...)[0] reordered) goes.
- The pool's PROBE_USER_ID guard in recordFailure could never fire (probe
  connections are never pooled), MAX_STORED_ERROR re-cut text already
  capped, and InstallDeps picked upstreams it never used.
- The gateway's instructions name the status tool from its constant.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DELETE /api/me/servers/:id/oauth silently did nothing for a server that is
not per-user, while the matching authorize route answered 400. Both now
share one per-user check (404 without access, 400 for another mode).

startUpstreamAuthorization stops re-checking transport and mode and takes
no separate owner: the context's oauth (null without OAuth, its owner
otherwise) already says both. The flow's return target is one FlowReturn
type instead of two literal unions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
scheduleInstall kept running installs in a module WeakMap keyed by the
runner instance so several apps could share one process. PackageInstalls
(app.installs) now owns that map with schedule() and reconcile(); admin
services reach it through AdminDeps.installs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
OIDC answered 404 from inside each handler while DCR skipped registering
its route. OIDC now registers nothing while it is not configured too, so a
switched-off feature is an unknown route either way. The route
registration test runs with OIDC configured.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
access.ts imported connectionOf, withReadability and TokenRow from the
upstream OAuth store, which imported ServerRow back from access.ts and threw
the pool's UpstreamError. The pure reading of a token row moves to
upstream-oauth/connection.ts; decryptTokens returns null for an unreadable
row and the token source (which already speaks UpstreamError) decides what
to throw; configuredClient takes only the columns it reads.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A new *_encrypted column that db/reencrypt.ts does not list would stay on
the old key forever without any test failing. The rotation test now
compares the columns reencryptAll reports with every *_encrypted column of
the drizzle schema.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The pool kept the last connect error of each key in an in-memory map for
mcphub__status, next to the same sanitized text on the key's
upstream_tool_lists row (and, for a shared key, on mcp_servers.last_error).
The status tool now reads the tool-list rows, so the map, the pool's
lastFailure and its test fake go.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The two round-2 changes met here: the audit target type became a shared
enum while client-access moved its auditing into the service.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The PKCE helper derived its challenge with the server's own s256, so a wrong
digest or encoding would pass; it now hashes like a client, and the RFC 7636
Appendix B pair is exchanged end to end. Revocation is checked by whether
/mcp still accepts the token instead of calling verifyAccessToken, grant ids
come from the user and admin client lists, and the tests no longer wait on
the internal grant.revoked event. The error page escaping is checked on a
string it actually prints.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A regex inside toMatchObject matches any string under vitest, so the
untrusted-endpoint cases never checked their message; they use
stringMatching now, and the non-https authorization endpoint case uses an
endpoint the SDK accepts so mcphub's own check is what refuses it. The
client list test inserts more clients than the cap and asserts the order
of clients it knows are present; the login audit check runs in the test
that logs in. The route registration list (14 of 23 modules) is dropped:
every module is reached by its own inject() suite.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The pool tests fired user.changed, access.changed and the runtime events by
hand, so a route that forgot to emit would still pass. They now change a
user's values, a server's args and access list, and a user's status through
the API and assert which processes the runner was told to kill. The admin
Test runs through its route, the catalog is read and switched through the
admin tools API, and the recording runner can list fewer tools so a shrinking
catalog comes from a real probe instead of an internal helper.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The gateway suite inserted catalog rows and access rows and fired
server.changed and access.changed by hand. The admin's tool switch now comes
from a Test plus the tools PATCH, the open server is created through
POST /api/admin/servers, and lost access through PUT .../access, asserting
the notification, the refused call and which per-user process was killed.
New: a server an admin disabled leaves tools/list and mcphub__status, its
calls are refused in words without starting a process, and it comes back
when re-enabled. Tests restore what they change and the revocation test uses
its own client, so the suite passes under --sequence.shuffle.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every lazy-start test now creates the servers it needs, so the file runs in
any order. A process exit replaces the hand-fired runtime event, the admin's
tool switch and start mode go through the API, and checks through
POST /api/me/servers/:id/check. The scheduled refresh no longer forges
lastUsedAt: a user who never used /mcp gets no per-user refresh until a
tools/list over /mcp records the use. The setup test holds the runner's
attach to see 'checking' before 'ok' instead of accepting either.

The recording runner tracks which processes are running. A kill assertion
was vacuous because the pool kills a key before every start; teardown is
now checked as 'no longer running'.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The admin server tests spied on server.changed, access.changed and
server.runtime.changed. Those spies are gone; a gateway-backed block checks
that new instance values, new variable definitions and a deletion stop the
running process (and the same values again do not), a tool switch sends
tools/list_changed, and the access cases are covered by the pool and gateway
suites. The probe test asserted the fake's own answer; it now makes the
probe throw and checks the plain message the route answers with.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The admin user and group tests asserted user.changed and access.changed
payloads; they now check sign-out and audit, and the process effects moved
to the gateway-backed pool suite (a member leaving a group loses their
per-user process, the remaining member keeps theirs). The runner cleanup
test asserted that an event fired before forgetUser, which proves nothing
about processes; it now deletes a user with a live per-user process and
checks the process stops and the runner is asked to forget them. The
last-admin guard was exercised with an actor the API cannot produce; two
admins now demote or disable each other concurrently and exactly one admin
remains (this fails without the advisory lock).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Only the missing-state-cookie path of the callback was tested; account
resolution and group sync called resolveOidcAccount directly. A fake OpenID
Provider (discovery, JWKS, PKCE-checking token endpoint, RS256 ID tokens
with the request's nonce) now lets every case run through /start and
/callback: linking by verified email then by subject, session creation and
the safe next redirect, no_account and disabled redirects with their failure
audits, a forged state, an unreachable IdP, provisioning and the admin
group, unverified emails, and linked-group sync. A gateway-backed case shows
a sign-in that drops an IdP group notifies the user's live MCP session and
stops their per-user process.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
When a call on a live per-user connection found the token refused and its
refresh refused too, the token source marked the row for re-authorization
and emitted user.server.changed at once. The pool drops the connection on
that event, which failed the request in flight as 'The connection to the
server closed' before the real reason got there, so the agent never saw
'authorize again'. The event now goes out after the error has propagated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The upstream OAuth tests fired user.server.changed by hand to force a
reconnect; the token source reads tokens per request, so the refresh cases
now run on the live connection (which exposed the wording fixed in the
previous commit), and each per-user test sets up its own server. The
unreadable-token case runs a portal check instead of building the token
source. The portal server tests each create their own server and set the
instance value through the admin API, and no longer spy on events. /readyz
answers 503 once the database is gone, and the reconcile test uses a closed
pool instead of a fake that only stubs transaction().

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Only the login limit was tested. Dynamic client registration allows 20 an
hour per address and the password change ten a minute; both are now checked
with a positive control from another address or within the limit. The CIMD
rebinding tests pinned how many DNS lookups happen; the 'not a public
address' answer already proves the private second answer was consulted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The hourly stats test compared the last bucket with rows inserted at file
setup, so it failed when the hour turned in between; it now looks buckets up
by the rows' own hour. The admin MCP tests switch it on themselves instead of
relying on an earlier test, and the default is read before any test runs.
The test-values and tool test-call suites give tests that change a server
their own server, filter recorded calls by tool, undo a hidden tool, and make
the call that writes the schema they read.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Waiting for what runs after a response (event listeners, process starts and
stops) with vi.waitFor's 1 s default failed a lazy-start test while another
project's suite loaded the machine. The waits go through eventually(), which
allows 5 s.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The forget tests read uids.json, the runner's private storage format, and
pinned how uids are allocated. Homes now come from the HOME the process
sees, forgotten keys from GET /keys, and a recreated key is checked to start
without the old home's files. A fixed 100 ms sleep before checking that a
detached process keeps running is a poll now, the kill test checks its own
key instead of a globally empty list, and the install test counts only the
installer runs it caused.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The freshness tests seeded and inspected the query cache; they now move
between the portal list and the activity page and count the requests, with a
control showing a view is not refetched without a write. Tool fixtures wrote
their kind with the shared toolKind() instead of the literal the API sends.
The modal's 'ignores outside clicks' passed because the event never reached
Radix; an outside click is now a press then a click after Radix listens, and
a dismissable modal closing on it is the positive control. The shared-server
check panel test gets a positive control in the same render, and the
variables test waits for the installing poll instead of invalidating queries.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
setInstanceValues, setTestValues, setUserVariables and the instance values
of create/update now share applyValues: the id check, what clears, and the
keys the audit names. Each caller passes how its column is written.
VariableInput.value reuses VariableValue.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
callGatewayTool now uses visibility(switches, rules).toolShown, the rule
tools/list uses, and branches on the admin switch only to choose the
message, so a new switch cannot hide a tool from the list while calls
still run it. checkToolCall returns the switches with every context.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The gateway's portal link uses serverPagePath. FlowReturn moves to
shared links.ts, serverPagePath and returnPath take it, and the flows
return_to column is typed with it, so no string is turned back into the
union (type only, no migration).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The pool no longer writes mcp_servers.last_error, which now holds
install errors only (a migration clears the connect errors left there).
The admin Overview shows the failed check's own error under Startup and
titles the server's error as an install failure.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The refresh after writes guessed a deleted id from the last segment of
any DELETE path, so stopping a shared runner process (keyed by its
server's id) dropped every cached query of that server. Requests now
declare what they delete (`deletes`), the remove endpoints set it, and
the path guessing is gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
docs(trail): learnings on change events, /mcp auth, runner capabilities and SPA freshness
All checks were successful
CI / check (pull_request) Successful in 3m0s
7c1a62a9d4
Replaces three learnings the refactor made stale (MCP keys, a deleted
docker.ts path, leftover per-mutation invalidations) and records the event
vocabulary decided here.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
marti merged commit 5df142f067 into develop 2026-11-16 22:55:33 +01:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
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
marti/mcphub!60
No description provided.