Skip to content

Adoption retries failed warehouse refreshes - #1586

Open
zlareb1 wants to merge 2 commits into
mainfrom
fix/adoption-warehouse-cache
Open

zlareb1 wants to merge 2 commits into
mainfrom
fix/adoption-warehouse-cache

Conversation

@zlareb1

@zlareb1 zlareb1 commented Nov 26, 2026 •

Copy link
Copy Markdown
Member

Changelog category

  • Bug Fix

Changelog entry

The adoption dashboard retries after a warehouse failure and keeps the fallback page out of the cache.

Why

An idle warehouse can take longer to answer than a public registry. A cached failure page can keep metrics hidden for up to an hour after the warehouse recovers.

Scope and risk

The warehouse request gets a 30-second deadline. The page shares an in-flight refresh across requests in the same process. A failed refresh can be retried after 15 seconds. Page and CSV fallback responses bypass CDN caching until the warehouse responds.

Compatibility, rollout and rollback

  • Wire changes: none.
  • Operator steps: none.
  • Rollback: revert the change.

Tests

  • node --test docs/lib/adoption*.test.mjs docs/lib/oss-snapshot.test.mjs
  • npm --prefix docs run build
  • Called the built adoption route with a warehouse error followed by a successful empty result. The first response sent Cache-Control: no-store. The second restored the one-hour cache.
  • make format, make lint, make typecheck
  • LOOM_ENV_FILE= .venv/bin/python -m pytest tests/unit/test_doc_links.py tests/unit/test_public_copy.py -q
  • The full local Python run hit platform and ClickHouse version failures. The unsupported schema setting also fails on the base revision. CI runs the full suite with the pinned build.

AI assistance in the code

  • AI-generated (Codex). I checked the dashboard cache path, retry behavior, and built response headers.

  • I can explain every line of this diff and how it interacts with the rest of Loom.

Checklist

  • Local format, lint, type checks and focused tests pass.
  • The description names operator steps and wire changes.
  • Commits are signed off.

Note

Medium Risk
Touches public adoption page caching and telemetry fetch timeouts; mis-detection of warehouse availability could affect CDN behavior, but scope is limited to the docs adoption route and data loader.

Overview
Fixes adoption dashboard behavior when the ClickHouse Query API is slow or down—especially while an idle warehouse is waking up.

Data layer: Warehouse fetches now use a 30s abort deadline (public registry calls stay at 5s). readSource respects a caller-provided signal instead of always applying the short timeout. loadPublishedAdoption keeps the normal 5-minute in-process cache on success, but on a failed or incomplete warehouse load (selfHosted.totals undefined) it shortens cache expiry to 15 seconds so the next request retries quickly instead of reusing a failed snapshot for five minutes.

HTTP caching: The adoption page and CSV exports only send one-hour CDN / short CSV cache headers when warehouse aggregates are actually present; otherwise responses use Cache-Control: no-store so Vercel does not serve a stale “warehouse disconnected” page for up to an hour after recovery.

Docs/tests: Telemetry README wording is updated to describe conditional page caching. A new unit test simulates warehouse timeout, shared in-flight refresh, and a successful retry with the expected timeout values.

Reviewed by Cursor Bugbot for commit 4a50c04. Bugbot is set up for automated code reviews on this repo. Configure here.

Allow the warehouse time to resume from idle and keep fallback responses out of the cache.

Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
@vercel

vercel Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
loom-docs Ready Ready Preview Nov 26, 2026 7:17pm UTC
loom-telemetry Ready Ready Preview Nov 26, 2026 7:17pm UTC

Request Review

Share a failed refresh briefly so an outage cannot repeatedly exhaust registry quotas.

Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 4a50c04. Configure here.

throw error;
},
);
published = refresh;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warehouse misses refetch public registries

Medium Severity

loadPublishedAdoption treats any missing selfHosted.totals as a failed refresh and drops the in-process TTL to 15s for the whole loadAdoption result. That condition also holds when warehouse credentials are absent, the endpoint URL is rejected, or the query times out, so GitHub, PyPI, npm, and GHCR are fetched again on every retry. Combined with no-store on the fallback page, origin traffic can exceed GitHub's unauthenticated 60 request/hour limit and hide the OSS metrics the fallback is meant to keep showing.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 4a50c04. Configure here.

This branch has not been deployed

No deployments
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