fix: negative-cache property/Connect JSON fetch failures - #407
fix: negative-cache property/Connect JSON fetch failures#407JakeSCahill wants to merge 1 commit into
Conversation
The property-tooltip script caches successful JSON fetches in localStorage for 24 hours but never caches failures, so when the referenced attachment does not exist (version drift between release tags and generated JSON), every page view re-requests a URL that is guaranteed to 404 (~17k requests/day). The Bloblang script has the same problem, plus a hardcoded fallback-version chain that multiplies the misses. Property tooltips now store a failure marker (1 hour TTL, versioned by latest-redpanda-tag) and resolve to an empty lookup while it is fresh. The Bloblang loader tracks per-URL failures for 1 hour and skips URLs that recently returned an error response. Preview mode is unaffected. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
✅ Deploy Preview for docs-ui ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe changes add localStorage-backed failure caching for Connect JSON and property JSON fetches. Connect requests skip URLs recorded as recently failed and record non-OK responses outside preview mode. Property data cache entries now distinguish failed fetches from successful results, using a one-hour failure TTL instead of the 24-hour success TTL, and failed fetches store version and timestamp metadata. Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant tryFetchConnectJSON
participant localStorage
participant ConnectJSONEndpoint
tryFetchConnectJSON->>localStorage: Read recent URL failures
localStorage-->>tryFetchConnectJSON: Return failure status
tryFetchConnectJSON->>ConnectJSONEndpoint: Fetch URL when not recently failed
ConnectJSONEndpoint-->>tryFetchConnectJSON: Return non-OK response
tryFetchConnectJSON->>localStorage: Record URL failure
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint install timed out. The project may have too many dependencies for the sandbox. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |

Problem
Two of the top 404 sources on docs.redpanda.com come from tooltip data fetches that retry a missing file on every page view:
19-property-tooltips.jscaches successful properties-JSON fetches for 24h in localStorage, but failures are never cached — when the referenced attachment doesn't exist (release tag drifted ahead of the generated JSON), every streaming page view fires a guaranteed 404 (~17.6k/day forredpanda-properties-v26.1.14.json).16-bloblang-interactive.jsbuilds the Connect JSON URL fromlatest-connect-versionand, on failure, walks a hardcoded fallback-version list — up to 6 404s per page view (~6.4k/day forconnect-4.102.0.json), with no caching of failures.Fix
failedmarker in the existing localStorage cache entry (1h TTL vs 24h for successes, so a fix deploy is picked up quickly; still versioned bylatest-redpanda-tag). While fresh, resolve to an empty lookup without fetching.This is defense-in-depth for the storm; the root cause (meta tags referencing JSON that was never generated) is fixed at build time by redpanda-data/docs-extensions-and-macros#224.
Testing
node --checkandnpx eslinton both files (only pre-existing max-len warning remains)🤖 Generated with Claude Code