Shape artifact and cache research
This page records a repository-private engineering program. It is deliberately separate from the product roadmap because the work is deep runtime infrastructure, not a public modeling capability.Why this work exists
Incremental CAD evaluation eventually needs to reuse expensive geometry across runs without changing any evaluator-visible behavior. Native shapes cannot be treated as generic byte blobs: a useful record must preserve the runtime and codec identity, geometry, topology graph, wrapper semantics, history, analytic overrides, and fresh ownership expected by downstream evaluation. The research program asks a narrower question:Can one exact, bounded, independently checked runtime encode a solid, destroy the producer, decode in a fresh compatible consumer, and reproduce every admitted evaluator semantic without sharing native ownership?Passing a finite test corpus provides evidence for that question. It does not certify arbitrary compatibility or authorize production caching.
Public foundations
The 0.1.0 package contains general protocol foundations:- Evaluator/kernel/artifact/solver-bound solid cache keys.
- Fail-closed solver fingerprints and all-or-nothing optional codec capabilities.
- Integrity-checked detached records and explicit encode/decode ownership.
- Bounded cancellable stores, aggregate sessions, and a copying in-memory reference store.
- A framework-neutral
invariantcad/conformanceaudit boundary. - Frozen semantic-observation protocol v1 plus explicit nullable-genus protocol v2, each with its own capture brand, witness domain, and codec-audit admission.
Owned OCCT facade boundary
The repository can reproducibly build an InvariantCAD-owned OCCT facade. The bundle is not published withinvariantcad and is never an implicit download.
The current facade ABI/bundle is 0.9:
- ABI 0.4 added ordered multi-input Boolean operations with complete face/edge/vertex evolution records.
- ABI 0.5 added exact fillet and chamfer evolution.
- ABI 0.6 added exact shell and whole-solid offset evolution.
- ABI 0.7 added bounded shape-artifact transport and a capped chunked BinTools-v4 writer.
- ABI 0.8 added a fixed 128 MiB cumulative native allocation-request budget.
- ABI 0.9 added an exact owned-profile BinTools-v4 structural preflight before OCCT deserialization.
Candidate artifact envelope
The repository-private OCCT candidate currently uses artifact format v3. It contains:- The bounded native binary BREP payload.
- Canonical topology and wrapper-state sidecar format v2.
- Native identity manifest format v1.
Topology and wrapper sidecar v2
The sidecar carries canonical topology, adjacency, native orientation, lineage, history, analytic overrides, and wrapper-visible state. Its fixed 48-byte big-endian header declares exact totals before allocation. Encoding counts before allocating exact sections. Decoding:- Preflights every declared total and exact envelope length.
- Requires closed tags, masks, and canonical finite binary64 values.
- Enforces sorted unique references and reciprocal topology.
- Uses bounded UTF-16BE string accounting.
- Creates fresh evaluation-scoped topology keys.
- Commits decoded state only after native verification succeeds.
- Requires exact sidecar and identity-section EOF.
occt-wasm may tolerate suffix bytes after a valid native BREP archive.
Strict EOF inside the BREP section is therefore an owned-ABI-0.7+ guarantee,
not a stock-runtime guarantee.
Native identity manifest v1
The identity section binds the serialized native structure to the sidecar instead of assuming that fresh topology enumeration is stable. For each unique located solid, shell, wire, face, edge, and vertex, it records the zero-based direct-child path to that shape’s firstIsSame occurrence. It
also records the complete rooted pre-order occurrence stream.
Every 12-byte occurrence record contains:
- Shape type.
- Composed orientation.
- Direct-child count.
- Canonical
IsSameclass index for the six indexed shape kinds.
- Occurrence multiplicity or order.
- Shape type or composed orientation.
- Direct-child count.
IsSameclass membership.- Geometry, incidence, or rooted structure.
Identity and structure ceilings
Native identity v1 has a 64-byte header and fixed ceilings:
The compatibility fingerprint binds these limits, the native structure
contract, artifact/identity format versions, exact runtime inputs, and owned
native materialization declarations.
Native preflight and allocation controls
ABI 0.9 parses the exact owned BinTools-v4 profile before invoking OCCT. It checks:- A maximum of
1,000,000structural work units. - Maximum nesting depth
64. - Location-power magnitude at most
1,000,000. - Canonical locations and the complete backward TShape hierarchy/reachability.
- Bounded TShape metadata charged to the native request quota.
- Conservative geometry, representation, expanded-topology, wire, and face envelopes.
Cache keys and records
Current hardening rejects non-canonical UTF-8 and bounds:
Record creation snapshots non-shared bytes before its first asynchronous
boundary. Shared backing is rejected. The private atomic encode/write
transaction gives the codec the exact remaining budget, accounts work
conservatively, hashes once, and publishes one record.
Record SHA-256 detects corruption or accidental misrouting. It does not
authenticate records against a trusted store that can replace both payload and
digest.
Direct-box evaluator experiment
An unexported explicit-trusted binding connects the private candidate to
evaluator cache sessions for one intentionally narrow case: a requested solid
output whose referenced feature is directly a box.
The binding:
- Snapshots the document and effective evaluation options.
- Validates codec capability and dimensions before store access.
- Creates a fresh session per evaluation.
- Rejects overlapping evaluation/disposal while active.
- Preserves ordinary status, measurements, topology, empty-result behavior, diagnostics, ownership, and cleanup on cold and warm paths.
- Models, encodes, and writes on a miss.
- Decodes a fresh owner on a hit.
- Deletes and recomputes read-write corruption.
- Fails strictly on read-only poison, failed eviction, store/codec/write failure, and cancellation.
- Bypasses the optimization and models normally when key metadata is too large.
Conformance and isolation evidence
The public conformance harness checks candidate codecs against:- Exact runtime identity and tagged semantic witnesses.
- Golden-first decode fixtures.
- Fresh producer and consumer instances.
- Both producer/consumer disposal orders.
- Ownership and mutation isolation.
- Malformed input and byte ceilings.
- Pre-abort behavior.
- Round-trip and downstream operation probes.
13,735 bytes. Its tagged
fixture witness is:
Browser worker evidence
The Chromium production bundle transfers a copy of the committed fixture into a stock-runtime module worker, checks retained-input immutability and transfer detachment, and returns scalar evidence only after shape/kernel cleanup. It also evaluates a real stock-OCCT box through the private trusted-store binding:- Cold evaluation records
miss,writeand one native box call. - Warm evaluation records
hit, detached evidence parity, and no additional box call.
Worker.terminate() is not awaitable. The gate proves a termination
request and fresh-worker recovery, not observed worker exit.
Fresh Node process evidence
pnpm test:occt-artifact-process runs the owned candidate in one-shot child
processes and is part of test:occt-facade-bundle.
Each child:
- Verifies packaged
metadata/release.jsonagainst the independently maintained reviewed pin. - Imports the exact verified JavaScript bytes through the Node module hook.
- Receives a fresh verified WASM copy.
- Emits successful evidence only after evaluated-design and evaluator cleanup.
- Two independent fresh producers must emit byte-identical records and
evidence after
miss,write. - A compatible fresh read-only consumer must hit, decode, perform zero native box calls, and reproduce measurements and topology.
- A different solver fingerprint must derive a different key, miss, and model once without invoking either codec direction.
- Tampered payload, forged key/metadata, hostile/shared views, post-start abort, injected failure, and incomplete event prefixes are rejected and followed by fresh-process recovery.
trusted-parent-mediated-record. Record
authentication remains false.
Runtime attestation boundary
Public Node and browser runtime loaders verify an exact caller-supplied owned runtime pair:- Canonical release manifest against an independent trusted pin.
- Exact JavaScript and WASM sizes and SHA-256 digests before JavaScript import.
- Initialized facade marker before kernel creation.
- A fresh verified WASM copy for every kernel.
node:module.registerHooks() hook per load. Node 22.13 and 22.14 use the
compatible process-wide node:module.register() worker-hook fallback, for
which the Permission Model must allow workers. Neither path writes temporary
executable files. Browser loading uses a revocable Blob module URL and needs a
compatible blob: content security policy.
The opaque matched-pair authority stays private to the evaluated InvariantCAD
module instance. Cloning the visible attestation report does not recreate that
authority.
Runtime-pair verification says which bytes execute. It does not authenticate
the declared build execution or publisher, and it does not protect against a
trusted host, same-process hook chain, or same-UID process.
Explicit non-claims
The current evidence does not establish:- Public or production evaluator caching.
- General feature-subtree caching.
- Compatibility certification for arbitrary inputs.
- Operational cancellation for ordinary same-thread evaluation.
- Live or peak native-memory proof.
- A real OCCT trap recovery proof; the injected trap is an orchestration fault.
- Authenticated build execution or publisher identity.
- Protection against a trusted host or same-UID attacker.
- Cross-edit topology identity.
- Persistent assembly-occurrence identity.
- Shared-TShape ancestry for distinct-location
IsSameclasses; stockocct-wasmlacksIsPartner. - A reviewed cross-platform producer/consumer golden matrix.
- Durable public identity for compounds, compsolids, or generic shape nodes.
Promotion gates
This research can return to active product development only after the modeling milestones justify incremental evaluation and all of these gates have owners:- External legal, security, provenance, and release approval for a supported owned-runtime distribution channel.
- A reviewed cross-platform owned-runtime golden matrix.
- A public worker/process isolation boundary wherever hard cancellation is promised.
- Resource evidence that distinguishes cumulative allocation requests from live and peak memory.
- A versioned diagnostic/topology-policy transcript so warm evaluation cannot change observable behavior.
- Public configuration that keeps trusted-store and authentication claims explicit.
- Dependency-bearing feature families with cold/warm parity, ownership, corruption, cancellation, eviction, and concurrency gates.
- Published capability advertising only after all production requirements pass.
Manifold deferral
A Manifold artifact codec remains deferred. Reconstructing a translated1 × 2 × 3 box from the lockfile-tested public Float32 mesh changes X bounds
from [-0.4, 0.6] to approximately
[-0.4000000059604645, 0.6000000238418579] and volume from 6 to
approximately 6.000000178813934.
Restoring a tolerance does not restore the exact evaluator-visible geometry.
Manifold artifacts require a backend-owned codec that preserves every admitted
semantic rather than round-tripping through a lossy public mesh.