@riddledc/riddle-proof 0.8.83 → 0.8.84

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/README.md CHANGED
@@ -92,8 +92,9 @@ produces no certificate:
92
92
  ```ts
93
93
  import {
94
94
  createRiddleProofSemanticCertificate,
95
- composeRiddleProofSemanticCertificates,
96
- matchRiddleProofSemanticCertificate,
95
+ createRiddleProofSemanticAtomicCertificateClosure,
96
+ composeRiddleProofSemanticCertificateClosures,
97
+ matchRiddleProofSemanticCertificateClosure,
97
98
  } from "@riddledc/riddle-proof/semantic-certificate";
98
99
 
99
100
  const quiet = createRiddleProofSemanticCertificate({
@@ -120,7 +121,16 @@ const quiet = createRiddleProofSemanticCertificate({
120
121
 
121
122
  if (!quiet.ok) throw new Error(quiet.error.message);
122
123
 
123
- const behavior = composeRiddleProofSemanticCertificates({
124
+ const quietClosure = createRiddleProofSemanticAtomicCertificateClosure({
125
+ certificate: quiet.certificate,
126
+ });
127
+ const laterClosure = createRiddleProofSemanticAtomicCertificateClosure({
128
+ certificate: later.certificate,
129
+ });
130
+ if (!quietClosure.ok) throw new Error(quietClosure.error.message);
131
+ if (!laterClosure.ok) throw new Error(laterClosure.error.message);
132
+
133
+ const behavior = composeRiddleProofSemanticCertificateClosures({
124
134
  rule: {
125
135
  rule_id: "tidepool.quiet-then-collision",
126
136
  rule_version: "1",
@@ -128,39 +138,46 @@ const behavior = composeRiddleProofSemanticCertificates({
128
138
  premises: [quiet.certificate.claim, later.certificate.claim],
129
139
  conclusion: observedWaveCollisionBehaviorClaim,
130
140
  },
131
- certificates: [quiet.certificate, later.certificate],
141
+ closures: [quietClosure.closure, laterClosure.closure],
132
142
  });
143
+
144
+ if (!behavior.ok) throw new Error(behavior.error.message);
133
145
  ```
134
146
 
135
- A later agent can consume one exact certificate without reopening its receipt
136
- files. The expected content ID must arrive through the consumer's trusted
137
- handoff or configuration; copying it from the same untrusted certificate would
138
- not add trust:
147
+ `riddle-proof.semantic-certificate-closure.v0` carries the root and every
148
+ transitively referenced full certificate body. Closure composition validates
149
+ each input, deduplicates shared descendants, creates the higher root, and then
150
+ validates the complete result. Arbitrary transport order is accepted, but a
151
+ successful validator returns one deterministic dependency-first, root-last
152
+ order. A closure is bounded by the exported
153
+ `RIDDLE_PROOF_SEMANTIC_CERTIFICATE_CLOSURE_MAX_CERTIFICATES` value (currently
154
+ 4,096 bodies). Missing bodies, duplicate IDs, snapshot/body disagreements,
155
+ cycles, and unreachable extras fail closed.
156
+
157
+ A later agent can validate the complete derivation without reopening receipt
158
+ files. It still needs the expected root ID, scope, claim, and assurance from an
159
+ independent trusted handoff or configuration; copying expectations from the
160
+ same untrusted closure would not add trust:
139
161
 
140
162
  ```ts
141
- const match = matchRiddleProofSemanticCertificate({
142
- certificate: JSON.parse(serializedCertificate),
143
- expected_certificate_id: trustedHandoffCertificateId,
163
+ const match = matchRiddleProofSemanticCertificateClosure({
164
+ closure: JSON.parse(serializedClosure),
165
+ expected_root_certificate_id: trustedHandoffCertificateId,
144
166
  expected_scope: scope,
145
167
  expected_claim: observedWaveCollisionBehaviorClaim,
146
168
  expected_assurance: "declared_runtime_rule",
147
169
  });
148
170
 
149
171
  if (!match.ok) throw new Error(match.error.message);
150
- // match.certificate is the exact scoped certificate this consumer requested.
172
+ // match.closure contains every validated body; match.root_certificate is exact.
151
173
  ```
152
174
 
