Repository navigation
feat(core): authoring fixture/diff tools, automatic host revision pin, clearer host and cache errors (#722, #723, #724, #725) - #735
Merged
Conversation
…uthoring tools (#722) suggestFixtures(yaml) proposes tests/requests.json cases only where the YAML alone determines the answer (redirect, respond, page/download, disabled 404, 405 with allow, missing/invalid simple inputs, required-body 400, unmatched 404); function, middleware, proxy, signals, extension, extension-policy, include, pattern/format and env/secret-binding routes go to gaps, and conditional, expiring, static, agents/throttle and unsampleable routes to review. summarizeYamlChange(before, after) reports route, capability, trusted/sandboxed code-seam and requested/released operator-grant changes by name only. Both are exported from @jimhoyd/urlcode/agent-context, exposed as `urlcode fixtures suggest` / `urlcode diff` and read-only MCP tools suggest_fixtures / summarize_yaml_change, deterministic and bounded. Core package budget raised (packed 660->675 KiB, unpacked 2700->2750 KiB) with justification in scripts/package-audit.ts. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_014jmv9dMggduiprzSsNd7iP
… be cached (#725) One assertion covers match/conditional routes, extension mounts and routes naming a cache-sensitive extension policy, but it always said "<pattern>: conditional routing requires cache disabled or no-store" (and "Conditional responses require no-store" for a cacheable response header). The message now follows the condition that fired: - match/conditional: "<pattern>: conditional routing requires cache disabled or no-store" / "<pattern>: conditional responses require no-store" - policies.extensions: "<pattern>: routes protected by extension "auth" cannot be cached; use cache: {strategy: no-store} or remove cache" - extension mount: "<pattern>: routes served by extension "<name>" cannot be cached; ..." - header variants: "... cannot send a cacheable response header; set it to no-store or remove it" Only the sensitive extension names are listed. The refusal itself is unchanged. Tests assert the exact text; EXTENSIONS.md documents it. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_014jmv9dMggduiprzSsNd7iP
…, test and dev (#724) #714 named extension activation errors, but two earlier failure points still printed "Operation failed; check project files, module dependencies and command options": - host.mjs itself throwing while imported (a top-level error or an import that cannot be resolved) now prints "Host file failed to load: <message>" with code host-load. - an extension's host() hook throwing inside composeHost now prints "Extension "<name>" host() failed: <message>" with code extension-host and the extension field (extensionError gains a 'host' phase). Both use boundedMessage: one line, 500 characters, no stack, operator console only; request-time answers are unchanged. Core's own refusals inside composeHost keep their message. A host file that imports a second copy of core is still recognized: ConfigError carries a Symbol.for brand and asConfigError rebuilds such an error with its known detail fields only. Module-resolution messages are shown as Node reports them, including the missing specifier and the importing file's absolute path, following #714's choice to print the operator's own error verbatim on the operator's own console; LOCAL-DEVELOPMENT.md says so, and AI-AUTHORING.md lists the codes. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_014jmv9dMggduiprzSsNd7iP
…tomatically (#723) Owner decision on #723: when a CLI command (serve, dev, validate, test, routes, audit, benchmark) receives both --policy and --host-file, core loads and validates the policy first and passes its projectSha256 to composeHost() as the host revision pin. No new flag; project YAML never supplies it. - loadOperatorHost(file, project, {revision}) sets a Symbol.for('urlcode.host.operatorRevision') slot only while it imports the host file (restored afterwards), so a host.mjs importing another copy of core still sees it. Only the revision crosses; the grants stay with core. - composeHost() takes its pin from hostRevisionPin(): that revision when present, otherwise PROJECT_SHA256. Each host() hook still receives it as context.projectSha256, so generated host.mjs files, starters and existing host files need no change. - PROJECT_SHA256 set alongside --policy must be equal, or the command refuses (code revision-pin-mismatch). A policy for another project revision refuses once the host registers an extension, with the usual revision-pin hint. Neither source still refuses, now naming both. - The registration equality check stays; the policy is read once and reused for bindings. The AWS and Vercel handlers load no host file and are unchanged: operator code that builds their extensions with composeHost still sets PROJECT_SHA256, and URLCODE_POLICY keeps its own pin check. The GitHub Action passes no --policy and keeps computing PROJECT_SHA256. CLI hints, OPERATIONS/EXTENSIONS (new "The revision pin" section), COMPOSING-A-SITE, STORE, FRAMEWORK, CI, RUNTIME-IMPLEMENTATION, the auth and mcp READMEs, the store-crud recipe and the create-extension scaffold now describe both sources; llms-full.txt regenerated. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_014jmv9dMggduiprzSsNd7iP
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.
Problem and change
suggestFixtures(yaml, {maxFixtures?})andsummarizeYamlChange(before, after)in@jimhoyd/urlcode/agent-context.urlcode fixtures suggest [--project] [--json]andurlcode diff <before.yaml> [after.yaml] [--json].suggest_fixturesandsummarize_yaml_change.location, respond/page/download, 404/405/400 cases, unmatched paths), each checked against router precedence.gaps; conditional, static and similar routes go toreview.--policyrevision pins the extension host automatically.--policyand--host-file, the policy'sprojectSha256becomescomposeHost()'s revision pin, through a scoped global slot that exists only while the host file is imported.PROJECT_SHA256still works, and must match if both are set (revision-pin-mismatch).host()receives only the pin, nothing else from the policy.host.mjsfiles and starters need no change.Host file failed to load: <message>(host-load) andExtension "<name>" host() failed: <message>(extension-host) replace "Operation failed" invalidate,test,devandservestartup. Messages are one line, at most 500 characters, with no stack, and never appear in HTTP responses. As with [Bug]: validate/test hide extension activation errors behind "Operation failed" #714, Node's own message is shown, so a module-resolution error names the importing file's path on the operator console./api/items: routes protected by extension "auth" cannot be cached; use cache: {strategy: no-store} or remove cache. The wording for conditional routes is unchanged.Verification
Run on Node v26.10.0:
npm run verifyon the combined branch, on the latestmain: exit 0. Root 868 tests; workspaces 34, 97, 233, 29, 53 and 66;test:addons4. All 0 failures, includingbuild-addon-manifest --checkandaudit:packages.npm run test:package: exit 0 (694400 packed, 2831966 unpacked bytes, 456 files).package-smokenow calls both authoring tools from the installed package.packages/core/src/cli.ts([Request]: make deterministic fixture suggestions and YAML change summaries reusable core authoring tools #722'ssafeFileand [Request]: remove the manual PROJECT_SHA256 bridge between operator policy and extension host #723'sOperatorPolicy), resolved by keeping both.test/authoring-suggestions.test.ts: each route kind lands in fixtures, gaps or review; generated fixtures passrunProjectTests; bounds; determinism; CLI/MCP. Separately, 63 fixtures generated for 10 bundled examples all passedurlcode test.host()throws, module resolution, and core refusals keeping their message.Compatibility and security
[Request]: make deterministic fixture suggestions and YAML change summaries reusable core authoring tools #722: additive. Read-tool count goes from 34 to 36 (42 in authoring mode).
[Request]: remove the manual PROJECT_SHA256 bridge between operator policy and extension host #723: operators can drop their policy→
PROJECT_SHA256glue. Existing env-based setups keep working, and a disagreement between the two now refuses explicitly.[Bug]: validate/test/dev still hide host file load and extension host() errors behind "Operation failed" #724: an operator-local error message that used to be hidden is now shown on consoles and in CI logs. The [Bug]: validate/test hide extension activation errors behind "Operation failed" #714 test that asserted it was hidden was updated.
[Bug]: cache refusal on an extension-protected route says "conditional routing requires cache disabled or no-store" #725: message text only.
Changes match the documented portable contract; docs/examples are updated where needed.
Relevant tests and package checks pass, or limitations are explained above.
No credentials, customer data or private project material are included.
Runtime/starter changes remain aligned where applicable.
🤖 Generated with Claude Code
https://claude.ai/code/session_014jmv9dMggduiprzSsNd7iP
Generated by Claude Code