Skip to content

fix(metadata): use short deprecation anchors#933

Open
vsolano9 wants to merge 3 commits into
nodejs:mainfrom
vsolano9:codex/issue-790-deprecation-links
Open

fix(metadata): use short deprecation anchors#933
vsolano9 wants to merge 3 commits into
nodejs:mainfrom
vsolano9:codex/issue-790-deprecation-links

Conversation

@vsolano9

Copy link
Copy Markdown

Description

Use short DEP#### codes as metadata slugs for headings on the deprecations page. This keeps duplicate handling in the existing stateful slugger, preserves ordinary slugging outside deprecations, and avoids emitting a duplicate legacy HTML alias when the primary slug is already short.

This changes web and Orama links from long heading-derived fragments to stable links such as #DEP0001. Legacy JSON and llms.txt outputs are byte-identical to the base for the tested deprecations source.

Assisted-by: OpenAI Codex

Validation

  • Node.js v24.14.0
  • npm ci (0 vulnerabilities)
  • focused metadata parser test: 27 passed
  • node --run test:ci: 512 passed, 0 failed
  • node --run lint: 0 errors, 2 pre-existing warnings in useOrama.mjs
  • node --run format:check
  • changeset status --since=main
  • node --run test:e2e: 4 passed
  • generated Node.js deprecations source at e6e6f677b34ba0fc87e897512feee11e4d2c0ca4 with legacy-html, legacy-json, web, orama-db, and llms-txt; short anchors were verified in legacy HTML, web, and Orama, with legacy JSON and llms.txt unchanged from base

Related Issues

Fixes #790

Check List

  • I have read the Contributing Guidelines and made commit messages that follow the guideline.
  • I have run node --run test and all tests passed.
  • I have checked code formatting with node --run format:check and node --run lint.
  • I have covered the new functionality with unit tests.

@vsolano9
vsolano9 requested a review from a team as a code owner July 22, 2026 12:19
@vercel

vercel Bot commented Jul 22, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
api-docs-tooling Ready Ready Preview Jul 23, 2026 6:24am

Request Review

@vercel

vercel Bot commented Jul 22, 2026

Copy link
Copy Markdown

@vsolano9 is attempting to deploy a commit to the OpenJS Foundation Team on Vercel.

A member of the Team first needs to authorize it.

@cursor

cursor Bot commented Jul 22, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Scoped to doc-generation slug and HTML anchor output; covered by new unit tests with no auth or runtime behavior changes.

Overview
Deprecation headings on the deprecations page now use short #DEP#### anchors instead of long title-derived slugs, so web and search links stay stable and match legacy behavior.

Metadata parsing adds getHeadingSlug: on the deprecations API only, headings matching DEP####: get slugs like DEP0001 (with the existing slugger handling duplicates as DEP0001-1). Other pages still use normal slugs. DEPRECATION_HEADING_REGEX moves to shared metadata constants; legacy HTML imports it from there.

Legacy HTML skips the extra legacy alias anchor when it would duplicate the primary id (same slug). When the primary slug differs from the legacy form, both anchors are still emitted.

Reviewed by Cursor Bugbot for commit a7ee557. Bugbot is set up for automated code reviews on this repo. Configure here.

Comment thread src/generators/legacy-html/utils/buildContent.mjs
Comment thread src/generators/metadata/utils/parse.mjs Outdated
*/
const getHeadingSlug = text => {
const deprecationHeading =
api === 'deprecations' && DEPRECATION_HEADING_REGEX.exec(text);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
api === 'deprecations' && DEPRECATION_HEADING_REGEX.exec(text);
DEPRECATION_HEADING_REGEX.exec(text);

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Applied the direct regex call. The /deprecations page check now stays in the return condition so DEP-like headings on other pages continue to use normal slugging.

Comment thread src/generators/metadata/utils/parse.mjs Outdated
Comment on lines +59 to +61
return deprecationHeading
? nodeSlugger.slug(deprecationHeading[1]).toUpperCase()
: nodeSlugger.slug(text);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Does nodeSlugger need to run on deprecationHeading[1]? Isn't that our slug itself?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

It still needs the stateful slugger for duplicate codes: repeated DEP0001 headings must become DEP0001 and DEP0001-1. The duplicate-code regression covers that behavior, so I retained nodeSlugger.

Add regression coverage for matching primary and legacy anchors.

Assisted-by: OpenAI Codex
Signed-off-by: Victor Solano <victor.solanonunez@gmail.com>

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit b1df29b. Configure here.

Comment thread .changeset/short-deprecation-links.md Outdated
Comment thread src/generators/metadata/constants.mjs
Share the deprecation heading matcher and classify the published fragment change as minor.

Assisted-by: OpenAI Codex
Signed-off-by: Victor Solano <victor.solanonunez@gmail.com>
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.

Long and short deprecation links

2 participants