@riddledc/riddle-proof 0.8.82 → 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,7 +92,9 @@ produces no certificate:
92
92
  ```ts
93
93
  import {
94
94
  createRiddleProofSemanticCertificate,
95
- composeRiddleProofSemanticCertificates,
95
+ createRiddleProofSemanticAtomicCertificateClosure,
96
+ composeRiddleProofSemanticCertificateClosures,
97
+ matchRiddleProofSemanticCertificateClosure,
96
98
  } from "@riddledc/riddle-proof/semantic-certificate";
97
99
 
98
100
  const quiet = createRiddleProofSemanticCertificate({
@@ -119,7 +121,16 @@ const quiet = createRiddleProofSemanticCertificate({
119
121
 
120
122
  if (!quiet.ok) throw new Error(quiet.error.message);
121
123
 
122
- 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({
123
134
  rule: {
124
135
  rule_id: "tidepool.quiet-then-collision",
125
136
  rule_version: "1",
@@ -127,10 +138,47 @@ const behavior = composeRiddleProofSemanticCertificates({
127
138
  premises: [quiet.certificate.claim, later.certificate.claim],
128
139
  conclusion: observedWaveCollisionBehaviorClaim,
129
140
  },
130
- certificates: [quiet.certificate, later.certificate],
141
+ closures: [quietClosure.closure, laterClosure.closure],
142
+ });
143
+
144
+ if (!behavior.ok) throw new Error(behavior.error.message);
145
+ ```
146
+
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:
161
+
162
+ ```ts
163
+ const match = matchRiddleProofSemanticCertificateClosure({
164
+ closure: JSON.parse(serializedClosure),
165
+ expected_root_certificate_id: trustedHandoffCertificateId,
166
+ expected_scope: scope,
167
+ expected_claim: observedWaveCollisionBehaviorClaim,
168
+ expected_assurance: "declared_runtime_rule",
131
169
  });
170
+
171
+ if (!match.ok) throw new Error(match.error.message);
172
+ // match.closure contains every validated body; match.root_certificate is exact.
132
173
  ```
133
174
 
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.
181
+
134
182
  Composition requires the declared premise claims and exact scope equality. It
135
183
  copies compact premise snapshots into the derivation and sets the higher
136
184
  certificate's evidence to the ordered concatenation of premise evidence. The
@@ -139,13 +187,21 @@ declared runtime rule. The parser rechecks those relationships and the
139
187
  content-addressed certificate ID. The serialized v0 objects use exact keys and
140
188
  reject any `status`, verdict, merge, sync, ready-to-ship, shipping-authority,
141
189
  or free-form metadata field: semantic composition is deliberately separate
142
- from release policy.
143
-
144
- The boundary remains explicit. Derivations say `runtime_contract_accepted` or
145
- `declared_runtime_rule`; JavaScript predicates and named rules are inspectable
146
- runtime models, not Lean proof terms. Certificate hashes are content identities,
147
- not signatures, and receipt IDs and digests do not authenticate browser, Git,
148
- 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.
149
205
 
150
206
  Persist a deploy result and its immutable receipt for later Change Proof input:
151
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';