spa-static-server-history-fallback-and-api-doc-parameter-drift
Solution written to ~/SOLUTION.md (also copied to /workspace/SOLUTION.md).
The workspace contained only problem.json — no source repo — so I built a minimal React 18 + Vite 5 + BrowserRouter SPA (/, /trees, /tree/:id) and reproduced/verified both defects for real.
Two independent root causes:
vite build emits a single dist/index.html; a plain static server resolves /trees and /tree/42 to nonexistent file paths and returns 404 before React loads. npx serve must be run with -s/--single to rewrite not-found requests to index.html.rootId query param and documented snake_case POST keys (parent_id, root_id) instead of the exact camelCase keys the server binds (parentId, rootId).vite build → only dist/index.html + hashed JS.serve -l 5183 -s dist: /, /trees, /tree/42, /tree/abc-123 → all 200, all containing id="root"; /assets/*.js still 200.serve -l 4174 dist (no -s): / → 200, /trees → 404, /tree/42 → 404.scripts/check-api-docs.mjs gate run against a drifted README exits 1 with 4 concrete errors; against the corrected README it prints API docs are contract-complete. and exits 0.The markdown includes the exact package.json scripts, serve.json rewrite alternative, the corrected README API quick ref (required rootId, camelCase body keys), the full CI checker script, observed terminal output, and a one-shot acceptance check.
# Evidence - Problem class: spa-static-server-history-fallback-and-api-doc-parameter-drift - Model: openrouter/deepseek/deepseek-v4.1-flash - Solved: 2026-09-12T01:47:16.336Z - Verification: solution produced by pi in sandbox; see signatures.json
{"description": "For a React BrowserRouter PWA, document npx serve with -s/--single so /trees and /tree/<id> serve index.html; keep README API quick refs contract-complete by naming required query params and exact camelCase POST keys. Verify with a fresh build plus control deep-link requests.", "environment": "React Vite documentation", "language": "markdown", "model": "openrouter/deepseek/deepseek-v4.1-flash", "problem_class": "spa-static-server-history-fallback-and-api-doc-parameter-drift", "provider": "openrouter", "solved_at": "2026-09-12T01:47:16.337Z", "version": ""}Solution written to ~/SOLUTION.md (also copied to /workspace/SOLUTION.md).
The workspace contained only problem.json — no source repo — so I built a minimal React 18 + Vite 5 + BrowserRouter SPA (/, /trees, /tree/:id) and reproduced/verified both defects for real.
Two independent root causes:
vite build emits a single dist/index.html; a plain static server resolves /trees and /tree/42 to nonexistent file paths and returns 404 before React loads. npx serve must be run with -s/--single to rewrite not-found requests to index.html.rootId query param and documented snake_case POST keys (parent_id, root_id) instead of the exact camelCase keys the server binds (parentId, rootId).vite build → only dist/index.html + hashed JS.serve -l 5183 -s dist: /, /trees, /tree/42, /tree/abc-123 → all 200, all containing id="root"; /assets/*.js still 200.serve -l 4174 dist (no -s): / → 200, /trees → 404, /tree/42 → 404.scripts/check-api-docs.mjs gate run against a drifted README exits 1 with 4 concrete errors; against the corrected README it prints API docs are contract-complete. and exits 0.The markdown includes the exact package.json scripts, serve.json rewrite alternative, the corrected README API quick ref (required rootId, camelCase body keys), the full CI checker script, observed terminal output, and a one-shot acceptance check.
# Evidence - Problem class: spa-static-server-history-fallback-and-api-doc-parameter-drift - Model: openrouter/deepseek/deepseek-v4.1-flash - Solved: 2026-09-12T01:47:16.336Z - Verification: solution produced by pi in sandbox; see signatures.json
{"description": "For a React BrowserRouter PWA, document npx serve with -s/--single so /trees and /tree/<id> serve index.html; keep README API quick refs contract-complete by naming required query params and exact camelCase POST keys. Verify with a fresh build plus control deep-link requests.", "environment": "React Vite documentation", "language": "markdown", "model": "openrouter/deepseek/deepseek-v4.1-flash", "problem_class": "spa-static-server-history-fallback-and-api-doc-parameter-drift", "provider": "openrouter", "solved_at": "2026-09-12T01:47:16.337Z", "version": ""}