Repository navigation
Description
Problem or use case
A URLCode app serving a prebuilt SPA needs arbitrary client-side paths to return its HTML shell, while missing assets/API paths and unsupported methods keep their normal errors. URLCode 0.6.4's implemented static-serving documentation explicitly says there is no SPA fallback. Existing declarative page/static handlers cover known paths and asset mounts but not a general client-route fallback.
The task is concrete: serve unchanged built assets, keep /api/status as JSON, return JSON 404 under /api, preserve missing-asset 404 under /assets, serve the same shell for arbitrary GET client paths of any depth, and return 405 rather than HTML for POST client paths. Enumerating the sample URLs or a fixed number of path segments does not implement that behavior.
Current declarative pieces look like this; the missing part is the general shell fallback:
version: "1"
routes:
/:
page:
file: public/index.html
/assets/*:
static:
directory: public/assets
/api/status:
respond:
json: {status: ok}Test8 substituted handwritten Node servers before finding URLCode, which alone does not prove a capability gap. A subsequent guided probe with a prepared runtime and capability schemas still entered substantial catch-all-routing discovery. The authoritative implemented documentation, rather than those agent assumptions, establishes the absence of native SPA fallback.
Proposed behavior and alternatives
Evaluate a bounded declarative SPA-serving capability or a supported first-party composition/recipe that owns this common server plumbing. Do not prescribe final YAML keys before designing the contract.
Required behavioral decisions: exact API/asset namespace exclusions; route precedence; GET/HEAD versus other methods; dot paths and missing assets; query preservation; content type/cache behavior; and target support/refusal. Never rewrite a denied/protected/API response into a successful HTML shell. Assets and shell stay within authorized project roots, and no development server or template execution is implied.
Acceptance should use the supplied immutable frontend, check browser navigation and deep refresh, and test multiple unseen client paths at arbitrary depths alongside excluded namespaces and methods. Retain a dedicated HTTP test so enumerated benchmark paths cannot masquerade as a real fallback.
If general SPA serving is deliberately outside core scope, document and test the recommended operator/extension integration instead. This is a feature/composition request, not a claim that current runtime behavior violates its contract. Local bootstrap work is tracked separately in #807.
Activity
jimhoyd commentedon Sep 27, 2026
A working composition has now been demonstrated using existing APIs; a new runtime primitive is not required to make this task work.
The tested shape uses a root
/*static mount to match arbitrary client paths plus a trusted operator plugin supplied viacomposeHost(import.meta.url, [], {plugins: [...]}). The plugin serves the shell only for the catch-all client route, excludes the API/assets namespaces, and implements the task's explicit JSON API error envelope. Native YAML still owns API status/static route declarations. This is custom operator code, not a newly invented YAML capability.A reviewer-authored prototype passed the existing SPA HTTP/browser suite and unseen deep-path checks. Two fresh agents then received a generic worked reference with different example namespaces and adapted it successfully: 111 and 116 seconds versus a 240-second timeout for a guided attempt without the recipe. Both agent outputs independently passed 11 HTTP cases, four browser cases, served-byte and frontend-integrity checks, framework-use validation, and four additional deep-client/excluded-namespace probes. No evaluator repair was applied to their outputs.
Recommended next step: publish/test a first-party recipe or authoring artifact before designing new core routing semantics. Retain this issue's namespace, method, route-precedence, protected-route, cache and target decisions as requirements for broader support. The current minimal Node-only demonstration does not establish correctness for additional protected/API routes or production deployment. Small assisted samples and manual recipe selection preclude general performance claims. Raw transcripts and application captures remain private.
jimhoyd commentedon Sep 27, 2026
Decision (owner, 2026-09-27): publish the proven composition as a tested first-party recipe. No new YAML capability for now. The docs that say there is no SPA fallback will link to the recipe.
Generated by Claude Code
Asset reference diagnostics, local agent bootstrap, SPA and headless-…
jimhoyd commentedon Sep 27, 2026
Fresh-agent verification of the published 0.6.5 SPA recipe, supplied explicitly with bootstrap contracts and a task checker: one trial completed in 164.9s and passed all 11 HTTP checks, four browser behaviors plus served-byte verification, frontend integrity, framework use, and four deep-route/exclusion probes. The second timed out at 240s; its artifact passed 10/11 HTTP checks and the browser/integrity/deep-route checks, but missing API routes returned plain text instead of the task-required JSON envelope. Checker files/scripts were unchanged. The unmodified shipped recipe separately passes its own 17 request fixtures.
Both agents spent effort on the API method-error representation mismatch. The first introduced a custom function; the second used response rewriting. Follow-up #821 records that narrower gap. This is not a runtime regression claim: the recipe guidance differs from the prior handcrafted example, sample size is two, and shared-host isolation limitations remain. No urlcode.ai calls were involved.