Skip to content

Update stale skill files and surface sandbox in explain/context - #134

Merged
jimhoyd merged 1 commit into
mainfrom
claude/fix-sandbox-reporting-and-skills
Sep 19, 2026
Merged

jimhoyd merged 1 commit into
mainfrom
claude/fix-sandbox-reporting-and-skills

Conversation

@jimhoyd

@jimhoyd jimhoyd commented Sep 19, 2026

Copy link
Copy Markdown
Collaborator

Context

Follow-up to #127 (trusted-by-default function/middleware, sandbox: true opt-in). An audit found three gaps in the doc/tooling rollout:

1. Three stale skill files

  • skills/urlcode/SKILL.md
  • .claude/skills/urlcode-authoring/SKILL.md
  • packaging/claude-plugin/skills/urlcode-authoring/SKILL.md

None mentioned "trusted" or the new default; they described the sandbox limits (no fetch, Node, filesystem, timers) as unconditional. Updated all three to state the actual default (trusted, unsandboxed, full Node/network/filesystem access) and scope the sandbox limits to sandbox: true routes, matching docs/AI-AUTHORING.md's established phrasing ("untrusted input, an unreviewed contribution, a particularly sensitive secret").

Judgment call: skills/urlcode/SKILL.md and .claude/skills/urlcode-authoring/SKILL.md are not byte-identical to each other today — they're two genuinely different skills with different names, descriptions and structure (confirmed via diff and via scripts/generate-claude-plugin.ts, which only syncs .claude/skills/{urlcode-authoring,urlcode-operations} into packaging/claude-plugin/). So I kept .claude/skills/urlcode-authoring/SKILL.md and its generated packaging/claude-plugin copy in sync via npm run docs:plugin (the existing convention), and edited skills/urlcode/SKILL.md separately with matching phrasing/terminology rather than forcing three files that were never identical into byte-identical lockstep.

2. sandbox missing from explain/context/MCP output

  • src/explain.ts: the function handler case in handlerOf now always includes sandbox as an explicit boolean (route.sandbox===true), never omitted.
  • src/context.ts: ProjectContext.routes[] entries now also carry sandbox: boolean per route.
  • src/mcp.ts needed no changes — its explain/get_context tools call explainRoute/buildContext directly with no separate response shaping, so they pick up both fixes automatically.
  • src/explain-cli.ts's explain --project detail view prints JSON.stringify(explanation.handler), so it also picks up the field with no code change.
  • Added test coverage in test/explain.test.ts: a new test asserts sandbox: false on the cookbook's trusted /hello/{name} function route and sandbox: true on recipes/webhook-receiver's /webhook route (which already declares sandbox: true). Also updated the existing full-object deepEqual assertion to include the new field.

3. README wording

Reworded two mentions of urlcode-docs' "sandboxed middleware" (~L145-148, ~L258-259) to "its own sandbox-opted-in (sandbox: true) middleware" — accurate either way, but the original reads ambiguously on a quick skim as if middleware is sandboxed by default.

Verification

  • npm run typecheck — pass
  • npm run lint — pass
  • npm run check (schema/reference/llms-full/cookbook-index/claude-plugin generation and staleness checks) — pass, including the claude-plugin sync check
  • npm test — 488 tests, 486 pass, 2 skipped (pre-existing, TLS-related), 0 fail
  • npm run build — pass
  • npm run test:package — pass

No schema changes, so no docs:reference regeneration was needed.


🤖 Generated with Claude Code

https://claude.ai/code/session_018neC2tYKPxMPbzZf1wNctr


Generated by Claude Code

Three skill files (skills/urlcode/SKILL.md, .claude/skills/urlcode-authoring
and its packaging/claude-plugin generated copy) still described the sandbox
as an unconditional property of every function/middleware route, predating
#127's trusted-by-default trust model. State the actual default (trusted,
unsandboxed, full Node access) and scope the "no fetch/Node/filesystem/
timers" language to sandbox: true routes, matching docs/AI-AUTHORING.md's
established phrasing. The .claude/skills copy is hand-edited (source of
truth); the plugin copy is regenerated via npm run docs:plugin.

Also add the route's actual `sandbox` boolean to `explain`'s handler output
and to `context`'s per-route listing, so an agent never has to infer the
default. The MCP explain/get_context tools call the same underlying
functions and pick this up with no separate changes needed. Add explain
test coverage for both a sandboxed route (recipes/webhook-receiver) and a
trusted one (cookbook).

Reword two README mentions of urlcode-docs' "sandboxed middleware" to make
explicit that's its own sandbox: true opt-in, not core's default, since it
reads ambiguously to a quick skim.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_018neC2tYKPxMPbzZf1wNctr
@jimhoyd
jimhoyd merged commit c984d72 into main Sep 19, 2026
10 checks passed
@jimhoyd
jimhoyd deleted the claude/fix-sandbox-reporting-and-skills branch September 19, 2026 04:40
jimhoyd pushed a commit that referenced this pull request Sep 19, 2026
Part 1: an optional `sandboxReason` string on function/middleware routes,
ajv-validated (max 500 chars, schemas/urlcode.schema.json) and stored on the
compiled route alongside `sandbox`. It applies regardless of whether
`sandbox` is true or false, so an author can record why a route needs
isolation or why it is safe to trust. Surfaced next to the existing
`sandbox` boolean in `explain`'s handler output and `context`'s per-route
listing, the same way #134 added `sandbox` there. recipes/webhook-receiver
now declares it, replacing what was only a source comment.

Part 2: a non-blocking advisory in `urlcode audit`: a route that runs
project code, accepts POST with a declared `request.body` policy, and
declares neither `sandbox: true` nor `sandboxReason` is flagged under a new
`advisories` array on the audit report ("consider whether this route needs
sandbox: true"). It never affects `ready` or the CLI's exit code — same
non-blocking spirit as the rest of `audit`'s reporting.

Update docs/AI-AUTHORING.md's "Deciding when a route needs sandbox: true"
and regenerate docs/YAML-REFERENCE.md and llms-full.txt. Add regression
tests: schema accept/reject including the length cap, explain/context
surfacing, and the audit heuristic firing/staying silent without changing
readiness.

Claude-Session: https://claude.ai/code/session_018neC2tYKPxMPbzZf1wNctr

Co-Authored-By: Claude Sonnet 5 <[email protected]>
jimhoyd added a commit that referenced this pull request Sep 19, 2026
Part 1: an optional `sandboxReason` string on function/middleware routes,
ajv-validated (max 500 chars, schemas/urlcode.schema.json) and stored on the
compiled route alongside `sandbox`. It applies regardless of whether
`sandbox` is true or false, so an author can record why a route needs
isolation or why it is safe to trust. Surfaced next to the existing
`sandbox` boolean in `explain`'s handler output and `context`'s per-route
listing, the same way #134 added `sandbox` there. recipes/webhook-receiver
now declares it, replacing what was only a source comment.

Part 2: a non-blocking advisory in `urlcode audit`: a route that runs
project code, accepts POST with a declared `request.body` policy, and
declares neither `sandbox: true` nor `sandboxReason` is flagged under a new
`advisories` array on the audit report ("consider whether this route needs
sandbox: true"). It never affects `ready` or the CLI's exit code — same
non-blocking spirit as the rest of `audit`'s reporting.

Update docs/AI-AUTHORING.md's "Deciding when a route needs sandbox: true"
and regenerate docs/YAML-REFERENCE.md and llms-full.txt. Add regression
tests: schema accept/reject including the length cap, explain/context
surfacing, and the audit heuristic firing/staying silent without changing
readiness.

Claude-Session: https://claude.ai/code/session_018neC2tYKPxMPbzZf1wNctr

Co-authored-by: Claude <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants