refactor(server): classify telemetry exports#10277

merged1
cleanup-server/service-internals
cleanup-server/telemetry-usage-internals
openedSep 6, 2026byJJulius Marminge
View on GitHubTwo-way sync enabledPR last imported 4d ago

Telemetry, diagnostics, resource monitoring, and usage modules had 21 unclassified runtime exports. This marks eight canonical Effect service constructors as intentionally public and keeps 13 implementation helpers private without changing telemetry or usage contracts.

This is layer 4 of 9 in the server Knip cleanup stack.

Verification after rebasing onto current main: server typecheck and the server-only Knip export audit pass. Changed-file lint and formatting pass, with one existing lint warning. Focused auth, provider, source-control, preview toolkit, orchestration, and Knip preprocessor tests pass: 90 tests across 9 files. This changes server export visibility and static analysis; screenshots do not apply.

Model: gpt-6 astra. Harness: Codex in T3 Code.

Summary by CodeRabbit

  • Documentation

    • Added public API documentation for several service constructors and diagnostic components.
  • Refactor

    • Reduced the public API surface by making internal helpers, constants, platform utilities, usage formatters, and telemetry functions module-private.
    • Existing behavior remains unchanged.
Synced from GitHub

Approvability

A prior Macroscope approval was dismissed. Re-evaluating 40fea11โ€ฆ

No code changes detected at 71d237b. Prior analysis still applies.

Synced from GitHub

Thread transfer impact

โœ… Thread transfer remains within every enforced ceiling.

โ„น๏ธ No successful main baseline artifact is available yet. This run establishes the initial measurement.

ProviderMetricMain baselineThis PRImpactPR ceiling
CodexTotal thread wireโ€”13.6 KiBโ€”15.1 KiBโœ…
CodexThread snapshot wireโ€”7.0 KiBโ€”7.3 KiBโœ…
CodexLive turn WebSocket wireโ€”6.5 KiBโ€”7.8 KiBโœ…
CodexLive turn WebSocket decodedโ€”57.0 KiBโ€”66.4 KiBโœ…
CodexLive turn messagesโ€”8โ€”21โœ…
ClaudeTotal thread wireโ€”13.6 KiBโ€”15.1 KiBโœ…
ClaudeThread snapshot wireโ€”7.0 KiBโ€”7.3 KiBโœ…
ClaudeLive turn WebSocket wireโ€”6.5 KiBโ€”7.8 KiBโœ…
ClaudeLive turn WebSocket decodedโ€”57.8 KiBโ€”66.4 KiBโœ…
ClaudeLive turn messagesโ€”9โ€”21โœ…

Baseline: unavailable ยท PR result: 71d237b ยท Source CI: success

Scenario and decoded snapshot size

10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

  • Codex decoded thread snapshot: 113.9 KiB
  • Claude decoded thread snapshot: 114.6 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

Added 1 commit

  • refactor(server): keep telemetry helpers private71d237b
Synced from GitHub

Bugbot is paused โ€” on-demand spend limit reached

Bugbot uses usage-based billing for this team and has hit its on-demand spend limit.

A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue.

Synced from GitHub

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. ๐ŸŽ‰

โ„น๏ธ Recent review info
โš™๏ธ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 70066dd7-f1be-4492-8b52-a21465f36956

๐Ÿ“ฅ Commits

Reviewing files that changed from the base of the PR and between 4f890a2689834d586693264eb984b6392359c77d and 71d237b15304d483225aa9c5136618396b38db12.

๐Ÿ“’ Files selected for processing (16)
  • apps/server/integration/NetworkTransferMeasurement.integration.ts
  • apps/server/integration/TransferBudgetReport.integration.ts
  • apps/server/integration/TransferBudgetScenario.integration.ts
  • apps/server/src/diagnostics/ProcessDiagnostics.ts
  • apps/server/src/diagnostics/ProcessResourceMonitor.ts
  • apps/server/src/diagnostics/TraceDiagnostics.ts
  • apps/server/src/resourceTelemetry/DesktopTelemetryReceiver.ts
  • apps/server/src/resourceTelemetry/Model.ts
  • apps/server/src/resourceTelemetry/NativeTelemetryClient.ts
  • apps/server/src/resourceTelemetry/ResourceMonitorBinary.ts
  • apps/server/src/resourceTelemetry/ResourceTelemetry.ts
  • apps/server/src/telemetry/AnalyticsService.ts
  • apps/server/src/usage/UsageLimitSources.ts
  • apps/server/src/usage/usageAggregation.ts
  • apps/server/src/usage/usageScanCache.ts
  • apps/server/src/usage/usageTranscripts.ts

Limit details: Youโ€™ve used all 10 included reviews currently available.


๐Ÿ“ Walkthrough

Walkthrough

The changes narrow module exports for internal helpers and constants. They also add public API documentation to canonical Effect service constructors.

Changes

API surface cleanup

Layer / File(s)Summary
Integration helper visibility
apps/server/integration/*
WebSocket measurement helpers and transfer budget constants are now module-private.
Diagnostics and resource telemetry API
apps/server/src/diagnostics/*, apps/server/src/resourceTelemetry/*
Resource telemetry helpers are narrowed to module scope, and service constructors receive public API documentation.
Analytics and usage API
apps/server/src/telemetry/AnalyticsService.ts, apps/server/src/usage/*
Analytics and usage helpers are narrowed to module scope, while service construction receives public API documentation.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Merge Risk: โšช Minimal ยท up to 71d23

This refactor makes internal telemetry, diagnostics, resource-monitoring, and usage helpers private while documenting canonical service constructors. No current-head runtime or contract regression is identified, so the change is ready to merge.

Suggested reviewers: t3dotgg

๐Ÿšฅ Pre-merge checks | โœ… 4 | โŒ 1

โŒ Failed checks (1 warning)

Check nameStatusExplanationResolution
Docstring Coverageโš ๏ธ WarningDocstring coverage is 6.25% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 16 functions across 16 files.Write docstrings for the functions missing them to satisfy the coverage threshold.
โœ… Passed checks (4 passed)
Check nameStatusExplanation
Linked Issues checkโœ… PassedCheck skipped because no linked issues were found for this pull request.
Out of Scope Changes checkโœ… PassedCheck skipped because no linked issues were found for this pull request.
Title checkโœ… PassedThe title clearly and concisely describes the main change: classifying server telemetry-related exports.
Description checkโœ… PassedThe description explains the export classification, scope, rationale, verification, and UI applicability. It does not use the template headings or include the checklist, but the required information iโ€ฆ
  • Fix all pre-merge checks with AI
โœจ Finishing Touches ๐Ÿ’ก 1
๐Ÿ“ Generate docstrings ๐Ÿ’ก
  • Create stacked PR
  • Commit on current branch
๐Ÿงช Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cleanup-server/telemetry-usage-internals

Comment @coderabbitai help to get the list of available commands.