[codex] Enrich source-control errors#3248
Conversation
Co-authored-by: codex <codex@users.noreply.github.com>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
ApprovabilityVerdict: Approved Error-handling refactor that adds structured context (command, cwd, reference) to source-control errors and sanitizes sensitive data from error transport values. No runtime behavior changes outside error handling, comprehensive test coverage included. You can customize Macroscope's approvability policy. Learn more. |
Summary
Validation
Note
Medium Risk
Touches contract error shapes and all major source-control providers; behavior change for error messages surfaced to clients, though causes are preserved for debugging.
Overview
Source-control failures now carry structured, client-safe context:
cwd, optionalcommand,repository, andreferenceonSourceControlProviderError, with matchingcommand/cwdon GitHub, GitLab, and Azure DevOps CLI errors.Public
detailandmessageno longer echo raw CLI stderr, schema decode text, or nested cause strings. CLI layers map VCS failures throughfromVcsError(keeping friendly missing-tool/auth/not-found guidance) and attach the original error oncause. JSON decode failures use fixed detail strings instead of formatter output.Providers build
SourceControlProviderErrorinline (replacing thinproviderErrorwrappers), sanitize references/repos viatransportSafeSourceControlErrorValue(strip URL credentials/query/hash, normalize whitespace, cap length), and use generic provider-level details for Bitbucket API failures. Registry unsupported-provider and detectProvider paths populate the same fields while preserving detection causes.Tests cover sanitization, cause retention, and updated fake
GitHubCliErrorshapes.Reviewed by Cursor Bugbot for commit 5d42a7a. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Enrich source-control errors with command, cwd, and sanitized context fields
SourceControlProviderError,GitHubCliError,GitLabCliError, andAzureDevOpsCliErrorwithcommand,cwd,reference, andrepositoryfields so errors carry structured context for debugging.transportSafeSourceControlErrorValuein SourceControlProvider.ts to sanitize reference/repository values: strips URL credentials, query strings, and fragments, collapses whitespace, and bounds length to 256 characters.providerErrorhelpers in GitHub, GitLab, Bitbucket, and Azure DevOps providers with explicit error construction that propagatescommandandcwdfrom CLI errors and preserves the original cause.cwdfield; existing error construction sites must provide it.Macroscope summarized 5d42a7a.