Skip to content

feat(proxy): emit session summary on persistent proxy shutdown - #352

Merged
abhisek merged 2 commits into
mainfrom
feat/proxy-server-session-summary
Jun 26, 2026
Merged

feat(proxy): emit session summary on persistent proxy shutdown#352
abhisek merged 2 commits into
mainfrom
feat/proxy-server-session-summary

Conversation

@Sahilb315

Copy link
Copy Markdown
Contributor

Why

The persistent proxy daemon (server mode) never runs the per-invocation flow that calls LogSessionComplete, so no session summary ever reached SafeDep Cloud for server-mode runs. Per-package events synced, but the per-run aggregate (and the CI/invocation context it carries) was missing.

What

  • Emit a session summary from the daemon on shutdown, built from the aggregate stats collector it already maintains. It's emitted after the request drain and before the final cloud flush, so it's delivered alongside the run's other events. Because it's a session-complete event, cloudSink automatically attaches the CI/invocation context.
  • Extract the event emission out of LogSessionComplete into a shared exported LogSessionSummary(SessionData). The per-invocation flow (which sources data from the audit session) and the daemon (which sources from the stats collector) now share one emit path — no duplicated event construction.
  • The daemon serves every package manager, so the summary carries no single package manager (maps to UNSPECIFIED); outcome is blocked when anything was blocked, else success; duration is the daemon lifetime.

Notes

  • TrustedSkipped / InsecureBypassed are 0 in server mode — the stats collector doesn't track them yet. Can be added via new Record* methods if needed.
  • Includes a small unrelated tweak: shorten the action's default cloud endpoint id prefix github-actions/gha/.

The persistent proxy daemon never ran the per-invocation flow that calls
LogSessionComplete, so no session summary reached the cloud for server-mode
runs. Emit one from the daemon's aggregate stats collector on shutdown,
before the final cloud flush, so it is delivered with the run's events and
carries the CI/invocation context.

Extract the event emission into a shared LogSessionSummary(SessionData); both
the per-invocation flow and the daemon now use it. The daemon serves every
package manager, so the summary carries no single package manager.
@safedep

safedep Bot commented Jun 26, 2026

Copy link
Copy Markdown

SafeDep Report Summary

Green Malicious Packages Badge Green Vulnerable Packages Badge Green Risky License Badge

No dependency changes detected. Nothing to scan.

View complete scan results →

This report is generated by SafeDep Github App

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 48.88889% with 23 lines in your changes missing coverage. Please review.
✅ Project coverage is 54.04%. Comparing base (c47776d) to head (9b2620c).

Files with missing lines Patch % Lines
internal/proxyserver/server.go 0.00% 23 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #352      +/-   ##
==========================================
- Coverage   54.10%   54.04%   -0.07%     
==========================================
  Files         205      205              
  Lines       13937    13961      +24     
==========================================
+ Hits         7541     7545       +4     
- Misses       5697     5717      +20     
  Partials      699      699              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@abhisek
abhisek merged commit 5ac0f27 into main Jun 26, 2026
23 checks passed
@abhisek
abhisek deleted the feat/proxy-server-session-summary branch June 26, 2026 09:17
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.

3 participants