Skip to content

Commit 7228a52

Browse files
committed
fix: define registry as initial contract
1 parent 269dfdd commit 7228a52

14 files changed

Lines changed: 110 additions & 96 deletions

‎CHANGELOG.md‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@
1111
editions and older persisted schemas are rejected; no migration or
1212
compatibility reader is provided. Generated CKB entries also remove the
1313
raw-`CSARGv1` witness fallback, so Edition 2026 accepts the payload only
14-
inside canonical `WitnessArgs.input_type`. The public registry contract is
15-
hard-cut to publish protocol v2 and registry schema 2: signed entries,
16-
persisted rows, CDN JSON, and the website all require Edition 2026 and the
17-
compatibility-profile hash. The generic admin API can no longer manufacture
18-
`verified_build` or `deployed` claims without an evidence-specific path. See the
14+
inside canonical `WitnessArgs.input_type`. The not-yet-deployed public
15+
registry is defined by one current contract: signed entries, the initial
16+
database schema, CDN JSON, and the website all require Edition 2026 and the
17+
compatibility-profile hash, with no fallback reader for incomplete entries.
18+
The generic admin API can no longer manufacture `verified_build` or
19+
`deployed` claims without an evidence-specific path. See the
1920
[0.23 development release notes](docs/releases/CELLSCRIPT_0_23_RELEASE_NOTES.md).
2021
- Complete the native-tooling cleanup: neutralize migration-era identifiers,
2122
remove tracked legacy traceback logs and cache exclusions, rename the native

‎docs/CELLSCRIPT_GATE_POLICY.md‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,9 @@ ABI changes require the `backend` gate in addition to ordinary `dev` and `ci`
5454
coverage.
5555

5656
The `ci` gate also typechecks, tests, and performs a Wrangler dry-run build of
57-
`services/registry-api`. This pins the publish-protocol/schema contract to the
58-
compiler-generated registry entry. It is local service coverage, not evidence
57+
`services/registry-api`. This pins the current publish contract and initial
58+
database/static-object shape to the compiler-generated registry entry. It is
59+
local service coverage, not evidence
5960
that Cloudflare, R2, Hyperdrive, Neon, DNS, or a production deployment works.
6061

6162
The full gate reads `scripts/ckb_acceptance_pin.json` and rejects a CKB checkout

‎docs/CELLSCRIPT_PACKAGE_PROVENANCE_AND_DEPLOYMENT_IDENTITY.md‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1093,7 +1093,7 @@ alongside `Cell.toml`, for audit and offline use:
10931093

10941094
```json
10951095
{
1096-
"schema_version": 2,
1096+
"schema_version": 1,
10971097
"name": "amm",
10981098
"namespace": "cellscript",
10991099
"versions": [
@@ -1122,9 +1122,10 @@ alongside `Cell.toml`, for audit and offline use:
11221122
}
11231123
```
11241124

1125-
The current Edition 2026 reader accepts only schema 2. The older schema-1
1126-
shape described in the historical Phase 1 audit below is not a compatibility
1127-
surface.
1125+
This is the registry's initial Edition 2026 shape. The registry has not been
1126+
deployed, so the original schema identifier is retained while the definition
1127+
is updated in place. Every non-optional field shown above is required; readers
1128+
do not fill in omitted `dependencies`, `status`, or `yanked` values.
11281129

11291130
The `tag` field maps each version to a git tag in the source repository.
11301131
This allows `cellc install` to clone the exact commit without needing
@@ -1181,9 +1182,9 @@ requires a stronger explicit flag such as `--allow-quarantined`. Default search,
11811182
recommendations, and production-visible package lists only include entries that
11821183
passed the required baseline checks.
11831184

1184-
A mirrored `registry.json` version entry with no `status` is treated as
1185-
`source_published`, not as verified. Public registry writes must emit an
1186-
explicit status; legacy mirrors need explicit risk flags before direct install.
1185+
A mirrored `registry.json` version entry with no `status`, `dependencies`, or
1186+
`yanked` field is malformed. Public registry writes and offline mirrors emit
1187+
the same complete entry shape.
11871188

11881189
### Installation Flow
11891190

‎docs/releases/CELLSCRIPT_0_23_RELEASE_NOTES.md‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ work until their implementation and evidence boundaries are complete.
2222
| Entry witness | `CSARGv1` is decoded only from canonical Molecule `WitnessArgs.input_type`. |
2323
| Failure mode | Raw payloads, malformed tables, absent `input_type`, wrong placement, and mismatched identities fail closed. |
2424
| Build identity | The resolved compatibility profile is bound into metadata, registry, lock, deployment, receipt, and builder records. |
25-
| Registry contract | Publish protocol v2 and registry schema 2 require Edition 2026 plus its compatibility-profile hash from CLI signature through API, database, CDN JSON, and website. |
25+
| Registry contract | The initial publish contract requires Edition 2026 plus its compatibility-profile hash from CLI signature through API, database, CDN JSON, and website. |
2626
| Tooling | CLI, LSP, WASM, website bindings, examples, and package tooling use the same edition contract. |
2727
| Native gate | Active test, fixture, evidence, and release tooling is Rust, shell, or Node; repository policy rejects Python source reintroduction. |
2828

