Skip to content

feat: classify child process telemetry failures - #85

Open
AmanVarshney01 wants to merge 3 commits into
mainfrom
codex/improve-failure-telemetry
Open

AmanVarshney01 wants to merge 3 commits into
mainfrom
codex/improve-failure-telemetry

Conversation

@AmanVarshney01

@AmanVarshney01 AmanVarshney01 commented Sep 4, 2026

Copy link
Copy Markdown
Member

Summary

  • Classify child-process failures as timeout, cancellation, interruption, termination, missing command, permission denial, max-buffer failure, spawn failure, or non-zero exit.
  • Preserve the category through the current Effect CommandRunner, including both checked commands and Prisma JSON commands. With reject: false, Execa returns its failure metadata as a result; discarding that metadata would make this tracking ineffective.
  • Keep the existing numeric/string error-code and stable Prisma CLI command/error fields.
  • Recognize Unix and Windows Ctrl+C exits as interruptions.

Privacy and behavior

Adds one allowlisted telemetry property: child-process-failure. It does not send messages, stdout/stderr, commands, arguments, paths, or secrets. Prisma error redaction remains intact; no raw Execa error is attached to those errors.

No extra subprocesses, network calls, retries, or dependencies are added to production execution. Success, failure, cancellation, and exit-code behavior are unchanged. Historical events have no value for the new property.

Updated against current main

The original implementation predates the Effect migration. This revision merges current main and captures metadata at the process boundary, before wrapping the failure.

Also corrects two existing E2E assertions encountered during verification: directory listings are compared independently of filesystem order, and a missing npm binary must fail preflight before any project files are created.

Verification

  • bun run check
  • bun run typecheck
  • bun run build
  • bun run test:unit: 69 passed
  • CREATE_PRISMA_DISABLE_TELEMETRY=1 CI=1 bun run test:e2e: 10 passed
  • Real child-process checks cover a missing executable, interruption exit status, stderr-only non-zero failure, and a structured Prisma failure envelope, through both checked and JSON command paths. Telemetry assertions verify that private command/output text is excluded.
  • Existing E2E tests scaffold and run a local Composer-backed Postgres app, build Next.js and raw Node templates, and generate/check the Deno template. This is not a new cloud deployment verification.

Local verification used Bun 1.4.0 on macOS. The existing Windows creation smoke check runs again on this revision; no diagnostic workflows were added.

Signed-off-by: Aman Varshney <amanvarshney.work@gmail.com>
@coderabbitai

coderabbitai Bot commented Sep 4, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Essentials

Run ID: 94384a3f-3808-4076-831e-94990682852d

📥 Commits

Reviewing files that changed from the base of the PR and between dcaaea3 and 8fdf26d.

📒 Files selected for processing (7)
  • src/create-outcome.ts
  • src/services/command-runner.ts
  • src/tasks/prisma-cli.ts
  • src/telemetry/create.ts
  • src/utils/child-process-failure.ts
  • tests/e2e/create-prisma.e2e.test.ts
  • tests/telemetry.test.ts

Included review availability: 1 review is currently available. Your included PR review attempts over the past 7 days set your current allowance at 4 reviews per hour.


Summary by CodeRabbit

  • Bug Fixes
    • Improved command failure reporting with consistent categories for timeouts, cancellations, permission issues, missing commands, interruptions, terminations, buffer limits, and other process failures.
    • Preserved failure classifications across CLI command errors for clearer diagnostics.
    • Prevented raw command output and sensitive information from being included in telemetry.

Walkthrough

The change adds Execa child-process failure classification for timeout, cancellation, buffer, interruption, termination, command lookup, permission, exit-code, and spawn errors. Command runners and Prisma CLI errors preserve the classification. Failed create telemetry records the child-process-failure category. Tests verify stable categories and exclude command output and secrets from telemetry. E2E tests update migration ordering and npm failure assertions.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 8fdf2

The telemetry classification and propagation changes have no identified merge-blocking risk.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 7 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely describes the main change: classifying child-process failures for telemetry.
Description check ✅ Passed The description directly explains the failure classifications, propagation paths, privacy behavior, and verification for the changeset.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/improve-failure-telemetry
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch codex/improve-failure-telemetry

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

@github-actions

Copy link
Copy Markdown

PR preview published

  • Version: 0.12.1-pr.85.342.1
  • Tag: pr85
  • Run with Bun: bunx create-prisma@pr85
  • Run with npm: npx create-prisma@pr85
  • Run with Yarn: yarn dlx create-prisma@pr85
  • Run with pnpm: pnpm dlx create-prisma@pr85
  • Run with Deno: deno run -A --minimum-dependency-age=0 npm:create-prisma@pr85
  • Workflow run: https://github.com/prisma/create-prisma/actions/runs/34867090298

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.

1 participant