153
- Matching first reparses the envelope and its content ID, then compares the
154
- trusted expected ID, all five scope fields, claim ID/version/parameters, and
155
- top-level assurance. It does no filesystem or network I/O, and a successful
156
- match does not authenticate the issuer or the referenced evidence.
157
-
158
- This is an exact root-certificate handoff, not independent proof-tree
159
- reconstruction. A composite certificate retains compact immediate-premise
160
- snapshots, not the full transitive certificate bodies. A consumer that does not
161
- already trust the expected root ID needs a complete certificate closure plus a
162
- contract/rule identity policy before it can independently inspect the whole
163
- derivation.
175
+ Closure matching reparses and re-hashes every body, resolves every immediate
176
+ premise snapshot to its exact full body, rejects bodies not reachable from the
177
+ declared root, and only then compares the trusted root ID, all five scope
178
+ fields, claim ID/version/parameters, and assurance. The original
179
+ `matchRiddleProofSemanticCertificate` remains available for intentionally
180
+ bounded, root-only handoffs.
164
181
 
165
182
  Composition requires the declared premise claims and exact scope equality. It
166
183
  copies compact premise snapshots into the derivation and sets the higher
@@ -170,13 +187,21 @@ declared runtime rule. The parser rechecks those relationships and the
170
187
  content-addressed certificate ID. The serialized v0 objects use exact keys and
171
188
  reject any `status`, verdict, merge, sync, ready-to-ship, shipping-authority,
172
189
  or free-form metadata field: semantic composition is deliberately separate
173
- from release policy.
174
-
175
- The boundary remains explicit. Derivations say `runtime_contract_accepted` or
176
- `declared_runtime_rule`; JavaScript predicates and named rules are inspectable
177
- runtime models, not Lean proof terms. Certificate hashes are content identities,
178
- not signatures, and receipt IDs and digests do not authenticate browser, Git,
179
- CDN, screenshot, or outside-world truth.
190
+ from release policy. Direct JavaScript inputs are treated as JSON data: object
191
+ fields must be own enumerable data properties and structural arrays must be
192
+ dense. Accessors, `toJSON` hooks, inherited fields, symbols, and hidden fields
193
+ are rejected instead of being executed or silently discarded.
194
+
195
+ The boundary remains explicit. Complete closure validation establishes
196
+ structural and semantic linkage, not the truth of the leaves. Derivations say
197
+ `runtime_contract_accepted` or `declared_runtime_rule`; JavaScript predicates
198
+ and named rules are inspectable runtime models, not Lean proof terms.
199
+ Certificate hashes are content identities, not signatures. Validation performs
200
+ no filesystem or network I/O, does not authenticate an issuer, and does not
201
+ authenticate or recompute browser, Git, CDN, screenshot, receipt, or artifact
202
+ truth. Contract/rule IDs remain declared data, so consumers that care which
203
+ models were used should apply their own allowlist or authenticated issuer
204
+ policy in addition to anchoring the expected root ID.
180
205
 
181
206
  Persist a deploy result and its immutable receipt for later Change Proof input:
182
207
 
@@ -1,6 +1,6 @@
1
1
  export { b as runner } from '../runner-4LJ5z0D-.cjs';
2
2
  export { l as engineHarness } from '../engine-harness-LBfqbFSe.cjs';
3
3
  export { p as proofRunCore } from '../proof-run-core-7Dqm7RKM.cjs';
4
- export { p as proofRunEngine } from '../proof-run-engine-Baiv6l3A.cjs';
4
+ export { p as proofRunEngine } from '../proof-run-engine-DpChFR5H.cjs';
5
5
  import '../types.cjs';
6
6
  import '../public-state.cjs';
@@ -1,6 +1,6 @@
1
1
  export { b as runner } from '../runner-BdQpOkZD.js';
2
2
  export { l as engineHarness } from '../engine-harness-CMACHP6A.js';
3
3
  export { p as proofRunCore } from '../proof-run-core-7Dqm7RKM.js';
4
- export { p as proofRunEngine } from '../proof-run-engine-MiKZt9oY.js';
4
+ export { p as proofRunEngine } from '../proof-run-engine-BqRoA3Do.js';
5
5
  import '../types.js';
6
6
  import '../public-state.js';
@@ -1,2 +1,2 @@
1
- export { R as RiddleProofEngine, c as createRiddleProofEngine, e as executeWorkflow } from '../proof-run-engine-Baiv6l3A.cjs';
1
+ export { R as RiddleProofEngine, c as createRiddleProofEngine, e as executeWorkflow } from '../proof-run-engine-DpChFR5H.cjs';
2
2
  import '../proof-run-core-7Dqm7RKM.cjs';
@@ -1,2 +1,2 @@
1
- export { R as RiddleProofEngine, c as createRiddleProofEngine, e as executeWorkflow } from '../proof-run-engine-MiKZt9oY.js';
1
+ export { R as RiddleProofEngine, c as createRiddleProofEngine, e as executeWorkflow } from '../proof-run-engine-BqRoA3Do.js';
2
2
  import '../proof-run-core-7Dqm7RKM.js';