@fabricorg/sdui-release
v0.7.4
Published
Versioned SDUI document, fragment, token-set, component-pack, and promoted release contracts validated independently of any renderer.
Readme
@fabricorg/sdui-release
Versioned SDUI document, fragment, token-set, component-pack, and promoted release contracts validated independently of any renderer.
The browser-safe @fabricorg/sdui-release/contracts entry adds Release v3 route and
tree-scoped grant contracts, RFC 8785 canonicalization, async crypto adapters, ES256
JWS verification, and signed monotonic release-channel pointers. It contains no Node
builtin or runtime Platform import. Release v2 and the existing root entry remain
compatible.
What this package owns
SduiDocument— a versioned tree of fragments with a token-set reference and declared component-pack ranges.variantsenumerates every alternative tree a compositor may select at request time; each is validated against the same grants and covered by the release digest, which is what makes "selection may never widen grants" enforceable rather than merely stated.SduiFragment— a node that renders a component, binds data from a capability view, and declares action handlers. Actions are alwayscapability://references to published action intents — never direct mutations.SduiTokenSet— renderer-neutral design tokens (color, spacing, typography). Two channels consuming the same token set apply the same visual intent through different renderings.SduiComponentPack— a versioned pack of components with prop schemas, slot declarations, and the published artifact digest used by assembly. A federated pack also declares itsremote: the entry URL, a subresource-integrity value, and its exposed modules. A federated pack executes whatever its entry serves, so the artifact digest alone describes the pack that was reviewed rather than the code that runs.SduiRelease— a promoted, validated, immutable bundle with a canonical SHA-256 digest. It includes the approved assembly identity and exact authorization grants. Two channels (web, mobile, CLI) can consume the same release while reads and actions remain capability references.
Validation
validateSduiRelease(input) is the single build gate. It rejects:
- Unknown components — a fragment references a component not in any declared pack or the core vocabulary.
- Incompatible packs — a component pack version does not satisfy the document's declared range.
- Unapproved composition — a pack artifact or usage contract does not match the exact generated contract provenance and pack content in the supplied assembly lockfile.
- Unauthorized data references — a fragment or prop references a capability view that no known contract publishes.
- Denied data references — a published view is not present in the input's
explicit
grants.viewslist. Contract visibility is not authorization. A reference is resolved wherever it sits: at a prop key, inside an array, or nested in either, since an array is the ordinary shape for a list prop. - Grants that widen —
grants.fragmentsnarrows a fragment subtree to a subset of the release-wide grants, inherited by its children, so a page built from several teams' fragments gets least privilege instead of the union. Narrowing is an intersection, so a fragment entry can never widen, and naming a reference the release does not grant is reported rather than ignored. - Unlocked federated remotes — a pack's declared remote does not match the entry and integrity assembly locked, or a remote was added or dropped after locking.
- Mutation bypasses — an action handler is not a
capability://reference or references an intent no known capability declares. - Denied intents — a published action intent is not present in the input's
explicit
grants.intentslist. - Broken intent declarations — an experience action intent points to an action ID the capability does not declare.
It returns every finding rather than throwing, so one CI run tells a vertical
everything it has to change. Use assertSduiReleaseValid(input) to throw on the
first invalid result. Every release input must provide an integrity-verified
assembly lockfile and both grant lists:
validateSduiRelease({
document,
tokenSet,
componentPacks,
contracts: usageContractDocuments,
assembly,
grants: {
views: ["capability://orders/summary"],
intents: ["capability://orders/submit"],
},
});An experience composer or adoption-binding build can derive these references from its reviewed grants. Supplying a contract, or merely finding a matching capability reference, never authorizes a read or mutation.
Channel consumption
createSduiChannel(id, coreComponents) creates a channel that consumes a
validated release. The channel verifies the immutable release digest before it
checks that every core component the document uses is in its vocabulary;
pack-namespaced components are resolved from the release's locked packs. The
integrity gate also validates the structure and format of releases loaded from
persistence or a network before computing their digest. The
channel never interprets or bypasses capability references — it renders
fragments and forwards action intents through
ProjectionHost (reads) and PlatformHost (actions).
Relationship to other packages
This package depends on @fabricorg/assembly for shared semver resolution,
@fabricorg/gen-capability for UsageContractDocument validation, and
@fabricorg/platform for PortableJsonSchema. It does not depend on a renderer,
a Host, or a specific runtime. SDUI rendering, theming, and composition remain
outside the portable kernel and governed Hosts. Separately versioned experience-tier
packages support those concerns as established by ADR 0015.
