Conversation
Replaces the duplicated condition logic in sendJobConclusionSpan with an explicit hasValidPrefix boolean. This removes the redundant colonIdx > 0 check in the exceptionMessage line (it was already implied by the exceptionType !== 'gh-aw.AgentError' test), and makes it immediately clear that both exceptionType and exceptionMessage derive from the same predicate. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Hey One item to address before this is ready for maintainer review:
If you'd like a hand, you can assign this prompt to your coding agent:
|
There was a problem hiding this comment.
Pull request overview
Simplifies exception type/message extraction for OTLP exception span events by factoring the shared “valid prefix” predicate into a dedicated boolean, preserving existing behavior while improving readability.
Changes:
- Extracted
hasValidPrefixto avoid duplicated/indirect conditional logic. - Updated
exceptionTypeandexceptionMessagederivation to use the shared predicate consistently.
Show a summary per file
| File | Description |
|---|---|
actions/setup/js/send_otlp_span.cjs |
Refactors exception prefix validation into hasValidPrefix and reuses it for both exception.type and exception.message extraction. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 1/1 changed files
- Comments generated: 0
This PR simplifies recently modified code from PR #25972 to improve clarity while preserving all functionality.
Files Simplified
actions/setup/js/send_otlp_span.cjs— extractedhasValidPrefixboolean to remove duplicated condition logicImprovement Made
Before:
After:
The
exceptionMessageline previously re-checkedcolonIdx > 0 && exceptionType !== "gh-aw.AgentError". ThecolonIdx > 0part was redundant — ifexceptionType !== "gh-aw.AgentError"is true,colonIdx > 0is necessarily also true. More importantly, checking the string value ofexceptionTypeto determine message extraction is indirect; using the samehasValidPrefixpredicate makes the relationship explicit and avoids the implicit coupling between the two variables.Changes Based On
Testing
extracts exception.type from colon-prefixed error messages,falls back to gh-aw.AgentError when message has no colon prefix, etc.)GITHUB_RUN_ATTEMPTenv var and version file environment issues)Review Focus
Please verify:
hasValidPrefixboolean correctly captures the original conditionexceptionTypeandexceptionMessageremain semantically equivalent to the original codeAutomated by Code Simplifier Agent — analyzing code from the last 24 hours