Skip to content
Source
Sign inSign up
TanStack/schemas

Keep the DeepSeek poll when its pricing page parses 0 rows #368

Mergedtombeckenhammerged 2 commits intomain fromclaude/wizardly-hamilton-4q3t2fmerged by tombeckenham View on GitHub

tombeckenhamcommented

Closes #367

Problem

Since 12:45 UTC today, every DeepSeek models poll has failed with deepseek pricing page: parsed 0 model rows (11 times on 2026-10-19 15:00–18:59 UTC as well). The pricing load ran outside tryDocs, so the fail-closed throw from assertParsed escaped listModels and took the whole DeepSeek poll down with it: no listing diff, no reasoning or replay facts, lastPolledAt stuck.

The page itself hasn't changed (last-modified 2026-10-19 06:05 UTC). Fetched from outside Cloudflare it still parses to both rows, so the Worker sometimes gets a different body from the CDN (Tencent EdgeOne).

Change

  • adapters/deepseek.ts: load pricing and the thinking guide (same docs host) through tryDocs. When one fails, each row gets unavailable('pricing') or, for rows with reasoning, unavailable('requestMap'), so stored values are kept, never nulled or invented. Failures are returned as docsFailures, which still emits ingest_failed (now with source) and shows on /v1/status as docsFailing. The listing is still not wrapped. absent maps merge rather than replace.
  • provider-replay.ts: loadReplayDoc takes an optional cached loader (so the tryDocs failure budget applies) and an optional verify, which runs before caching. Without it, a bad body from the host would sit in KV for six hours and keep failing the poll after the host recovered. Other callers are unchanged (defaults).
  • deepseek-pricing.ts: deepseekModelPricing takes the cached loader tryDocs hands it. On a zero-row parse it throws deepseek pricing page (<n> chars, title "<title>"): parsed 0 model rows, so the next failure says what the Worker got. The parse_rows source label stays deepseek pricing page, so the drop alert's distinct-source count doesn't change.
  • Tests: (1) a pricing body with no table leaves the row listed with absent.pricing: 'unavailable' and one described docs failure; (2) both pages serving such a body leave the row listed with pricing and requestMap unavailable and two failures. Both fail without the fix.

Review notes (non-critical, not changed)

  • ingest_failed for this failure now carries source: <url> and is no longer a job-level failure. Anything filtering on the old exact message or on job-level DeepSeek failures needs updating.
  • A model first listed during an outage is stored with null pricing until the next healthy poll. The provider-level docsFailing flags it.
  • The zero-row check sits ahead of assertParsed, whose own zero-row branch can no longer fire for this source; it still emits parse_rows.
  • Untested: a body with no <title> (renders title null), and that a healthy poll returns docsFailures.failed === 0.
  • The root cause of the bad body (which CDN variant the Worker receives) needs the new error text from production before anyone can act on it.

Checks

bun run test (2073 passed), bun --bun run lint, bun run typecheck, bun --bun run check: all clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_01NCVVcnPYARcSkMUWQhu9H4

    1. cloudflare-workers-and-pages[bot](GitHub profile, opens in a new tab)commented

      Deploying with &nbsp;Cloudflare Workers &nbsp;Cloudflare Workers

      The latest updates on your project. Learn more about integrating Git with Workers.

      StatusNameLatest CommitPreview URLUpdated (UTC)
      ✅ Deployment successful!
      View logs
      modelschemasa1f5e2deCommit Preview URL

      Branch Preview URL
      Oct 20 2026, 01:55 PM
    2. Triage summary

      What it solvesEvery DeepSeek models poll since 12:45 UTC today failed because the pricing page sometimes parses to 0 rows on the Worker, and that load (plus the thinking guide on the same host) ran outside tryDocs. Now the poll survives, and the failing docs are reported as docsFailures.
      Does it matterYes. While the page misbehaves, DeepSeek gets no listing diff, no new models, no reasoning or replay facts. 16 failed polls in the last 7 days, all since 2026-10-19.
      Added complexitySmall. About 40 lines in the adapter, plus two optional parameters on loadReplayDoc whose defaults keep the other callers unchanged. Same pattern as Fireworks/NVIDIA.
      Fallbacks that should be errorsNone. Prices and the replay request map are kept from what is stored (unavailable), never invented or nulled. The parser still throws on a zero-row page, the failure is still ingest_failed plus /v1/status docsFailing, and bad bodies are no longer cached.
      Public type/API changesNone. The /v1/status shape is unchanged. Internal: deepseekModelPricing(kv, cached), loadReplayDoc(url, kv?, cached?, verify?).
      Users helped/hurtHelped: catalog consumers get fresh DeepSeek rows while the docs host is flaky. Hurt: a PostHog filter on the old exact error string or on job-level DeepSeek failures would miss the new event shape (it now carries source).
      Standards complianceFollows CLAUDE.md: docs loads go through tryDocs, the listing is not wrapped, parsers stay strict, no hardcoded values. Regression tests are not under src/routes/. Lint, typecheck, prettier and 2073 tests pass.
      VerdictApprove. It brings DeepSeek in line with the documented tryDocs contract without hiding the error or touching stored prices.

      Generated by Claude Code

    3. tombeckenham merged this264c5ad

    4. tombeckenham closed this

Sign in to join this conversation.