跳转到内容

Aira Representation Translation v0.1 契约

状态:Draft / ExactSolid→MeshSolid + Field3D→MeshSolid Adapter Gates Verified
转换版本:aira.representation-translation/0.1.0
Canonical Schema:representation-translation.schema.json
机器证据:exact-to-mesh-v0.1.json

表示转换是 AMIR 中显式、有损、可追踪的 operation,不是类型 cast。该契约固定一次转换必须交付的身份绑定、 误差预算、执行方法、loss certificate、source→target mapping、聚合结论和失败诊断,使 AI、GUI、runtime 与 validator 对“保留了什么、损失了什么、是否仍可引用”得到同一份机器可验证答案。

首个实现是 convert.exactToMesh@1.0.0;Field 专属合同随后以 0.2.0 实现 convert.fieldToMesh@1.0.0。二者关闭的是最小 adapter/contract 投资 Gate,不代表 production ExactSolid evaluator、产品级 SemanticRef 或完整工业 feature catalog 已启用。

  1. source ExactSolid 与 target MeshSolid 永远是两个不同 artifact,禁止共享 artifact ID 或 subentity ID。
  2. 转换以 artifactRelation=convertedFrom 连接 artifact,以 faceRelation=tessellatedFrom 连接 face。
  3. source/target endpoint 必须分别绑定 Revision、Evaluation、ExecutionManifest、ArtifactGraph 与 artifact content hash;translation record 不修改任一 ArtifactGraph。
  4. 同一 authoring Revision 可以产生两个不同 representation context;此时 resolveAcross 合法且必须使用。
  5. translationId、lossCertificateId 与 mapping evidence 均由 canonical bytes 内容寻址;kernel handle、指针、 face ordinal、临时文件路径和 runtime cache 不进入 wire。
  6. 转换证据不进入 AMIR RevisionId,也不能自行切换 Body authority;权威切换仍需显式 body.setAuthority Patch 和重新验证。

根记录 RepresentationTranslationEvidence 是闭合对象,必填:

  • translationVersion、translationId、status 与 operationRef;
  • source、target 两个 hash-bound endpoint;
  • errorBudget 与 method;
  • lossCertificate;
  • mappings[] 与 aggregate;
  • diagnostics[]。

Exact→Mesh v0.1 的误差预算固定四个语义字段:

  • maxChordalDeviation;
  • maxAngularDeviation;
  • minimumSegmentLength;
  • requireBoundedError。

每项实际结论必须使用以下 claim level 之一,禁止省略:

claim level 含义
provenUpperBound 执行器交付了可验证上界
measuredEstimate 来自实际结果或内核 metadata 的估计/观测,不是证明
requestedOnly 仅记录传入执行器的参数,未证明结果满足它
unknown 当前没有可依赖证据

若 requireBoundedError=true 而关键误差项不是 provenUpperBound,必须在产生可发布 target 前 fail closed 为 ERROR_BOUND_UNAVAILABLE。若已有 proven bound 超预算,必须返回 ERROR_BUDGET_EXCEEDED。warning 不能把失败 转成 pass。

certificate 同时记录保留与损失,至少回答:

  • target 是否通过 MeshSolid manifold/solid 后置条件;
  • source exact dimensions 是否仍可从 target 权威读取;
  • target 是否允许被当作 STEP/B-Rep export authority;
  • chordal、angular 与 minimum-segment 证据分别属于哪个 claim level;
  • source face 是否全部获得 mapping;
  • 是否存在 split、missing、unknown 或 error diagnostic。

Exact→Mesh v0.1 必须声明 exactDimensionsPreserved=false 与 stepExportAllowed=false。Manifold 验证通过只证明 目标网格的拓扑/solid 后置条件,不证明它到 source surface 的 Hausdorff 或 chordal 上界。

每个 source face 的 mapping outcome 只能是:

outcome target 数量 translation 结果 SemanticRef 结果
converted 1 可继续聚合 exactly-one 时可为 resolved
split ≥2 fail ambiguous,publishable=false
missing 0 fail missing,禁止静默重绑

v0.1 pass 必须同时满足:所有 source face 一对一 converted、无 error diagnostic、loss certificate 通过、 MeshSolid validator 通过且 aggregate 与 mappings 一致。任何调用方把 split/missing/失败 certificate 强行改为 pass,Core validator 必须拒绝为 REPRESENTATION_TRANSLATION_FALSE_PASS。禁止选择第一个 target 伪装成功。

