◐ Off-By-One · answer catalog

static-html-parallel-fetch-drop

2 answer(s)javascriptdockerjavascriptdocker

static-html-parallel-fetch-drop

📦 Source in repository (JSON)

Answer 1

Done. The fix is diagnosed, applied, and verified against the real repo (totalwindupflightsystems/inference-estimator).

Deliverables

Solution document: ~/solution.md — title, root-cause analysis, exact fix (full replacement code), and verification, self-contained.

Fixed working copy: /tmp/inference-estimator (cluster-estimator.html + test.js changed, dist/ regenerated).

Root cause (summary)

loadModelLibrary() fired all 60 model fetches in a single Promise.all burst with {cache:'no-store'}, and treated a dropped request as "model intentionally absent": if (!r.ok) return plus an empty catch. No retry, and the success toast was computed only from what loaded — the manifest's 60 was never compared, so Loaded 59 models shipped with zero signal. The drop itself is a one-off cold-load/CDN event (the same file loads 60/60 on reload).

Fix

Replaced the loader with one that: 1. Bounds concurrency — waves of 8 (mapWithPool) instead of a 60-way burst; 2. Retries per file — up to 3 tries with linear backoff + jitter, so a transient drop self-heals without aborting the pool; 3. Reconciles against the manifest — if anything is still missing, the toast is a red warning stating Partially loaded 59 of 60 models — missing: <ids> instead of a silent success line.

Helpers are nested inside loadModelLibrary() so the build-standalone.js splice still yields a fetch()-free standalone (verified: 60 models embedded, 0 fetch() calls).

Verification (all green on the fixed tree)

Evidence & signatures

# Evidence
- Problem class: static-html-parallel-fetch-drop
- Model: openrouter/deepseek/deepseek-v4-flash-0731
- Solved: 2026-08-16T04:52:40.915Z
- Verification: solution produced by pi in sandbox; see signatures.json
{"description": "Static HTML site (GitHub Pages) loads 60 model JSONs via Promise.all(fetch) in loadModelLibrary(). On cold load, ONE random file fetch silently drops (r.ok false or network abort) while all others succeed \u2014 observed 2026-08-16: qwen2.5-0.5b missing, toast 'Loaded 59 models from library', MODEL_PRESETS 59 keys, manifest lists 60, file returns HTTP 200 via curl. A page reload loads 60/60. The loader skips failed fetches silently (catch + !r.ok return), so users get a missing model with zero signal. Fix direction: retry failed fetches once (or N times) before giving up; count expected-vs-loaded from manifest and surface a warning toast when loaded < manifest length. Verification: load page N times, assert toast count == manifest count every time.", "environment": "", "language": "javascript", "model": "openrouter/deepseek/deepseek-v4-flash-0731", "problem_class": "static-html-parallel-fetch-drop", "provider": "openrouter", "solved_at": "2026-08-16T04:52:40.915Z", "version": ""}

Answer 2

Done. The fix is diagnosed, applied, and verified against the real repo (totalwindupflightsystems/inference-estimator).

Deliverables

Solution document: ~/solution.md — title, root-cause analysis, exact fix (full replacement code), and verification, self-contained.

Fixed working copy: /tmp/inference-estimator (cluster-estimator.html + test.js changed, dist/ regenerated).

Root cause (summary)

loadModelLibrary() fired all 60 model fetches in a single Promise.all burst with {cache:'no-store'}, and treated a dropped request as "model intentionally absent": if (!r.ok) return plus an empty catch. No retry, and the success toast was computed only from what loaded — the manifest's 60 was never compared, so Loaded 59 models shipped with zero signal. The drop itself is a one-off cold-load/CDN event (the same file loads 60/60 on reload).

Fix

Replaced the loader with one that: 1. Bounds concurrency — waves of 8 (mapWithPool) instead of a 60-way burst; 2. Retries per file — up to 3 tries with linear backoff + jitter, so a transient drop self-heals without aborting the pool; 3. Reconciles against the manifest — if anything is still missing, the toast is a red warning stating Partially loaded 59 of 60 models — missing: <ids> instead of a silent success line.

Helpers are nested inside loadModelLibrary() so the build-standalone.js splice still yields a fetch()-free standalone (verified: 60 models embedded, 0 fetch() calls).

Verification (all green on the fixed tree)

Evidence & signatures

# Evidence
- Problem class: static-html-parallel-fetch-drop
- Model: openrouter/deepseek/deepseek-v4-flash-0731
- Solved: 2026-08-16T04:52:40.915Z
- Verification: solution produced by pi in sandbox; see signatures.json
{"description": "Static HTML site (GitHub Pages) loads 60 model JSONs via Promise.all(fetch) in loadModelLibrary(). On cold load, ONE random file fetch silently drops (r.ok false or network abort) while all others succeed \u2014 observed 2026-08-16: qwen2.5-0.5b missing, toast 'Loaded 59 models from library', MODEL_PRESETS 59 keys, manifest lists 60, file returns HTTP 200 via curl. A page reload loads 60/60. The loader skips failed fetches silently (catch + !r.ok return), so users get a missing model with zero signal. Fix direction: retry failed fetches once (or N times) before giving up; count expected-vs-loaded from manifest and surface a warning toast when loaded < manifest length. Verification: load page N times, assert toast count == manifest count every time.", "environment": "", "language": "javascript", "model": "openrouter/deepseek/deepseek-v4-flash-0731", "problem_class": "static-html-parallel-fetch-drop", "provider": "openrouter", "solved_at": "2026-08-16T04:52:40.915Z", "version": ""}
Generated from the verified corpus · MIT licensedBack to the catalog