Skip to content

[#7] Accept YouTrack project keys starting with a digit - #8

Open
heitor-lassarote wants to merge 1 commit into
heitor-lassarote/#4-add-rspec-testsfrom
heitor-lassarote/#7-fix-youtrack-issue-prefix-digit-keys
Open

[#7] Accept YouTrack project keys starting with a digit#8
heitor-lassarote wants to merge 1 commit into
heitor-lassarote/#4-add-rspec-testsfrom
heitor-lassarote/#7-fix-youtrack-issue-prefix-digit-keys

Conversation

@heitor-lassarote

Copy link
Copy Markdown
Member

Description

youtrack_issue's prefix pattern in issue-prefix.rb required a
YouTrack project key to start with an uppercase letter, but some real
project keys start with a digit (e.g. 1IN, 21C, both confirmed via
the YouTrack API). Commit subjects prefixed with such a key weren't
recognized as having a valid issue prefix.

Widens the pattern's character class so the key can start with a
digit or a letter, and adds regression tests for both examples.

Base branch note: this PR targets
heitor-lassarote/#4-add-rspec-tests rather than master, since
master doesn't have the RSpec suite yet and this fix needs a
regression test. This PR depends on #6 landing first.

Related issue(s)

Fixed #7

✅ Checklist for your Pull Request

Related changes (conditional)

  • Tests

    • If I added new functionality, I added tests covering it.
    • If I fixed a bug, I added a regression test to prevent the bug from
      silently reappearing again.
  • Documentation

    • I checked whether I should update the docs and did so if necessary:
  • Agent instructions (conditional)

    • If this PR was opened by a coding agent (Claude Code, Copilot, etc.),
      it followed the agent instructions in .claude/settings.json
      (plugin) and .github/copilot-instructions.md.
  • Public contracts

    • Any modifications of public contracts comply with the Evolution
      of Public Contracts
      policy.
    • I added an entry to the changelog if my changes are visible to the users
      and
    • provided a migration guide for breaking changes if possible

Stylistic guide (mandatory)

@heitor-lassarote
heitor-lassarote force-pushed the heitor-lassarote/#4-add-rspec-tests branch 3 times, most recently from b5fa5e2 to 762b517 Compare August 26, 2026 21:11
Problem: youtrack_issue's prefix pattern required the project key to
start with an uppercase letter (/\[[A-Z][A-Z0-9]*-\d+\]/), but some
real project keys start with a digit (e.g. 1IN, 21C, both confirmed
via the YouTrack API). Commit subjects prefixed with such a key were
not recognized as having a valid issue prefix. The same bug existed
independently in check_merge_request's ticket_links default pattern,
used to scan PR/MR titles and bodies for YouTrack ticket mentions.

Solution: Extract the shared YOUTRACK_ISSUE_KEY_PATTERN sub-pattern
into a constant used by both issue-prefix.rb and merge-request.rb, so
there is only one place left to get this right, and widen it so the
key can start with a digit or a letter. Add regression tests for both
call sites and both example keys.
@heitor-lassarote
heitor-lassarote force-pushed the heitor-lassarote/#7-fix-youtrack-issue-prefix-digit-keys branch from 0803429 to e1cccad Compare August 26, 2026 21:25
@heitor-lassarote heitor-lassarote self-assigned this Aug 26, 2026
@heitor-lassarote
heitor-lassarote marked this pull request as ready for review August 26, 2026 21:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant