check_redirects.py: flag redirects over unlisted pages and loops through wildcard destinations

Aperta
#2,380 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
72/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python

Direzione di ricerca

Start with scripts/check_redirects.py and the existing cases in scripts/test_check_redirects.py. Check with mint dev whether a wildcard redirect source takes precedence over an existing page, then cover that behavior and add tests for detecting loops through wildcard destinations. Done when redirects from unlisted on-disk pages are checked and wildcard loops are caught without flagging the intended section-rename chains.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Two gaps in scripts/check_redirects.py came up in the review of #2369. Neither shows up in docs.json today.

A redirect whose source is a real page on disk is dead: Mintlify serves the page and the redirect never fires (checked with mint dev in the #2369 review). The check only catches this when the page is in navigation. A page that exists on disk but isn't in navigation, such as hidden.mdx with a redirect from /hidden, passes. The fix is to test whether the page exists for each source as well as navigation. Wildcard sources need some thought: does /a/:slug* over an existing /a/b.mdx fire, or does the page win? That needs checking against mint dev first.

The check deliberately doesn't follow chains through wildcard destinations, because section renames rely on them (/build-on-celo/:slug* → /build/:slug* → newer exact entries). As a result, /p/:slug* → /q/:slug* together with /q/:slug* → /p/:slug* loops and passes. A walk of at most five hops that fails on a repeated source would catch loops without flagging the chains we want.

Both need unit tests in scripts/test_check_redirects.py alongside the existing cases.

Lingua principale
MDX
Stelle
89
Fork
396
Merge medio
3g 5h
PR unite (30g)
17

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di celo-org/docs

Tutte le issue di celo-org/docs

Issue simili

Altre issue su Documentation

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.