Conversation
|
Claude finished @binoy14's task in 1m 53s —— View job Code ReviewIssues Found1. Missing Type Exports (packages/@sanity/cli-core/src/index.ts:22) The public types Fix: Add to index.ts: export {type CLITelemetryStore, type TelemetryUserProperties} from './telemetry/types.js'2. Potential Race Condition in SanityCommand (packages/@sanity/cli-core/src/SanityCommand.ts:113) The telemetry is initialized in Fix: Consider making telemetry optional or adding proper error handling in 3. Redundant Dependency (packages/@sanity/cli-core/package.json:76) The package adds Fix: Use 4. Worker Error Handling Loses Context (packages/@sanity/cli/src/hooks/prerun/flushTelemetry.worker.ts:17-19) The worker silently exits on error without logging anything, making debugging failures difficult. Fix: } catch (error) {
// Log to stderr for debugging without blocking parent
console.error('Telemetry flush failed:', error)
process.exit(1)
}5. Process Exit Error Handling (packages/@sanity/cli/src/hooks/prerun/setupTelemetry.ts:70-72) The TODO comment indicates error handling is incomplete. Non-zero exit codes get a generic error message regardless of the actual error that occurred. Recommendation: Implement proper error tracking (possibly via oclif's error handling hooks) or document why this approach is sufficient. 6. Test Coverage Gap (packages/@sanity/cli/src/hooks/prerun/flushTelemetry.worker.ts) Coverage report shows 0% coverage for the worker file. The worker is a critical path for telemetry reliability. Fix: Add tests for |
This stack of pull requests is managed by Graphite. Learn more about stacking. |
b96cc57 to
30b9f03
Compare
d317d8a to
b977c98
Compare
Preview this PR with pkg.pr.newRun the Sanity CLInpx https://pkg.pr.new/sanity-io/cli/@sanity/cli@a43610c <command>...Or upgrade project dependencies📦
|

This PR sets up the functions and ways to make telemetry calls in the command. (See the stacked PR on top on how to use it.)
The way this works is that once we initialize the telemetry store we inject a new context of the cli trace to
globalsthis maybe neat or maybe silly as this is same aswindow.but I have not found a great way to share this information between hooks and commands. I looked thru oclif github issues and this was one of the way it was recommended.Happy to look thru other options if anyone has any ideas