Repository navigation
Description
Part of #384. Implements the publish half of spec §13, §7's served-version gate and public refusals, and the tier 2 admission of §1; decisions repo and dev loop points 7–10, the init prototype (two artifacts, re-derivation as built), identity points 3, 4 and 6, the SDK point 5 (the server graph), limits §4 (built with).
What to build
- The server build in the CLI:
server/bundled into one closed module with no dynamic imports, through the repo's toolchain; the import check on the server graph (patchy/server,patchy/csv) with the sameimport_refusedmessage as the page; page code importingserver/only as types. - Two artifacts on the publish wire: the server artifact (sha256, bytes) stored beside the HTML bundle;
handlersandsdkImportsin the manifest. The server re-derives the handlers from the stored bytes by inspection in a throwaway process; a disagreement, a throw at load or a load that does not finish isinvalid_manifest(exit 2). The server refuses anything the loader cannot resolve. - Tier rules: tier 2 with zero handlers publishes with a warning;
server/below tier 2 staystier_mismatch. Stored versions keep the wire they were built for, and for tier 2 wire 1 fixes the guest protocol and compatibility date. - The served-version gate: while the patch is tier 2, a document whose loaded version is below tier 2 gets
meand nothing else; every other direct operation isserver_required. The patch tier is loaded beside the version at admission. Rollback to a tier 1 version reopens direct operations for tier 1 documents; tier 2 pages never get them. tier2_not_public(exit 2):patchy share --share publicand the portal's scope change while the served version is tier 2, and publishing a tier 2 version to a public patch without--share company. The sharing checks read the served version's tier, never local config.- The shell's "reload to keep saving" element (from the stream ticket) fires on the
servedframe for this gate. --json:artifacts: { html: { sha256, bytes } }on every tier; on tier 2 alsoartifacts.serverandhandlers: [{ name, kind }]sorted by name.- The publish event carries the tier, SDK entry points, declared primitives and integrations, handler counts by kind and bundle sizes.
- Tier 2 admission: the server accepts tier 2 publish. Dev and test instances serve it on the local executor; a production server refuses tier 2 admission until it runs the fleet executor.
- The promise appended to ADR-0010 and
docs/product.md§ Tier 2 (spec §5), with the server-only client.
Admitted at merge
Tier 2 publish, served in dev and test instances.
Done when
A tier 2 repo publishes both artifacts and a tier 2 page calls a mutation; a tampered descriptor, a top-level throw and a never-finishing initialiser are each invalid_manifest; an old tier 1 tab's write is server_required and a rollback reopens it; share --share public on a tier 2 patch is tier2_not_public.
Surfaces
The wire (docs/API.md), ADR-0004 (invalid_manifest, tier2_not_public, the --json fields), ADR-0010 (the promise, the gate), ADR-0011 (stored versions keep the guest protocol), packages/patchy/README.md, the Runtime glossary (Patch tier, Server required), docs/product.md § Tier 2 turned from proposed to built, § Declaring and changing a tier, and the public tier 2 and admin grant proposals marked deferred.
Activity
feat(patches): publish tier 2 server artifacts (#434)