Skip to content

feat(cli): add missing-redirects rule to fern check#14132

Merged
kafkas merged 6 commits intomainfrom
anar/fer-9171-implement-missing-redirects-fern-check-rule
Apr 2, 2026
Merged

feat(cli): add missing-redirects rule to fern check#14132
kafkas merged 6 commits intomainfrom
anar/fer-9171-implement-missing-redirects-fern-check-rule

Conversation

@kafkas
Copy link
Copy Markdown
Member

@kafkas kafkas commented Mar 26, 2026

Description

Linear ticket: FER-9171

Add a new fern check rule, missing-redirects, that compares the current docs navigation against the previously published markdown slug table stored in FDR. The rule detects when a page that was previously published has either been removed entirely or moved to a new slug without a corresponding redirect in docs.yml, helping prevent broken historical docs URLs after publish.

The rule is configurable through check.rules in docs.yml, where users can set it to warn or error, and it follows the standard docs check severity behavior. In practice this means the rule defaults to warning behavior, but can be promoted to an error when teams want redirect coverage to be enforced before publishing.

Because the rule depends on prior published state, it makes an authenticated network call to FDR during validation. The implementation handles first-publish, missing auth, offline/network failure, and timeout cases gracefully so the behavior remains consistent with the configured severity. This PR also extracts the core diffing and redirect-matching logic into unit-testable helpers and aligns slug generation behavior with the backend, including changelog-specific handling.

Changes Made

  • Added a new missing-redirects docs validation rule and wired it into check.rules configuration in docs.yml
  • Fetches previously published markdown slug entries from FDR and compares them against the current resolved docs navigation
  • Reports pages that were removed or moved without redirect coverage, with suggested redirect entries for moved pages
  • Handles first-publish, missing auth, offline/network failure, and timeout scenarios according to the configured rule severity
  • Extracted pure diffing and redirect-coverage logic into testable helpers and added unit tests for removed, moved, wildcard redirect, and basepath cases
  • Reused shared pageId-to-slug behavior for changelog entries to avoid drift with backend slug table generation

Testing

  • Unit tests added/updated
  • Manual testing completed

Copy link
Copy Markdown

@claude claude Bot left a comment

Choose a reason for hiding this comment

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

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review to trigger a review.

Tip: disable this comment in your organization's Code Review settings.

@github-actions
Copy link
Copy Markdown
Contributor

🌱 Seed Test Selector

Select languages to run seed tests for:

  • Python
  • TypeScript
  • Java
  • Go
  • Ruby
  • C#
  • PHP
  • Swift
  • Rust
  • OpenAPI
  • Postman

How to use: Click the ⋯ menu above → "Edit" → check the boxes you want → click "Update comment". Tests will run automatically and snapshots will be committed to this PR.

@kafkas kafkas force-pushed the anar/fer-9171-implement-missing-redirects-fern-check-rule branch from eeb9d32 to 31cfb66 Compare April 2, 2026 19:12
@kafkas kafkas merged commit 403e9d3 into main Apr 2, 2026
311 checks passed
@kafkas kafkas deleted the anar/fer-9171-implement-missing-redirects-fern-check-rule branch April 2, 2026 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants