Skip to content

[BUG] check-edit-links generates 404s #5151

@Ishita-190

Description

@Ishita-190

Describe the bug.

Running npm run test:editlinks generates 404 links for some spec pages.
File: scripts/markdown/check-edit-links.ts

Image

Proposed fixes

Dynamically detect available versions from the filesystem.

  • Resolve the specification directory at runtime (reference/specification/, derived from process.cwd()).

  • Read directory contents using Node’s fs module.

  • Detect specification versions by matching entries against a semantic version pattern:

    • v\d+\.\d+\.\d+ for folders, or
    • v\d+\.\d+\.\d+\.md for files.
  • Normalize file paths (\/) before comparisons so behavior is consistent across platforms.
  • Pass the discovered version list to determineEditLink, allowing it to automatically generate GitHub edit links for any valid spec version without maintaining a manual allowlist.

Expected behavior

  • Files outside the ignore list are checked for broken edit links.
  • Files returning 404 are logged with their file paths.
  • All other links are considered valid.

Screenshots

After making the proposed changes, running npm run test:editlinks confirms that all edit links are valid

Image

How to Reproduce

  1. npm install
  2. npm run test:editlinks

🖥️ Device Information [optional]

  • Operating System (OS): Windows

👀 Have you checked for similar open issues?

  • I checked and didn't find similar issue

🏢 Have you read the Contributing Guidelines?

Are you willing to work on this issue ?

Yes I am willing to submit a PR!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    To Be Triaged

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions