@fabricorg/sdui-release 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,125 @@
1
+ # Changelog
2
+
3
+ ## 0.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 89982ba: Lock federated component-pack delivery. A component pack may declare a `remote` with its entry URL,
8
+ a subresource-integrity value, and its exposed modules; `resolveAssembly` locks that binding in the
9
+ lockfile alongside the artifact digest, and `validateSduiRelease` rejects a release whose declared
10
+ remote does not match the locked one, or which adds or drops a remote the assembly did not.
11
+
12
+ A federated pack executes whatever its remote entry serves at load time, so an approved artifact
13
+ digest describes the pack that was reviewed rather than the code that runs. Locking the entry and
14
+ its integrity closes that gap without Fabric loading anything: the shell verifies integrity against
15
+ the lockfile before executing. The field is optional, so packs delivered any other way are unchanged.
16
+
17
+ - 89982ba: Add enumerated document variants and per-fragment grant narrowing.
18
+
19
+ `SduiDocument.variants` declares every alternative tree a compositor may select at request time.
20
+ Each variant is walked against the same grants as the default tree and is covered by the release
21
+ digest, so selection can never widen what a viewer may see or do. Enumeration at promotion is what
22
+ makes that invariant enforceable: a selector able to produce a tree outside the release cannot be
23
+ validated. Fragment ids are unique within a tree rather than across the document, since only one
24
+ variant renders.
25
+
26
+ `SduiAuthorizationGrants.fragments` narrows a fragment subtree to a subset of the release-wide
27
+ grants, inherited by its children. Narrowing is an intersection, so a fragment entry can never widen,
28
+ and naming a reference the release does not grant is reported as `fragment_grant_exceeds_release`
29
+ rather than silently ignored. A page assembled from several teams' fragments gets least privilege
30
+ instead of the union of everything any of them needs.
31
+
32
+ ### Patch Changes
33
+
34
+ - 6f5471b: Close the gaps an independent review found in the grant, remote and identity work.
35
+
36
+ A capability reference object was treated as a leaf, so a granted reference could shield ungranted
37
+ ones parked beside it on the same object; sibling keys are now walked. Prop recursion is depth
38
+ bounded, so cyclic programmatic input reports a finding instead of exhausting the stack. Federated
39
+ remotes now compare their exposed-module mapping, not only entry and integrity, and the locked remote
40
+ is carried onto the promoted release so two releases differing only in their remote cannot share a
41
+ digest. Pack lookup matches full pack identity rather than namespace and name alone, and a stored
42
+ lockfile that declares one pack or capability twice is rejected rather than resolved by first match.
43
+
44
+ Grant digests omit `variants` and `fragments` when absent, so a release that declares neither digests
45
+ exactly as it did before those fields existed and previously promoted releases keep verifying.
46
+ Variants are hashed in id order, so reordering the same set no longer churns the digest. Fragment
47
+ grants written as a `{ __proto__: … }` object literal are rejected, because that sets the prototype
48
+ rather than creating the entry and the narrowing would silently disappear.
49
+
50
+ `assertActorClaimsCoverScope` no longer fails open: an invalid clock is rejected instead of making
51
+ every temporal comparison false, timestamps must be RFC 3339 with an explicit offset so a credential
52
+ cannot expire at different instants on different hosts, and `spaceIds` must be an array of strings so
53
+ a bare string cannot reach substring matching where `"space_10"` would cover `"space_1"`.
54
+
55
+ - 89982ba: Check capability references at every position a prop value can occupy. Grant enforcement previously
56
+ ran only where a reference sat directly at a prop key: a reference nested inside an array was
57
+ recursed into as if it were a props record, matched no branch, and was never checked, so a published
58
+ but ungranted view passed validation with no findings. Arrays are the ordinary shape for list props
59
+ such as `rows` and `items`, so this reached the common case rather than an edge case. Prop values now
60
+ route through a single `checkValue` that resolves references at any depth, which closes the same gap
61
+ in action `params`.
62
+ - Updated dependencies
63
+ - Updated dependencies [89982ba]
64
+ - Updated dependencies [6f5471b]
65
+ - @fabricorg/gen-capability@0.5.0
66
+ - @fabricorg/assembly@0.3.0
67
+
68
+ ## 0.2.0
69
+
70
+ ### Minor Changes
71
+
72
+ - 4e585a4: Close final production-maturity correctness gaps: expired leases can no longer be renewed,
73
+ saga parent transitions are serialized, atomic, terminal-safe, and retry-idempotent by lifecycle identity, hydrated
74
+ projections must meet requested checkpoints, and SDUI releases accept components only from
75
+ resolved document packs. The release gate now verifies every package and public subpath in
76
+ isolated ESM, CommonJS, and TypeScript consumers.
77
+ - 1ba3a9e: Require explicit view and action-intent grants during SDUI release validation,
78
+ and reject experience intents that do not resolve to a declared governed action.
79
+ - 8e9a571: Added versioned SDUI document, fragment, token-set, component-pack, and
80
+ promoted release contracts validated independently of any renderer. Every
81
+ promoted release requires an integrity-verified assembly lockfile and rejects
82
+ usage contracts or component-pack artifacts outside that approved composition.
83
+ Release format version 2 binds the assembly digest and exact authorization
84
+ grants into its immutable digest. Channels reject release content changed after
85
+ promotion or loaded with an invalid release structure or format, while reads
86
+ and actions remain capability references.
87
+ - e6aede7: Split the SDUI release implementation into cohesive private modules without
88
+ changing public exports, and centralize semver range resolution by importing
89
+ from `@fabricorg/assembly` instead of duplicating the zero-dependency semver
90
+ implementation. Adds `@fabricorg/assembly` as a runtime dependency.
91
+
92
+ ### Patch Changes
93
+
94
+ - Updated dependencies [62dd1ca]
95
+ - Updated dependencies [b932767]
96
+ - @fabricorg/assembly@0.2.0
97
+ - @fabricorg/gen-capability@0.4.1
98
+
99
+ ### Additional release notes
100
+
101
+ - Split the single-file implementation into cohesive private modules
102
+ (types, helpers, structural, digest, capabilities, walker, channel, schemas,
103
+ validate) without changing any public exports.
104
+ - Centralized semver range resolution by importing `parseSemverRange` and
105
+ `resolveVersionRange` from `@fabricorg/assembly` instead of duplicating the
106
+ zero-dependency semver implementation.
107
+ - Require explicit view and action-intent grants during SDUI release validation,
108
+ so published contract membership is not treated as authorization.
109
+ - Validate that every declared experience action intent resolves to an action in
110
+ its capability contract.
111
+ - Build the known-component vocabulary only from packs resolved by the document,
112
+ preventing undeclared supplied packs from authorizing unusable components.
113
+ - Structurally validate persisted or network-loaded promoted releases before
114
+ recomputing their digest, including the release format version.
115
+
116
+ ## 0.1.0
117
+
118
+ - Added versioned `SduiDocument`, `SduiFragment`, `SduiTokenSet`,
119
+ `SduiComponentPack`, and `SduiRelease` contracts.
120
+ - Added `validateSduiRelease` build gate that rejects unknown components,
121
+ incompatible packs, unauthorized data references, and mutation bypasses.
122
+ - Added `assertSduiReleaseValid` for throwing on the first invalid result.
123
+ - Added `createSduiChannel` for multi-channel release consumption with core
124
+ component compatibility checks.
125
+ - Added canonical SHA-256 release digests for deterministic release identity.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) Fabric Pro
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,103 @@
1
+ # `@fabricorg/sdui-release`
2
+
3
+ Versioned SDUI document, fragment, token-set, component-pack, and promoted release
4
+ contracts validated independently of any renderer.
5
+
6
+ ## What this package owns
7
+
8
+ - **`SduiDocument`** — a versioned tree of fragments with a token-set reference and
9
+ declared component-pack ranges. `variants` enumerates every alternative tree a
10
+ compositor may select at request time; each is validated against the same
11
+ grants and covered by the release digest, which is what makes "selection may
12
+ never widen grants" enforceable rather than merely stated.
13
+ - **`SduiFragment`** — a node that renders a component, binds data from a capability
14
+ view, and declares action handlers. Actions are always `capability://` references
15
+ to published action intents — never direct mutations.
16
+ - **`SduiTokenSet`** — renderer-neutral design tokens (color, spacing, typography).
17
+ Two channels consuming the same token set apply the same visual intent through
18
+ different renderings.
19
+ - **`SduiComponentPack`** — a versioned pack of components with prop schemas,
20
+ slot declarations, and the published artifact digest used by assembly. A
21
+ federated pack also declares its `remote`: the entry URL, a
22
+ subresource-integrity value, and its exposed modules. A federated pack executes
23
+ whatever its entry serves, so the artifact digest alone describes the pack that
24
+ was reviewed rather than the code that runs.
25
+ - **`SduiRelease`** — a promoted, validated, immutable bundle with a canonical
26
+ SHA-256 digest. It includes the approved assembly identity and exact
27
+ authorization grants. Two channels (web, mobile, CLI) can consume the same
28
+ release while reads and actions remain capability references.
29
+
30
+ ## Validation
31
+
32
+ `validateSduiRelease(input)` is the single build gate. It rejects:
33
+
34
+ - **Unknown components** — a fragment references a component not in any declared
35
+ pack or the core vocabulary.
36
+ - **Incompatible packs** — a component pack version does not satisfy the document's
37
+ declared range.
38
+ - **Unapproved composition** — a pack artifact or usage contract does not match
39
+ the exact generated contract provenance and pack content in the supplied
40
+ assembly lockfile.
41
+ - **Unauthorized data references** — a fragment or prop references a capability
42
+ view that no known contract publishes.
43
+ - **Denied data references** — a published view is not present in the input's
44
+ explicit `grants.views` list. Contract visibility is not authorization. A
45
+ reference is resolved wherever it sits: at a prop key, inside an array, or
46
+ nested in either, since an array is the ordinary shape for a list prop.
47
+ - **Grants that widen** — `grants.fragments` narrows a fragment subtree to a
48
+ subset of the release-wide grants, inherited by its children, so a page built
49
+ from several teams' fragments gets least privilege instead of the union.
50
+ Narrowing is an intersection, so a fragment entry can never widen, and naming
51
+ a reference the release does not grant is reported rather than ignored.
52
+ - **Unlocked federated remotes** — a pack's declared remote does not match the
53
+ entry and integrity assembly locked, or a remote was added or dropped after
54
+ locking.
55
+ - **Mutation bypasses** — an action handler is not a `capability://` reference or
56
+ references an intent no known capability declares.
57
+ - **Denied intents** — a published action intent is not present in the input's
58
+ explicit `grants.intents` list.
59
+ - **Broken intent declarations** — an experience action intent points to an
60
+ action ID the capability does not declare.
61
+
62
+ It returns every finding rather than throwing, so one CI run tells a vertical
63
+ everything it has to change. Use `assertSduiReleaseValid(input)` to throw on the
64
+ first invalid result. Every release input must provide an integrity-verified
65
+ assembly lockfile and both grant lists:
66
+
67
+ ```ts
68
+ validateSduiRelease({
69
+ document,
70
+ tokenSet,
71
+ componentPacks,
72
+ contracts: usageContractDocuments,
73
+ assembly,
74
+ grants: {
75
+ views: ["capability://orders/summary"],
76
+ intents: ["capability://orders/submit"],
77
+ },
78
+ });
79
+ ```
80
+
81
+ An experience host or adoption-binding build can derive these references from
82
+ its reviewed grants. Supplying a contract, or merely finding a matching
83
+ capability reference, never authorizes a read or mutation.
84
+
85
+ ## Channel consumption
86
+
87
+ `createSduiChannel(id, coreComponents)` creates a channel that consumes a
88
+ validated release. The channel verifies the immutable release digest before it
89
+ checks that every core component the document uses is in its vocabulary;
90
+ pack-namespaced components are resolved from the release's locked packs. The
91
+ integrity gate also validates the structure and format of releases loaded from
92
+ persistence or a network before computing their digest. The
93
+ channel never interprets or bypasses capability references — it renders
94
+ fragments and forwards action intents through
95
+ `ProjectionHost` (reads) and `PlatformHost` (actions).
96
+
97
+ ## Relationship to other packages
98
+
99
+ This package depends on `@fabricorg/assembly` for shared semver resolution,
100
+ `@fabricorg/gen-capability` for `UsageContractDocument` validation, and
101
+ `@fabricorg/platform` for `PortableJsonSchema`. It does not depend on a renderer,
102
+ a host, or a specific runtime. SDUI rendering, theming, and composition remain
103
+ outside Fabric Platform, as established by ADR 0006.