/** * Capsule declaration locking the GraphPatch round-trip identity as a standing * `pureTransform` contract: `apply(a, diff(a, b))` deep-equals `b`. Where * `canonical-cbor-decode.ts` proves the byte reader inverts the byte writer, * this proves the structural DIFFER inverts itself over two {@link DocumentGraph} * identities — the contract the future graph editor builds against. * * WHY `pureTransform` (not `receiptedMutation`): `run` is a PURE function of its * input — `diff` then `apply`, no receipt byte law, no async hashing, no mutate * channel. `GraphPatch.receipt` (the receipted seam) is deliberately NOT exercised * here; the round-trip identity is a value-level property the pure-transform * harness's property test fits exactly. * * WHY THE INPUT IS SEED MATERIAL (not raw `DocumentGraph`s): a `DocumentGraph` * is content-addressed — its node `id`s and graph `id`/`digest` are `fnv1a` over * the canonical CBOR of the payload, minted ONLY through `sealNode`/`sealGraph`. * The schema-driven arbitrary (`schemaToArbitrary`) cannot mint those addresses; * a raw `Struct` arbitrary would emit graphs with garbage `id`s that `apply` * re-seals away, making the round-trip vacuously red on EVERY sample. So the * input schema generates a small, fully-supported SEED domain (axis-name lists + * acyclic edge index pairs) and `run` SEALS it into two real, valid, sealed * graphs through the one kernel. The invariants then assert over those REAL * sealed graphs (returned in the output), so the property they verify is the * genuine `diff`/`apply`/`validate` contract, never a weakened stand-in. * * @module */ import { Schema } from 'effect'; import type { DocumentGraph, SignalNode } from '../document-graph.js'; declare const GraphSeed: Schema.Struct<{ /** Signal-axis names → one sealed `SignalNode` per DISTINCT name. */ readonly inputs: Schema.$Array; /** `[i, j]` index pairs → a `from`→`to` edge between sealed nodes (normalized acyclic). */ readonly edges: Schema.$Array>; }>; type GraphSeedValue = Schema.Schema.Type; /** Seal a minimal Signal node keyed by its input axis (its id is minted from the payload). */ declare function signalNode(input: string): SignalNode; /** * Build a real, sealed, structurally-VALID graph from a seed. Distinct inputs * dedup to distinct nodes; edge index pairs are normalized to `min → max` over * the node list (so every endpoint exists and the graph stays acyclic, never a * self-loop), keeping `validate` honest without weakening it. */ declare function buildGraph(seed: GraphSeedValue): DocumentGraph; /** * CANONICAL graph equality — the faithful "same graph" test for the round-trip. * * A {@link DocumentGraph} is, by its own addressing kernel * (`document-graph-address.ts`), a CONTENT-ADDRESSED MULTISET: `id`/`digest` are * minted over the SORTED node ids + sorted edges, so "Re-ordering authoring does * not fork identity". The `nodes`/`edges` arrays therefore carry AUTHORING ORDER, * which is volatile (like `meta`) and NOT part of graph identity. * * `apply` rebuilds `nodes` in Map-insertion order (kept-then-added), which need * not match `b`'s authoring order even when the two are THE SAME graph. So a * positional `deepEquals` over the arrays would report a false mismatch on a * genuine round-trip (it did: a=[''], b=[' ','']). The honest equality is the * graph's OWN identity law: same `_tag`/`_version`/`id`/`digest`, plus the same * node MULTISET (by node id) and edge MULTISET (by structural triple). This is * STRONGER than id-equality alone (it re-checks the underlying members), and * never weaker than the real contract — it just refuses to treat authoring order * as identity, exactly as the kernel does. */ declare function sameGraph(a: DocumentGraph, b: DocumentGraph): boolean; /** * Declared capsule for the GraphPatch round-trip identity. Registered in the * module-level catalog at import time; walked by the factory compiler. The * generated property test feeds schema-seeds, `run` seals two real graphs and * computes `diff`→`apply`, and the invariants assert the round-trip / validity / * id-consistency over the SEALED graphs. */ export declare const graphPatchIdentityCapsule: import("../assembly.js").CapsuleDef<"pureTransform", { readonly a: { readonly edges: readonly (readonly [number, number])[]; readonly inputs: readonly string[]; }; readonly b: { readonly edges: readonly (readonly [number, number])[]; readonly inputs: readonly string[]; }; }, unknown, unknown>; /** Internal helpers exported for direct unit assertions over the seed→graph builder. */ export declare const _graphPatchIdentityInternals: { readonly buildGraph: typeof buildGraph; readonly sameGraph: typeof sameGraph; readonly signalNode: typeof signalNode; }; export {}; //# sourceMappingURL=graph-patch-identity.d.ts.map