Skip to content

Suggest similar commands when users type non-existent commands #572

@kfess

Description

@kfess

What would you like to be added?

When users type a command that doesn't exist, but a similar valid command exists,
it might be more helpful if Prow could suggest the relevant commands. For example:

The /label release-note-none cannot be applied. Did you mean /release-note-none?

Why is this needed?

Users often make typos or confuse command syntax.
For example:

/label release-note-none

This fails because release-note-none is not a valid label, but the correct command /release-note-none exists.

Currently, the message Prow shows is as follows:

The label(s) /label release-note-none cannot be applied. These labels are supported: api-review, tide/merge-method-merge, tide/merge-method-rebase, tide/merge-method-squash, team/katacoda, refactor, ci-short, ci-extended, ci-full, official-cve-feed. Is this label configured under labels -> additional_labels or labels -> restricted_labels in plugin.yaml?

New contributors cannot understand what is wrong and have to search through documentation to figure out the correct command.

Expected behavior

Expected message Prow shows might be:

The /label release-note-none cannot be applied. Did you mean /release-note-none?

This would help users quickly identify and correct their mistakes, improving the contributor experience especially for newcomers.
I think this could be implemented using edit distance (e.g., Levenshtein distance) to find similar command names.

Additional notes

Ideally, the error message could combine the benefits of both the current approach (showing available options) and the proposed suggestion (showing similar commands).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions