feat(048): eliminate remaining tray /api/v1/servers refetches#451
Merged
Conversation
Spec 047 (PR #450, v0.29.4) eliminated the burst-storm refetch path (servers.changed -> refetch). This PR addresses the residual: 5 other call sites in the Swift tray that still hit /api/v1/servers, totaling ~8 GETs per 60 s at idle on a 30-server config. All 5 sites now read SSE-driven appState.servers in place of fetching: - CoreProcessManager case "status": no longer refetches on connected_count change. Inline stats are merged unconditionally; per-server state arrives via the spec 047 servers.changed payload within ~50 ms of any actual transition. - refreshState (30 s periodic) drops the refreshServers() call. refreshActivity / refreshSessions / refreshTokenMetrics / refreshSecurityStatus stay (SSE doesn't cover those domains). - refreshSecurityStatus's Docker fallback now reads appState.servers synchronously instead of issuing another GET. - MCPProxyApp's 10 s server-refresh Timer is removed entirely. - menuWillOpen no longer refetches on every tray click. The menu rebuilds from in-memory state only. In their place: a single 5-minute Combine timer in MCPProxyApp.swift calls a new CoreProcessManager.refreshServersForSafetyNet() — pure defense-in-depth in case SSE drops events past the 256-event buffer. Verification (specs/048-tray-refetch-elimination/verification/report.md) on the same MCPProxy.app + 30-server scenario as spec 047: - 0 GETs / 60 s at idle (was ~8) - context7 disable propagates to tray menu in 1 s - context7 enable propagates in 2 s - 0 GETs during the entire toggle window Spec, plan, research, data-model, quickstart, tasks all under specs/048-tray-refetch-elimination/. No core / Go changes. Backward-compatible with older cores (spec 047 fallback path retained). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Deploying mcpproxy-docs with
|
| Latest commit: |
728d82a
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://09bdc488.mcpproxy-docs.pages.dev |
| Branch Preview URL: | https://048-tray-refetch-elimination.mcpproxy-docs.pages.dev |
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
📦 Build ArtifactsWorkflow Run: View Run Available Artifacts
How to DownloadOption 1: GitHub Web UI (easiest)
Option 2: GitHub CLI gh run download 25568426295 --repo smart-mcp-proxy/mcpproxy-go
|
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.
Summary
appState.serversinstead of fetching:CoreProcessManager case "status":— stat-only update, no refetch on connected-count changerefreshState(30 s periodic) — drops therefreshServers()callrefreshSecurityStatusDocker fallback — readsappState.serverssynchronouslyMCPProxyApp.swift10 sTimer.publish— removedmenuWillOpen— no per-click refetchCoreProcessManager.refreshServersForSafetyNet()as a defense-in-depth safety net for missed SSE events.Verification
Live test on same 30-server / 1.06 GB BBolt scenario as spec 047 (
specs/048-tray-refetch-elimination/verification/report.md):/api/v1/serversGETs / 60 s idledisableRESTenableRESTThe accessibility-tree state cycle on
context7:Test plan
swiftc(no errors, only pre-existingtry?warnings)servers.changedfallback path from spec 047 retained — older cores still workXCTests are not authored: the existing Swift testing convention in this repo doesn't run
swift testin CI (CommandLineTools-only environments can't run XCTest, and there's nomake swift-testtarget). Adding tests would document intent but not gate behavior; relied on live verification +mcpproxy-ui-testMCP instead.Out of scope (deferred)
refreshActivity/refreshTokenMetrics/refreshSessionsperiodic refreshes still hit their respective endpoints every 30 s. Future spec to make those SSE-driven.dockerStatus()anddiagnostics()calls insiderefreshSecurityStatusare unchanged (independent of server list).Spec & artifacts
specs/048-tray-refetch-elimination/spec.mdspecs/048-tray-refetch-elimination/plan.mdspecs/048-tray-refetch-elimination/tasks.mdspecs/048-tray-refetch-elimination/research.mdspecs/048-tray-refetch-elimination/verification/report.md🤖 Generated with Claude Code