Skip to content

fix(renovate-changesets): prevent hex digest digits from being extracted as version numbers#2019

Merged
marcusrbrown merged 7 commits intomainfrom
copilot/fix-digest-only-update-summaries
Apr 14, 2026
Merged

fix(renovate-changesets): prevent hex digest digits from being extracted as version numbers#2019
marcusrbrown merged 7 commits intomainfrom
copilot/fix-digest-only-update-summaries

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 11, 2026

  • Understand the issue and identify root cause
  • Fix VERSION_PATTERN approach — move (?!\w) out of the shared constant and apply it only to the two update ... to V patterns in TEXT_PATTERNS where the version sits at the end of the regex (avoiding false positives from digest hashes like 6a454fe)
  • Fix formatVersionText in summary-helpers.ts — omit redundant (N) when newVersion is a bare major digit
  • Add regression tests for digest-only PR title parsing
  • Fix lint errors (regexp/no-useless-assertions — lookahead was always-true in middle-of-regex contexts)
  • Build dist/ for the renovate-changesets action
  • Create changeset for renovate-changesets package (patch)

…s version numbers

- Add `(?!\w)` negative lookahead to VERSION_PATTERN so leading digits
  of hex strings like `6a454fe` are not captured as bare version numbers
- In formatVersionText, omit the redundant `(N)` parenthetical when
  newVersion equals majorVersion (single-digit major-only like `v4`)
- Add regression tests for digest-only PR title parsing

Agent-Logs-Url: https://github.com/bfra-me/.github/sessions/63b2a431-4332-434c-81d8-3bfde5876654

Co-authored-by: marcusrbrown <831617+marcusrbrown@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix malformed summaries for digest-only Docker updates fix(renovate-changesets): prevent hex digest digits from being extracted as version numbers Apr 11, 2026
Copilot AI requested a review from marcusrbrown April 11, 2026 22:05
@marcusrbrown marcusrbrown marked this pull request as ready for review April 11, 2026 23:51
@bfra-me bfra-me Bot added documentation Improvements or additions to documentation typescript Changes to TypeScript code and configuration labels Apr 11, 2026
@bfra-me bfra-me Bot requested a review from fro-bot April 11, 2026 23:51
@marcusrbrown
Copy link
Copy Markdown
Member

@copilot ALWAYS run quality checks before pushing up code. Fix the linter errors.

…N to fix lint

The negative lookahead was useless in middle-of-regex contexts where the
version is already bounded by whitespace, arrows, or parentheses. Apply
(?!\w) only to the two end-of-regex "update ... to V" patterns where it
is needed to reject leading hex digits of digest hashes.

Agent-Logs-Url: https://github.com/bfra-me/.github/sessions/d5b72141-582b-42e6-b7b9-e3c8cb48e499

Co-authored-by: marcusrbrown <831617+marcusrbrown@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 12, 2026

@copilot ALWAYS run quality checks before pushing up code. Fix the linter errors.

Fixed in f1e62be. The (?!\w) was baked into the shared VERSION_PATTERN constant, which caused the lint error because in middle-of-regex contexts (e.g. bump ... from V \s+to\s+ V) the lookahead is already guaranteed to pass. Moved it out of the constant and applied it only to the two update ... to V patterns where the version is at the end of the regex — the only positions where the assertion is non-trivial and actually rejects leading hex digits from digest hashes.

@marcusrbrown marcusrbrown requested review from fro-bot and removed request for fro-bot April 13, 2026 04:32
Copy link
Copy Markdown
Contributor

@fro-bot fro-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: PASS

Clean, well-scoped bug fix that prevents hex digest leading digits from being falsely extracted as version numbers in Docker digest-only Renovate PRs.

Blocking issues

None

Non-blocking concerns

  • renovate-parser.test.ts:554 — Placeholder issue URL https://github.com/bfra-me/.github/issues/XXXX in the regression test comment. Consider linking to the actual issue or removing the reference.

Missing tests

None — the three added tests provide solid coverage:

  1. Bare hex digest (6a454fe) correctly rejected as version
  2. sha256: prefixed digest correctly yields no version
  3. Regression guard confirming v4 major-only versions still parse correctly

Risk assessment: LOW

  • The (?!\w) negative lookahead is narrowly applied only to the two update ... to VERSION patterns where the version sits at regex end, which is exactly where digest-hash false positives occur.
  • The bump ... from V to V and (V → V) patterns are unaffected (correctly so — their paired structure already prevents this class of false positive).
  • The formatVersionText fix for to v4 (4)to v4 is a clean deduplication of display logic with no risk to other version formats.
  • dist/index.js changes match the source edits exactly.
  • Changeset correctly targets renovate-changesets with patch bump.

Run Summary
Field Value
Event pull_request
Repository bfra-me/.github
Run ID 24325784560
Cache hit
Session ses_27ae21f33ffegGQMWmfOa7nD36

@bfra-me bfra-me Bot requested a review from fro-bot April 13, 2026 05:30
@marcusrbrown marcusrbrown merged commit 07bc641 into main Apr 14, 2026
12 checks passed
@marcusrbrown marcusrbrown deleted the copilot/fix-digest-only-update-summaries branch April 14, 2026 00:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation typescript Changes to TypeScript code and configuration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(renovate-changesets): Docker digest-only updates produce malformed 'to v6 (6)' summaries

3 participants