Repository navigation
Add static compile target (S3/CloudFront) - #125
Merged
Merged
Conversation
Proposal only, nothing implemented. Sequences the two extractions (link first, middleware second) around the shared extension mechanism already in src/extensions.ts (mount ownership + authorize()), and flags the cross-repo dependency on urlcode-auth/-admin/-ui that a middleware contract change would introduce. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_018neC2tYKPxMPbzZf1wNctr
License Apache-2.0 and repo settings mirror core's GOVERNANCE.md; both new extension repos publish public from the start rather than the private-until-reviewed pattern auth/admin/ui used. Adds a performance section (link's extensionResponse overhead on a latency-sensitive path; middleware's sandbox-vs-trusted-code tradeoff hiding inside what looks like a speed question) and rules out other core handlers as extraction candidates (proxy, policies, native routing, management/grants). Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_018neC2tYKPxMPbzZf1wNctr
Same spike doc: unlike link/middleware (which shrink core), a static compile target (S3/CloudFront) extends the progression below core without touching it, reusing the existing per-target capability refusal mechanism. Flags GitHub Pages' lack of server-side redirects as a real fidelity gap rather than promising parity it can't deliver. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_018neC2tYKPxMPbzZf1wNctr
middleware is project-authored guest code in the same threat category as function (docs/FUNCTION-SECURITY.md), not a lighter-weight sibling of auth's trusted authorize() hook. urlcode-middleware keeps its own sandboxed execution; auth's trusted-extension model stays reserved for vetted, operator-installed packages. Reframes the sandbox's real performance cost (paid on every request, not once per route like function) as a reason to shrink how much needs to be guest code via native declarative primitives, not a reason to drop isolation. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_018neC2tYKPxMPbzZf1wNctr
Maintainer decision, not yet implemented: sandboxing becomes opt-in (explicit sandbox: true) rather than the current unconditional default. Documents what this reverses (AGENTS.md, SECURITY.md, FUNCTION-SECURITY.md, SANDBOX-REVIEW.md, README.md all currently state the opposite as an absolute guarantee), what actually needs building (no in-process execution path exists today, it's fully hardwired to the sandbox), and the test/docs/capacity rework this requires before it ships. Recommends landing this ahead of the middleware extraction in SPIKE-CORE-LAYERING.md, since it changes that spike's assumptions. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_018neC2tYKPxMPbzZf1wNctr
Express/Next.js/Django/Rails all serve AI-agent-generated code unsandboxed in production; the industry's actual sandboxing pattern for AI-written code is generation-time (E2B, Modal, Code Interpreter), not serve-time. Records this as supporting evidence for the decision already made, not a re-opening of it. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_018neC2tYKPxMPbzZf1wNctr
Covers auth/admin/ui (contract unaffected, but their own docs/examples may need an audit for now-inaccurate sandboxing claims), versioning (this is a behavior change needing a major/minor bump and explicit peers.json pinning, not silent inheritance), dynamic-link (unaffected), and middleware (directly affected, with an open question on whether it should inherit trusted-by-default or deliberately stay sandboxed given it wraps every request through a route rather than one operation). Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_018neC2tYKPxMPbzZf1wNctr
Maintainer decision: no special case for middleware despite its wider per-request blast radius versus function — same rule, same opt-in sandbox mechanism. Marks SPIKE-DEFAULT-TRUST-MODEL.md's middleware question as resolved and corrects SPIKE-CORE-LAYERING.md's sections that still assumed middleware stays sandboxed by default (mechanism choice, sequencing, and the performance analysis), pointing them at the trust-model doc instead of re-arguing settled ground. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_018neC2tYKPxMPbzZf1wNctr
Add a `static` build target alongside node/aws/vercel/cloudflare: it
compiles a project's redirect/respond/page/static/download routes into
plain files and two small JSON manifests for an S3 + CloudFront
deployment, with no server process at all.
- src/capabilities.ts: add `static` to capabilityTargets and give it
per-capability refusal reasons ("no server, so ..."), refusing
function/middleware/link/dynamicLinks/extensions/proxy/signals/
conditional/conditions/parameters/request.body/response.headers/
bindings/every policy the same way Cloudflare refuses what it can't
serve, while allowing redirect/respond/page/static/download.
- src/build-static.ts: new compiler, following build-cloudflare.ts's
shape. Writes served files under out/objects/<key> (S3 key = route
path), objects.json (content-type/cache-control/content-disposition
metadata), redirects.json (S3 per-object website-redirect-location
entries, always 301), and the shared project manifest.json. Refuses
at build time what capability analysis can't see: a redirect needing
a path parameter, query passthrough/mapping, or a non-301 status; a
disabled/expired route; a route using a method other than GET/HEAD.
- src/cli.ts: wire `urlcode build --target static`.
- src/index.ts: export buildStatic alongside buildCloudflare.
- docs/STATIC.md: new target doc; explicitly scopes claimed support to
S3/CloudFront and puts GitHub Pages out of scope (no per-object
redirect metadata or server-side rewrite layer there, so the same
fidelity is not available). Reference it from README, CAPABILITIES,
FRAMEWORK, TOOLING and llms.txt.
- schemas/recipe.schema.json: add `static` to the recipe/example
metadata `targets` verdict map; update every recipe/example's
hand-written metadata to match the derived verdict.
- test/static.test.ts: capability refusal, a mixed project's function
route refused, the compiled object/redirect layout, and every
build-time-only refusal (parameterized/mapped/non-301 redirect,
disabled/expired route, unsupported method).
- Update existing tests whose assertions enumerated capability targets
or per-target refusal lists to include `static`.
See docs/SPIKE-CORE-LAYERING.md, "The full ladder: one contract, one
vocabulary per level".
Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_018neC2tYKPxMPbzZf1wNctr
jimhoyd
pushed a commit
that referenced
this pull request
Sep 19, 2026
…target Main gained PR #125 (static compile target for S3/CloudFront) while this branch was in flight; that work independently referenced link/dynamicLinks in several places (capability refusal reasons, recipe/example metadata, docs, exports). Resolved by keeping this branch's removal and combining it with the static-target additions: - src/capabilities.ts: kept the extension-target-aware decision() logic and added the target==='static' early-refusal branch (staticRefusals lookup) ahead of it; dropped link/dynamicLinks from staticRefusals. - src/build-static.ts: fixed a stale comment listing link/dynamicLinks among refused capabilities. - test/static.test.ts: removed the link-specific sub-test (dynamicLinks/link route no longer exist); kept the function/middleware refusal coverage. - test/exports.test.ts: kept buildStatic in the expected export list, dropped openLinkStore/startLinkApi. - recipes/authenticated-json-api, recipes/protected-download, examples/extensions: merged this branch's conditional/refused target verdicts (extension-target-aware, no host file) with main's added `static: refused` key. - docs/CAPABILITIES.md, docs/FRAMEWORK.md, docs/STATIC.md, llms.txt: merged the static-target documentation with this branch's link-removal notes; fixed the framework ladder's rung numbering after removing the "Live short links" rung; regenerated llms-full.txt. - README.md, docs/README.md: took main's urlcode-shortener -> urlcode-short rename and updated extension package versions, combined with this branch's note that the shortener demo predates the link-store removal. - examples/live-links/example.yaml: kept deleted (main only added a `static: refused` entry to a file this branch removes entirely). - schemas/recipe.schema.json: dropped the now-unused `link-store` grant kind from the recipe metadata schema (no recipe declares it after this removal). Verified after the merge: npm run lint, typecheck, check, build all pass; npm test passes 471 tests (469 pass, 2 skipped, 0 fail, including the new static-target tests from main). Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_018neC2tYKPxMPbzZf1wNctr
jimhoyd
pushed a commit
that referenced
this pull request
Sep 19, 2026
main advanced with the static target (#125) and link/dynamicLinks extraction (#126) while this branch was in progress. Resolved conflicts in src/capabilities.ts and src/runtime.ts by keeping this branch's trusted-by-default logic and dropping the now-removed link-store wiring; combined doc wording from both sides in README.md, docs/CAPACITY.md, docs/PROJECT-DIRECTION.md and docs/RELEASE-READINESS.md; regenerated the two generated files (starters/default/AGENTS.md via renderAgentsGuide, llms-full.txt via scripts/build-llms-full.ts) rather than hand-editing them; updated test/explain.test.ts to match. Also tightened the static target's middleware refusal reason ("no server, so no middleware execution", dropping the now-stale word "sandboxed") since it no longer applies uniquely under the new default. Verified post-merge: typecheck, lint, npm run check, full test suite (481 tests: 479 pass, 0 fail, 2 skipped), build, test:package all green. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_018neC2tYKPxMPbzZf1wNctr
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a
staticbuild target alongside the existingnode/aws/vercel/cloudflaretargets:urlcode build --target staticcompiles a project'sredirect/respond/page/static/downloadroutes into plain files and two small JSON manifests for an S3 + CloudFront deployment — no server process at all.This implements the design in
docs/SPIKE-CORE-LAYERING.md, "The full ladder: one contract, one vocabulary per level": the sameurlcode.yamla self-hosted server or a serverless adapter runs, with fewer refusals as the target gets more capable. It is purely additive and does not touchfunction/middleware/linkruntime behavior or any other target's behavior.What it does
src/capabilities.tsgets astaticentry incapabilityTargets, refusingfunction,middleware,link/dynamicLinks,extension/policies.extensions,proxy/signals,conditional/conditions,parameters,request.body,response.headers,bindings, and everypolicies.*— each with a "no server, so ..." reason, the same mechanism Cloudflare already uses to refusefunction/link/middleware.redirect/respond/page/static/downloadremain supported.redirectroutes to real HTTP redirects: each becomes an S3 per-object website-redirect (x-amz-website-redirect-location), the most portable representation for a path-to-path redirect. Since S3 always answers that with 301, a redirect declaring another status, a path parameter, orquery.pass/query.mapis refused at build time with a clear message rather than silently downgraded.page/static/download/respondroutes to actual files, laid out with S3 object keys matching the route path (/→index.html), plus a metadata manifest (content-type/cache-control/content-disposition) a deploy step applies as the S3 object's own headers.docs/STATIC.md(following thedocs/CLOUDFLARE.md/docs/AWS.mdpattern), referenced fromREADME.md,docs/CAPABILITIES.md,docs/FRAMEWORK.md,docs/TOOLING.mdandllms.txt.test/static.test.tscovers capability refusal, a mixed redirect/static/page project with afunctionroute that's refused (not silently ignored), the compiled object/redirect layout, and every build-time-only refusal (parameterized/mapped/non-301 redirect, disabled/expired route, unsupported method).Known, documented limitation — GitHub Pages is explicitly out of scope
This target's claimed support is S3 + CloudFront only. GitHub Pages has no per-object redirect metadata and no server-side rewrite layer, so the same
redirectroute has no equivalent fidelity there (only a meta-refresh/JS page or a 404-page trick, both lower fidelity).docs/STATIC.mdsays this plainly and does not claim GitHub Pages parity — this is a known limitation of the feature as scoped, not a bug to fix later.Incidental fix-forward
Adding a fifth
capabilityTargetis exhaustively checked wherever the catalog/manifest/context/recipe-metadata machinery iterates targets, so every recipe/example's hand-writtentargets:metadata needed astatic:verdict added (schemas/recipe.schema.json+ the 22recipe.yaml/example.yamlfiles) to keepnpm run check's derived-metadata check honest. This is mechanical and doesn't change any of those recipes' actual behavior.Verification
Not verified: no deployment to S3/CloudFront has happened. Bucket policy, CloudFront caching behavior and the exact
aws s3/aws s3apiinvocations documented indocs/STATIC.mdare unproven until a real deployment exercises them — this is stated in the doc's "Verification status" section, matching how Cloudflare/AWS/Vercel already caveat their own unverified provider deployment.🤖 Generated with Claude Code
https://claude.ai/code/session_018neC2tYKPxMPbzZf1wNctr
Generated by Claude Code