Skip to content

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

Draft
caugner wants to merge 1 commit intomainfrom
fix-slug-underscore-prefix-match
Draft

fix(tools): treat _/- as non-delimiters in slug prefix check#620
caugner wants to merge 1 commit 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

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

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