feat(security): US4 Collapse the scan-notification storm into one debounced settled event (MCP-2207) (Spec 077) - #787
Closed
Dumbris wants to merge 2 commits into
Closed
Conversation
…r server Related #786 Spec 077 US4 (MCP-2207): the security-scan notification storm came from per-scanner scan_started/progress/completed/failed SSE events multiplied by reconnect storms (prior partial fixes: #659, MCP-2223). Replace those per-scanner lifecycle emissions with a single debounced security.scan_settled event per server per scan. ## Changes - Add scanNotifyDebouncer (internal/runtime/scan_notify.go): terminal-triggered per-server debounce with a generation counter guarding the AfterFunc race; only completed/failed arm the timer, started/progress are dropped. - Add EventTypeSecurityScanSettled; route runtime EmitSecurityScan* through the debouncer (started/progress become no-ops, completed/failed record terminal state) and publish one settled event carrying the terminal findings summary. - Wire scanNotify (750ms) into newRuntime alongside the existing coalescer. - Collapse the activity log to one handleSecurityScanSettled record per scan, removing the former started/completed/failed handlers. ## Testing - scan_notify_test.go: a reconnect storm across N servers yields <= N settled events (exactly one per server) and zero per-scanner lifecycle events; settled event carries the terminal summary. Related: Spec 077 (specs/077-scanner-simplification)
…lifecycle Related #786 Spec 077 US4 (MCP-2207): forward the new security.scan_settled SSE event from the system store as a mcpproxy:scan-settled window event, and have useSecurityScannerStatus refresh its cached scan totals off that single settled signal instead of tracking per-scanner lifecycle events. ## Changes - stores/system.ts: add a security.scan_settled SSE listener that dispatches mcpproxy:scan-settled. - composables/useSecurityScannerStatus.ts: register a module-scope mcpproxy:scan-settled listener that triggers a status refresh. ## Testing - frontend vue-tsc --noEmit clean; vite build succeeds. Related: Spec 077 (specs/077-scanner-simplification)
Deploying mcpproxy-docs with
|
| Latest commit: |
19c49be
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://bbd00d01.mcpproxy-docs.pages.dev |
| Branch Preview URL: | https://077-us4-notify-collapse.mcpproxy-docs.pages.dev |
|
Codecov Report❌ Patch coverage is 📢 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 28500611147 --repo smart-mcp-proxy/mcpproxy-go
|
Member
Author
|
KimiReviewer fallback review — ACCEPT (MCP-3818) Reviewed at head Summary: Spec 077 US4 — collapses the per-scanner scan-notification storm into a single debounced What I verified:
Verdict: ACCEPT — no issues found. |
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
Spec 077 US4 (MCP-2207). MCPProxy's security-scan notification storm came from per-scanner
security.scan_started/progress/completed/failedSSE events multiplied by reconnect storms (prior partial fixes: #659, MCP-2223). This PR replaces those per-scanner lifecycle emissions with a single debouncedsecurity.scan_settledevent per server per scan, satisfying FR-015 / SC-006.Base:
077-us1-baseline(stacked on US1 #786), notmain.Per-task changes
T034 (test-first) —
internal/runtime/scan_notify_test.go<= Nsettled events — exactly one per server — and zero per-scanner lifecycle events. Confirmed red before implementation, green after.T035 —
internal/runtime/scanNotifyDebouncer(scan_notify.go): terminal-triggered, per-server debounce. Onlycompleted/failedarm the per-server timer; noisystarted/progressare dropped. A per-server generation counter guards the classicAfterFuncrace (a superseded timer becomes a no-op), so each server settles exactly once.EventTypeSecurityScanSettled. RuntimeEmitSecurityScan*now route through the debouncer:started/progressbecome no-ops,completed/failedrecord terminal state;publishScanSettledemits one event carrying the terminalfindings_summary.scanNotify(750 ms window) intonewRuntimenext to the existing servers-changed coalescer.handleSecurityScanSettledrecord per scan; the formerstarted/completed/failedhandlers were removed.T036 —
frontend/src/stores/system.ts: forward thesecurity.scan_settledSSE event as amcpproxy:scan-settledwindow event.composables/useSecurityScannerStatus.ts: refresh cached scan totals off the single settled signal instead of per-scanner lifecycle events.The
/eventsSSE endpoint forwards event types generically, so the new type flows to clients automatically; no whitelist change needed.Verification (actual output)
go build ./...— clean (exit 0).go test ./...(full suite, withMCPPROXY_BINARY_PATHset to a freshly builtmcpproxy) — 0 failures.go run ./cmd/scan-eval --corpus specs/065-evaluation-foundation/datasets/detect_corpus_v1.json --gate --min-recall 0.90 --max-fp 0.05—GATE PASSED: recall=1.0000 (>=0.9000), fp=0.0000 (<=0.0500).golangci-lint run --config .github/.golangci.yml ./...—0 issues.vue-tsc --noEmitclean;vite buildsucceeds.🤖 Generated with Claude Code