Skip to content

fix(docs): fall back to direct URL when page verification is rate-lim…#41

Open
RajPorus19 wants to merge 1 commit into
Mathijs-Bakker:masterfrom
RajPorus19:fix/docs-rate-limit-fallback
Open

fix(docs): fall back to direct URL when page verification is rate-lim…#41
RajPorus19 wants to merge 1 commit into
Mathijs-Bakker:masterfrom
RajPorus19:fix/docs-rate-limit-fallback

Conversation

@RajPorus19

@RajPorus19 RajPorus19 commented Jun 17, 2026

Copy link
Copy Markdown

Summary

Fix :GodotDocs (and related commands) failing completely when docs.godotengine.org rate-limits or is unreachable — even though the RST documentation source on GitHub is perfectly reachable.

Details

Problem

M.open() in lua/godotdev/docs.lua calls fetch.resolve_doc_url() which always fetches HTML from docs.godotengine.org to verify the page exists before attempting the RST source fetch. When that host returns HTTP 429 (rate limit):

  1. The direct page HTML fetch fails
  2. fetch_index() is called as fallback — but it also hits docs.godotengine.org
  3. Both fail → callback(nil, nil)M.open() shows "Could not find Godot docs" and aborts

The RST source fetch (fetch_markdown()raw.githubusercontent.com/godotengine/godot-docs) is never reached, even though it's on a completely different domain and works fine.

Fix

In M.open() (lua/godotdev/docs.lua): when resolve_doc_url() returns nil (rate-limited / network error), instead of showing an error and aborting, bypass the HTML verification entirely and proceed directly to the RST source:

  1. Construct the page URL from common.build_base_url() + common.class_slug()
  2. For browser renderer → open the URL directly
  3. For buffer/float → call open_from_rst() which fetches RST from GitHub via fetch_markdown()
  4. If RST also fails → the existing fallback_renderer logic handles the fallback to browser

This mirrors the proven approach used in real-world setups where docs.godotengine.org aggressively rate-limits shared IPs but

✅ Checklist

  • [x ] Tested in Godot version: 4.6.3
  • [x ] Tested in Neovim version: v0.12.3
  • [ x] Tested on OS / Terminal app: 24.04.1-Ubuntu / gnome-terminal
  • [x ] Code follows plugin style guidelines
  • [x ] Documentation updated (if needed)

📷 Screenshots (if applicable)

image

🧩 Related Issues

#40 40 Bug: :GodotDocs fails completely when docs.godotengine.org rate-limits (HTTP 429)

@RajPorus19 RajPorus19 marked this pull request as draft June 17, 2026 15:44
@RajPorus19

Copy link
Copy Markdown
Author

There was an error, i'm turning this into draft until I fix it.

@RajPorus19 RajPorus19 force-pushed the fix/docs-rate-limit-fallback branch from e928622 to 68d014b Compare June 17, 2026 15:45
… rate-limited

When resolve_doc_url() returns nil (rate-limited, network error, or
unreachable from docs.godotengine.org), instead of giving up with a
"Could not find Godot docs" error, construct the page URL from the
class name and proceed directly to fetch_markdown() from the GitHub RST
source. This mirrors the approach used in real-world setups where
docs.godotengine.org aggressively rate-limits shared IPs but
raw.githubusercontent.com remains reachable.

The fallback path:
1. Construct page_url from build_base_url() + class_slug()
2. For browser renderer: open the URL directly
3. For buffer/float: call open_from_rst() which fetches RST from GitHub
4. If RST also fails: the existing fallback_renderer logic handles it
@RajPorus19 RajPorus19 marked this pull request as ready for review June 17, 2026 15:47
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