Repository navigation
Validate spec URL fragments with @webref/xref - #4713
Open
schalkneethling wants to merge 12 commits into
Open
schalkneethling wants to merge 12 commits into
schalkneethling wants to merge 12 commits into
Conversation
Check the fragment of every spec URL against the definition and heading anchors that w3c/webref crawls, using the same rules as BCD's spec_url linter (skip fragment-less URLs, strip text fragments, lookup with series: true and standing: good). Unknown fragments warn without failing the build while existing data is cleaned up; flip fragmentErrorsAreFatal to make them errors. npm run test:specs -- --report additionally writes a self-contained HTML report of every fragment check to reports/spec-fragments.html. Progress on web-platform-dx#84 Co-Authored-By: Claude Fable 5 <[email protected]>
Update 28 spec URLs whose fragments are legacy alias ids, renamed anchors, or moved definitions, so they target ids that w3c/webref records. Follows the approach suggested in web-platform-dx#84: update links to current ids rather than asking webref to carry legacy aliases. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Fj5YkGFX6Jy2Db9UWHwxcE
Co-authored-by: François Daoust <[email protected]>
Per review feedback: web-features doesn't use text fragments today and they break easily as spec prose changes, so treat any :~:text= fragment as invalid instead of skipping or partially validating it. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_012mrFGmopoAXrcD8CLnc8gN
# Conflicts: # features/anchor-positioning-transforms.yml # features/anchor-positioning.yml # features/parse-html-unsafe.yml
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Fragment mismatches are now logged as errors and count towards the exit code. Bump @webref/xref to 1.2.22 so the check uses the anchors that web-platform-dx#4321 was verified against. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
This replaces #4320, which GitHub closed when I deleted my fork by mistake. The commits are unchanged from that PR (head
71d6e8f), so earlier review discussion is on #4320.Progress on #84.
Important
Merge this after #4712. This PR makes unknown fragments fail the build, and
mainstill has the 30 spec URLs that #4712 relinks, sotest:specsfails here until #4712 lands. With #4712's data applied,test:specspasses with no errors.Checks the fragment of every spec URL against the anchors w3c/webref crawls, using the same rules as BCD's
spec_urllinter (mdn/browser-compat-data#23958): skip fragment-less URLs, strip:~:text=fragments,lookup(url, { series: true, standing: "good" }).fragmentErrorsAreFatalinscripts/specs.tstofalse.@webref/xrefas a dev dependency, at^1.2.22. That's the version Relink spec URL fragments that webref no longer knows #4712's relinked URLs were verified against. Older versions are missing anchors that current specs define, so they report valid links as unknown.npm run test:specs -- --reportwrites a self-contained HTML report of every fragment check toreports/spec-fragments.html.Because
@webref/xrefisn't pinned to an exact version, a localnpm installcan pick up a newer release whose crawl no longer has an anchor that the data links to. In that casetest:specsfails locally before it fails in CI. CI usesnpm ci, which installs the locked version, so workflows only change when the lockfile is updated.Per tidoust's suggestion, #4712 relinks the stale fragments to current ids rather than asking webref to carry legacy alias ids.