当前 adapter 使用锁定的 OCCT V8.0.1 WASM runtime:

  1. BRepMesh_IncrementalMesh 以 absolute deflection、single-thread 和显式 surface-deflection 参数 tessellate;
  2. 从 requested chordal budget 预留量化焊接的最大位移,剩余值作为 mesher deflection;
  3. 逐 Face 读取 Poly_Triangulation,应用 TopLoc_Location,并按 TopAbs_REVERSED 修正三角绕序;
  4. 只焊接量化后位置相同的顶点,记录焊接位移上界;
  5. 为每个 target face 建立 representation-local MeshSolid ArtifactGraph 与 tessellatedFrom mapping;
  6. 通过独立 Manifold 3.5.1 kernel 检查 target mesh 的 solid/topology 后置条件;
  7. BRepTools.Clean 清理 transient triangulation,保证同预算重复构建不受旧 triangulation 状态污染。

OCCT face deflection metadata 加焊接位移只发布为 measuredEstimate;angular 只发布为 requestedOnly;实际 最短 mesh edge 发布为 measuredEstimate。因此当前 adapter 不支持 bounded-error authoritative claim。

构建包固定 36 bindings、TauCAD opencascade.js source commit ebd263f15337b440b391492af073662707e86482、OCCT commit b8f597c677811d1f9f4d8a97f5ae2825c0353a42 与 digest-pinned OCI image;link 阶段禁用网络。最终 WASM 为 8,816,714 raw / 3,389,747 gzip-9 bytes,sha256 为 301a1ea1b17042c171f8e483a07550440eb47b671f3710d0c5a9c6878c87b270。

真实 fixture 是半径 10 mm、高 20 mm 的 OCCT 圆柱,共 3 个 Exact face:

budget vertices triangles 最大 face deflection 合并观测 chord estimate
0.5 mm / 0.5 rad / 0.01 mm 52 100 0.072911259 mm 0.072912125 mm
0.05 mm / 0.1 rad / 0.001 mm 252 500 0.00310818 mm 0.003109046 mm

两档均为 3/3 face 一对一 converted,Manifold 均报告 NoError。细预算重复执行的 target ArtifactGraph hash、 translation ID、vertex buffer 与 triangle buffer 全部一致。同一 Revision 的 Exact→Mesh SemanticRef 为 converted / resolved / publishable=true。

负向 Gate 同时证明:

  • requireBoundedError=true 返回 ERROR_BOUND_UNAVAILABLE;
  • 1→2 split 使 translation fail,SemanticRef 为 ambiguous / publishable=false;
  • 1→0 missing fail closed;
  • 伪造 pass 被 REPRESENTATION_TRANSLATION_FALSE_PASS 拒绝;
  • silent wrong rebind 为 0。

本节的 Exact→Mesh 历史报告固定为 sha256:fd11ba2c9b8982245da83c60f202be797aa423c6c4db59796089ac279c1a7efb。后续 Exact operation 可以扩展 SemanticRef、Exact ArtifactGraph 与 translation adapter/test,但 translation schema/contract、OCCT build manifest/lock 与 sealed runtime receipt 仍须逐字节匹配。存在 receipt-matching OCCT runtime 时, 验证器还会重新执行真实转换,并比较除 artifact bytes 外的完整历史语义。

8. Field3D→MeshSolid graph-bound translation

Section titled “8. Field3D→MeshSolid graph-bound translation”

Field translation 0.2.0 与 Exact translation 共享表示不变量,但不伪造 face mapping:

  • source/target endpoint 各自绑定 Revision、evaluation:sha256:*、ExecutionManifest、ArtifactGraph hash、 artifact ID 与 content hash;
  • source ArtifactGraph 只含 ScalarField/Region,target ArtifactGraph 只含 MeshSolid;
  • cross-representation convertedFrom 只存在于 translation record,不写入两图的局部 derivation;
  • target Face 数为 0,loss certificate 的 SemanticRef survival 为 unknown;
  • 交换图、悬空 locator、contract/lineage 篡改均 fail closed。

真实证据见 Field ArtifactGraph v0.2, 完整 Field/mesher 规则见 Field IR v0.1。

  • 本 adapter 和 scheduler 仍是 spike,不进入 production capability surface;
  • 独立 Manifold 检查不是几何偏差的第二种证明;
  • Exact dimensions、STEP export 与 ExactSolid authority 不从 MeshSolid target 继承;
  • Edge/Wire/Vertex mapping、持久 cache 与通用 NURBS 偏差证明尚未实现;
  • Edge 是后续非阻塞浏览器兼容 smoke test,不是本内核 Gate 的前置条件。

后续最小 typed Field IR、representation-local Field ArtifactGraph 与 graph-bound TrueSDF→MeshSolid Gate 均已通过。下一主线是 GeneralImplicit root semantics 与真正 bounded-error/isotopy mesher 的明确裁决;通过前 不选择 GPU authoritative 路径,也不扩张 fillet、constraint、工业 feature catalog 或 Evals。