feat: add privacy-safe crash reporting - #63
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces bounded, privacy-safe crash reporting for unexpected putio CLI failures, backed by a persisted user preference (telemetry_disabled) and exposed through new putio telemetry commands. It integrates a minimal Sentry transport that rebuilds envelopes from an allowlist to avoid leaking original error details, while documenting the policy and operational boundaries.
Changes:
- Add crash reporting bootstrap + process-level crash boundary for uncaught exceptions, unhandled rejections, and Effect defects (captured once, bounded flush).
- Add persisted telemetry preference (
telemetry_disabled) with CLI commands:telemetry status|disable|enable, plus metadata exposure viaputio describe. - Add extensive unit + process-boundary test coverage and update user/agent/architecture documentation.
Reviewed changes
Copilot reviewed 30 out of 31 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/test-support/crash-process.mjs | Adds a fixture process to exercise crash boundary behavior end-to-end. |
| src/sea.ts | Bootstraps crash reporting and wires crash reporter into the app layer for SEA entrypoint. |
| src/internal/state.ts | Persists telemetry_disabled and adds state APIs to read/update telemetry preference. |
| src/internal/state.test.ts | Adds tests ensuring telemetry preference persists without affecting auth state. |
| src/internal/metadata.ts | Extends describe metadata contract with crashReporting and telemetry_disabled config field. |
| src/internal/metadata.test.ts | Verifies new crashReporting metadata shape and telemetry command presence. |
| src/internal/main.ts | Captures Effect defects via the crash reporter from the CLI error handler. |
| src/internal/main.test.ts | Adds coverage ensuring defects still render stderr-only and invoke crash capture. |
| src/internal/crash-reporting.ts | Implements Sentry integration with allowlisted event/envelope sanitation and bounded transport. |
| src/internal/crash-reporting.test.ts | Adds thorough tests for preference loading, event/envelope sanitation, and transport guarantees. |
| src/internal/crash-boundary.ts | Adds process-level handlers for uncaught exceptions/unhandled rejections and fatal replay logic. |
| src/internal/crash-boundary.test.ts | Tests crash boundary installs/removes handlers and captures exactly once. |
| src/internal/crash-boundary-process.test.ts | Process-boundary tests verifying stdout purity, exit semantics, and Node rejection modes. |
| src/internal/crash-bootstrap.ts | Adds early preference loading + crash reporter creation + handler installation bootstrap. |
| src/internal/crash-bootstrap.test.ts | Tests opt-out prevents initialization/handler installation and fail-closed behavior. |
| src/internal/config.ts | Exposes resolved config path as a service effect for reuse by telemetry/state. |
| src/internal/cli-contract.ts | Registers new telemetry command specs in the command catalog. |
| src/internal/app-layer.ts | Wires the crash reporter service into the application layer. |
| src/index.ts | Updates public exports for state-related schemas and new telemetry helpers. |
| src/i18n/catalog/en.ts | Adds English strings for telemetry subcommands/status rendering. |
| src/commands/telemetry.ts | Introduces `putio telemetry status |
| src/cli.ts | Adds telemetry command to CLI and includes crashReporting decision in describe output. |
| src/cli.test.ts | Adds CLI-level tests for telemetry disable (including with invalid API env config). |
| src/bin.ts | Bootstraps crash reporting and wires crash reporter into the app layer for main entrypoint. |
| skills/putio-cli/SKILL.md | Documents telemetry opt-out/status/enable in the consumer skill guidance. |
| skills/putio-cli/references/guardrails.md | Adds guardrail note about respecting telemetry preference state. |
| skills/putio-cli/references/discovery.md | Documents crashReporting metadata as part of automation discovery. |
| README.md | Adds a new Crash Reporting and Diagnostics section describing policy and usage. |
| pnpm-lock.yaml | Adds locked dependency entries for @sentry/core. |
| package.json | Adds @sentry/core dependency. |
| docs/ARCHITECTURE.md | Documents crash-reporting policy, boundaries, and data-handling guarantees. |
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
putio-releaser Bot
added a commit
that referenced
this pull request
Aug 15, 2026
## [1.6.0](v1.5.1...v1.6.0) (2026-08-15) ### Features * add privacy-safe crash reporting ([#63](#63)) ([17cf2fe](17cf2fe))
Contributor
|
🎉 This PR is included in version 1.6.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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
Closes #61.
Adds bounded, privacy-safe crash reporting for unexpected CLI failures. Official releases enable reporting by default with one durable local control:
putio telemetry disable|status|enable.Changed
putio/putio-cliSentry integration and release/environment taggingreleaseEnvironment into npm and standalone artifacts; no production DSN remains in tracked sourcetelemetry_disabledpreference loaded before Sentry initializationRisks
Verification
pnpm exec vp run verify— 33 files, 339 tests, 89.81% statement coverageactionlint .github/workflows/ci.yml .github/workflows/backfill-release-assets.ymlbuild_configuration_unavailableVerify CLI— passedComplexity
Preference loading, build configuration, Sentry initialization, event construction, final envelope serialization, bounded transport, and fatal replay are separate fail-closed stages so reporting cannot replace or leak the original command failure.