Skip to content

enhance(scripts/diff-flat): detect moves#29561

Draft
caugner wants to merge 5 commits into
mainfrom
flat-diff-rename
Draft

enhance(scripts/diff-flat): detect moves#29561
caugner wants to merge 5 commits into
mainfrom
flat-diff-rename

Conversation

@caugner
Copy link
Copy Markdown
Contributor

@caugner caugner commented Apr 28, 2026

Summary

Enhance the diff-flat script to detect feature moves.

Test results and supporting details

Related issues

Triggered by #29451.

@github-actions github-actions Bot added infra Infrastructure issues (npm, GitHub Actions, releases) of this project scripts Issues or pull requests regarding the scripts in scripts/. size:l [PR only] 101-1000 LoC changed labels Apr 28, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 28, 2026

Tip: Review these changes grouped by change (recommended for most PRs), or grouped by feature (for large PRs).

caugner added 2 commits April 30, 2026 22:53
Project each detected move's `__compat` from its source path onto the
destination path in the base tree before flattening, so a pure rename
produces zero diff output beyond the moves listing. Real edits inside
a moved feature still surface, anchored to the new path.
…ords

Add a fallback pass to `detectMoves` for features without `spec_url` or
`mdn_url`. Score each candidate by common-ancestor depth (primary) plus
inverse-frequency-weighted shared leaf tokens (secondary). Tokens that
appear in more than half of unmatched removed or added features are
treated as scaffolding (e.g. `init`, `parameter`) and ignored.

Catches renames like `api.fetch.init_keepalive_parameter` →
`api.fetch.options_parameter.keepalive` that pass 1 misses for lack of a
spec URL.
Comment thread scripts/diff-flat.js
}
node = node[parts[i]];
}
node[parts[parts.length - 1]] = value;
Comment thread scripts/diff-flat.js
const rendered = formatMove(from, to, options);
const visibleLen =
options.format === 'html'
? rendered.replace(/<[^>]+>/g, '').length
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

infra Infrastructure issues (npm, GitHub Actions, releases) of this project scripts Issues or pull requests regarding the scripts in scripts/. size:l [PR only] 101-1000 LoC changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants