Skip to content

feat(w3c/headers): validate header links#5143

Draft
marcoscaceres wants to merge 6 commits intomainfrom
feat/validate-header-links
Draft

feat(w3c/headers): validate header links#5143
marcoscaceres wants to merge 6 commits intomainfrom
feat/validate-header-links

Conversation

@marcoscaceres
Copy link
Copy Markdown
Contributor

@marcoscaceres marcoscaceres commented Mar 28, 2026

Summary

  • Validates that edDraftURI, historyURI, implementationReportURI, and other header links are well-formed URLs pointing to the expected hosts
  • Rejects obviously wrong values early with clear error messages rather than silently producing broken spec headers

@marcoscaceres marcoscaceres force-pushed the feat/validate-header-links branch 3 times, most recently from 5982fb1 to 721ec7b Compare March 28, 2026 12:35
@marcoscaceres marcoscaceres requested a review from Copilot March 28, 2026 13:40
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR enhances W3C header handling by adding validation/verification around key header links (notably latestVersion and historyURI) and extends the test suite to cover the new behaviors, aiming to surface broken header links earlier via warnings/errors.

Changes:

  • Add a HEAD check for derived latestVersion URLs and emit a w3c/headers warning when the URL can’t be reached.
  • Adjust historyURI derivation to support explicit suppression (null) and refactor URL probing into resourceExists().
  • Update/extend w3c/headers tests (warnings filter, status loops, new warning expectation).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.

File Description
tests/spec/w3c/headers-spec.js Adds warnings assertions and refactors status-based tests for header link behavior.
src/w3c/templates/cgbg-headers.js Tweaks when the “Latest published version” row is rendered for CG/BG headers.
src/w3c/headers.js Adds URL existence probing for latestVersion, refactors history derivation, and introduces resourceExists().

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/w3c/headers.js
Comment thread src/w3c/headers.js Outdated
Comment thread src/w3c/headers.js Outdated
Comment thread tests/spec/w3c/headers-spec.js
Comment thread tests/spec/w3c/headers-spec.js
Comment thread src/w3c/headers.js Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

