bug(actions): duplicate artifacts command registered on the same parent shadows actions artifacts <run-id> #291
Labels
No labels
breaking
bug
documentation
enhancement
epic
good first issue
help wanted
refactoring
resolution/duplicate
resolution/invalid
resolution/wontfix
security
severity/critical
severity/high
severity/low
severity/medium
status/abandoned
status/blocked
status/needs-decision
status/needs-info
status/needs-verification
testing
upstream
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
sixfold-space/madtea#291
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Two distinct cobra commands named
artifactsare registered on the same parent (actions). Cobra does not reject duplicate names -Find()returns the first match - so one of them is unreachable from the CLI.Evidence (at
13aceba2)Both call
Cmd.AddCommandon the sameactionsparent:internal/cmd/actions/artifacts.go:21-ArtifactsCmd,Use: "artifacts",Short: "Repository artifact operations". A group withlist/get/delete/downloadsubcommands. Registered atinternal/cmd/actions/artifacts.go:112.internal/cmd/actions/workflows.go:158-artifactsCmd,Use: "artifacts <run-id>",Short: "List artifacts for a workflow run",Args: cobra.ExactArgs(1). Registered atinternal/cmd/actions/workflows.go:184.Symptom
madtea actions --helplistsartifactstwice, with the two differentShortstrings, which is how this surfaced.Since Go initializes files within a package in lexical filename order,
artifacts.goruns beforeworkflows.go, so the group registers first and should win lookup. That would make the per-run listing (actions artifacts <run-id>, backed bysvc.ActionsWorkflows.ListRunArtifacts) unreachable: the run-id positional would instead be parsed as an unknown subcommand of the group. Worth confirming against the intended precedence rather than taking the init-order reasoning as settled.Suggested direction
Whichever way precedence is meant to fall, the two want distinct paths. One option is folding the per-run listing into the group as a subcommand that takes the run id, e.g.
actions artifacts run <run-id>, leavingactions artifacts listas the repository-wide listing. That keeps both reachable and makes the repo-vs-run scope distinction explicit at the call site.A guard that fails the build (or a test) on duplicate command names under one parent would catch the class - this is silent today.
Notes
Found while updating a v0.12.3 CLI reference doc against v0.18.0. Not verified at runtime: the CLI declines to run under an agent and redirects to the
madt_*MCP tools, so the above is a source read plus the doubled--helpoutput, not an executed repro.