fix(ux): improve error messages for artifact mismatches and missing release branches#750
Merged
fix(ux): improve error messages for artifact mismatches and missing release branches#750
Conversation
…elease branches Two UX improvements to help users diagnose common configuration issues: 1. Artifact errors now show the user's .craft.yml config, list available artifact/workflow names, and give actionable checklist suggestions. Also upgrades the zero-artifact warning to a hard error when artifact patterns are configured. 2. Release branch checkout failures now explain that `craft prepare` needs to run first, show the configured branch prefix, and list both exact-match and fuzzy-match (Levenshtein distance <= 3) remote branches to help identify typos or naming mismatches.
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 3 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
- Scope checkout try/catch to release-branch path only, so --rev errors propagate unchanged; include original error in message - Fix incorrect comment about git branch sorting (alphabetical, not chronological) - Extract shared formatArtifactConfigForError() into utils/strings.ts to eliminate YAML formatting duplication between publish.ts and github.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two UX improvements to help users diagnose common configuration issues faster:
1. Artifact mismatch errors now include config context and actionable suggestions
Before: Generic messages like
No artifacts matching filters found for revision "abc123" (tries: 3)— users had no idea what went wrong or how to fix it.After: Error messages now include:
.craft.ymlartifact configuration rendered as YAMLAlso upgrades the "no artifacts found" warning in
printRevisionSummaryto a hard error when.craft.ymlexplicitly defines artifact patterns — if you configured artifacts but none were found, that's a misconfiguration, not something to warn about.Example improved error:
2. Missing release branch error now suggests
craft prepareand lists similar branchesBefore: Raw git error
error: pathspec 'release/1.2.3' did not match any file(s) known to git— completely opaque.After: Clear error with:
craft preparerelaese→releaseorreleases→releaseExample improved error:
Changes
src/artifact_providers/github.tsgetArtifactsFromWorkflowRunsto also return all seen artifact names; addedformatArtifactConfigForError()helper; improved 3 error messages with config dumps and suggestionssrc/commands/publish.tsfindReleaseBranches()for exact + fuzzy branch listing; upgradedprintRevisionSummaryzero-artifact warning to error when artifact config is setsrc/utils/git.tsfindReleaseBranches()— fetches remote, lists all branches, returns exact and fuzzy (edit distance ≤ 3) matchespackage.jsonfastest-levenshteindependency (zero-dep, 21kB) for fuzzy branch matchingsrc/artifact_providers/__tests__/github.test.tsformatArtifactConfigForError(),allNamesreturn value, and new test helpersrc/utils/__tests__/git.test.tsfindReleaseBranches()covering exact, fuzzy, both, empty, HEAD filtering, limits, fetch failuresTest plan
_errcatch params)