beads/internal/github
Harry Miller 33cab03193
fix: recognize ado:NNNNN shorthand in IsExternalRef and ExtractIdentifier (#2966)
* fix: recognize ado:NNNNN shorthand in IsExternalRef and ExtractIdentifier

IsExternalRef and ExtractIdentifier only matched full ADO URLs
(/_workitems/edit/\d+), but BuildExternalRef produces ado:NNNNN
shorthand when org/project config is unavailable. This caused the
sync engine to treat existing beads as new, creating duplicate ADO
work items instead of updating existing ones.

Fixes harry-miller-trimble/beads#28

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix: add shorthand ref support to GitHub/GitLab trackers, tighten ado:0

Address PR #2966 review feedback:

- GitHub tracker: add ghShorthandPattern (github:{id}) to IsExternalRef
  and ExtractIdentifier, fixing the same duplicate-creation bug as ADO
- GitLab tracker: add glShorthandPattern (gitlab:{id}) to IsExternalRef
  and ExtractIdentifier, fixing the same duplicate-creation bug as ADO
- ADO tracker: tighten regex from ^ado:(\d+)$ to ^ado:([1-9]\d*)$ to
  reject ado:0 which is invalid in practice
- Add test cases for shorthand format in all three trackers

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-02 19:20:30 -07:00
..
client.go lint: suppress gosec G404 for retry jitter (math/rand is fine for backoff) 2026-03-30 09:15:53 -07:00
fieldmapper.go feat: add GitHub Issues integration (tracker plugin) (GH#2373) 2026-03-10 15:53:31 -07:00
mapping.go feat: add GitHub Issues integration (tracker plugin) (GH#2373) 2026-03-10 15:53:31 -07:00
mapping_test.go feat: add GitHub Issues integration (tracker plugin) (GH#2373) 2026-03-10 15:53:31 -07:00
tracker.go fix: recognize ado:NNNNN shorthand in IsExternalRef and ExtractIdentifier (#2966) 2026-04-02 19:20:30 -07:00
tracker_test.go fix: recognize ado:NNNNN shorthand in IsExternalRef and ExtractIdentifier (#2966) 2026-04-02 19:20:30 -07:00
types.go feat: add GitHub Issues integration (tracker plugin) (GH#2373) 2026-03-10 15:53:31 -07:00
types_test.go feat: add GitHub Issues integration (tracker plugin) (GH#2373) 2026-03-10 15:53:31 -07:00