Skip to content

fix(tools): treat _/- as non-delimiters in slug prefix check#620

Open
caugner wants to merge 2 commits intomainfrom
fix-slug-underscore-prefix-match
Open

fix(tools): treat _/- as non-delimiters in slug prefix check#620
caugner wants to merge 2 commits intomainfrom
fix-slug-underscore-prefix-match

Conversation

@caugner
Copy link
Copy Markdown
Contributor

@caugner caugner commented Apr 10, 2026

Description

Update the fix-flaws search algorithm, treating _ and - as non-delimiters in the slug prefix check.

find_non_prefix_match now treats _ and - as non-delimiters,

Motivation

Ensures shorter slugs don't match as a complete hit inside a longer one (e.g. Mobile inside Mobile_accessibility), which prevented fixable flaws from being fixed.

Additional details

find_non_prefix_match() fell through to _ => true for '_' and '-', treating them as word boundaries. This caused slugs like "Mobile" to match as a complete hit inside "Mobile_accessibility", producing wrong byte offsets and making apply_suggestions skip the second fix on the same line as overlapping.

Related issues and pull requests

Part of mdn/fred#1462.

find_non_prefix_match fell through to `_ => true` for '_' and '-',
treating them as word boundaries. This caused slugs like "Mobile" to
match as a complete hit inside "Mobile_accessibility", producing wrong
byte offsets and making apply_suggestions skip the second fix on the
same line as overlapping.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 10, 2026

5f73f1a was deployed to: https://rari-pr620.review.mdn.allizom.net/

@caugner caugner marked this pull request as ready for review April 15, 2026 09:43
@caugner caugner requested a review from a team as a code owner April 15, 2026 09:43
@caugner caugner requested a review from LeoMcA April 15, 2026 09:43
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.

2 participants