@@ -105,13 +105,14 @@ The 0.23 identity set is:
105105
| Compile receipt | edition and resolved compatibility profile |
106106
| Generated action builder | `cellscript-generated-action-builder-v0.23-edition-2026` |
107107
| Registry build record | edition and compatibility-profile hash |
108-
| `registry.json` / public publish | schema 2 / `cellscript-registry-publish-v2` |
108+
| `registry.json` / public publish | one required entry shape with explicit edition, profile hash, status, dependencies, and yank state |
109109

110110
Consumers reject other identities. Rebuild the artifact and regenerate its
111111
metadata, lock/deployment records, receipt, and builder together.
112112

113-
The registry boundary has no v1 reader or migration path. The write API checks
114-
the complete signed nested entry instead of accepting an untyped JSON object,
113+
The registry has not been deployed, so its initial contract and
114+
`0001_initial.sql` definition are updated in place. The write API accepts one
115+
complete signed nested entry instead of an untyped or incomplete JSON object,
115116
persists edition/profile as typed columns, and repeats them in the CDN object.
116117
Generic admin status changes may quarantine, yank, deprecate, or move an entry
117118
through indexing, but cannot label it `verified_build` or `deployed` without a
@@ -125,7 +126,7 @@ future evidence-specific promotion endpoint.
125126
accept only `"2026"`.
126127
- The playground worker and TypeScript declarations pass that edition into the
127128
WASM boundary and include it in compiler-output provenance.
128-
- Registry pages reject stale schema-1 fixture data and display each package
129+
- Registry pages reject incomplete fixture data and display each package
129130
version's edition and compatibility-profile hash.
130131
- Entry-witness reports, ABI reports, action plans, and generated builders
131132
expose canonical `WitnessArgs.input_type` placement.

‎docs/wiki/Tutorial-12-Phase1-Registry-End-to-End.md‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,14 @@ source and build identity locally.
6666

6767
## Edition 2026 Registry Contract
6868

69-
Public publishing uses `cellscript-registry-publish-v2` and registry schema 2.
70-
The signed payload contains one complete version entry, and the API checks that
69+
Public publishing uses the registry's single current publish contract. The
70+
signed payload contains one complete version entry, and the API checks that
7171
its namespace, package name, version, and source hash equal the outer signed
7272
identity. The entry must also contain:
7373

