fix(mr): resolve an all-digit discussion ID prefix

Description

glab mr note resolve and glab mr note reopen read any all-digit identifier as a note ID. A discussion ID prefix that happens to be all digits, such as 42873626 from 428736269e25…, failed with "note not found" and was never tried as a prefix. About 2.3% of 8-character prefixes are all digits.

  • When an all-digit value of 8 or more characters matches no note, it is now tried as a discussion ID prefix. A matching note still wins, so note IDs behave as before.
  • When neither matches, the error names both: no note 12345678 in merge request !1, and no discussion found matching prefix "12345678".
  • Values shorter than 8 characters are still read as note IDs only.
  • The 8-character minimum is now mrutils.MinDiscussionPrefixLen, shared by the prefix resolver and the --reply checks in mr note create and mr note draft create.
  • The Long text of both commands says how an all-digit value is read, with docs/source/ regenerated.

mr note create --reply was not affected: it always resolves a prefix.

Resolves #8795 (closed)

How has this been tested?

  • New cases in mr_note_resolve_test.go: resolve and reopen by an all-digit prefix, a note ID winning over a matching all-digit prefix, and an all-digit value that matches neither. The three fallback cases fail on main.
  • lefthook run pre-push on the changed files: build, go-lint, go-test (1017 tests), check-generated, vale, markdownlint, lychee and comment checks pass.

Merge request reports

Loading
Loading