Skip to content

python: drop a starlight-pydocs registry left by a dev restart without pydocs - #44

Merged
ewels merged 1 commit into
mainfrom
pydocs-stale-registry
Nov 18, 2026
Merged

ewels merged 1 commit into
mainfrom
pydocs-stale-registry

Conversation

@ewels

@ewels ewels commented Nov 18, 2026

Copy link
Copy Markdown
Owner

This is the opposite case of #41. starlight-pydocs publishes its symbols at globalThis[Symbol.for('starlight-pydocs')], and that global also stays after an in-place astro dev restart that removes starlight-pydocs from the config. The Python adapter then still links names in code blocks to API pages that no longer exist, which gives 404 links in dev. starlight-pydocs cannot clear it, because none of its hooks run after it is removed, so codeblocks drops it.

  • The fix
    • A new dropStalePydocsRegistry(integrations) in adapters/python.ts deletes the pydocs registry when no integration in the config is named starlight-pydocs.
    • codeblocksIntegration calls it at the start of astro:config:setup. That hook runs with and without Starlight.
  • When the check runs
    • The check runs in astro:config:setup, so it relies on the pydocs integration already being in config.integrations at that point.
    • With Starlight, both plugins add their integrations in Starlight's config:setup, before either integration's hook runs. Without Starlight, the site lists both.
    • No test builds a full site with both plugins, so this is not covered end to end.
  • Tests
    • A unit test checks that the registry stays when starlight-pydocs is in the list and goes when it is not.
    • Two test helpers that call astro:config:setup with a fake config now pass integrations: [].

The pydocs side of the same problem is in ewels/starlight-pydocs#10.

🤖 Generated with Claude Code

…t pydocs

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ewels
ewels merged commit 3c06a33 into main Nov 18, 2026
5 of 6 checks passed
@ewels
ewels deleted the pydocs-stale-registry branch November 18, 2026 08:35
@ewels ewels mentioned this pull request Nov 18, 2026
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.

1 participant