Skip to content

feat(scanner): compute and render per-scanner duration_ms#667

Merged
Dumbris merged 1 commit into
mainfrom
mcp-2402-scanner-duration-ms
Jun 14, 2026
Merged

feat(scanner): compute and render per-scanner duration_ms#667
Dumbris merged 1 commit into
mainfrom
mcp-2402-scanner-duration-ms

Conversation

@Dumbris

@Dumbris Dumbris commented Jun 14, 2026

Copy link
Copy Markdown
Member

Summary

The scan report JSON carried per-scanner started_at/completed_at but no
duration_ms, and the CLI rendered no per-scanner timing at all. This adds a
derived per-scanner duration and surfaces it in the CLI.

Changes

  • internal/security/scanner/types.goScannerJobStatus gains a
    duration_ms JSON field and a Duration() helper that returns 0 for the
    degenerate cases (still running, never started, clock skew).
  • internal/security/scanner/engine.goupdateScannerStatus recomputes
    DurationMs once both timestamps are known. The live scan path sets
    StartedAt and CompletedAt in separate calls, so the duration is derived
    from the stored StartedAt when CompletedAt arrives.
  • cmd/mcpproxy/security_cmd.go
    • security status per-scanner table gains a DURATION column.
    • security report renders a per-scanner "Scanner timing" block.
    • Helpers read duration_ms, falling back to computing from
      started_at/completed_at for reports produced before the field existed.
  • docs/cli/security-commands.md — updated status/report examples and
    documented the new scanner_statuses[].duration_ms field.

Testing

TDD: tests written first (red), then implementation (green).

  • internal/security/scanner: TestScannerJobStatusDuration,
    TestUpdateScannerStatusComputesDurationMs
  • cmd/mcpproxy: TestFormatScannerDurationMs, TestScannerDurationMs,
    TestPrintScannerStatusTableRendersDuration,
    TestPrintReportTableRendersScannerTimings

Verified locally:

  • go test ./internal/security/... ./cmd/mcpproxy/ -race — pass
  • go test ./internal/httpapi/ -run Scan — pass
  • golangci-lint v2 run --config .github/.golangci.yml (changed pkgs) — 0 issues

Related to MCP-2402

The scan report carried per-scanner started_at/completed_at but no
duration, and the CLI rendered no per-scanner timing. Add a derived
duration_ms to each scanner status and surface it in the CLI:

- ScannerJobStatus gains a duration_ms field and a Duration() helper;
  the engine recomputes it once both timestamps are known (the live
  scan path sets start and completion in separate updates).
- security status grows a DURATION column.
- security report renders a per-scanner "Scanner timing" block.
- CLI reads duration_ms, falling back to started_at/completed_at for
  reports produced before the field existed.

Related to MCP-2402
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying mcpproxy-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: f701b8f
Status: ✅  Deploy successful!
Preview URL: https://5a8484f9.mcpproxy-docs.pages.dev
Branch Preview URL: https://mcp-2402-scanner-duration-ms.mcpproxy-docs.pages.dev

View logs

@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 77.14286% with 16 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
cmd/mcpproxy/security_cmd.go 75.38% 9 Missing and 7 partials ⚠️

📢 Thoughts on this report? Let us know!

@mcpproxy-gatekeeper mcpproxy-gatekeeper Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved via Claude Code review (Codex out): per-scanner duration_ms (MCP-2402). Reviewer verified fix + tests + CI green; VERDICT ACCEPT.

@Dumbris Dumbris enabled auto-merge (squash) June 14, 2026 14:56
@github-actions

Copy link
Copy Markdown

📦 Build Artifacts

Workflow Run: View Run
Branch: mcp-2402-scanner-duration-ms

Available Artifacts

  • archive-darwin-amd64 (28 MB)
  • archive-darwin-arm64 (25 MB)
  • archive-linux-amd64 (16 MB)
  • archive-linux-arm64 (14 MB)
  • archive-windows-amd64 (28 MB)
  • archive-windows-arm64 (25 MB)
  • frontend-dist-pr (0 MB)
  • installer-dmg-darwin-amd64 (21 MB)
  • installer-dmg-darwin-arm64 (19 MB)

How to Download

Option 1: GitHub Web UI (easiest)

  1. Go to the workflow run page linked above
  2. Scroll to the bottom "Artifacts" section
  3. Click on the artifact you want to download

Option 2: GitHub CLI

gh run download 27501692667 --repo smart-mcp-proxy/mcpproxy-go

Note: Artifacts expire in 14 days.

@Dumbris Dumbris merged commit bf8b2d6 into main Jun 14, 2026
47 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants