Skip to content

Fixture cookie jar, init --adopt, hosted-assisted skill mode, headless ui docs (#806, #811, #812, #814) - #815

Merged
jimhoyd merged 8 commits into
mainfrom
claude/issues-806-814
Sep 27, 2026
Merged

jimhoyd merged 8 commits into
mainfrom
claude/issues-806-814

Conversation

@jimhoyd

@jimhoyd jimhoyd commented Sep 27, 2026

Copy link
Copy Markdown
Collaborator

Problem and change

This PR covers four issues. The owner decided each approach on 2026-09-27, and the decisions are recorded on the issues.

#811: urlcode test fixtures carry a cookie session between steps

  • Per-fixture jar: each steps fixture gets its own jar (packages/core/src/cookie-jar.ts), which is dropped when the fixture ends. Jars are never shared between fixtures or runs. A restart step keeps the jar.
  • Semantics: a minimal RFC 6265 subset:
    • Path and the default path; host-only cookies or a matching Domain.
    • Max-Age takes precedence over Expires, and a past or zero value deletes the cookie.
    • __Secure- and __Host- prefixes are enforced.
    • Limits of 50 cookies and 4 KiB each.
  • Secure cookies: kept when the test origin is https or loopback.
  • Explicit cookie header: takes precedence for each name it sets.
  • New capture form: {"cookie": "name"} captures a cookie value. {"header": "set-cookie"} is now refused when the file is read, where before it failed at run time.
  • Redaction: every cookie value appears as <cookie NAME> in failure diffs. Audit and verify-deployment output was already free of values, and a test asserts it stays that way.
  • The headless-auth-profile recipe now covers its signed-in lifecycle as fixtures: 52 cases, including one 41-step fixture. They re-run cleanly on the same database.
  • urlcode audit does not report the recipe ready yet. GET and HEAD on the ui asset mount stay uncovered, because it serves only content-hashed file names that a fixture can't know in advance. This is documented and asserted in the recipe test.

#812: why a JSON-only auth site mounts ui (docs only)

auth requires ui, and the auth mount still serves HTML account pages to clients that don't ask for JSON. The ui mount is stateless and only answers GET or HEAD for kit files, so it's harmless. This is explained in the auth README, the ui README and CONTRACT, and the recipe README.

#814: urlcode init --adopt (and bootstrap --create --adopt)

  • Opt-in flag: plain init still refuses a directory that holds user files; that's a documented guarantee. The refusal now says when --adopt would work, or lists the colliding paths.
  • Write set first: --adopt computes init's full write set before writing anything.
  • Collisions: if a path already exists, a file or symlink is where a directory is needed, or anything is at app, init refuses, lists the paths and writes nothing.
  • Writes: otherwise it creates only new files, each with exclusive create. It never overwrites and never writes through a symlink. It reports what it left alone (leftAlone, bounded).
  • Guards: app/ and inside-a-project are still refused. Re-running is idempotent.
  • Add-ons: with --with, the add-on scaffold files are checked after npm install has run, and a collision undoes everything.

#806: opt-in hosted-assisted mode in the urlcode-authoring skill

  • Local-only stays the default, and urlcode bootstrap runs first in both modes.
  • Hosted mode calls urlcode_task_plan before writing YAML. It prefers a registered hosted MCP server; the MCP setup is documented in TOOLING.
  • HTTP fallback: hosted-plan.mjs, which ships in the npm package and the Claude plugin. It does one limited exchange with https://urlcode.ai/mcp:
    • 20-second deadline and a 1 MiB reply cap;
    • https only, or loopback;
    • no redirects.
    • It refuses task text that looks like it contains a secret.
  • Result: exactly one JSON result is printed: used or version-mismatch, or a limited failure.
  • Contract: the published tool accepts only {task} (up to 512 characters). The runtime version is compared locally against the returned kit, and capability names go into the task text.
  • Endpoint: it's https://urlcode.ai/mcp, checked against urlcode-ai's docs/OPERATIONS.md ("sole documented MCP endpoint") and app/functions/llms.mjs. api.urlcode.ai serves only the REST skills and feedback API. An earlier commit on this branch moved it to api.urlcode.ai by mistake; that is corrected here.

Verification

  • npm run verify exits 0 on this exact tree:

    • core: 1048 pass;
    • every workspace suite has 0 failures (auth 267, forms 57, store 85, ui 103, and the rest);
    • test:addons 4/4.
  • npm run test:package exits 0: "39 packaged example commands ran from consumer copies; Packed installation and starter/cookbook checks passed".

  • New tests:

    • test/fixture-cookies.test.ts
    • test/init-adopt.test.ts
    • test/skill-hosted-plan.test.ts, which runs against a local mock MCP server only, with no live calls
    • additions to test/bootstrap.test.ts, test/cli.test.ts, test/skills-export.test.ts and the headless-auth-profile recipe test.
  • Core package budget, set from the merged measurement:

    Old budget New budget Measured
    Packed 812 KiB 828 KiB 844581 bytes
    Unpacked 3220 KiB 3280 KiB 3349335 bytes
    Entries 495 500 490

Limitations

  • [Request]: Add an explicit urlcode.ai-assisted workflow to the authoring skill #806: it hasn't been checked against the live hosted service: the argument name, the response shape on the deployed revision, and SSE and session behaviour are all unconfirmed. There is no evidence yet that the mode helps authoring. The secret filter is a heuristic.

  • [Request]: let urlcode test fixtures carry a cookie session between steps #811:

    • HttpOnly, SameSite and the public-suffix list are not modelled.
    • Expiry is tested with an injected clock.
    • Short cookie values can be over-redacted in diffs.
  • [Request]: init/bootstrap cannot create a site in a directory that already holds a frontend #814:

    • A typical repository root (README.md, .gitignore, package.json) is refused, which follows the never-overwrite rule.
    • Add-on files are only known after npm install.
    • The collision check and the writes aren't atomic if the directory changes at the same moment, though nothing can be overwritten.
  • Testing scope: tested on macOS/Node 26 locally. The Windows symlink cases in test/init-adopt.test.ts rely on the runners allowing symlinks, as other tests already do.

  • 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.

Closes #806
Closes #811
Closes #812
Closes #814

🤖 Generated with Claude Code

jimhoyd and others added 7 commits September 27, 2026 09:30
Local-only authoring stays the default. When the user explicitly asks for
URLCode AI, the skill bootstraps first, then calls urlcode_task_plan before
writing YAML: over a registered hosted MCP server when there is one, else
through hosted-plan.mjs, a bounded HTTP fallback shipped beside SKILL.md
(initialize, notifications/initialized, tools/call against
https://api.urlcode.ai/mcp; 20 s deadline, 1 MiB reply cap, structured JSON
result). It sends only `task` (the published input schema's one argument),
refuses secret-looking text, compares the kit's pinned runtime with the
site's and withholds a mismatched kit. Only `hostedGuidance: used` may be
claimed.

The plugin generator now copies a skill's supporting files; the hosted
endpoint pin follows the service's own llms.txt. Tests use a local mock MCP
server only.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
)

urlcode init DIR --adopt (and bootstrap DIR --create --adopt) computes init's
full write set first, including npm's node_modules and package-lock.json with
--with. Any collision (an existing path init writes, a file or symlink where
it needs a directory, anything at app/) is refused with the colliding paths
listed and nothing written. Otherwise only new files are written with
exclusive creation, never through a symlink, and the top-level entries left
alone are reported. An add-on scaffold file under an adopted entry refuses
and undoes the whole init. Adoption keeps the app/ and inside-a-project
guards; a directory that already holds a site is recognized and refused with
no writes. Plain init keeps refusing user files and names --adopt when it
would succeed; bootstrap's next step does the same.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The hosted-assisted work moved the documented endpoint to api.urlcode.ai/mcp
after reading the served llms.txt. urlcode-ai's own source says otherwise:
docs/OPERATIONS.md names https://urlcode.ai/mcp as the sole documented MCP
endpoint, and app/functions/llms.mjs emits `${publicOrigin}/mcp`, moving only
the skills/feedback REST endpoints to api.urlcode.ai. Restore urlcode.ai/mcp
in the skill, its helper default, TOOLING/AI-AUTHORING, llms files, the
agent-facts pin and the tests.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…recipe lifecycle as fixtures (#811, #812)

#811: each `steps` fixture is one client with its own RFC 6265 cookie jar,
created empty per fixture and never shared with another fixture or run. The
jar honours Domain, Path (with the default path), Secure, Expires and
Max-Age (deletion on zero, negative or past), and the __Secure-/__Host-
prefixes. It is a client of the site origin (--origin, else the local
loopback address; the --target for verify-deployment); Secure cookies are
kept for https or loopback origins. An explicit `cookie` step header is sent
as written and the jar adds only the names it does not send. A new capture
form {"cookie": "name"} keeps a jar value for replay; {"header":
"set-cookie"} is now refused at read time. Cookie values are redacted as
<cookie NAME> in test failures, audit and verify-deployment output.

recipes/headless-auth-profile now tests the signed-in lifecycle (csrf,
register, login, profiles, another user denied, logout, revoked session
replayed and refused) as fixtures, re-runnable against the same operator
database. audit covers every /account and /api/profile method; the ui
mount's content-hashed files remain uncovered, so audit is not listed.

#812: document why a JSON-only auth site still declares the ui asset mount
and that it is harmless (auth and ui READMEs, ui CONTRACT, recipe README).

Closes #811
Closes #812

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…measurement

Measured on the merged branch (Node 26): 844581 packed, 3349335 unpacked,
490 entries. Budgets: 828 KiB packed, 3280 KiB unpacked, 500 entries.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Windows CI (verify windows-latest, 24, 2) failed "an empty or missing
destination is initialized exactly as before": the comparison meant to leave
out package.json (it carries the directory's name, so "adopt-empty" and
"empty" differ by six bytes) matched only '/package.json', and Windows
snapshot paths use a backslash. Match either separator. init's output was
never different.

Co-Authored-By: Claude Opus 5.5 <[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

1 participant