@githolon/dsl 0.55.0 → 0.55.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@githolon/dsl",
3
- "version": "0.55.0",
3
+ "version": "0.55.1",
4
4
  "type": "module",
5
5
  "description": "Nomos 2 domain-authoring DSL: aggregates + directives in TS, executed and encoded to the Rust kernel's wire shapes.",
6
6
  "license": "SEE LICENSE IN LICENSE.md",
@@ -44,6 +44,7 @@ import type { FieldOp } from "./ops.js";
44
44
  import type { RelationTypeDecl, Rewrite } from "./relation_schema.js";
45
45
  import type { WorkspaceInvariantDecl } from "./framework/workspace_invariant.js";
46
46
  import { finishCount } from "./count.js";
47
+ import { clearDirectiveId } from "./clear_directive.js";
47
48
  import { voMetaOf, voSample } from "./value_object.js";
48
49
  import { mintedCreateField } from "./workspace_routing.js";
49
50
  import { deterministicPorts } from "./ctx.js";
@@ -2660,6 +2661,39 @@ export function generateTsProof(modules: readonly DomainModule[], opts: TsProofO
2660
2661
  );
2661
2662
  }
2662
2663
 
2664
+ // CLEAR-LANE PROOF (null_semantics.md): a `t.clearable(...)` field's compose-injected clear directive
2665
+ // (`clearDirectiveId(agg, field)`) LOWERS to a Set of json null — dispatch it on the created instance
2666
+ // and read the field back as null (ExplicitNull). Only UN-GATED clear directives (the proof binds no
2667
+ // actor); a gated clear needs authority the negative/positive gate legs already cover. Empty for a
2668
+ // clearable-free aggregate (byte-identical proof).
2669
+ const clearLegs = Object.entries(agg.fields as Record<string, Field>)
2670
+ .filter(([, f]) => f.isClearable === true)
2671
+ .map(([field]) => ({ field, dirId: clearDirectiveId(agg.id, field) }))
2672
+ .filter(({ dirId }) => {
2673
+ const cd = (mod.directives as Directive<unknown>[]).find((d) => d.id === dirId);
2674
+ return cd !== undefined && (cd as { requiresRelationGate?: unknown }).requiresRelationGate === undefined;
2675
+ });
2676
+ for (const { field, dirId } of clearLegs) {
2677
+ out.push(
2678
+ `// ${n()}. CLEAR-LANE PROOF — \`${field}\` is clearable: \`${dirId}\` lowers to Set(json null); after it,`,
2679
+ `// the field reads back null (ExplicitNull), never omitted.`,
2680
+ `try {`,
2681
+ ` await app.${dirId}({ id: createdId });`,
2682
+ `} catch (e) {`,
2683
+ ` fail(\`clear-lane ${dirId} was REFUSED — an un-gated clear of a clearable field must be admitted: \${(e as Error).message}\`);`,
2684
+ `}`,
2685
+ `{`,
2686
+ ` const clearedRows = await holon.queryById(createdId) as { data?: Record<string, unknown> }[];`,
2687
+ ` const clearedRow = clearedRows[0];`,
2688
+ ` if (clearedRow !== undefined && clearedRow.data !== undefined && clearedRow.data[${JSON.stringify(field)}] != null) {`,
2689
+ ` fail(\`clear-lane ${field}: expected null after clear, got \${JSON.stringify(clearedRow.data[${JSON.stringify(field)}])}\`);`,
2690
+ ` }`,
2691
+ ` ok(${JSON.stringify(`clear-lane — ${domain}/${dirId} admitted; \`${field}\` reads back null (ExplicitNull)`)});`,
2692
+ `}`,
2693
+ ``,
2694
+ );
2695
+ }
2696
+
2663
2697
  out.push(
2664
2698
  `globalThis.fetch = realFetch;`,
2665
2699
  `ok("offline proof ENFORCED — fetch was trapped: local write/read touched no network");`,