Skip to content

Audit covers extension asset mounts via a per-mount declaration, so ui-composed sites can report ready (#816) - #817

Merged
jimhoyd merged 12 commits into
mainfrom
claude/issue-816
Sep 27, 2026
Merged

jimhoyd merged 12 commits into
mainfrom
claude/issue-816

Conversation

@jimhoyd

@jimhoyd jimhoyd commented Sep 27, 2026

Copy link
Copy Markdown
Collaborator

Problem and change

Fixes #816, option (b), decided by the owner on 2026-09-27. A site composing ui, meaning every auth, admin or forms site, could never get urlcode audit to report it ready. The reason: the ui asset mount serves only content-hashed file names, which no fixture can know in advance.

Contract addition (additive, and core still imports no package):

  • A new optional field, ExtensionInstance.assetMounts?: readonly string[], names which of the instance's own mounts serve only hashed files under <mount><immutableAssets.prefix>/ and answer 404 for anything else.
  • Why per mount rather than per extension: ui's screen mounts are only known after activation, and immutableAssets.prefix is set once per extension.
  • Activation refuses a declaration made without immutableAssets, or one naming anything other than distinct mounts of the extension's own routes.
  • It has no effect on how requests are served.
  • The ui package declares its one asset mount; its screen mounts are not declared.

Audit (readiness.ts):

  • Probe: after the fixtures, audit requests an unknown, unhashed path, <mount><prefix>/urlcode-audit-unknown-asset, with GET and HEAD, whichever of the two the route allows.
  • Pass condition: the probe passes only on 404, with an empty HEAD body and no Set-Cookie.
  • Report: a passing pair that no fixture covers is listed in a new field, extensionAssetRouteMethods, labelled coverage: "extension-assets". It is not counted as fixture-covered.
  • Failure: a failing probe counts as a failed check, and the pair stays uncovered.
  • Unchanged: other methods, undeclared mounts and ordinary routes keep today's coverage rules.

Recipe: headless-auth-profile now lists urlcode audit --expect-routes 3 --host-file …. Its package test asserts ready: true, with both /assets/ui/* pairs labelled extension-assets.

Docs:

  • READINESS, with a new "Extension asset mounts" section
  • EXTENSIONS
  • FRAMEWORK
  • A new RIM-EXT-ASSETS-001 card
  • The ui CONTRACT, README and CHANGELOG
  • llms-full.txt, regenerated

Verification

  • New tests in test/extensions.test.ts, 3 of them:

    • the label is applied, and another mount of the same extension stays uncovered;
    • a fixture that names a real hashed file covers its pair the ordinary way;
    • a probe answering 200, or 404 with Set-Cookie, fails and leaves the pair uncovered;
    • an extension with no declaration is never probed;
    • invalid declarations are refused.

    The recipe test drives the CLI audit to ready.

  • npm run verify exits 0: 1051 core tests pass, every workspace suite has 0 failures (auth 267, ui 103), and test:addons passes 4/4.

  • npm run test:package exits 0, with 39 packaged example commands run.

  • These results carry over: this tree is byte-identical before and after merging main post-Fixture cookie jar, init --adopt, hosted-assisted skill mode, headless ui docs (#806, #811, #812, #814) #815, because main equals Fixture cookie jar, init --adopt, hosted-assisted skill mode, headless ui docs (#806, #811, #812, #814) #815's final commit. So those results also apply to the merged branch.

  • Core package budget:

    Old budget New budget Measured
    Packed 828 KiB 832 KiB 847255 bytes
    Unpacked 3280 KiB 3290 KiB 3359276 bytes
    Entries 500 (unchanged) 500 490

Compatibility and security

  • Additive contract field. Extensions that don't declare it behave as before.

  • No change to serving. Audit sends two more requests per declared mount.

  • Limitations:

    • verify-deployment does not send the probe.
    • The probe checks one unknown name and trusts the extension's declaration about the rest. It does not check the extension's own hashed files or their cache headers.
    • Checking "not the shell" relies on the 404 status alone: the body is not inspected.
    • This is a local readiness gate, not a security review.
  • 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 #816

🤖 Generated with Claude Code

jimhoyd and others added 12 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]>
#816)

A mount that serves only content-hashed files has no path a fixture can
know, so every site composing ui could never reach a ready audit.

- Generic contract: ExtensionInstance.assetMounts names the instance's
  own mounts that serve only its immutableAssets files and 404 for
  anything else. Refused without immutableAssets or for anything but
  distinct own mounts. No request-time effect.
- ui declares its one asset mount (/assets/ui/*); screen mounts are not
  declared and keep fixture coverage.
- audit probes <mount><prefix>/urlcode-audit-unknown-asset with GET and
  HEAD after the fixtures and requires 404, an empty HEAD body and no
  Set-Cookie. A passing pair is listed under extensionAssetRouteMethods
  with coverage "extension-assets", not in coveredRouteMethods; a failing
  probe is a failed check and leaves the pair uncovered. Other methods,
  undeclared mounts and ordinary routes keep today's rules.
- recipes/headless-auth-profile now lists audit --expect-routes 3 and
  its package test asserts ready end to end through --host-file.
- Docs: READINESS (extension asset mounts), EXTENSIONS, FRAMEWORK,
  RIM-EXT-ASSETS-001, ui CONTRACT/README/CHANGELOG; llms-full.txt.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Measured 847255 packed, 3359276 unpacked, 490 entries on Node 26. Budgets:
832 KiB packed, 3290 KiB unpacked (entries unchanged at 500).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts:
#	packages/auth/test/headless-auth-profile-recipe.test.ts
#	packages/core/src/readiness.ts
#	packages/ui/CONTRACT.md
#	packages/ui/README.md
#	recipes/headless-auth-profile/README.md
#	scripts/package-audit.ts
@jimhoyd
jimhoyd enabled auto-merge (squash) September 27, 2026 15:16
@jimhoyd
jimhoyd merged commit da60242 into main Sep 27, 2026
30 checks passed
@jimhoyd
jimhoyd deleted the claude/issue-816 branch September 27, 2026 15:22
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.

[Request]: audit cannot cover the ui extension's content-hashed asset mount, so ui-composed sites never report ready

1 participant