[repository-quality] 🎯 Repository Quality Improvement Report - Error Message Actionability #54543
Closed
Replies: 1 comment
|
This discussion was automatically closed because it expired on 2026-08-22T13:15:31.876Z.
|
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Analysis Date: 2026-08-21
Focus Area: Error Message Actionability (validation & wrapped errors)
Strategy Type: Custom
Custom Area: Yes — the repo already has a dedicated
.github/skills/error-messages/SKILL.mdstyle guide mandating "what's wrong / what's expected / how to fix" errors with examples, but a codebase-wide scan shows hundreds offmt.Errorfcall sites that don't follow it. This is a high-leverage, repo-specific gap rather than a generic category.Executive Summary
gh-awmaintains an explicit error-message style guide (error-messagesskill) requiring every validation error to state what's wrong, what's expected, and provide a concrete example, and to preferNewValidationError(field, value, reason, suggestion)over barefmt.Errorfin*_validation.gofiles. A repository scan found 2,666fmt.Errorfcall sites acrosspkg/, including roughly 245 "invalid X: %s"-style messages with no suggestion or example, and 509 "failed to X: %w" wrapper errors that pass through a low-level error with no recovery guidance.NewValidationErroritself has zero usages inpkg/parser, despite that package containing the bulk of frontmatter/workflow validation logic (import_field_extractor.go,mcp.go,remote_workflow_spec.go, etc.).This means users hitting common failures (bad repo slug format, bad workflow spec host, bad mcp-servers config) get terse errors with no actionable fix path, increasing support burden and back-and-forth debugging. Bringing these call sites in line with the existing skill is low-risk (pure string/wrapping changes, no logic changes) and immediately improves CLI usability for both human and Copilot-agent-driven workflows.
Recommended next steps: (1) retrofit
pkg/repoutilandpkg/parservalidation errors with actionable, example-driven messages per the skill template, (2) introduceNewValidationErrorusage inpkg/parserwhere currently absent, (3) add a lightweight lint/grep-based CI check to catch new bare "invalid X: %s"-style errors going forward.Full Analysis Report
Focus Area: Error Message Actionability
Current State Assessment
The repository already codifies error-message expectations in
.github/skills/error-messages/SKILL.md:[what's wrong]. [what's expected]. [example of correct usage]NewValidationError(field, value, reason, suggestion)in*_validation.gofilesfmt.Errorf("failed to X: %w", err)unless recovery guidance is addedinvalid,cannot,must,failed) without pairing it with expected behaviorA scan of
pkg/shows this guidance is inconsistently applied.Metrics Collected:
fmt.Errorfcall sites inpkg/"invalid ... : %s"-style errors (no example/suggestion)"failed to X: %w"wrapper errorsNewValidationErrorusages inpkg/parsererror-messagesskill exists and is documentedFindings
Strengths
.github/skills/error-messages/SKILL.md) with a good/bad example table.pkg/parser/remote_workflow_spec.go:91(invalid workflowspec host %q — expected a GitHub host... (for example: ...)) andpkg/parser/mcp.go:93(includes a full YAML example).NewValidationErrorexists as a helper for structured validation errors (used elsewhere in the codebase for schema/frontmatter validation).Areas for Improvement
pkg/repoutil/repoutil.go:20—fmt.Errorf("invalid repo format: %s", slug)gives no example of the expectedowner/repoformat, contradicting the skill's own documented ✅ example (invalid repo format '%s' — expected 'owner/repo' format (for example: 'github/gh-aw')).pkg/cli/preconditions.go:170,pkg/cli/fetch.go:95,pkg/cli/outcome_eval.go:518— repeat the same bare "invalid repo(sitory)... : %s" pattern without guidance, duplicating the same fixable gap across multiple files.pkg/cli/shell_completion.go:209,281—invalid bashrc path: %s/invalid zshrc path: %sgive no reason the path was rejected nor what a valid path looks like.pkg/parser(frontmatter/workflow parsing, the most user-facing validation surface) has zeroNewValidationErrorusages, meaning its ~31 files withfmt.Errorfrely entirely on ad hoc string formatting instead of the structured helper the skill recommends for*_validation.gologic.pkg/parser/workflow_update.goandpkg/parser/frontmatter_hash.goshows chains of 5+ near-identical wrappers (failed to read file,failed to parse frontmatter,failed to extract frontmatter) with no added context about which file/operation, making log triage harder.Detailed Analysis
The core risk is drift between documented style and actual code: the skill guide is high quality, but nothing enforces it. Because
gh awis a CLI used interactively and by Copilot coding agents parsing error text to decide next steps, ambiguous errors likeinvalid repo format: %scost extra round trips (the agent/user must guess the expected format). Centralizing the fixed strings inpkg/repoutil(used by many CLI commands) would have outsized impact for low effort, sinceSplitRepoSlugis likely called from multiple command paths.🤖 Tasks for Copilot Agent
NOTE TO PLANNER AGENT: Split the following tasks into individual work items.
Improvement Tasks
Task 1: Make repo-slug validation errors actionable in pkg/repoutil
Priority: High
Estimated Effort: Small
Focus Area: Error Message Actionability
Description: Update
SplitRepoSluginpkg/repoutil/repoutil.goto return an error message matching the skill's documented format: state what's wrong, the expectedowner/repoformat, and a concrete example.Acceptance Criteria:
[what's wrong]. [what's expected]. [example]github/gh-aw)SplitRepoSlugstill pass; add/update a test asserting the new message contentmake fmtrun after the changeCode Region:
pkg/repoutil/repoutil.go(functionSplitRepoSlug, line ~20)Task 2: Apply consistent actionable messaging to duplicated "invalid repo(sitory)" errors in pkg/cli
Priority: Medium
Estimated Effort: Small
Focus Area: Error Message Actionability
Description:
pkg/cli/preconditions.go:170,pkg/cli/fetch.go:95, andpkg/cli/outcome_eval.go:518each return a barefmt.Errorf("invalid repo... : %s", repo)/fmt.Errorf("invalid repository slug: %s", ...)without an example or expected format. Align these with the improved message introduced in Task 1.Acceptance Criteria:
owner/repoformat with an examplemake fmtrun after changesCode Region:
pkg/cli/preconditions.go:170,pkg/cli/fetch.go:95,pkg/cli/outcome_eval.go:518Task 3: Add actionable guidance to shell_completion.go path validation errors
Priority: Low
Estimated Effort: Small
Focus Area: Error Message Actionability
Description:
pkg/cli/shell_completion.go:209and:281returninvalid bashrc path: %s/invalid zshrc path: %swith no reason or fix guidance. Add context about why the path is invalid (e.g., does not exist, not writable) and what a valid path looks like.Acceptance Criteria:
--rc-file <path>or check$HOME)make fmtrun after the changeCode Region:
pkg/cli/shell_completion.go:209,281Task 4: Introduce NewValidationError usage in pkg/parser for at least one high-traffic validation path
Priority: Medium
Estimated Effort: Medium
Focus Area: Error Message Actionability
Description:
pkg/parserhas zero usages of theNewValidationErrorhelper despite being the primary frontmatter/workflow validation surface (import_field_extractor.go,inline_skill_extractor.go,sub_agent_extractor.go). Convert the duplicate-name validation errors (pkg/parser/inline_skill_extractor.go:118andpkg/parser/sub_agent_extractor.go:238, both currentlyfmt.Errorf("duplicate ... name %q", name)) to useNewValidationError(field, value, reason, suggestion)for consistent, structured, example-driven output.Acceptance Criteria:
NewValidationErrorhelper definition (likely inpkg/parseror a shared validation package) and confirm its signatureNewValidationErrorwith afieldnaming the config path, areasondescribing the duplicate, and asuggestionwith an example of renaming/removing the duplicatemake fmtand targetedgo test ./pkg/parser/...passCode Region:
pkg/parser/inline_skill_extractor.go:118,pkg/parser/sub_agent_extractor.go:238In pkg/parser, two validation error sites do not use the project's NewValidationError helper, unlike the pattern recommended in .github/skills/error-messages/SKILL.md: pkg/parser/inline_skill_extractor.go:118 -> fmt.Errorf("duplicate inline skill name %q", name) pkg/parser/sub_agent_extractor.go:238 -> fmt.Errorf("duplicate inline sub-agent name %q", name) First, find the NewValidationError(field, value, reason, suggestion) helper definition in this repo (grep for "func NewValidationError"). Then convert both call sites above to use NewValidationError instead of fmt.Errorf, providing: - field: the relevant frontmatter path (e.g., "skills" or "sub-agents") - value: the duplicate name - reason: "duplicate name '<name>' is already defined" - suggestion: an example showing how to rename one of the duplicates or remove it, following the skill's example-driven format Update or add tests in pkg/parser covering the duplicate-name error case for both inline skills and sub-agents, asserting on the new error type/message content. Run `make fmt` and `go test ./pkg/parser/...` (or the project's targeted test command) to confirm no regressions.📊 Historical Context
Previous Focus Areas
🎯 Recommendations
Immediate Actions (This Week)
Short-term Actions (This Month)
pkg/parservalidation errors toNewValidationErrorwhere structured field/value/reason/suggestion applies — Priority: Mediumfmt.Errorf("invalid ...: %s", ...)patterns lacking "expected"/"example" text — Priority: MediumLong-term Actions (This Quarter)
📈 Success Metrics
Next Steps
Generated by Repository Quality Improvement Agent
Next analysis: 2026-08-22 — Focus area selected by diversity algorithm
All reactions