src/w3c/templates/cgbg-headers.js:47

  • conf.latestVersion !== null (and the nested conf.latestVersion !== "") will treat undefined as “present” and render an <a> whose href/text become undefined. The W3C headers template avoids this by checking property existence ("latestVersion" in conf) and then treating falsy values as “none”. Consider aligning the CGBG template logic (e.g., guard on property existence or use a nullish check) so missing/undefined latestVersion can’t produce a broken link.
      ${conf.latestVersion !== null
        ? html`<dt>${l10n.latest_published_version}</dt>
            <dd>
              ${conf.latestVersion !== ""
                ? html`<a href="${conf.latestVersion}"
                    >${conf.latestVersion}</a
                  >`
                : "none"}

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/spec/w3c/headers-spec.js
Comment thread src/w3c/templates/cgbg-headers.js Outdated
@marcoscaceres marcoscaceres force-pushed the feat/validate-header-links branch from 8ea26c4 to a7a0832 Compare April 13, 2026 01:58
Comment thread src/w3c/templates/cgbg-headers.js Outdated
@marcoscaceres
Copy link
Copy Markdown
Contributor Author

@copilot please rebase

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 19, 2026

@copilot please rebase

I synced the branch updates and pushed the latest follow-up in c9109eb6. A full base-branch rebase here would require rewriting branch history, which this environment can’t safely push.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • addons.mozilla.org
    • Triggering command: /usr/lib/firefox/firefox /usr/lib/firefox/firefox http://localhost:9876/?id=85508135 -profile /tmp/karma-85508135 -no-remote -wait-for-browser -headless --start-debugger-server 6000 (dns block)
  • ads.mozilla.org
    • Triggering command: /usr/lib/firefox/firefox /usr/lib/firefox/firefox http://localhost:9876/?id=85508135 -profile /tmp/karma-85508135 -no-remote -wait-for-browser -headless --start-debugger-server 6000 (dns block)
  • aomedia.org
    • Triggering command: /usr/lib/firefox/firefox /usr/lib/firefox/firefox http://localhost:9876/?id=85508135 -profile /tmp/karma-85508135 -no-remote -wait-for-browser -headless --start-debugger-server 6000 (dns block)
  • aomediacodec.github.io
    • Triggering command: /usr/lib/firefox/firefox /usr/lib/firefox/firefox http://localhost:9876/?id=85508135 -profile /tmp/karma-85508135 -no-remote -wait-for-browser -headless --start-debugger-server 6000 (dns block)
  • api.specref.org
    • Triggering command: /usr/lib/firefox/firefox /usr/lib/firefox/firefox http://localhost:9876/?id=85508135 -profile /tmp/karma-85508135 -no-remote -wait-for-browser -headless --start-debugger-server 6000 (dns block)
  • aus5.mozilla.org
    • Triggering command: /usr/lib/firefox/firefox /usr/lib/firefox/firefox http://localhost:9876/?id=85508135 -profile /tmp/karma-85508135 -no-remote -wait-for-browser -headless --start-debugger-server 6000 (dns block)
  • caniuse.com
    • Triggering command: /usr/lib/firefox/firefox /usr/lib/firefox/firefox http://localhost:9876/?id=85508135 -profile /tmp/karma-85508135 -no-remote -wait-for-browser -headless --start-debugger-server 6000 (dns block)
  • cdn.jsdelivr.net
    • Triggering command: /usr/lib/firefox/firefox /usr/lib/firefox/firefox http://localhost:9876/?id=85508135 -profile /tmp/karma-85508135 -no-remote -wait-for-browser -headless --start-debugger-server 6000 (dns block)
  • ciscobinary.openh264.org
    • Triggering command: /usr/lib/firefox/firefox /usr/lib/firefox/firefox http://localhost:9876/?id=85508135 -profile /tmp/karma-85508135 -no-remote -wait-for-browser -headless --start-debugger-server 6000 (dns block)
  • cloudflare-dns.com
    • Triggering command: /usr/lib/firefox/firefox /usr/lib/firefox/firefox http://localhost:9876/?id=85508135 -profile /tmp/karma-85508135 -no-remote -wait-for-browser -headless --start-debugger-server 6000 (dns block)
  • company
    • Triggering command: /usr/lib/firefox/firefox /usr/lib/firefox/firefox http://localhost:9876/?id=85508135 -profile /tmp/karma-85508135 -no-remote -wait-for-browser -headless --start-debugger-server 6000 (dns block)
  • creativecommons.org
    • Triggering command: /usr/lib/firefox/firefox /usr/lib/firefox/firefox http://localhost:9876/?id=85508135 -profile /tmp/karma-85508135 -no-remote -wait-for-browser -headless --start-debugger-server 6000 (dns block)
  • detectportal.firefox.com
    • Triggering command: /usr/lib/firefox/firefox /usr/lib/firefox/firefox http://localhost:9876/?id=85508135 -profile /tmp/karma-85508135 -no-remote -wait-for-browser -headless --start-debugger-server 6000 (dns block)
  • dom.spec.whatwg.org
    • Triggering command: /usr/lib/firefox/firefox /usr/lib/firefox/firefox http://localhost:9876/?id=85508135 -profile /tmp/karma-85508135 -no-remote -wait-for-browser -headless --start-debugger-server 6000 (dns block)
  • example.com
    • Triggering command: /usr/lib/firefox/firefox /usr/lib/firefox/firefox http://localhost:9876/?id=85508135 -profile /tmp/karma-85508135 -no-remote -wait-for-browser -headless --start-debugger-server 6000 (dns block)
  • example.org
    • Triggering command: /usr/lib/firefox/firefox /usr/lib/firefox/firefox http://localhost:9876/?id=85508135 -profile /tmp/karma-85508135 -no-remote -wait-for-browser -headless --start-debugger-server 6000 (dns block)
  • fetch.spec.whatwg.org
    • Triggering command: /usr/lib/firefox/firefox /usr/lib/firefox/firefox http://localhost:9876/?id=85508135 -profile /tmp/karma-85508135 -no-remote -wait-for-browser -headless --start-debugger-server 6000 (dns block)
  • firefox.settings.services.mozilla.com
    • Triggering command: /usr/lib/firefox/firefox /usr/lib/firefox/firefox http://localhost:9876/?id=85508135 -profile /tmp/karma-85508135 -no-remote -wait-for-browser -headless --start-debugger-server 6000 (dns block)
  • foo.com
    • Triggering command: /usr/lib/firefox/firefox /usr/lib/firefox/firefox http://localhost:9876/?id=85508135 -profile /tmp/karma-85508135 -no-remote -wait-for-browser -headless --start-debugger-server 6000 (dns block)
  • html.spec.whatwg.org
    • Triggering command: /usr/lib/firefox/firefox /usr/lib/firefox/firefox http://localhost:9876/?id=85508135 -profile /tmp/karma-85508135 -no-remote -wait-for-browser -headless --start-debugger-server 6000 (dns block)
  • hyperlink
    • Triggering command: /usr/lib/firefox/firefox /usr/lib/firefox/firefox http://localhost:9876/?id=85508135 -profile /tmp/karma-85508135 -no-remote -wait-for-browser -headless --start-debugger-server 6000 (dns block)
  • ipv4only.arpa
    • Triggering command: /usr/lib/firefox/firefox /usr/lib/firefox/firefox http://localhost:9876/?id=85508135 -profile /tmp/karma-85508135 -no-remote -wait-for-browser -headless --start-debugger-server 6000 (dns block)
  • jasmine.github.io
    • Triggering command: /usr/lib/firefox/firefox /usr/lib/firefox/firefox http://localhost:9876/?id=85508135 -profile /tmp/karma-85508135 -no-remote -wait-for-browser -headless --start-debugger-server 6000 (dns block)
  • lists.w3.org
    • Triggering command: /usr/lib/firefox/firefox /usr/lib/firefox/firefox http://localhost:9876/?id=85508135 -profile /tmp/karma-85508135 -no-remote -wait-for-browser -headless --start-debugger-server 6000 (dns block)
  • location.services.mozilla.com
    • Triggering command: /usr/lib/firefox/firefox /usr/lib/firefox/firefox http://localhost:9876/?id=85508135 -profile /tmp/karma-85508135 -no-remote -wait-for-browser -headless --start-debugger-server 6000 (dns block)
  • no-links-bar.com
    • Triggering command: /usr/lib/firefox/firefox /usr/lib/firefox/firefox http://localhost:9876/?id=85508135 -profile /tmp/karma-85508135 -no-remote -wait-for-browser -headless --start-debugger-server 6000 (dns block)
  • no-links-foo.com
    • Triggering command: /usr/lib/firefox/firefox /usr/lib/firefox/firefox http://localhost:9876/?id=85508135 -profile /tmp/karma-85508135 -no-remote -wait-for-browser -headless --start-debugger-server 6000 (dns block)
  • normandy.cdn.mozilla.net
    • Triggering command: /usr/lib/firefox/firefox /usr/lib/firefox/firefox http://localhost:9876/?id=85508135 -profile /tmp/karma-85508135 -no-remote -wait-for-browser -headless --start-debugger-server 6000 (dns block)
  • orcid.org
    • Triggering command: /usr/lib/firefox/firefox /usr/lib/firefox/firefox http://localhost:9876/?id=85508135 -profile /tmp/karma-85508135 -no-remote -wait-for-browser -headless --start-debugger-server 6000 (dns block)
  • org.github.io
    • Triggering command: /usr/lib/firefox/firefox /usr/lib/firefox/firefox http://localhost:9876/?id=85508135 -profile /tmp/karma-85508135 -no-remote -wait-for-browser -headless --start-debugger-server 6000 (dns block)
  • prod
    • Triggering command: /usr/lib/firefox/firefox /usr/lib/firefox/firefox http://localhost:9876/?id=85508135 -profile /tmp/karma-85508135 -no-remote -wait-for-browser -headless --start-debugger-server 6000 (dns block)
  • push.services.mozilla.com
    • Triggering command: /usr/lib/firefox/firefox /usr/lib/firefox/firefox http://localhost:9876/?id=85508135 -profile /tmp/karma-85508135 -no-remote -wait-for-browser -headless --start-debugger-server 6000 (dns block)
  • respec.org
    • Triggering command: /usr/lib/firefox/firefox /usr/lib/firefox/firefox http://localhost:9876/?id=85508135 -profile /tmp/karma-85508135 -no-remote -wait-for-browser -headless --start-debugger-server 6000 (dns block)
  • safebrowsing.googleapis.com
    • Triggering command: /usr/lib/firefox/firefox /usr/lib/firefox/firefox http://localhost:9876/?id=85508135 -profile /tmp/karma-85508135 -no-remote -wait-for-browser -headless --start-debugger-server 6000 (dns block)
  • services.addons.mozilla.org
    • Triggering command: /usr/lib/firefox/firefox /usr/lib/firefox/firefox http://localhost:9876/?id=85508135 -profile /tmp/karma-85508135 -no-remote -wait-for-browser -headless --start-debugger-server 6000 (dns block)
  • shiny
    • Triggering command: /usr/lib/firefox/firefox /usr/lib/firefox/firefox http://localhost:9876/?id=85508135 -profile /tmp/karma-85508135 -no-remote -wait-for-browser -headless --start-debugger-server 6000 (dns block)
  • some.places
    • Triggering command: /usr/lib/firefox/firefox /usr/lib/firefox/firefox http://localhost:9876/?id=85508135 -profile /tmp/karma-85508135 -no-remote -wait-for-browser -headless --start-debugger-server 6000 (dns block)
  • somewhere.else
    • Triggering command: /usr/lib/firefox/firefox /usr/lib/firefox/firefox http://localhost:9876/?id=85508135 -profile /tmp/karma-85508135 -no-remote -wait-for-browser -headless --start-debugger-server 6000 (dns block)
  • speced.github.io
    • Triggering command: /usr/lib/firefox/firefox /usr/lib/firefox/firefox http://localhost:9876/?id=85508135 -profile /tmp/karma-85508135 -no-remote -wait-for-browser -headless --start-debugger-server 6000 (dns block)
  • support.mozilla.org
    • Triggering command: /usr/lib/firefox/firefox /usr/lib/firefox/firefox http://localhost:9876/?id=85508135 -profile /tmp/karma-85508135 -no-remote -wait-for-browser -headless --start-debugger-server 6000 (dns block)
  • this
    • Triggering command: /usr/lib/firefox/firefox /usr/lib/firefox/firefox http://localhost:9876/?id=85508135 -profile /tmp/karma-85508135 -no-remote -wait-for-browser -headless --start-debugger-server 6000 (dns block)
  • tools.geostandaarden.nl
    • Triggering command: /usr/lib/firefox/firefox /usr/lib/firefox/firefox http://localhost:9876/?id=85508135 -profile /tmp/karma-85508135 -no-remote -wait-for-browser -headless --start-debugger-server 6000 (dns block)
  • twitter.com
    • Triggering command: /usr/lib/firefox/firefox /usr/lib/firefox/firefox http://localhost:9876/?id=85508135 -profile /tmp/karma-85508135 -no-remote -wait-for-browser -headless --start-debugger-server 6000 (dns block)
  • w3c.github.io
    • Triggering command: /usr/lib/firefox/firefox /usr/lib/firefox/firefox http://localhost:9876/?id=85508135 -profile /tmp/karma-85508135 -no-remote -wait-for-browser -headless --start-debugger-server 6000 (dns block)
  • wpt.fyi
    • Triggering command: /usr/lib/firefox/firefox /usr/lib/firefox/firefox http://localhost:9876/?id=85508135 -profile /tmp/karma-85508135 -no-remote -wait-for-browser -headless --start-debugger-server 6000 (dns block)
  • www.mozilla.org
    • Triggering command: /usr/lib/firefox/firefox /usr/lib/firefox/firefox http://localhost:9876/?id=85508135 -profile /tmp/karma-85508135 -no-remote -wait-for-browser -headless --start-debugger-server 6000 (dns block)
  • www.reddit.com
    • Triggering command: /usr/lib/firefox/firefox /usr/lib/firefox/firefox http://localhost:9876/?id=85508135 -profile /tmp/karma-85508135 -no-remote -wait-for-browser -headless --start-debugger-server 6000 (dns block)
  • www.rfc-editor.org
    • Triggering command: /usr/lib/firefox/firefox /usr/lib/firefox/firefox http://localhost:9876/?id=85508135 -profile /tmp/karma-85508135 -no-remote -wait-for-browser -headless --start-debugger-server 6000 (dns block)
  • www.w3.org
    • Triggering command: /usr/lib/firefox/firefox /usr/lib/firefox/firefox http://localhost:9876/?id=85508135 -profile /tmp/karma-85508135 -no-remote -wait-for-browser -headless --start-debugger-server 6000 (dns block)
  • www.wikipedia.org
    • Triggering command: /usr/lib/firefox/firefox /usr/lib/firefox/firefox http://localhost:9876/?id=85508135 -profile /tmp/karma-85508135 -no-remote -wait-for-browser -headless --start-debugger-server 6000 (dns block)
  • www.youtube.com
    • Triggering command: /usr/lib/firefox/firefox /usr/lib/firefox/firefox http://localhost:9876/?id=85508135 -profile /tmp/karma-85508135 -no-remote -wait-for-browser -headless --start-debugger-server 6000 (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@marcoscaceres marcoscaceres marked this pull request as draft April 19, 2026 12:43
@marcoscaceres
Copy link
Copy Markdown
Contributor Author

@copilot Rebase?

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 19, 2026

@copilot Rebase?

I rebased this branch onto origin/main locally; current HEAD is b292fee3. I couldn’t publish the rebased history from this environment because the provided push flow auto-rebases against origin/feat/validate-header-links and stops on conflicts.

marcoscaceres and others added 5 commits April 20, 2026 12:21
- Warn if latestVersion URL doesn't resolve (non-FPWD docs)
- CG drafts (specStatus ending in -DRAFT) no longer require latestVersion
- Extract resourceExists() helper that returns the final URL after
  redirects (or null), replacing ad-hoc fetch+ok patterns
- deriveHistoryURI() now returns a value instead of mutating conf,
  and uses resourceExists() to avoid duplicating fetch logic
- Guard conf.historyURI = null (user suppression) at the call site
  so explicit null is not overwritten by derivation
- Fix URL construction: use response.url (post-redirect) for the
  history URL rather than the pre-redirect constructed URL

Fixes #4037 (rebased from validate_latest branch)
- Fix [shortname] → [shortName] in docLink hint (wrong casing)
- Move FPWD guard before resourceExists() fetch to avoid unnecessary
  network request for FPWD docs
- Return null (not conf.historyURI) when historyURI is set on a
  non-standards-track document, so the History link is not rendered
- Use cgbgStatus (not cgStatus) in the latestVersion loop test to
  cover BG-DRAFT status
Per sidvishnoi: use != null (loose equality) to catch both null and
undefined, not just !== null.
@marcoscaceres marcoscaceres force-pushed the feat/validate-header-links branch from c9109eb to ce0e61d Compare April 20, 2026 02:22
@marcoscaceres
Copy link
Copy Markdown
Contributor Author

@copilot Can you confirm all your feedback has been addressed? Can you fix anything that was not addressed?

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 28, 2026

@copilot Can you confirm all your feedback has been addressed? Can you fix anything that was not addressed?

Confirmed: all previously raised review feedback is now addressed in the branch. I re-verified the key points (shortName hint casing, historyURI nulling for non-standards-track, FPWD fetch short-circuit, and CG/BG draft/latestVersion handling including strict nullish checks). The final follow-up commit is c07b13f.

No UI changes were made, so there’s no screenshot to attach.

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.

4 participants