7474
```json
7575
{
76-
"schema_version": 2,
76+
"schema_version": 1,
7777
"versions": [{
7878
"edition": "2026",
7979
"compatibility_profile_hash": "<32-byte hex hash>"
@@ -84,8 +84,10 @@ identity. The entry must also contain:
8484
These are not website labels. `edition` identifies the selected language and
8585
CKB ABI rule bundle; `compatibility_profile_hash` binds the resolved details of
8686
that bundle. The API stores both as typed fields and exposes them in its static
87-
package-version JSON. Schema 1, a missing field, or a mismatched nested identity
88-
is rejected. There is no v1 migration or compatibility reader.
87+
package-version JSON. Missing `edition`, `compatibility_profile_hash`,
88+
`dependencies`, `status`, or `yanked`, an unknown schema identifier, or a
89+
mismatched nested identity is rejected. Because the registry has not been
90+
deployed, this is the initial shape rather than an upgrade or migration story.
8991

9092
`source_published` means the signed source snapshot was admitted; it does not
9193
mean the build or deployment was verified. The generic admin endpoint cannot

‎roadmap/CELLSCRIPT_0_23_ROADMAP.md‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,13 @@ path, idempotent publish, and admin-gated status transitions. The 0.23 work
130130
is to actually deploy it on `cellscript.dev` and to wire the frontend and CLI
131131
into the same trust model.
132132

133-
The Edition 2026 contract slice is complete: publish protocol v2 and registry
134-
schema 2 are a hard cut across the Rust publisher/reader, API validation,
135-
Postgres schema, R2 package-version object, checked-in registry fixture, and
136-
website data model. There is no schema-1 compatibility path. Generic admin
137-
status changes cannot create `verified_build` or `deployed` claims; an
138-
evidence-specific promotion path remains production work.
133+
The Edition 2026 contract slice is complete across the Rust publisher/reader,
134+
API validation, initial Postgres schema, R2 package-version object, checked-in
135+
registry fixture, and website data model. The registry has not been deployed,
136+
so these surfaces are updated directly and accept one complete entry shape;
137+
there is no fallback reader for omitted fields. Generic admin status changes
138+
cannot create `verified_build` or `deployed` claims; an evidence-specific
139+
promotion path remains production work.
139140

140141
### Production Domains And Hosting
141142

‎services/registry-api/README.md‎

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ It intentionally does not use D1 as the primary database. Runtime state is
1515
stored in Neon Postgres through Cloudflare Hyperdrive, while immutable source
1616
snapshots and static registry read objects are stored in R2.
1717

18+
This service has not been deployed. `migrations/0001_initial.sql` is therefore
19+
the authoritative initial database definition and is edited in place with the
20+
API contract; there is no deployed schema or compatibility reader to preserve.
21+
1822
## Implemented Boundaries
1923

2024
- JoyID-rooted capability authorisation with `@joyid/ckb` `verifySignature`.
@@ -29,9 +33,10 @@ snapshots and static registry read objects are stored in R2.
2933
- Namespace claim cooldown for newly claimed namespaces by the same JoyID
3034
principal; invalid JoyID signatures do not consume principal quota.
3135
- Publish admission path for source packages.
32-
- Hard-cut `cellscript-registry-publish-v2` admission: the signed
33-
`registry_entry` must use registry schema 2, contain exactly the published
34-
version, and bind Edition 2026 plus its compatibility-profile hash.
36+
- Single-shape `cellscript-registry-publish-v1` admission: the signed
37+
`registry_entry` must contain exactly the published version and explicitly
38+
bind Edition 2026, its compatibility-profile hash, dependencies, status, and
39+
yank state.
3540
- Namespace owner ACL check before publish admission.
3641
- P-256 capability-signature verification for daily publish payloads.
3742
- One-time signed nonce consumption for capability creation, capability
@@ -201,7 +206,7 @@ cellscript-registry-auth-v1 / authorize_capability
201206
Daily publish signs the canonical JSON form of:
202207

203208
```text
204-
cellscript-registry-publish-v2 / publish
209+
cellscript-registry-publish-v1 / publish
205210
```
206211

207212
The API rejects a publish unless:
@@ -211,7 +216,7 @@ The API rejects a publish unless:
211216
- the capability scope covers `publish:namespace/package`;
212217
- the namespace exists and is active;
213218
- the capability principal owns the namespace;
214-
- the signed nested registry entry is schema 2, names the same package/version
219+
- the signed nested registry entry uses the current schema, names the same package/version
215220
and source hash, and records `edition = "2026"` plus a 32-byte
216221
`compatibility_profile_hash`;
217222
- the signed manifest hash is present;
@@ -244,9 +249,9 @@ https://registry.cellscript.dev/packages/:namespace/:name/versions/:version.json
244249

245250
The route is served from R2 and sets short CDN cache headers. It does not
246251
require Hyperdrive or the write store, so ordinary package reads stay isolated
247-
from authenticated write-path dependencies. Its JSON object is also schema 2
248-
and repeats `edition` and `compatibility_profile_hash` at the top level so
249-
consumers do not need to trust an untyped nested blob.
252+
from authenticated write-path dependencies. Its JSON object repeats `edition`
253+
and `compatibility_profile_hash` at the top level so consumers do not need to
254+
trust an untyped nested blob.
250255

251256
CLI publish has two supported signing shapes:
252257

‎services/registry-api/src/domain.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ import type { SignChallengeResponseData } from "@joyid/ckb";
33
export const AUTH_PROTOCOL = "cellscript-registry-auth-v1";
44
export const AUTH_ACTION = "authorize_capability";
55
export const AUTH_REVOKE_CAPABILITY_ACTION = "revoke_capability";
6-
export const PUBLISH_PROTOCOL = "cellscript-registry-publish-v2";
6+
export const PUBLISH_PROTOCOL = "cellscript-registry-publish-v1";
77
export const PUBLISH_ACTION = "publish";
8-
export const REGISTRY_SCHEMA_VERSION = 2;
8+
export const REGISTRY_SCHEMA_VERSION = 1;
99
export const CELLSCRIPT_EDITION = "2026";
1010
export const DEFAULT_REGISTRY_ORIGIN = "https://api.registry.cellscript.dev";
1111
export const DEFAULT_STATIC_REGISTRY_ORIGIN = "https://registry.cellscript.dev";

‎services/registry-api/src/store.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
type CapabilityAuthorisationPayload,
66
type PublishPayload,
77
type RegistryEntryStatus,
8+
type RegistryIndexEntry,
89
} from "./domain";
910

1011
export type NamespaceStatus = "active" | "review_pending" | "reserved" | "rejected" | "quarantined";
@@ -47,7 +48,7 @@ export interface PackageVersionRecord {
4748
capability_key_id: string;
4849
principal_type: string;
4950
principal_id: string;
50-
registry_entry: Record<string, unknown>;
51+
registry_entry: RegistryIndexEntry;
5152
snapshot_hash: string;
5253
direct_url: string;
5354
created_at: string;

0 commit comments

Comments
 (0)