jamf-cli version
main at 5c77d4d. Present in every released version that carries the resource.
Product namespace
pro (Jamf Pro / Platform API)
Auth method
not applicable — the defect is in command registration
OS / platform
All
Command run
Expected behavior
Each resource appears once in the command list.
Actual behavior
computer-groups appears twice. Counted on the built binary: two rows.
Anything else?
Cause. internal/commands/pro/generated/registry.go registers the same constructor on two consecutive lines:
71: root.AddCommand(NewComputerGroupsCmd(ctx))
72: root.AddCommand(NewComputerGroupsCmd(ctx))
It is the only duplicate in the registry. Checked by extracting every New…Cmd(ctx) call and looking for repeats; NewComputerGroupsCmd is the sole result.
What it costs. No capability is lost, because the two subtrees are identical. Three smaller costs:
pro --help is wrong, and a duplicated row reads as a defect to anyone using the output.
- Cobra's
Find resolves every path under computer-groups to the first copy, so the second whole command tree is unreachable. It is built at every process start and never used.
- It inflates any count taken by walking the command tree by one. A test that walks the tree and reports a leaf count reports 1437 where 1436 commands are reachable.
This is a generated file, so the fix belongs in the generator, not in registry.go, which make generate overwrites. The emitter is registryTemplate in generator/parser/generator.go. The likely cause is a resource reaching the registry list twice — for example surviving both a family split and a version dedupe — so the fix is to make the emitter refuse or collapse a repeated constructor rather than to delete one line by hand.
A guard would be worth more than the fix: the emitter can fail when it is about to register the same constructor twice, so the next occurrence cannot reach a release. make verify-generated cannot see this, because the duplicate is faithfully reproduced by the generator and the tree is therefore "up to date".
How it was found. #360 walks every leaf of the command tree, and its allowlist recorded pro computer-groups get as an example that "resolves to a same-named sibling". The real cause is this duplicate, so that comment sent a reader looking for an example problem. #360 corrects the comment and does not fix the registry, this being a separate generator concern.
jamf-cli version
mainat 5c77d4d. Present in every released version that carries the resource.Product namespace
pro (Jamf Pro / Platform API)
Auth method
not applicable — the defect is in command registration
OS / platform
All
Command run
Expected behavior
Each resource appears once in the command list.
Actual behavior
computer-groupsappears twice. Counted on the built binary: two rows.Anything else?
Cause.
internal/commands/pro/generated/registry.goregisters the same constructor on two consecutive lines:It is the only duplicate in the registry. Checked by extracting every
New…Cmd(ctx)call and looking for repeats;NewComputerGroupsCmdis the sole result.What it costs. No capability is lost, because the two subtrees are identical. Three smaller costs:
pro --helpis wrong, and a duplicated row reads as a defect to anyone using the output.Findresolves every path undercomputer-groupsto the first copy, so the second whole command tree is unreachable. It is built at every process start and never used.This is a generated file, so the fix belongs in the generator, not in
registry.go, whichmake generateoverwrites. The emitter isregistryTemplateingenerator/parser/generator.go. The likely cause is a resource reaching the registry list twice — for example surviving both a family split and a version dedupe — so the fix is to make the emitter refuse or collapse a repeated constructor rather than to delete one line by hand.A guard would be worth more than the fix: the emitter can fail when it is about to register the same constructor twice, so the next occurrence cannot reach a release.
make verify-generatedcannot see this, because the duplicate is faithfully reproduced by the generator and the tree is therefore "up to date".How it was found. #360 walks every leaf of the command tree, and its allowlist recorded
pro computer-groups getas an example that "resolves to a same-named sibling". The real cause is this duplicate, so that comment sent a reader looking for an example problem. #360 corrects the comment and does not fix the registry, this being a separate generator concern.