Repository navigation
fix(parser): isolate formatted import resolution errors - #73817
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
✅ Ponytail Reviewer completed successfully! Ponytail ReviewerOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ PR Code Quality Reviewer completed the code quality review.
|
|
✅ Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft. Design Decision Gate 🏗️Outcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ Test Quality Sentinel completed test quality analysis. Test Quality SentinelOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the change to isolate underlying causes in formatted import errors.
No open issues 🎉
What changed in this PR
This PR isolates formatted import-resolution errors from their underlying causes, preventing errors.Is and errors.As from exposing internal filesystem errors while preserving user-facing diagnostics and formatted-error detection.
Changes:
- Return a cause-free
FormattedParserErrorfromFormatImportError. - Add regression coverage for direct, wrapped, sentinel, and nil causes.
- Document the error-chain boundary without changing import-cycle or YAML parse error traversal.
| File | Description |
|---|---|
pkg/parser/README.md |
Documents that formatted import errors hide the underlying error chain. |
pkg/parser/import_error.go |
Uses the cause-free constructor and clarifies error-chain comments. |
pkg/parser/import_error_test.go |
Verifies cause isolation, formatted-error detection, and retained diagnostic content. |
Review effort: Balanced (auto)
|
🎉 This pull request is included in a new release. Release: |
Why
TestUserFacingErrorsDontLeakInternals/import_resolution_errorfails because formatted import-resolution errors retain their underlying cause, allowingerrors.Asto expose a filesystemPathError. This is a separate follow-up to the pre-existing failure observed on #73586.Approach
Return a display-ready
FormattedParserErrorwithout an underlying cause fromFormatImportError. Preserve source location, YAML context, and fix hints, as well as formatted-error detection that prevents double formatting. Import-cycle and YAML parse error traversal remain unchanged.Add regression coverage for direct and wrapped filesystem errors, sentinel errors, and nil causes, and document the import formatter's error-chain boundary.
Validation
golangci-lintpassed with zero issues.make agent-report-progressgate remains blocked by pre-existing custom-linter diagnostics on unchanged indexing expressions inpkg/parser/import_error.go. Its impacted Go tests and schema freshness check passed.