CANP-WP-0006 T05: HTTP registries, and one finding

--registry now accepts an http(s):// URL as well as a path, implemented with
urllib so reference/ keeps PyYAML as its only dependency.

This was the first real test of INTENT principle 10's claim that a hosted
registry layers on without changing package semantics. Verified against the
running service, almost everything survived the transport unaltered: identity
and its ambiguity rules (a bare id in two registries returns 409 over HTTP just
as it does locally), immutability of a published id@version (identical content
accepted, changed content refused, version bump accepted), strict packaging,
validation, and the index. A package published and then installed over HTTP was
byte-identical to its source — diff -r clean — and its canonical-fidelity eval
still passed after the round trip.

One thing did not survive: a URL is not a registry. A filesystem registry IS
one registry and section 20.1 names it from its directory; an HTTP service
HOSTS SEVERAL behind one base URL. The address therefore cannot name the
registry, so it must be named separately — --as when publishing, a qualified
reference when installing.

Recorded as section 20.4 rather than worked around silently in the client,
because the gap is in the specification's list of registry kinds, not in the
CLI. Publishing to an HTTP registry without --as fails with that explanation
rather than guessing a registry name.

Registry responses are treated as untrusted input (section 19): decode_files
refuses path traversal, with a test. The wire shape round-trips binary content
through base64, also tested.

Reference tests 99 -> 105.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Bjefh8NUiEiahN4JLwoSKM

Assistant: claude-code
Assistant-Model: opus
Assistant-Process: 388925@bnt-lap001
Assistant-Session: 3507023f-e0fd-4a1e-9d90-a0d4217d1502
This commit is contained in:
tegwick 2026-09-06 20:39:04 +02:00
parent 56b1708b58
commit c076d8395e
6 changed files with 263 additions and 3 deletions

View file

@ -181,6 +181,24 @@ signing and trust scoring are explicit non-goals. Ownership lives with the
registry rather than in the package, so no package carries an unverifiable
assertion of authority.
## Registries over HTTP
`--registry` takes a URL as readily as a path:
```bash
export CANNED_PROMPTS_PUBLISH_TOKEN=...
python canned_prompts.py publish ../examples/pqrst-estimate \
--registry https://registry.example --as helix
python canned_prompts.py install helix:practice/pqrst-estimate \
--registry https://registry.example
```
Publishing needs `--as`, because a URL addresses a service that hosts several
registries and so does not name one the way a directory does (§ 20.4). That is
the *only* place the transport is visible: identity and ambiguity, immutability
of a published version, strict packaging, validation and the index all behave
the same over HTTP as on a filesystem.
## The index
Every store keeps an `index.yaml` recording which package versions entered it,