Skip to content

fix: negative-cache property/Connect JSON fetch failures - #407

Open
JakeSCahill wants to merge 1 commit into
mainfrom
fix/json-fetch-negative-cache
Open

fix: negative-cache property/Connect JSON fetch failures#407
JakeSCahill wants to merge 1 commit into
mainfrom
fix/json-fetch-negative-cache

Conversation

@JakeSCahill

Copy link
Copy Markdown
Contributor

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.js caches 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 for redpanda-properties-v26.1.14.json).
  • 16-bloblang-interactive.js builds the Connect JSON URL from latest-connect-version and, on failure, walks a hardcoded fallback-version list — up to 6 404s per page view (~6.4k/day for connect-4.102.0.json), with no caching of failures.

Fix

  • Property tooltips: store a failed marker in the existing localStorage cache entry (1h TTL vs 24h for successes, so a fix deploy is picked up quickly; still versioned by latest-redpanda-tag). While fresh, resolve to an empty lookup without fetching.
  • Bloblang: track per-URL failure timestamps in localStorage (1h TTL); skip URLs that recently returned an error response. Only deterministic HTTP errors are marked — transient network errors still retry.
  • Preview mode (localhost / docs-ui.netlify.app) is unaffected: failures there are never marked, and property-tooltip cache reads were already skipped in preview.

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 --check and npx eslint on both files (only pre-existing max-len warning remains)

🤖 Generated with Claude Code

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>
@netlify

netlify Bot commented Jul 28, 2026

Copy link
Copy Markdown

Deploy Preview for docs-ui ready!

Name Link
🔨 Latest commit 8e76e4c
🔍 Latest deploy log https://app.netlify.com/projects/docs-ui/deploys/6a68843b48a21c00085ac71f
😎 Deploy Preview https://deploy-preview-407--docs-ui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 29 (no change from production)
Accessibility: 89 (no change from production)
Best Practices: 92 (no change from production)
SEO: 89 (no change from production)
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 22eca7a9-677f-4486-8437-2b626d04339f

📥 Commits

Reviewing files that changed from the base of the PR and between 6273f77 and 8e76e4c.

📒 Files selected for processing (2)
  • src/js/16-bloblang-interactive.js
  • src/js/19-property-tooltips.js

📝 Walkthrough

Walkthrough

The 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
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly names the main change: negative-caching failed property and Connect JSON fetches.
Description check ✅ Passed The description directly matches the changes, problem statement, fix, and testing for cached JSON fetch failures.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/json-fetch-negative-cache

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

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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