Repository navigation
feat(ui): activity scope filters, views and deep links (Spec 109-k) - #1385
Merged
Merged
Conversation
Every <dialog class="modal"> now opens via showModal()/close() through a shared useDialogOpen composable instead of the `open` attribute or a `modal-open` class toggle, so a modal can never be painted over by the sidebar or header regardless of z-index (the Add Server modal bug, H4). Adds frontend/src/assets/z-index.css as the single source for the sidebar < header < dropdown < modal < toast scale and retires the ad-hoc z-40 on the sidebar's drawer-side. Also folds in two small header changes that touch the same files: Add-to-MCPProxy button state and header layout groundwork.
Cross-surface UX fixes with no dependency on later PRs in the spec:
- `/` lands on the Overview panel (interim step before Home in a later
PR); `/usage` and `/overview` stay deep-linkable (FR-051).
- Server detail and Settings tabs read `?tab=` on mount and write it
back with router.replace on change, keeping other query params
(FR-016).
- Settings is named "Settings" everywhere (sidebar, route title, H1,
document title), its tabs use line icons instead of emoji, and the
"Server Edition" tab is gated on the runtime edition
(systemStore.status.edition, now carried on every SSE status frame)
rather than on whether the config happens to have a server_edition
key (FR-056).
- Tool review states use one vocabulary — Approved / New, needs review
/ Changed, needs review — with the `awaiting` filter value removed;
the Tools page's "Needs review" stat is a link to /review, backed by
interim redirects to /servers (?status=needs_review) and
/servers/:name (?tab=tools) until a later PR ships the real review
views (FR-027, T026a).
- One pure function, contracts.AnnotationTier, computes a tool's tier
(read/write/destructive/unannotated) from its annotations; GET /tools
and GET /servers/{id}/tools carry it, and the Web Tools page and CLI
`tools list --tier` (`--risk` kept as an alias) use it instead of each
deriving their own — the CLI's old `--risk` read a field
(annotations.operation_type) that doesn't exist on a real payload, so
it matched nothing (FR-028, X11).
- Count charts (calls per tool, activity over time) use integer ticks,
and the excluded "never completed a call" group is titled "Calls to
unknown tools" (FR-074).
- "Add to MCPProxy" (Repositories + CLI `registry add`), flipping to
"Added ✓ · Open" after a successful add (FR-063).
- The header ProfileSwitcher is hidden until at least one profile
exists (FR-057).
…PR a) - ToolLabels.swift: one shared approval-state and tier label table (Approved / New, needs review / Changed, needs review; Read / Write / Destructive / Unannotated / Unknown), matching the Web/CLI vocabulary. ServerDetailView's approval badge and ToolsView's new tier badge both go through it. - ServerTool/SearchTool decode the backend-computed `tier` field (contracts.AnnotationTier) rather than deriving one from raw annotations. - ServerBrowseView: "Add to MCPProxy", flipping to "Added ✓ · Open" (opens the server) after a successful add.
make swagger, after adding contracts.Tier / Tool.Tier.
Verified findings against 109-a-quick-wins (PR-a of Spec 109).
FIXED:
- z-index: --z-header/--z-sidebar shipped inverted, so the sticky
header painted over the open mobile drawer sidebar instead of the
other way around (the same class of stacking bug this scale exists
to prevent, on the header/sidebar pair instead of sidebar/modal).
Swapped the token values, updated the doc comment and
z-index-scale.spec.ts's ordering assertion.
- useDialogOpen: never listened for the native `close` event a
showModal()-opened <dialog> fires on Escape, so the driving Vue
state desynced from the DOM the first time a user hit Escape on
Repositories.vue's three dialogs, UserTokens/UserServers/
UserActivity's dialogs, OnboardingWizard or ConnectModal — the
dialog stayed closed forever after that (no reopen). Added an
`onClose` hook plus a `close` listener guarded against looping back
on our own close() calls, wired every affected consumer's own
close/reset function through it. AddServerModal/AddSecretModal
(already safe via useModalA11y's capture-phase Escape handler) get
the same wiring for defense in depth. New test:
use-dialog-open-native-close.spec.ts.
- Search tier: GET /index/search always reported tier=unannotated
regardless of a tool's real annotations, disagreeing with the same
tool's tier on GET /servers/{id}/tools. The reported cause (a missing
"annotations" key in server.searchResultsToMaps's tool map) was one
level above the real one: the Bleve ToolDocument never stored
annotations at all, so a search hit could not carry them no matter
what the map-shaping code did. Added a stored (not indexed)
annotations_json field to the Bleve schema, round-tripped through
toolDocument/readToolMetadata, requested it in the shared search
Fields list, and now surface it in searchResultsToMaps. New tests:
bleve_annotations_test.go, search_tools_tier_test.go.
- Tools.vue: selectStatCard's toggle-to-total branch dropped the
filterApproval reset that existed before this PR removed the old
"pending" stat card. Total is the row's other "reset" gesture
(clearFilters resets both filters too); restored it. New test:
tools-total-card-resets-approval.spec.ts.
- macOS ServerBrowseView: the "Added checkmark Open" flow keyed
addedServers on the registry catalog's display name, but the backend
can assign a different name (empty name falls back to the entry id,
a conflict gets de-duplicated) and echoes it in the response body,
which AddServerResult discarded entirely. Now decoded and used,
matching the Web UI's `result.server?.name || server.name`. New
test: APIClientAddServerFromRegistryTests.swift.
- macOS ToolsView: the tier badge rendered nothing at all for a nil
tier (an older core not yet sending the field), while the Web UI
always renders one, defaulting to "Unannotated". Added
ToolRow.displayTier and used it unconditionally. New tests in
ToolLabelsTests.swift.
- cmd/mcpproxy/registry_cmd.go: registryAddErrorOutput's doc comment
was glued to registryAddMessage by a missing blank line, hiding it
from godoc. Reordered; cosmetic only.
REJECTED (false positive for this PR):
- scripts/test-api-e2e.sh's blanket `pkill -f "mcpproxy.*serve"` /
`pkill -f "launcher-server.*--port 39933"` in its cleanup trap is a
real, pre-existing operational risk (can kill another worktree's or
the user's own running instance), but git blame shows these lines
predate every commit in this PR and none of this PR's three commits
touch the file. No tasks.md for Spec 108/109 exists in this repo to
substantiate the finding's claim that removing them was a task this
PR was itself scoped to do. Left alone here rather than fixed blind
without the actual spec to guide the exact requirement (own-PID
tracking vs. a decoy-process proof) on a script every worktree's E2E
run depends on; flagged instead as a follow-up task.
DEFERRED (genuine, not implemented — infra, not a rejection):
- e2e/web-ui-sweep/visual-a11y-sweep.spec.ts has no elementFromPoint
assertion proving the z-index fix above holds in a real browser.
Adding one needs the real launcher (scripts/run-web-smoke.sh) and a
live Playwright run to confirm it actually catches the regression
rather than being vacuously true — this fix-and-verify pass could
not do that locally, so an unverified test was not committed;
flagged as a follow-up task instead.
Verification: go build ./... and -tags server both clean; go vet and
gofmt clean on touched files; go test -race on internal/index,
internal/server (CI skip regex, both bare and -tags server variants),
internal/httpapi, internal/contracts, cmd/mcpproxy, internal/config,
internal/oauth, internal/storage, internal/serveredition/* all green;
golangci-lint v2 (bare and --build-tags server) on touched packages
shows only 6 pre-existing staticcheck issues in test files this PR
never touched; frontend npm ci + npm run build (vue-tsc + vite) +
npx vitest run all green (147 files / 1393 tests, package-lock.json
unchanged); swift test full suite green except one known
environment-caused failure (AppLifecycleTests, caused by a real
~/.mcpproxy/tray-lifecycle.jsonl already present on this shared
machine from outside this session — unrelated to any file this PR
touches, reproduces identically before any of these changes).
Not pushed; branch left detached per instructions.
Verified each round-2 finding against current source before touching
anything; fixed the genuine ones test-first, deferred one with reasons
below. No false positives to reject this round.
FIXED:
1. (high) Repositories.vue: closeAddRegistry()/closeDeleteRegistry() are
wired as useDialogOpen's native-close handler (Escape/backdrop), but
their own addingRegistry/deletingRegistry guard silently skipped the
showAddRegistry/showDeleteRegistry flip. A native close already happened
in the DOM by the time that fires and cannot be undone, so the guard just
desynced Vue state from an already-closed dialog — reopening became a
no-op forever (round 1's H4 bug, reintroduced by round 1's own fix). Split
the native-close handler from the Cancel-button handler; the Cancel/
Delete-cancel buttons keep the guard (now via :disabled) since an
explicit click CAN be blocked mid-submit.
2. (medium) OnboardingWizard.vue: dismiss() (also wired as useDialogOpen's
onClose) awaited up to three sequential engagement-bookkeeping calls
before emit('close'). props.show stayed true for that whole window, so
reopening the wizard from the sidebar Setup entry was a no-op. emit
synchronously first; the bookkeeping now runs decoupled in the
background.
3. (low) ConnectModal.vue: close() (same onClose role) reset several result/
preview fields but not disconnectTarget, so Escape during the "Disconnect
X?" confirm sub-panel left it stale for the next open.
4. (medium-high) internal/runtime/lifecycle.go: annotations_json is only
written at (re)index time, but the reindex trigger is a Hash comparison
that deliberately EXCLUDES annotations (see calculateToolApprovalHash's
own comment in tool_quarantine.go: annotations are unstable across
reconnections, and hashing them in before caused false
"tool_description_changed" spam on every reconnect). So an
already-indexed, otherwise-unchanged tool could never pick up newly
observed annotations short of a manual reindex. Fixed WITHOUT touching
Hash/change-detection (which would reintroduce that exact regression):
applyDifferentialToolUpdate now tracks annotation-only diffs separately
and silently refreshes just those documents (no approval/quarantine
state, no "Tool schema changed" log, no hash rewrite). Covered by
TestApplyDifferentialToolUpdate_BackfillsAnnotationsForUnchangedTool and
...IsIdempotent.
6. (low-medium) RegistryModels.swift: RegistryAddServerErrorBody decoded a
`message` key, but writeRegistryAddError (internal/httpapi/server.go)
serializes the field as `error` — every other error envelope in this API
uses the same shape. err?.message was therefore always nil against the
real backend, so a failed Add-from-Registry always showed the generic
"HTTP 400: ..." text instead of the actual reason. Fixed the CodingKeys
mapping and added a test that asserts on the decoded message text (the
round-1 test used a stub keyed `message`, which "passed" without ever
checking the value — a green test over a broken decode).
7. (low) Same files: round 1's own comment/test claimed the backend
"de-duplicates on conflict" for a name collision. It doesn't —
AddServer (internal/server/server.go) hard-fails with duplicate_name; no
rename/suffix logic exists anywhere in that path. Corrected the
misleading comments in RegistryModels.swift and ServerBrowseView.swift,
and reworked the test's success-case stub to model the one case that IS
real (empty entry name falls back to the entry id) instead of an
invented de-dup suffix.
8. (medium) Settings.vue: hasServerEdition depends on systemStore.status,
populated asynchronously by App.vue's SSE connection in its own
onMounted. On a reload of /settings?tab=teams, Settings.vue's onMounted
could run its `?tab=` membership check before that status frame lands,
silently dropping `teams` with no retry once it arrives. Added a
one-shot retry gated on hasServerEdition, guarded so it never overrides
a tab the user picks in the meantime and is a no-op when the edition
really is personal.
DEFERRED (real, not a false positive, but out of scope for a quick-wins
fix round):
5. (low) internal/index/bleve.go: a pre-105/pre-this-PR on-disk index opens
with its OWN persisted mapping, which never declared annotations_json —
so that field falls to Bleve's dynamic-mapping default (Index=true,
contributes to _all) on a legacy index, while a freshly created index
gets the explicit Index=false mapping added in round 1. Confirmed real:
this is genuine BM25 divergence between legacy and fresh indexes.
NOT fixed here: the obvious-looking fix (disable dynamic mapping) is
actively wrong — output_schema_json has NO explicit field mapping at all
and already relies on the same dynamic-mapping fallback in every index,
old and new alike; disabling it would silently stop storing that field
on every newly created index. A correct fix needs an actual Bleve
mapping-version/migration mechanism (there is none today — the
OutputSchemaHashSchemaVersion precedent lives entirely in the BBolt
approval-record store, not the search index), which is a properly scoped
follow-up, not a round-2 quick fix.
Verification: go build ./... and -tags server; go test -race
./internal/runtime/... (192s, clean); golangci-lint v2 bare and
--build-tags server (only pre-existing, unrelated issues, e.g.
event_bus.go:887 reflect.Ptr); frontend npm run build + npx vitest run
(151 files, 1401 tests, all green; package-lock.json unmodified); swift
test (1179 tests, 1 failure — AppLifecycleTests.
testTheSharedJournalNeverWritesToTheRealInstanceRootUnderTests, a
documented pre-existing environmental flake tied to a real
~/.mcpproxy/tray-lifecycle.jsonl on this machine, unrelated to this diff
and already failing on main).
Verified each round-3 finding against current source before touching anything; fixed the genuine one test-first, confirmed one is already covered by existing tests, and reaffirmed one deferral. No false positives to reject this round — all three findings described the code accurately. FIXED: 1. (medium, T011a) scripts/test-api-e2e.sh's cleanup trap used a blanket `pkill -f "mcpproxy.*serve"` / `pkill -f "launcher-server.*--port 39933"`. Round 1 rejected this same finding on the premise that no tasks.md substantiates it being an in-scope task for this PR; that premise was false — specs/109-ux-navigation- consistency/tasks.md (present on the sibling 109-ux-navigation- consistency branch, both branched from the same commit) lists T011a explicitly under "Phase 2: PR 109-a — quick-wins". Live-verified the actual risk before fixing: this machine had a real tray-managed `mcpproxy serve` (PID 15758) and a second, unrelated worktree's test instance running at the same time — the unfixed script's blanket pkill would have killed both. Replaced both blanket kills with `descendant_pids()`, which snapshots the actual OS-process descendants of $MCPPROXY_PID (recursively, via `pgrep -P`) BEFORE touching it, then reaps only those specific PIDs (and only if still alive) as a fallback for the launcher-test fixture getting orphaned before mcpproxy's own graceful-shutdown reap path runs. Added scripts/test-api-e2e-cleanup-check.sh (the check T011a specifies): starts a decoy `mcpproxy serve` on another port with a scratch data dir, runs the full E2E script, and asserts the decoy is still alive afterward. Ran it for real: 65/66 sub-tests passed (the one failure is the pre-existing, unrelated "server-edition binary present" check, which needs a separately built ./mcpproxy-server and fails identically on main), and the decoy — plus this machine's real tray core — survived the run. 2. (low-medium, T007 Playwright half) e2e/web-ui-sweep/ visual-a11y-sweep.spec.ts had no browser-level proof that the H4 z-index fix (frontend/src/assets/z-index.css) holds under real layout and paint, only jsdom token-ordering coverage. Added "mobile drawer sidebar paints above the sticky header, not under it (H4)": opens the mobile drawer against a real launched instance and asserts via `elementFromPoint` that the drawer, not the header, is the topmost element at a point they both occupy. Verified it actually catches the regression it targets, not just a code read: temporarily re-inverted --z-header/--z-sidebar back to round-1's shipped bug, rebuilt, and reran — the new test timed out failing exactly as expected; restored the tokens and reran the full 25-test suite clean. One real finding surfaced while building this: daisyUI's drawer opens via a CSS `visibility`/`opacity` transition (`allow-discrete`, ~0.2-0.3s), so `elementFromPoint` checked on the very next frame after the checkbox flips can still legitimately see the header for a couple of frames — normal opening animation, not the H4 regression (a permanently wrong settled z-index). The assertion polls for the settled state instead of asserting immediately, so it does not flake on that transition. ALREADY COVERED (not a gap, no change needed): - The finding's other T007 half — "a vitest asserting none of Repositories.vue's three dialogs still uses the `:open` binding" — already exists: frontend/tests/unit/z-index-scale.spec.ts (added in the original PR commit 8bc8d23de, kept through round 1) has both "Repositories.vue dialogs use showModal()/close(), not :open (FR-055)" (lines 71-88, checking exactly the `:open` binding and all three data-test ids) and a broader "every <dialog class=modal> drives its open state imperatively" sweep across all 8 affected components, Repositories.vue included. Wrote a duplicate test file first, then found this and deleted it rather than ship two guards for the same invariant. DEFERRED (confirmed real, reaffirming round 2's deferral — not fixed here): 3. internal/index/bleve.go: re-verified the pre-105/pre-this-PR legacy-index dynamic-mapping divergence against current source. annotations_json still has no on-disk mapping-version guard, RebuildIndex() is still a documented no-op, and output_schema_json still has no explicit field mapping of its own — so it's still true that disabling dynamic mapping to close this gap would silently stop indexing output_schema_json on every freshly created index, on top of every index that already exists today. Round 2's reasoning holds exactly as written: a correct fix needs an actual Bleve mapping-version/migration mechanism, which is properly scoped design work, not a quick-wins round change. Flagging a follow-up task for that design work separately rather than leaving it only in this commit message. Verification: go build ./... and -tags server (-o /dev/null, per the server-tags-build-overwrite gotcha) both clean. No Go, frontend/src, or native code touched this round, so go test -race / vitest / swift test are unaffected by this diff; ran golangci-lint v2 anyway (bare and --build-tags server) — 16 and 19 pre-existing issues respectively, none in any file this round touched (reflect.Ptr inlining, deprecated TopK/Features test usage, deprecated ecdsa.PublicKey.X/Y, ParseDir deprecation — all pre-existing on files untouched by any of the three rounds). scripts/test-api-e2e-cleanup-check.sh and the new Playwright test were both run for real against a locally built instance, not just read. Not pushed; branch left detached per instructions.
Round-4 zcode findings on the E2E cleanup trap (T011a) and a stale Tools.vue stat-card bug. Confirmed genuine, fixed test-first: - F3 (medium): descendant_pids had no test of its own. Extracted it to scripts/descendant-pids.sh (sourced by test-api-e2e.sh) and added scripts/descendant-pids.test.sh, a hermetic unit test that builds a real 3-level process tree and proves the recursive walk reaches a grandchild and great-grandchild, not just direct children. Also extended test-api-e2e-cleanup-check.sh to assert a REAL orphan of the run (the launcher-test fixture, left running by test_launcher_lifecycle Step 5) is actually gone after cleanup, not just that the decoy survives. Wired both scripts into the Makefile (test-descendant-pids, test-e2e-cleanup-check). - F4 (medium): the audit_log sub-test's AUDIT_PID/AUDIT_DATA_DIR/ AUDIT_JSONL_DIR/AUDIT_SERVER_LOG were only reaped on its own fall-through path; an early exit while that sub-test is running leaked them. cleanup() now reaps them too, idempotently. - F1 (medium, partial fix): the descendant snapshot was taken once, before sending the kill signal, missing a child spawned during mcpproxy's own graceful-shutdown window. Now re-snapshotted on every poll of the wait loop while mcpproxy is confirmed still alive. The case where mcpproxy has already exited (crash/OOM) before cleanup() even runs is not fixable without reintroducing the system-wide pattern match T011a deliberately removed (kills unrelated mcpproxy instances) — documented as an accepted, narrow residual gap. - F2 (low): the reap loop now records each descendant's command name at snapshot time and re-checks it before SIGKILL, so a PID reused by an unrelated process in the snapshot-to-reap window is skipped instead of killed. - F6 (low): test-api-e2e-cleanup-check.sh's decoy port was a fixed default (only DECOY_DIR was made unique), colliding between concurrent runs. Now picks an OS-assigned free port. - F7 (low): added --max-time to the two curl calls in test-api-e2e-cleanup-check.sh that lacked it, matching every curl call in test-api-e2e.sh. - Tools.vue activeStatCard (low, flagged rounds 1 and 2, never actually fixed): it only inspected filterStatus, so an approval-only filter (filterStatus empty) still rang the Total stat card as active even though the table was filtered. Total now reads as active only when no filter narrows the table. New regression test: tools-active-stat-card-approval-only.spec.ts (reproduced the bug first, then fixed). F5 (EXIT trap not firing on SIGINT) does not hold up under a faithful reproduction: sending SIGINT to the actual process group (what a terminal's Ctrl-C really delivers) already ran cleanup() correctly on the pre-round-4 code, because the foreground child dies from the same signal, bash's `wait` unblocks, and an untrapped terminating signal still fires the EXIT trap. Verified this directly (group-wide kill -INT and kill -TERM both fired the trap on the unmodified script; only a single-PID kill -INT, which is not what a terminal sends, appeared to hang, and that appearance was itself an artifact of test harness backgrounding setting SIGINT to ignore). Kept explicit `trap ... INT TERM` handlers anyway as harmless, idiomatic defense-in-depth for a supervisor that signals only this process's PID, with an idempotent cleanup() (CLEANUP_DONE guard) so it cannot double-run. Verified locally: go build ./... clean (no Go files touched by this commit); golangci-lint v2 (bare and --build-tags server) shows only pre-existing unrelated findings; frontend build + full vitest run (152 files / 1402 tests) green; scripts/descendant-pids.test.sh green; a full scripts/test-api-e2e-cleanup-check.sh run against a real built mcpproxy/mcpproxy-server passed all 70 E2E tests, confirmed the decoy instance survived on a freshly-picked port, and confirmed the real launcher-server orphan was reaped.
Verify each round-6 finding against the code before fixing; fix genuine
ones test-first, reject/defer two that are out of scope here.
1. internal/index/bleve.go (finding 1, high): an index created before the
annotations_json field mapping existed keeps its old mapping forever
after bleve.Open (no SetMapping in vendored bleve v2.6.1), so the
differential-update backfill's annotations JSON gets indexed as free
text via bleve's dynamic-field defaults, leaking into the field-less
`_all` composite field and skewing BM25 ranking on any upgraded (not
freshly installed) deployment. A full fix needs index-mapping-version
tracking plus rebuild-from-storage, which doesn't exist yet
(RebuildIndex is a stub) -- flagged as a follow-up task instead of
building that here. Applied a bounded, tested mitigation:
warnIfMappingPredatesAnnotations logs an actionable warning on open;
toolMapping.Dynamic = false closes the whole bug class for indexes
created from now on; and an explicit output_schema_json field mapping
(previously undeclared, relying on the same dynamic fallback) closes a
second, pre-existing instance of the same leak that surfaced only once
Dynamic was turned off. New tests: bleve_mapping_migration_test.go.
2. cmd/mcpproxy/tools_cmd.go (finding 4, medium): --tier/--risk/--status/
--approval were only ever applied on the global (no --server) tools-list
path; `--server=x --tier destructive` silently printed every tool
unfiltered. Client-mode (daemon-backed) now reuses
applyGlobalToolFilters, since GET /api/v1/servers/{id}/tools shares
enrichServerTools with the global endpoint and carries the same fields.
Standalone (no-daemon) mode gets a new filterToolMetadataByTier for
--tier (computed locally via contracts.AnnotationTier) and a fast,
explicit error for --status/--approval, which need daemon-persisted
state this path has no access to. A zcode re-review of this fix caught
a residual message bug it introduced: emptying a non-empty standalone
result via --tier fell into the "server doesn't support tools"
diagnostic meant for a server with genuinely zero tools;
standaloneNoToolsMessage now tells the two cases apart.
3. native/macos ServerBrowseView.swift / RegistryModels.swift (finding 2,
medium): "Add to MCPProxy" -> "Added (checkmark) Open" state was tracked
by bare server.id, while the same file's own cross-registry search
dedupe already keys by "registry::id" (catalog ids collide across
registries, MCP-866) -- two colliding cards from different registries
could flip together. Added RepositoryServer.addedKey and switched both
addedServers call sites to it. A zcode re-review found the same
collision class still live in ForEach(results)'s SwiftUI identity and in
addingID; fixed both, plus a stale doc comment that still described the
bug this commit fixes.
4. frontend/src/components/AuthErrorModal.vue (finding 3, medium): the
last dialog left on the old v-if/div modal pattern while its four
siblings were migrated to the browser top layer (FR-055); a 401 raised
while one of those is open painted underneath it. Migrated to a native
<dialog> via the existing useDialogOpen/useModalA11y composables,
deliberately without the click-catcher backdrop form the other dialogs
use (clicking outside must not dismiss this one -- a pre-existing,
audited rule). Replaced the onMounted form-reset with a
watch(props.show), since the dialog no longer unmounts/remounts on
every open/close the way the v-if version did.
5. scripts/test-api-e2e-cleanup-check.sh (finding 5, medium): the T011a
proof's launcher-server pgrep check had no pre-run baseline, so a stray
left by an earlier crashed run or a parallel worktree's own E2E run
produced a false FAIL. Snapshots PIDs before running and diffs with
comm -13 so only a genuinely new PID counts as this run's own leak.
Rejected (not fixed here):
- Finding 6 (specs/109-ux-navigation-consistency/tasks.md T026 vs macOS
DashboardView.swift): tasks.md lives on branch docs/specs-108-109, not
this branch, so it can't be edited from here. The same tasks.md's own
"Follow-ups (not in this spec)" section already lists "a native macOS
Usage view" as deferred future work, directly contradicting T026's
in-scope macOS clause -- a spec/tasks inconsistency for whoever owns
that branch to reconcile, not a reason to invent a new macOS chart
feature inside a quick-wins PR. Flagged as a follow-up task.
Every fix is test-first: internal/index, cmd/mcpproxy and native/macos
each got new regression tests confirmed to fail before the fix (or, for
the macOS swift package which has no such build gate here, verified by
temporarily reverting and re-running) and pass after.
Reviewed with zcode (GLM), the mandated external reviewer for this
branch. It returned a clean pass on internal/index/bleve.go +
cmd/mcpproxy/tools_cmd.go (one residual message bug found and fixed, see
above), a clean pass with three genuine follow-ups on the macOS
ServerBrowseView/RegistryModels change (all three folded into this
commit), and a clean pass with no defects on
scripts/test-api-e2e-cleanup-check.sh. The AuthErrorModal.vue chunk could
not get a completed zcode pass despite five retries over ~20 minutes --
the shared zcode/GLM account was rate-limited (HTTP 429, "Rate limit
reached for requests") by concurrent sibling review sessions running the
same review round in parallel worktrees, not by anything in this diff.
Verified by hand instead, against the identical, already-shipped and
already-tested pattern in AddSecretModal.vue / AddServerModal.vue /
ConnectModal.vue / OnboardingWizard.vue, plus the full frontend build
(vue-tsc + vite) and vitest suite (152 files / 1402 tests, including
auth-single-surface.spec.ts) passing.
Local verification: go build ./...; go test -race on internal/index,
cmd/mcpproxy, internal/runtime (+ subpackages), and an internal/httpapi
tool/tier/search subset; golangci-lint v2 (bare and --build-tags server)
clean on every touched Go package, no new issues anywhere else; npm ci &&
npm run build && npx vitest run (152/152 files, 1402/1402 tests), then
package-lock.json left unchanged (no dependency changes); swift build +
swift test (one pre-existing, unrelated failure confirmed present with
and without this diff: AppLifecycleTests.
testTheSharedJournalNeverWritesToTheRealInstanceRootUnderTests).
Round 7 findings, verified against the code (zcode unavailable this round: 5-hour usage limit, resets 10:35 — reviewed manually instead, same as the finding's own note): - frontend/src/composables/useDialogOpen.ts (high, confirmed): a showModal() dialog's own Escape handling fires a native `cancel` event and, unless that event is canceled, closes the dialog — independently of useModalA11y's document-level keydown listener, whose preventDefault() only affects the keydown event and does not stop the platform's cancel/close algorithm. AuthErrorModal relies on its close() being a no-op while canClose is false, but the native path ignored that gate entirely: Escape closed the <dialog> element regardless, desyncing it from isOpen() (same bricking shape as the existing H4 fix) and defeating the "must not be dismissable" intent the whole modal exists for. Fixed by always preventing the native `cancel` event in useDialogOpen and routing every Escape-driven close through the one close() callback that already owns the permission check, the same way useModalA11y's keydown handler does. Covered by frontend/tests/unit/use-dialog-open-cancel-prevented.spec.ts, confirmed red before the fix (dispatching a synthetic `cancel` event closed the dialog) and green after. - internal/index/bleve.go (medium, confirmed, carried from round 6): round 6 only warned when an on-disk Bleve index predated the annotations_json field mapping, leaving an in-place upgrade with a silently stale mapping (and the resulting free-text/`_all` leakage) until an operator noticed the log line and deleted the directory by hand. Manager.RebuildIndex is a pre-existing unwired no-op stub, not a path to fix this. Replaced the warn-only function with one that closes the stale index, removes its directory, and creates a fresh one with the current mapping automatically — safe because index.bleve is a derived search cache, not a source of truth: an empty index makes every server's tools look newly discovered, and the normal discovery path (applyDifferentialToolUpdate) already reindexes everything as each server reconnects at startup, the same way it backfills a brand-new install. Extended bleve_mapping_migration_test.go with a regression test asserting the rebuilt index carries the current mapping and rejects free-text search on annotations_json, with no operator step. - native/macos/MCPProxy/Views/DashboardView.swift (medium, carried from rounds 5-6): re-scoped rather than implemented. Spec 109 T026's "macOS DashboardView.swift equivalent label" describes the same integer-tick + "Calls to unknown tools" fix web's CallHistogram.vue got, but macOS has no per-tool call-histogram anywhere to attach it to — the file's only chart-like element (Token Distribution) is a per-server token-SIZE bar list with no ticked axis and no "unresolved tool name" concept, a different metric keyed by server name rather than call outcome. Spec 109's own tasks.md lists "a native macOS Usage view" as a Follow-up explicitly "not in this spec" — building one now would be new scope, not a quick win. Added an explanatory comment recording that scope decision next to tokenDistributionSection so this stops being silently re-flagged every round; tracked for the eventual macOS Usage view instead. Verification: go build ./...; go test -race ./internal/index/...; golangci-lint v2 (bare and --build-tags server) clean of new issues; frontend npm ci + vitest run (153 files / 1405 tests green) + vue-tsc build; swift build + swift test (1182 tests, 1 pre-existing failure — AppLifecycleTests.testTheSharedJournalNeverWritesToTheRealInstanceRootUnderTests fails on this machine because ~/.mcpproxy/tray-lifecycle.jsonl already exists from real daily use, unrelated to and unaffected by this comment-only Swift change; reproduces identically without it).
Verify each round-8 zcode finding against the code before fixing; all six
are genuine, fixed test-first, no false positives to reject.
1. internal/index/bleve.go (finding 1, high): the pre-annotations mapping
migration was destructive-before-construct (Close -> os.RemoveAll(path)
-> createBleveIndex(path)), so a failure after the wipe (disk full,
permission error) left the daemon with no index and no way to recover
without operator intervention -- turning a previously-degraded-but-
working deployment (stale mapping, but an openable, functional index)
into a hard outage on every restart. rebuildIfMappingPredatesAnnotations
now builds the replacement at a temporary sibling path FIRST; only once
that succeeds does it retire the original (close, remove, rename the
replacement into place, reopen). If construction fails, the original
index is left untouched and returned as-is, logging the error instead of
failing startup -- the same degraded-but-running outcome round 6 had.
New test: TestRebuildIfMappingPredatesAnnotations_ConstructionFailureKeepsStaleIndexUsable
(forces the failure deterministically via a read-only parent dir).
2. frontend/src/composables/useDialogOpen.ts (finding 2, medium): Escape was
a dead key on the ~8 dialogs (ConnectModal, OnboardingWizard,
Repositories.vue's three dialogs, teams/UserActivity, UserServers,
UserTokens) that pair useDialogOpen alone, with no useModalA11y keydown
listener. handleCancel unconditionally prevented the native `cancel`
event on the assumption a paired keydown listener would call close() --
true only for the ~3 dialogs that pair both composables. handleCancel
now also calls onClose() itself, guarded on isOpen() still reading true
(a no-op, not a double call, when a paired keydown already closed it,
since keydown is synchronous and cancel is a browser-queued task per the
HTML spec). New test dispatches ONLY the native cancel event (no direct
state flip), the case the existing round-7 tests didn't cover.
3. frontend/src/views/ServerDetail.vue (finding 3, medium): App.vue's
<router-view> is keyed on the auth epoch, not the route, so navigating
from one /servers/:serverName to another reuses the same component
instance -- onMounted never reruns, so it never re-read `?tab=`. The
existing props.serverName watch already resets per-server state for
exactly that reason but never touched activeTab, so a stale tab (e.g.
Security) kept showing for the next server even with no ?tab= in its
URL. Factored the onMounted tab-read into readTabFromQuery() and call it
from the watch too, resetting to the default when the new URL carries no
?tab= and honoring it when present.
4. frontend/src/views/Repositories.vue (finding 4, medium): "Added (check)
Open" state (addedServers/addingServerId, Spec 109 FR-063) was keyed by
the bare catalog entry id, while searchServers' own cross-registry dedupe
already keys by `${registry}::${id}` since catalog ids collide across
registries (MCP-866) -- the same bug the macOS half of this PR
(ServerBrowseView.swift's addedKey) already fixed on that side. Added the
matching addedKey() helper on the Web side and switched every
addedServers/addingServerId read and write to it.
5. Makefile / .github/workflows (finding 5, medium): the two new tests
proving the E2E cleanup trap no longer kills unrelated mcpproxy
instances (test-descendant-pids, test-e2e-cleanup-check) were wired into
neither `make test`/`test-e2e` nor any workflow, so a regression
reintroducing the blanket `pkill -f "mcpproxy.*serve"` this PR removes
would pass CI undetected. Wired the hermetic descendant-pids.test.sh into
a new standalone job in unit-tests.yml (no build/binary needed), and the
heavier test-api-e2e-cleanup-check.sh (needs the built binary, re-runs
the full E2E suite as a subprocess) into release-qa-gate.yml's
suite-api-e2e job right after the API E2E suite step, doubling that
job's timeout budget accordingly.
6. cmd/mcpproxy/tools_cmd.go (finding 6, medium): --tier/--risk accepted any
string with no validation; a typo like `--tier destrutive` silently
matched nothing via strings.EqualFold and exited 0 with an empty table --
a CI or audit script grepping for e.g. destructive tools reads that as
"the host has none" instead of "the flag was misspelled". Added
validateTierFilter, checked in runToolsList before any of the three list
paths (global/client-mode/standalone) dispatch; names the actual flag
(--tier vs --risk) in the error since resolvedTierFilter merges them.
Manually verified against a live scratch instance: `--tier destrutive`
now exits 1 with the flag list; `--tier read` still works.
Local verification: go build ./... and -tags server both clean; go test
-race on internal/index and cmd/mcpproxy (touched packages) pass;
golangci-lint v2 (bare and --build-tags server) clean on touched files, only
pre-existing unrelated debt elsewhere; frontend npm run build (vue-tsc +
vite) and full npx vitest run (154 files / 1410 tests) pass; manually built
and ran a scratch mcpproxy instance to exercise the bleve reopen path and the
new --tier validation end to end.
Co-Authored-By: Claude Sonnet 5 <[email protected]>
Spec 109-k FR-080a (url-filter-contract.md "Backend gate"): a caller that is not one of our own UIs must not get unfiltered rows presented as filtered. rejectUnsupportedScopeFilters answers 400 unsupported_scope_filter for a profile/client/token (or the pre-existing `agent` alias of token) query parameter this build does not support, checked before any storage read. GET /servers, /tools, /sessions and /tokens now call the gate (empty supported list in this PR; Spec 108-e fills it in). GET /api/v1/status gains features.scope_filters, omitted while the list is empty.
…eve_tools is called Spec 109-k / audit finding F-Token: ServerTokenMetrics.Estimated (and the echoed UsageAggregateResponse.tokens_saved_estimated) tells callers whether AverageQueryResultSize/SavedTokens is a synthetic per-topK simulation (no retrieve_tools call observed yet) or derived from the real average response size of actual completed retrieve_tools calls (usage aggregate, ~4 bytes/token). resolveAverageQueryResultSize is the pure decision; wired into Runtime.CalculateTokenSavings and buildUsageResponse. Also applies the FR-080a gate (previous commit) to /activity, /activity/export, /activity/summary and /activity/usage — /activity and /activity/export keep honouring the existing `agent` filter unchanged.
url-filter-contract.md: --view (calls|system|all, default all; overridden by an explicit --type) on list/watch/export, and --from/--to as aliases of --start-time/--end-time on list/export, accepting the same relative shorthand as the Web composable (-1h/-24h/-7d/-30d/-Nm). On 'activity summary', --from is an alias of --period restricted to those four values (FR-075); --to is rejected there. 'activity watch' bounds streamed records to [--from,--to] and exits cleanly once --to has passed, instead of reconnecting forever. Also applies the existing --tool "server:tool" split rule consistently via a shared splitActivityTool helper, reused by list and export. activityExportQueryParams now returns an error (relative-time parsing can fail), so its one existing caller/test is updated for the new signature.
contracts/cli.md: a new "Token savings: ~N tokens/request" summary line directly after "Servers:", suffixed " (estimate)" while ServerTokenMetrics.Estimated is true. Sourced from a new cliclient GetTokenStats (GET /api/v1/stats/tokens) call, best-effort: a scoped (agent token) caller or a daemon with no tokenizer configured simply omits the line.
… estimate fields make swagger, after adding @failure 400 (unsupported_scope_filter) to GET /activity/export, /servers and /tools, and picking up the new ServerTokenMetrics.Estimated / UsageAggregateResponse.tokens_saved_estimated fields.
Single source of truth for the URL filter contract (specs/109-ux-navigation-consistency/contracts/url-filter-contract.md): registerScopeParam + useScopeQuery(page), with the full parameter table (server, tool, session, status, from/to, view, type, tab, q, tier/risk, approval, auth_type, change, source, focus, and profile/client/token gated behind features.scope_filters). Implements the REST mapping rules (tool split, the session ws- prefix, the Usage `window` mapping incl. the window=all-when-absent case, the Web-only status=other bucket), sticky carry via linkTo, unknown-param preservation, and chips. Not yet wired into every scope-aware page — see PR description for what still needs Activity.vue/Servers.vue/macOS/108-e-dependent follow-up.
url-filter-contract.md link map: a tool row's usage count links to
/activity?view=calls&tool=<server:tool> via useScopeQuery('tools').linkTo, so
its Calls follow the same URL contract Activity will read. A zero-usage row
stays a plain "0" (nothing to show).
…eve_tools data Spec 109-k / audit finding F-Token: the "Tokens saved per request" tile now shows a small "estimate" badge while the backend reports tokens_saved_estimated=true, and none once a real average is available. Adds the estimated/tokens_saved_estimated fields to the TS contract types.
…round 1)
realRetrieveToolsAvgRespBytes looked up snap.Tools[toolKey("", "retrieve_tools")],
but applyToolRollup's default case drops every internal_tool_call record
(retrieve_tools included) before it ever reaches a.tool(...) — by design, so
retrieve_tools never gets a per-tool row. The lookup therefore always missed,
so ServerTokenMetrics.Estimated could never become false and the "estimate"
badge/suffix could never clear, even after real usage.
Adds a dedicated (not per-tool) UsageAggregate counter —
RetrieveToolsRespBytesSum/RetrieveToolsSizedCalls, folded by
applyRetrieveToolsSizing on every successful, non-truncated retrieve_tools
call (reusing the existing truncatedBuiltinOverstatesDelivery exclusion) —
and reads it via the new AvgRetrieveToolsRespBytes(). No AdmissionVersion bump:
this adds a value alongside Tools/Buckets without changing what they admit.
Found by zcode (GLM) review, round 1.
… (Spec 109-k) Also notes the --tool server:tool split rule and that --to is accepted but always rejected on 'activity summary'.
…, F6, F7)
F1 (high): the SSE envelope's "timestamp" is a Unix-seconds JSON number
(internal/httpapi/server.go emits time.Now().Unix()/evt.Timestamp.Unix()),
not an RFC3339 string. Reading it with getStringField always got "", which
the old string-based activityWatchInRange treated as "malformed, pass
through" — so --from/--to filtered nothing against a real daemon while unit
tests (which fed RFC3339 strings) stayed green. activityWatchInRange now
takes a time.Time; the new eventTimestampFromWrapper reads the real Unix
number.
F4 (low): an unbounded relative amount ("-999999999d") could overflow the
int64 duration multiplication and resolve to a bogus (or future) timestamp
instead of failing. Bounded to 100000 units.
F5 (medium): a relative --to (e.g. -30m) always resolves to the past, so
watch exited instantly and silently despite the flag help advertising
relative values for it. --to on watch must now be an absolute, future
RFC3339 timestamp; rejected otherwise with a clear error.
F6 (medium): the --to cutoff was checked only inside watchActivityStream,
reachable only after a successful connection — with the daemon unreachable,
watch reconnected forever regardless of an elapsed --to. Now also checked in
watchWithReconnect's retry loop.
F7 (low): activityWatchFromTime/activityWatchToTime were only ever SET when
the corresponding flag was non-empty, never reset otherwise — a hazard for
in-process reuse (tests) sharing these package-level vars across watch runs.
Now reset to zero at the top of every run.
Found by zcode (GLM) review, round 1.
…vation bugs (zcode round 1)
F1 (major): setAvailableFeatures had no production caller — GET /api/v1/status
features.scope_filters was never read anywhere, so useScopeQuery's
profile/client/token rows could never un-hide even once Spec 108 ships the
backend feature. Adds systemStore.fetchScopeFilterFeatures() (GET
/api/v1/status -> setAvailableFeatures), called from App.vue's onMounted
alongside fetchInfo/fetchRouting (same admin-only gating; the SSE "status"
event carries a narrower payload and does not include `features`, so this has
to be a REST fetch). Extends api.getStatus()'s return type (StatusResponse)
with the optional `features` field.
F3 (two related bugs in set()/clear()):
- A valueless query param ("?bare", vue-router parses it as null) was
dropped by every set()/clear() call, however unrelated to it — violates
"unknown parameters are preserved untouched" (url-filter-contract.md rule
6). set() now keeps null values through the copy.
- clear() with no names targeted every registered param for the page
without checking availability, so it would have stripped a hidden
?profile= from the URL before scope_filters exists — violates "kept
untouched in the URL" for an unavailable parameter (rule 7). clear()'s
default target list is now filtered through isAvailable.
Found by zcode (GLM) review, round 1.
zcode (GLM-5.3) review of 109-a-quick-wins...109-k-activity-scope-filters
(read-only, --mode plan) ran 3 of 5 chunks to a real verdict before hitting
the provider's usage-limit window; the other 2 (frontend composable/wiring)
came back UNREVIEWED. All 6 findings from that round were verified against
the current source and are addressed or rejected below.
Fixed:
- cmd/mcpproxy/activity_cmd.go: `activity watch -o json` (NDJSON) printed the
raw SSE payload and returned before the --view/--type/--server/--from/--to
filters ever ran, making the whole FR-075 filter surface a silent no-op in
JSON mode. Filters now run first; JSON is emitted only for a record that
passes them.
- cmd/mcpproxy/activity_cmd.go, docs/cli/activity-commands.md,
frontend/src/composables/useScopeQuery.ts: url-filter-contract.md rule 8
("Contradictory parameters") was implemented nowhere -- CLI, Web composable
and CLI docs all silently kept the explicit --server/URL server and
dropped the tool-prefix server instead of failing loud. splitActivityTool
now returns an error ("--server X conflicts with the server in --tool
Y:z") that `activity list`/`export` surface via exit 1 before any request;
splitScopeTool now reports `conflict: true`, and useScopeQuery's toRest()
returns null (no REST call) with both `server`/`tool` chips marked
`conflicting`, matching the CLI. Frontend behavior change is currently
dormant: no page in this branch calls toRest() with a `tool` value yet
(Tools.vue only uses linkTo; Usage.vue doesn't import the composable) --
Activity.vue wiring is Phase 10 (T118/T119), tracked separately.
- internal/runtime/usage_aggregate.go, token_metrics_estimate.go: a
deployment whose retrieve_tools responses routinely exceed
tool_response_limit left RetrieveToolsSizedCalls at zero forever (every
observed call truncated), so ServerTokenMetrics.Estimated never flipped to
false even though real calls had completed -- contradicting its documented
contract. Added RetrieveToolsObservedCalls/HasObservedRetrieveToolsCall,
counted independently of truncation. realRetrieveToolsAvgRespBytes now
falls back to tool_response_limit (a conservative stand-in for the
delivered size) when every observed call was truncated, instead of
reporting the synthetic simulation forever. An exact sized (non-truncated)
average still wins when available.
- internal/httpapi/scope_filters_gate_routes_test.go (new): the existing
gate tests called rejectUnsupportedScopeFilters directly, so a refactor
that dropped the call from a real handler would leave the suite green --
exactly the version-skew FR-080a exists to prevent. Added tests driving
all 8 gated routes (activity, activity/export, activity/summary,
activity/usage, servers, tools, sessions, tokens) through the production
chi route table via (*Server).ServeHTTP, plus the agent-exemption pair on
the two routes that honour it. Verified these catch a regression by
temporarily removing one handler's gate call and confirming the new test
fails (then reverted).
- internal/runtime/calculate_token_savings_wiring_test.go (new): no test at
any level called Runtime.CalculateTokenSavings -- the Estimated wiring, the
tool_response_limit fallback, and the SavedTokens/percentage zero-total
clamp were untested end to end. Added coverage through a real Runtime.
Rejected / deferred (no code change):
- "review-process" finding: reports the review's own execution status
(3/5 chunks reviewed, 2 UNREVIEWED on a Z.AI usage-limit window). Not an
actionable code defect.
- Cross-referenced spec gap (tasks.md Phase 10, T116/T118/T119/T122): this
diff indeed makes no changes to Activity.vue, Sessions.vue, Servers.vue,
router/index.ts, or native/macos/ -- confirmed against
specs/109-ux-navigation-consistency/tasks.md on docs/specs-108-109, all
four tasks are still open there. That is the PR's own remaining scope
(US6/Phase 10 UI wiring), not a regression this review-fix round
introduced, and rewriting Activity.vue + Sessions.vue + Servers.vue +
router + the full macOS Swift surface is a separate, substantial body of
work well beyond a review-fix pass. Left for the branch's own remaining
tasks / a follow-up session.
Verification: go build ./...; go test -race on cmd/mcpproxy and
internal/runtime (full suites); go test -race with -tags server and the
CLAUDE.md CI -skip regex on internal/httpapi; golangci-lint v2
(.github/.golangci.yml) bare and with --build-tags server on the touched
packages (2 pre-existing, unrelated issues in files this diff does not
touch; zero new); frontend: npm ci, vue-tsc + vite build clean, npx vitest
run (156 files / 1446 tests green, package-lock.json unmodified). No REST
contract, oas/swagger, or built-in MCP tool schema changes, so no regen
needed.
Both round-2 findings verified against current source (HEAD 38703cdd9,
"fix: address review round 1"). No code change required.
Rejected / deferred (no code change):
- "Reviewer unavailable this round" (zcode CLI, N/A file): all 5 zcode
chunks hit the same account-wide Z.AI error 1308 ("Usage limit reached
for 5 hour", 429) reported in round 1's identical lockout window,
meaning the quota deficit has now persisted across two consecutive
review rounds with zero successful calls. Per the task's standing
instruction to use only zcode (no codex/opencode fallback authorized),
no substitute reviewer was run. This is a report on the review
process's own execution status, not an actionable code defect --
same disposition as round 1's identical "review-process" finding.
- Cross-referenced spec gap (specs/109-ux-navigation-consistency/tasks.md
Phase 10, T116/T118/T119/T122, via docs/specs-108-109): re-verified --
this branch still makes no changes to frontend/src/views/Activity.vue,
Sessions.vue, Servers.vue, frontend/src/router/index.ts (still a
standalone /sessions route, not the T119 redirect into
/activity?view=sessions), or any file under native/macos/. This is the
exact finding round 1 already investigated and explicitly deferred
("the branch's own remaining tasks / a follow-up session") -- not a
regression this round-1 fix commit introduced, and not new information.
T118 (Activity.vue views/folding/column-hiding/block-reason/Duration
fix + absorbing Sessions.vue), T119 (router redirect + Servers.vue/
Usage.vue wiring) and T122 (macOS ScopeFilter + ActivityView.swift
segments/filters/folding, with T116's Swift test suite) are Phase 10's
own implementation tasks in specs/109-ux-navigation-consistency/tasks.md
on docs/specs-108-109 -- a substantial, separately-scoped feature build
(new Vue views, a router change, and the full macOS Swift surface with
its own swift test verification), not a defect a review-fix round
should rush through untested. Left as-is for the branch's own remaining
implementation work.
Verification (no files touched, re-confirming branch health only):
go build ./...; go test (cmd/mcpproxy, internal/runtime full suites);
go test -race -tags server with the CLAUDE.md CI -skip regex on
internal/httpapi; golangci-lint v2 (.github/.golangci.yml) bare and with
--build-tags server on internal/httpapi, internal/runtime, cmd/mcpproxy
(same 2 pre-existing, unrelated issues as round 1: event_bus.go govet
inline hint, contracts_test.go SA1019 on deprecated Config.TopK; zero
new). No frontend, native/macos, or REST-contract files changed, so no
vitest/swift test/oas regen needed this round.
Round-3 finding verified against current source (HEAD 0ecfd795b, "fix:
address review round 2"). No code change required.
Rejected / deferred (no code change):
- "Reviewer unavailable this round" (zcode CLI, N/A file): all 5 zcode
chunks (internal/httpapi+oas; internal/runtime+contracts;
cmd/mcpproxy+docs/cli; frontend/src/composables/useScopeQuery.ts;
frontend wiring App.vue/Tools.vue/Usage.vue/system.ts/api.ts/types)
hit the identical account-wide Z.AI error 1308 ("Usage limit reached
for 5 hour", HTTP 429, providerId account:zai-individual-coding-plan)
reported in round 1 and round 2's same lockout window -- zero
successful zcode calls across three consecutive review rounds now.
Re-verified live with two extra probes after the 5-way launch (a
trivial 60s prompt at 00:32 UTC): identical error, with retry-after
counting down correctly (7500s then 7401s, ~99s apart matching the
real wall-clock gap), confirming a genuine live countdown on a hard
quota cap rather than a stale/cached error -- it will not clear with
further retries inside this session (~2h remaining). Per the task's
standing instruction to use only zcode (no codex/opencode fallback
authorized), no substitute reviewer was run. This is a report on the
review process's own execution status, not an actionable code
defect -- same disposition as round 1 and round 2's identical
"review-process" finding.
Verification (no files touched, re-confirming branch health only):
go build ./...; go test -race (cmd/mcpproxy, internal/index,
internal/cliclient, internal/contracts, cmd/generate-types full
suites), go test -race ./internal/runtime/... (all subpackages); go
test -race -tags server with the CLAUDE.md CI -skip regex on
internal/httpapi and internal/server; golangci-lint v2
(.github/.golangci.yml) bare and with --build-tags server on the
branch's touched Go packages (cmd/generate-types, cmd/mcpproxy,
internal/cliclient, internal/contracts, internal/httpapi,
internal/index, internal/runtime, internal/server) -- same 8
pre-existing issues as before, all in files this branch does not
touch (event_bus.go govet inline hint; contracts_test.go,
diagnostics_fixers_test.go, e2e_config_auto_refresh_test.go,
socket_e2e_test.go staticcheck SA1019/QF1012 on deprecated
Config.TopK/Features and WriteString(Sprintf(...))), zero new;
frontend: npm ci, vue-tsc + vite build clean, npx vitest run (156
files / 1446 tests green, package-lock.json unmodified). No REST
contract, oas/swagger, built-in MCP tool schema, or native/macos
changes this round, so no regen or swift test needed.
Wire Servers.vue to the url-filter-contract's `status`/`q` parameters (Spec 109-k, T119 remainder). The `/review` route (T026a) has redirected to `/servers?status=needs_review` since it landed, but Servers.vue never read `status` from the URL at all, so that redirect silently landed on the unfiltered server list. Reads `status` and `q` on mount and on route change (mirrors Tools.vue's existing one-directional `q` pattern); `needs_review` covers both server-level quarantine and tool-level pending/changed quarantine (ServerCard's own "needs review" signals). Both parameters stay client-side only per the contract (`GET /servers` takes no query string) — new test: frontend/tests/unit/servers-scope.spec.ts. Round-5 zcode findings, disposition: 1. (review-process, high) Confirmed but not a code defect: zcode is still quota-limited account-wide (error 1308, retry-after ~5232s as of this round, reset ~02:35 UTC) — the same lockout reported in rounds 1-4. Re-verified directly (`zcode doctor` healthy, a live prompt call still 429s). Per this round's brief, codex and opencode are both off-limits here, so no substitute reviewer ran. This round is UNREVIEWED by an external model, same as rounds 2-4. 2. (spec-completeness, medium) Confirmed genuine and independently re-verified against specs/109-ux-navigation-consistency/tasks.md (docs/specs-108-109): Phase 10 / PR 109-k does assign T118 (Activity.vue view switcher + Sessions.vue merge + folding/column-hiding/block-reason), the router/Servers.vue/macOS remainder of T119/T121a/T122, and their tests (T112, T113, T116) to this PR, and none of it has landed. Checked the audit report directly: S1/O1/S3 (the carve-out this round's brief named) are ServerCard sign-in, import self-filter and stale-detail refetch — unrelated to Activity/Sessions/router/macOS, so the carve-out does not cover this gap. Not fixed in this round. Scoping it out: T118 alone is a rewrite/merge of an already-2332-line Activity.vue with Sessions.vue's content, plus folding, column-hiding and a Duration fix; T122 is macOS Swift (AppState.swift + ActivityView.swift) with its own test suite; T119's router piece is coupled to T118 (redirecting /sessions to a view Activity.vue does not yet render would break navigation, not fix it). Digging into T113/T111 also surfaced that Tools.vue's own status/tier/ approval filters are still local-only (not URL-driven either) — the remaining surface is larger than the finding text alone suggests. Doing this as a rushed, non-test-first pass in one round risks exactly the "web/macOS/CLI out of sync" outcome the standing instructions warn against. Fixed the one independently-scoped, safely-testable piece (Servers.vue's status/q wiring, a real regression on its own) and left the rest for a dedicated implementation session.
…and macOS parity (Spec 109-k) - Activity.vue: add the Tool calls / Sessions / System events / All view tabs (FR-070), defaulting to Tool calls instead of the previously unfiltered mix; System events folds a server's per-tool tool_quarantine_change batch into one summary row (acceptance scenario 6); Sensitive/Intent columns hide when no visible row carries data; Duration no longer clips. Sessions is now rendered by a new SessionsPanel component (replacing the standalone Sessions.vue page). - Tools.vue, Servers.vue, Activity.vue: filter changes and chip/tab removal now call router.replace via useScopeQuery, so the URL matches the table (FR-080); a stale ?risk= is normalized to the canonical ?tier= on write-back. - router/index.ts: /sessions redirects to /activity?view=sessions, keeping the query string. - Usage.vue, CallHistogram.vue, Timeline.vue: chart bars now link to the calls behind them (FR-082 link map), and Usage reads server/tool from the URL on load. - macOS: AppState.scopeFilter (ScopeFilter struct) replaces pendingActivitySessionFilter; ActivityView gains the same four-segment view picker, the quarantine-batch fold, and a Sessions panel, keeping Web/macOS in sync for this spec's surface. Regression tests: scope-filters-url-writeback.spec.ts, activity-views-and-writeback.spec.ts, sessions-redirect.spec.ts, usage-chart-bar-links.spec.ts, ScopeFilterTests.swift, ActivityQuarantineFoldingTests.swift. Verified: frontend build + vitest (163 files, 1485 tests) green; swift build + swift test green except the pre-existing AppLifecycleTests.testTheSharedJournalNeverWritesToTheRealInstanceRootUnderTests, which fails on this machine because ~/.mcpproxy/tray-lifecycle.jsonl already exists from the real tray install — unrelated to this diff (no files it covers were touched). go build ./... and golangci-lint (bare) are clean; no Go files changed. S1, O1 and S3 are out of scope (handled elsewhere).
Activity.vue and Tools.vue never read their contract query params (view/type/server/tool/status/tier/approval) on mount, so a deep link (incl. the Tools row "Calls" link) always landed on a fully unfiltered page — both the rendered table and, on Activity, the REST request. - Activity.vue: hydrate filters from route.query during setup, before the first fetch; send type/server/tool/status to GET /activity (per url-filter-contract.md) instead of only limit/parent_id; add a filterTool ref, refetch when a REST-owned filter changes, and add a matching "Tool" chip. - utils/activity.ts: activityViewTypes() derives the view->type mapping from the existing ACTIVITY_TYPE_LABELS map so it cannot drift. - Tools.vue: applyQueryParam() now also reads server/tier(+risk alias)/status/approval, watching the whole route query instead of only `q`. - cmd/mcpproxy: activitySystemTypes was a hand-maintained literal that had drifted from storage.ValidActivityTypes, silently dropping tool_quarantine_change/security_scan/credential_broker from `--view system`. Derive it from storage.ValidActivityTypes instead, and add a parity test so it cannot drift again. Regression tests: activity-scope-query-hydration.spec.ts and tools-scope-query-hydration.spec.ts mount both views with an incoming filtered route and assert the table narrows and (Activity) the request carries the filter — the prior suites only exercised useScopeQuery in isolation or the filters once already set through the UI.
Verified findings from a zcode review of the previous commit: - Activity.vue: effectiveTypes only read activeView inside the untaken branch of a ternary while an explicit ?type= override was active, so Vue never tracked view as a dependency in that state — switching tabs with an override set silently kept the old tab's rows and request. Now computed unconditionally, and setView() also clears the local override directly. - Activity.vue: there was no reactive route-query watcher at all, so a second in-app link to the same 'activity' route (SessionsPanel's own View Activity button, a second Tools-row Calls link, a Usage chart-bar link) never re-applied while the page was already open — only the FIRST deep link that reached it ever took effect. applyRouteFilters() is now symmetric (clears a field when its param is absent, not just sets it when present) and reruns on every route.query change. - Activity.vue: from/to were never read from the URL or sent to the activity/export requests at all, only ever set by the date pickers and applied client-side — so the new Usage chart-bar links dropped their whole time bound. Added the read side (with datetime-local conversion, relative shorthand resolved the same way the composable does) and the REST/export send side. - utils/activity.ts and ActivityQuarantineFolding.swift: the tool_quarantine_change batch fold agreed on server+status with no time bound, so two genuinely separate same-server actions far apart in time (nothing of a different type between them) could fold into one summary row. Added a 5-minute window, checked against the run's own lead record. Regression tests added to activity-run-grouping.spec.ts, activity-views-and-writeback.spec.ts, and ActivityQuarantineFoldingTests.swift for every finding above. Verified: frontend build + vitest (163 files, 1494 tests) green; swift build + swift test green except the same pre-existing, unrelated AppLifecycleTests failure noted in the previous commit.
…109-k T116/T122)
- State/ScopeFilter.swift: the native URL filter contract. restRequest(for:)
maps every parameter to the same REST query as useScopeQuery.ts and the
CLI: tool split into server + bare tool, rule 8 (disagreeing server ->
nil, no request), ws- session routing, view -> type (calls / every other
type / none), Sessions view -> GET /sessions carrying only
profile/client/token, Usage window presets (an unmappable range sends
window=all rather than silently meaning the 24h default), Tools/Servers
never sending client-side params. profile/client/token stay hidden and
unsent until GET /status lists features.scope_filters.
- AppState.scopeFilter replaces pendingActivitySessionFilter; the in-app
link channel is handOffScopeFilter/consumeScopeFilter/openActivity(with:)
(tray glance row, Token row "Activity" link hidden until scope_filters).
- ActivityView: Tool calls / Sessions / System events / All segments
(default Tool calls), tool / time / caller pickers, Sessions view with the
link-map row -> view=calls&session=<work_session_id>, rule-5 disabled
chips, rule-8 conflict state, and FR-071 folding of same type+server
records within 60 s in System events ("filesystem: 14 tools approved").
Reloads coalesce through one task, and a superseded load no longer
clears the newer load's spinner.
- StatusResponse decodes features.scope_filters; MCPSession decodes
work_session_id.
Tests first: ScopeFilterTests (+ AppState hand-off, session-row links) and
ActivityFoldingTests, 42 cases. Cross-reviewed by zcode over 3 rounds
(the final round was clean).
Activity.vue's loadActivities() read the `session` scope filter from the
URL/picker but never included it in the GET /activity request, so
session filtering on the Tool calls/System events/All views ran
client-side over an unfiltered limit=200 fetch instead of narrowing the
actual backend query via `work_session_id`/`session_id` — contradicting
contracts/url-filter-contract.md's session row and quickstart.md's
109-k pass condition ("no unfiltered fetch in the network log"). Wire
the same ws- prefix rule the CLI already uses (sessionQueryParam),
exposed from useScopeQuery as sessionRestParam, into the getActivities()
call. The client-side matchesSessionFilter pass over the loaded rows
stays in place — it only narrows what the server already filtered, it
does not compensate for a legacy pre-Spec-082 row lacking a
work_session_id.
- useScopeQuery.usageWindowFor() now maps any range it cannot express (e.g. from=-3d) to window=all instead of undefined, so toRest() never silently omits `window` and lets GET /activity/usage fall back to its own 24h default under a URL that promised something else. - Activity.vue's URL write-back watch now converts the datetime-local from/to values through dateTimeLocalToISO() before writing them to the route query, instead of writing the naive "YYYY-MM-DDTHH:mm" control value verbatim (not a valid RFC 3339 value per the url-filter-contract). - Usage.vue now hydrates its window picker from an incoming from/to (a server card's stats link, a shared URL, ...) via usageWindowFor(), and shows a disabled "not applied on Usage" chip when the linked range isn't one of the three supported presets, matching contract rule 5 and macOS's ScopeFilter.usageWindow(from:to:). - Adds/updates vitest coverage under the file names tasks.md T112/T113 name: activity-views.spec.ts, activity-system-folding.spec.ts, activity-empty-columns.spec.ts, activity-block-reason.spec.ts, tools-scope.spec.ts, usage-scope.spec.ts. Verified: `mcpproxy` and full Go build unaffected (no Go files touched); frontend build + full vitest suite green (169 files, 1521 tests).
…uplicates The rebase merge of 109-k-macos-scope-filter onto the new base picked a different merge-base than the original merge (0284142b5) and failed to carry forward the delete side of the add/delete conflict for these three files, which the new State/ScopeFilter.swift and Views/ActivityFolding.swift (plus their tests) already supersede. Nothing else references them.
…idActivityTypes
Live-verified against a real running instance: 'mcpproxy activity list
--view system' errored on every call ('invalid type
tool_quarantine_change: must be one of [...]') because Validate() kept
its own hand-maintained type list, missing the exact three types
(tool_quarantine_change, security_scan, credential_broker)
activitySystemTypes was already fixed to include by deriving from
storage.ValidActivityTypes. The --view flag correctly produced a type
filter that Validate() then rejected right back out. Both lists now
derive from the same source, and a new test
(TestActivityListView_SystemPassesValidate) pins the whole --view ->
Validate() pipeline instead of either half in isolation.
Deploying mcpproxy-docs with
|
| Latest commit: |
f5eda63
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://eb3e8c89.mcpproxy-docs.pages.dev |
| Branch Preview URL: | https://109-k-activity-scope-filters.mcpproxy-docs.pages.dev |
Contributor
📦 Build ArtifactsWorkflow Run: View Run Available Artifacts
How to DownloadOption 1: GitHub Web UI (easiest)
Option 2: GitHub CLI gh run download 36254521833 --repo smart-mcp-proxy/mcpproxy-go
|
|
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
…quash-merged main) # Conflicts: # frontend/src/components/OnboardingWizard.vue # frontend/src/views/Settings.vue # frontend/src/views/Tools.vue # internal/index/bleve.go # internal/index/bleve_mapping_migration_test.go # oas/docs.go
Regenerated via 'make swagger' so the embedded swagger doc reflects the merged REST contract (FR-080a scope-filter gate, Bleve mapping-migration endpoints, etc.) instead of the raw merge-conflict resolution snapshot.
Rule 8 (contradictory server/tool) and related url-filter-contract.md gaps found on 109-k-activity-scope-filters, all fixed test-first, no false positives to reject this round: - F1 (Usage.vue): a disagreeing server/tool now issues no REST request and shows a conflict empty state, instead of silently falling back to the window's unfiltered aggregate. - F2 (Activity.vue): same rule-8 conflict now blocks the /activity request entirely and shows a conflict banner, instead of keeping `server` and dropping the mismatched `tool`. - F3 (Tools.vue): applyQueryParam now clears a filter when its query param is absent, not just sets it when present, so a same-route navigation to a narrower URL no longer leaves a stale filter that the write-back watch then resurrects. - F4 (Activity.vue): from/to/server/tool/status/type/auth_type now render as disabled "not applicable to Sessions" chips in the Sessions view, and setView no longer strips an explicit `type` when switching into Sessions (only calls/system/all clear it). - F5 (Activity.vue): the filter write-back watch now re-asserts the URL's original raw from/to value (relative or absolute) unless the date picker itself was actually edited, so a sticky `from=-24h` survives an unrelated filter change instead of freezing into an absolute instant. - F6 (cmd/mcpproxy/activity_cmd.go): `activity watch --view <invalid>` now validates the same way `list`/`export` already do, via a shared validateActivityWatchView() guard checked before the daemon connection. - F7 (macOS): TokenMetrics now decodes `estimated` (defaulting to false when absent, for back-compat with an older core) and the Dashboard's Token Savings card shows an "estimate" badge, matching Web/CLI. - F8 (Web Sessions view): GET /sessions now carries profile/client/token once features.scope_filters lists them, via a dedicated scoped watcher that leaves the general on-mount session-name-resolution fetch (used by every other Activity view) unscoped. Verification: go build (bare + -tags server); go test -race on cmd/mcpproxy and on internal/serveredition, config, oauth, server, httpapi, storage (-tags server, CI -skip regex); golangci-lint v2 (bare + --build-tags server) on cmd/mcpproxy/... (0 issues) and on ./... (only pre-existing findings in files this change does not touch); frontend npm ci + npm run build + npx vitest run (1563 passed, package-lock.json unchanged so no revert needed); native/macos swift build + swift test (1243 tests, the one failure — AppLifecycleTests.testTheSharedJournalNeverWritesToTheRealInstanceRootUnderTests — is a pre-existing local-machine artifact from a real ~/.mcpproxy install, unrelated to any file this change touches). No REST contract changes (the Sessions scope params are additive and feature-flag-gated on a param the backend already conditionally supports), so no oas/swagger.yaml or frontend contracts.ts regeneration is needed.
# Conflicts: # oas/docs.go
…filters # Conflicts: # oas/docs.go
8 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #1378 (109-a-quick-wins) — rebase onto that branch when it merges, then retarget this PR at
main.What this ships (Spec 109-k)
Activity scope-filters, views and deep links, wired to one shared URL-filter contract (
specs/109-ux-navigation-consistency/contracts/url-filter-contract.md) across every surface: Web UI, macOS, CLI and REST.Web UI
?view=calls|sessions|system|all, defaultcalls) — and/sessionsnow redirects to/activity?view=sessions, keeping the query string.from/toand shows a disabled "not applied" chip when the linked range isn't one of the three supported presets.retrieve_toolsdata exists.useScopeQueryis the one composable that reads/writes contract parameters, withrouter.replacewrite-back and sticky parameters carried across scope-aware pages.macOS
AppState.scopeFilter(aScopeFilter?handed off viahandOffScopeFilter/openActivity/consumeScopeFilter) replaces the oldpendingActivitySessionFilter, so every in-app link — tray glance row, Clients row, Token row — publishes the filter before switching the sidebar, the same race-safe patternshowMainWindow(tab:)already used.ActivityFolding), and a Sessions panel, keeping macOS in sync with the Web behaviour for this spec's surface.State/ScopeFilter.swift,Views/ActivityFolding.swiftand their test suites) was contributed by a peer session on109-k-macos-scope-filterand merged in here; rebasing this branch onto109-a-quick-winsreplayed that merge and needed the same conflict resolution (verified byte-identical to the original merge commit) plus a follow-up commit to remove three now-dead files (Models/ScopeFilter.swift,Models/ActivityQuarantineFolding.swiftand its test) that the rebase's automatic 3-way merge failed to carry the delete side of forward for.CLI
activity list|watch|exportaccept--view calls|system|all(overridden by an explicit--type) and--from/--to(RFC 3339 or relative-1h/-24h/-7d/-30d), aliasing--start-time/--end-time;watchbounds streamed records to the range and exits once--tohas passed instead of reconnecting forever. (--view systemitself only actually works after the rebase-follow-up fix below — it errored on every run before it.)activity summary --fromis restricted to the four--periodpresets; anything else exits 1 rather than silently widening the window.statusprints a "Token savings: ~N tokens/request" line, suffixed "(estimate)" while the metric is estimated rather than observed.REST / shared contract
GET /api/v1/activity,/activity/summary,/activity/usage,/activity/export,/sessions,/tools,/serversand/tokensgain the FR-080a version-skew gate: a caller sendingprofile/client/token(or theagentalias) to a build that doesn't yet honour it gets400 unsupported_scope_filterinstead of unfiltered rows presented as filtered.GET /api/v1/statusgainsfeatures.scope_filters(empty until Spec 108-e fills it in).ServerTokenMetricsgainsestimatedand a catalog-basedaverage_query_result_sizeestimate.Findings fixed
retrieve_toolshad run./sessions→/activity?view=sessions, tied to the Clients-hub navigation section): the standalone Sessions page is retired in favour of the Sessions view inside Activity, with the old route redirecting and keeping its query.status/qfrom the URL (so the/reviewredirect silently landed unfiltered), Activity/Tools never hydrated from an incoming route query on mount, session filtering ran client-side over an unfiltered fetch instead of narrowing the actualGET /activityrequest, and the datetime-localfrom/tocontrols wrote a non-RFC-3339 value straight into the URL. All of these are now routed throughuseScopeQuerywith regression tests pinning each one.Findings fixed by this rebase itself
Rebasing onto
109-a-quick-winsreplayed a real merge from a peer session (see macOS section above) and, separately, live verification on a rebuilt binary caught one more drift bug this branch's own unit tests hadn't:ActivityFilter.Validate()had a second hand-maintained type list (cmd/mcpproxy/activity_cmd.go), independent of theactivitySystemTypeslist the "live QA findings" commits already fixed to derive fromstorage.ValidActivityTypes. It was missing the same three types (tool_quarantine_change,security_scan,credential_broker), somcpproxy activity list --view system— the exact CLI feature this PR ships — errored on every real invocation with "invalid type 'tool_quarantine_change'". Neither existing test caught it because each covered only one half of the pipeline (the--view→ type-string derivation, orValidate()'s hand list in isolation), never the type string--viewactually produces flowing intoValidate(). Fixed by sourcing both lists from the samestorage.ValidActivityTypes, with a new test (TestActivityListView_SystemPassesValidate) that exercises the whole pipeline for every view value.Tests
cmd/mcpproxy,internal/httpapi,internal/cliclient,internal/contracts,internal/gatereport,internal/index,internal/runtime(and its subpackages) — all green.activity-*,scope-*,tools-*,usage-*,servers-scope,sessions-redirect,principal-gating), plus a cleannpm run build.swift buildclean;swift testgreen except the pre-existing, unrelatedAppLifecycleTests.testTheSharedJournalNeverWritesToTheRealInstanceRootUnderTests, which fails on this machine because~/.mcpproxy/tray-lifecycle.jsonlalready exists from the real, currently-running tray install — no file that test covers was touched by this branch.gofmtandgolangci-lint(bare +--build-tags server) clean on every touched Go file; the two pre-existing issues golangci-lint reports are in files this branch never touches.How this was verified live
Rebuilt the Go binary and the frontend bundle (including copying the frontend build into the Go binary's embed directory,
make build's own step) and ran the real binary against a scratch--data-dir/--configinstance on a spare port, with its own auto-generated API key. Confirmed the FR-080a version-skew gate over curl:GET /activity,/servers,/tokensand/sessionsall return400 unsupported_scope_filterfor aprofile/client/tokenparameter, andGET /statuscorrectly omitsfeatures.scope_filterswhile the supported list is still empty. Confirmedactivity/summary?period=24hand the plain/activitylist respond correctly. Opened the built Web UI against that same running instance in a real browser: the Activity page renders all four view tabs (Tool calls · Sessions · System events · All) defaulting to Tool calls; switching to System events shows the realsystem_start/system_stoprows and updates the URL to?view=system; reloading that exact URL cold reproduces the same filtered view (the deep-link hydration fix); and navigating to/sessionsredirects to/activity?view=sessionsand lands on the Sessions tab, confirming N5. It was this live run — not a unit test — that surfaced theactivity list --view systemCLI bug above; the quarantine-folding and full multi-server scenario (SC-010) beyond what a fresh instance's own startup events exercise stays covered by the vitest/XCTest suites listed above, not repeated here live.