Skip to content

Conversation

@jiashengguo
Copy link
Member

@jiashengguo jiashengguo commented Jan 16, 2026

Summary by CodeRabbit

  • New Features

    • Added comprehensive error telemetry tracking to enhance error monitoring, diagnostics, and system insights.
  • Bug Fixes

    • Improved error propagation and handling logic to preserve error context and deliver more accurate error messages.
  • Chores

    • Bumped package version to 0.2.4.

✏️ Tip: You can customize this high-level summary in your review settings.

Copilot AI review requested due to automatic review settings January 16, 2026 00:03
@coderabbitai
Copy link

coderabbitai bot commented Jan 16, 2026

Warning

Rate limit exceeded

@jiashengguo has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 6 minutes and 59 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between d3af1ad and e13091f.

📒 Files selected for processing (1)
  • src/zmodel-parser.ts

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

📝 Walkthrough

Walkthrough

This PR bumps the package version to 0.2.4 and enhances error handling throughout the codebase by introducing telemetry tracking for errors in the main error handler and refining error propagation in the parser to preserve CliError instances rather than wrapping them.

Changes

Cohort / File(s) Summary
Version Management
package.json
Version bumped from 0.2.3 to 0.2.4
Error Telemetry
src/index.ts
Added telemetry.trackError() calls in three error handling branches before logging—for CliError, standard Error, and untyped error cases
Error Propagation
src/zmodel-parser.ts
Modified parseDatasource catch block to rethrow CliError instances as-is while continuing to wrap non-CliError exceptions in new CliError

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Poem

🐰 A hop through errors, now tracked with care,
CliErrors freed from wrapping snare,
Telemetry whispers what went wrong,
Version bumped—the fix is strong!
Precise and pure, our logs now sing! 🌟

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'dev to main' is generic and vague, describing only the branch merge operation rather than the actual functional changes made (version bump, error telemetry tracking, and error propagation improvements). Use a descriptive title summarizing the main changes, such as 'Add error telemetry tracking and improve error propagation' or 'Bump version to 0.2.4 and add error telemetry'.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR merges development changes to main, focusing on improving error handling and telemetry tracking. The changes ensure that CliError exceptions are properly propagated and that all error paths are tracked through telemetry.

Changes:

  • Enhanced error handling in datasource URL parsing to preserve CliError exceptions
  • Added telemetry error tracking for all error paths in the main error handler
  • Version bump from 0.2.3 to 0.2.4

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/zmodel-parser.ts Added check to re-throw CliError instances during datasource URL evaluation, preventing them from being wrapped in a generic error
src/index.ts Added telemetry.trackError() calls for all error handling branches to ensure errors are properly tracked
package.json Version bumped to 0.2.4 reflecting the new release

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

src/index.ts Outdated
// ignore
exitCode = e.exitCode
} else if (e instanceof CliError) {
telemetry.trackError(e)
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error is being tracked twice for CliError instances. The trackCli wrapper already tracks errors via trackSpan (line 116 in telemetry.ts), which calls track('proxy:error') in its catch block. This duplicate tracking will result in two error events being sent to telemetry for the same error.

Suggested change
telemetry.trackError(e)
// telemetry for CliError is already handled by telemetry.trackCli

Copilot uses AI. Check for mistakes.
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/index.ts (1)

81-87: Add an else branch to ensure the process exits with the proper error code when telemetry.isTracking is false.

When telemetry.isTracking is false and an error occurs, the catch block completes without calling process.exit(). Since this is the main CLI entry point, the process will exit naturally with code 0 instead of the error code, masking failures.

    if (telemetry.isTracking) {
      // give telemetry a chance to send events before exit
      setTimeout(() => {
        process.exit(exitCode)
      }, 200)
+   } else {
+     process.exit(exitCode)
    }
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between def99f3 and d3af1ad.

📒 Files selected for processing (3)
  • package.json
  • src/index.ts
  • src/zmodel-parser.ts
🧰 Additional context used
🧬 Code graph analysis (1)
src/zmodel-parser.ts (1)
src/cli-error.ts (1)
  • CliError (4-4)
🔇 Additional comments (4)
package.json (1)

3-3: LGTM!

Version bump to 0.2.4 appropriately accompanies the telemetry and error handling enhancements in this PR.

src/zmodel-parser.ts (1)

135-141: LGTM!

This correctly preserves the specific CliError message (e.g., "Environment variable X is not set") from the env() helper rather than masking it with the generic evaluation error. This improves debuggability and ensures meaningful error messages reach the telemetry in src/index.ts.

src/index.ts (2)

70-71: LGTM!

Telemetry tracking for CliError is correctly placed before logging.


73-79: LGTM!

Error tracking covers both standard Error instances and non-Error values by wrapping the latter in a new Error. This ensures telemetry receives proper error objects in all cases.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

@jiashengguo jiashengguo merged commit 4a6420c into main Jan 16, 2026
3 checks passed
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.

2 participants