Repository navigation
Description
Problem
The owner changed the scope of #4840 on 2026-11-12 (comment 6835584734): the usage-error ranking proposes pass-through entries after the registry exists. The design of #4840 of 2026-11-20 defers this part, because the registry is not in the tree. So #4840 builds its six classes only, and this item holds the deferred part.
Scope
- Add the proposal class
passthrough_candidate: an unknown command under a group whose registry entries (src/devops_cli/core/passthrough.py) name a tool. An example isdevops openspec validatewhen no such command exists. The proposal is a pass-through entry, not a new flag. - Precedence:
hintedcomes beforepassthrough_candidate. - A command that the registry lists as never wrapped (
pr merge,auth,secret set,repo delete,release) never getspassthrough_candidate. The ranking reads that list from the registry, so the two lists stay the same. flag_candidatenever names a pass-through command.- For an unknown option of an API command, the proposal names the query field or the body field of its route (the API naming rule of the ADR of feat(cli): add the tool pass-through registry and its ADR #6597). The usage-error record holds the command path and the typed name only, and no argument value.
- The proposal threshold (5 errors on 3 days) also decides when a deferred tool group gets its pass-through item:
k8s,kustomize,tf,uv,test,pipeline,docker sign|verify, the single-tool rows ofdevops ci, and the root aliaseslint,formatandtui.
Acceptance criteria
- Test first: on the fixture ledger, a record of
devops openspec validate, when no such command exists, getspassthrough_candidate. The test fails on the base. - A test: a record of
devops pr mergegetshinted, notpassthrough_candidate. - A test: no row names a pass-through path as
flag_candidate. - A test: an unknown option of an API command gets a proposal that names the field of its route.
Dependencies
- feat(cli): add the tool pass-through registry and its ADR #6597
- feat(telemetry): rank CLI usage errors and propose fixes #4840
Source
Source: #4833
Alternatives check of 2026-11-27: none.
Tool: none found.
Reason: Searches found only shell command correctors such as thebleep and thefuck plus static completion specs; none reads an aggregated usage-error ledger, applies a 5-errors-on-3-days threshold, or proposes a registry pass-through entry.
Lacks:
- Reads no aggregated usage-error ledger of unknown commands and options
- Applies no threshold of 5 errors on 3 days per tool group
- Writes no pass-through entry from a registry never-wrapped list
- Names no query or body field of an API route
Proposed design
Problem statement
The usage-error ranking in src/devops_cli/telemetry/usage_error_report.py gives six classes and proposes no pass-through entry. A user who types an unknown command under a group with a registry entry gets no proposal, so the tool stays unwrapped. This item adds the class passthrough_candidate after hinted, reads the registry and NEVER_WRAPPED at run time, separates the classes by the record kind, and keeps the is_proposal threshold. The unregistered tool groups are item #7622. The API route field naming waits on a route table and moves to a new item.
Acceptance criteria
Requirement: Pass-through proposal for a registry group
The usage-error ranking SHALL give an unknown command under a group with a registry entry the class passthrough_candidate.
Scenario: Unknown command under the openspec group
- WHEN A test passes
passthrough_paths={"openspec": ("devops openspec",)}and replays 5 records on 3 days of the command pathopenspecand the namevalidate. - THEN The one row has the class
passthrough_candidateandis_proposaltrue.
Requirement: hinted before passthrough_candidate
The ranking SHALL give a record that a usage hint covers the class hinted and SHALL NOT give it the class passthrough_candidate.
Scenario: Hinted record under a never-wrapped entry
- WHEN A test passes
passthrough_paths={"gh pr merge": ("devops gh pr merge",)}and replays 5 records on 3 days of the command pathgh pr, the namemergeandhintedtrue. - THEN The row has the class
hintedand notpassthrough_candidate.
Requirement: Never-wrapped names get no pass-through proposal
The ranking SHALL NOT give a command whose tool path is in NEVER_WRAPPED the class passthrough_candidate.
Scenario: Each never-wrapped gh verb
- WHEN A test passes a fixture map from each of
gh pr merge,gh auth,gh secret set,gh repo deleteandgh releaseto its devops path, and replays 5 records on 3 days of each command. - THEN No row has the class
passthrough_candidate.
Requirement: Never-wrapped set read at call time
The ranking SHALL read NEVER_WRAPPED from devops_cli.core.passthrough at call time and SHALL keep no copy of it.
Scenario: A verb added to the set at call time
- WHEN A test replaces
devops_cli.core.passthrough.NEVER_WRAPPEDwith a set that addsrun list, and replays 5 records on 3 days of the command pathgh runand the namezzzwith no suggestion. - THEN The row has the class
feature_candidateand notpassthrough_candidate.
Requirement: Kind separates the classes
The ranking SHALL give a record of the kind unknown_option the class flag_candidate and SHALL NOT give it the class passthrough_candidate.
Scenario: Unknown option under a registry group
- WHEN A test passes
passthrough_paths={"openspec": ("devops openspec",)}and replays 5 records on 3 days of the kindunknown_option, the command pathopenspecand the name--dry-runn. - THEN The row has the class
flag_candidateand notpassthrough_candidate.
Requirement: Pass-through group below the threshold
The ranking SHALL set is_proposal to false for a passthrough_candidate group below telemetry.usage_errors_min_count or below telemetry.usage_errors_min_days.
Scenario: Four errors on three days
- WHEN A test passes
passthrough_paths={"openspec": ("devops openspec",)}and replays 4 records on 3 days of the command pathopenspecand the namevalidate, withmin_count5 andmin_days3. - THEN The row has the class
passthrough_candidateandis_proposalfalse.
Existing Tool Considered
The alternatives check of 2026-11-27 in the issue body gives the verdict none and names no tool; the block in the issue body holds what each candidate lacks. No open, maintained tool or library covers the need. The change builds the class inside the ranking in src/devops_cli/telemetry/usage_error_report.py, and it reuses the record kinds and the registry. Cost: about 40k tokens to build, keep and fix the code and its tests, and about 3 hours of elapsed time.
Key questions
- Which module holds the usage-error ranking, and which classes does it give?:
src/devops_cli/telemetry/usage_error_report.pyholds the ranking and the six classes in the orderresolved,hinted,alias_candidate,flag_candidate,feature_candidate,help_candidate. The living specopenspec/specs/usage-error-ranking/spec.mdstates that order and the threshold. [sources: src/devops_cli/telemetry/usage_error_report.py, openspec/specs/usage-error-ranking/spec.md, tests/telemetry/test_usage_error_report.py] - Which commands does the registry hold today, and which tool do they name?:
src/devops_cli/core/passthrough.pyholds five entries:gh run list,gh issue create,gh issue edit,gh issue closeandgh issue reopen. Each has a devops pathdevops gh ...and names the toolgh.NEVER_WRAPPEDholds the gh verbspr merge,auth,secret set,repo deleteandrelease. [sources: src/devops_cli/core/passthrough.py] - Which fields does the usage-error record hold for a proposal?: The record holds the command path, the typed name, the kind, the suggestion, the hinted flag and the caller. It holds no argument value, and a word that is not in the form of a CLI name becomes
<value>. [sources: src/devops_cli/telemetry/usage_errors.py] - Does this item still wait on feat(telemetry): rank CLI usage errors and propose fixes #4840 or feat(cli): add the tool pass-through registry and its ADR #6597?: No. The tree holds the six classes and the registry, and the living spec holds the ranking. This item changes
src/devops_cli/telemetry/usage_error_report.py, its test and the spec. [sources: src/devops_cli/telemetry/usage_error_report.py, src/devops_cli/core/passthrough.py, openspec/specs/usage-error-ranking/spec.md] - How does the ranking find the tool group of an unknown command?: The ranking compares the words of the record
command_pathwith each registry devops path, with the leadingdevopsremoved, and takes the longest entry whose path starts with those words. The matched entry names the tool, and the proposed entry is the typed path ofcommand_pathandname. (best practice) [sources: src/devops_cli/core/passthrough.py, docs/adr/0037-tool-commands-mirror-and-pass-through-options.md]- Chosen: Longest word-prefix match on the record command path. One rule serves a one-word group, a two-word row such as
docker sign, and the three-word rows ofgh. - Rejected: Match the full typed path. An unknown name is not a registered path, so no record would match.
- Rejected: A static map of groups in the ranking. It copies the registry and drifts from it.
- Chosen: Longest word-prefix match on the record command path. One rule serves a one-word group, a two-word row such as
- Where does
passthrough_candidatesit in the class order?: The class comes afterhintedand beforealias_candidate. (best practice) [sources: openspec/specs/usage-error-ranking/spec.md, src/devops_cli/telemetry/usage_error_report.py]- Chosen: After
hintedand beforealias_candidate. It keeps the precedence of the scope and puts a real tool entry before an alias of a devops command. - Rejected: Before
hinted. The scope of the issue putshintedfirst. - Rejected: After
help_candidate. An alias would then win over the pass-through entry for a registry group.
- Chosen: After
- How does the ranking compare a registry entry with
NEVER_WRAPPED?: The ranking readsNEVER_WRAPPEDfromdevops_cli.core.passthroughat call time. For an entry whose tool path starts withgh, it removes that prefix and tests the rest against the set, because the set holds gh verbs. (best practice) [sources: src/devops_cli/core/passthrough.py]- Chosen: Remove the
ghprefix, then test the set. The docstring of the set names gh verbs, and each registry key starts withgh. - Rejected: Test the whole tool path. No key equals a verb, so the exclusion never fires.
- Rejected: Test the last words of the key. A later tool with a same-named verb would be excluded by mistake.
- Chosen: Remove the
- How does the ranking separate a pass-through candidate from a flag candidate?: The record
kindseparates the cases. A record of kindunknown_commandgoes tohintedorpassthrough_candidate, and a record of kindunknown_optiongoes toflag_candidate. (best practice) [sources: src/devops_cli/telemetry/usage_errors.py, src/devops_cli/telemetry/usage_error_report.py]- Chosen: Classify by the record
kind. The kind states whether the caller typed a command word or an option name. - Rejected: Classify by token shape and group match. The shape does not tell an unknown command from an unknown option.
- Rejected: Let both classes fire for one record. One error would give two proposals.
- Chosen: Classify by the record
- How does the threshold decide a pass-through proposal?: The class reuses the
is_proposalrule: true only when the group meetstelemetry.usage_errors_min_count(default 5) andtelemetry.usage_errors_min_days(default 3). A group below the threshold stays in the output withis_proposalfalse. (best practice) [sources: openspec/specs/usage-error-ranking/spec.md, src/devops_cli/telemetry/usage_error_report.py]- Chosen: Reuse the
is_proposalrule of the spec. One threshold serves every class, and the spec already states it. - Rejected: Add a second threshold for
passthrough_candidate. It adds a second rule for the same count and breaks the spec.
- Chosen: Reuse the
- How does a test give the ranking a registry entry for a group?:
build_usage_error_reporttakes an optional keyword map from a tool path to its devops paths. The default derives the map fromdevops_cli.core.passthrough.REGISTRYat call time, so the two lists stay the same. A test passes a fixture map for a group with no entry, such asopenspec. (best practice) [sources: src/devops_cli/core/passthrough.py, src/devops_cli/telemetry/usage_error_report.py]- Chosen: An optional keyword map derived from
REGISTRYat call time. A test names a fixture group, and the default reads the real registry. - Rejected: A required map of
PassthroughEntryobjects. Each fixture entry needs nine fields, and the ranking reads paths only. - Rejected: Replace
REGISTRYin the module withmonkeypatch.setattr. A test would change a module constant, and no criterion would show the real registry.
- Chosen: An optional keyword map derived from
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Nov 21, 2026
#6597 builds the pass-through registry and ADR. The candidate adds the proposal class that reads that registry.devops-cli-service commentedon Nov 21, 2026
The result in the alternatives block of the issue body changed. Before this check: no check. A person decides what the new result means for the item.
Searches (8)
Tools considered:
Searches run:
Sources:
devops-cli-service commentedon Nov 22, 2026
Next step: the open items close, or a person replies in a comment or edits the body. See Dependencies in the section Proposed design of the body.
devops-cli-service commentedon Nov 27, 2026
Next step: the open items close, or a person replies in a comment or edits the body. See Dependencies and Watched files in the section Proposed design of the body.
devops-cli-service commentedon Nov 28, 2026
Next step: the stage job writes the plan of the item. See Moved to new items in the section Proposed design of the body.
dan-petty commentedon Nov 29, 2026
Returning #6598: its acceptance criterion and Key Question 6 require reading query and body field names from an API route table delivered by #6597, but #6597 (, ) only defines entries for CLI pass-through commands (, , , , , , , , ) with zero API route table or query/body field mappings.
dan-petty commentedon Nov 29, 2026
Clarifying exact file and symbol evidence from
#6597:src/devops_cli/core/passthrough.py(PassthroughEntry,REGISTRY) anddocs/adr/0037-tool-commands-mirror-and-pass-through-options.mdonly define CLI tool pass-through entries (devops_paths,runner,mode,owned_options,refused_options,mcp_allowlist,run_cost,page_rule,timeout) forghsubcommands, with no API route table or query/body field mappings required by theAPI route field namingcriterion of#6598.devops-cli-service commentedon Nov 29, 2026
Next step: the stage job writes the plan of the item. See Moved to new items in the section Proposed design of the body.
devops-cli-service commentedon Nov 29, 2026
Released in v0.257.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.257.0
devops-cli-service commentedon Nov 29, 2026
Live since 2026-11-29 22:09 UTC