Expand description
Format-neutral scale plan and proof contracts (DESIGN.md Appendix D).
This module owns the two distinct scale operations Appendix D defines —
ScaleOperation::WholeDocumentLinearUnits and
ScaleOperation::RestBindUniformScale — plus their shared pure
planning, candidate construction, and proof layer. It deliberately
consumes and returns only format-neutral facts: an already-loaded
Document and a ScaleCapabilityFacts projection that a format
frontend (for example animsmith-gltf’s raw capability preflight)
builds from its own source-specific inventory. This module does not
accept paths, glTF/ufbx types, config parsers, or publication policy,
and it does not itself decide CLI selectors, evidence schemas, or
artifact/evidence publication — those are producer concerns layered on
top.
The public vocabulary and entrypoints continue to resolve through this facade. Private implementation modules own numeric leaves, validation, planning/replay, reference construction, and proof respectively; proof’s residual recorder is nested under proof so its paired maximum/count state cannot be mutated outside that implementation boundary.
ScaleOperation::RestBindUniformScale selects by raw, format-neutral
source identity — source_skin_index and source_root_node_index — not
by normalized crate::model::BoneId or mesh-instance ordinal.
Resolving those selectors, and classifying the affected domain’s affine
shape, walks crate::model::SceneAssets::source_skeleton: the only
place a full (possibly sheared) authored local matrix survives, since
crate::model::Bone::rest is a lossy TRS decomposition that can never
look sheared even when the source was.
plan_scale is pure and fail-closed: it never mutates its input and
returns a typed ScaleError for every unsupported affine domain,
incomplete closure, incomplete capability, invalid selector, invalid
factor. An internal reference builder constructs analytic candidates for
fixtures and calibration; production format frontends instead rewrite
exact source bytes and wrap the emitted reload with
ScaleCandidate::from_document. prove_scale independently re-derives
the plan’s claims from the source and candidate documents and reports the observed
residual maxima against the fixed ScaleTolerancePolicy::APPENDIX_D_V6
tolerance identity.
Those residuals are the producer evidence record of §D.6, which is why
two properties of this module are contracts rather than implementation
details. Every typed ScaleProofObligation is declared only when
the planned document carries the evidence for it. Candidate construction
and proof re-derive that structural inventory and report a stale plan as
ScaleError::PlanDocumentMismatch; a counterpart missing inside an
inventory-matched walk is ScaleError::MissingProofEvidence. Neither
case becomes a zero residual — a record asserting 0.0 for something
nothing checked would be false, not merely incomplete. The two
observed-factor fields §D.6 asks for are both recorded, together with
ScaleProof::observed_factor_divergence between them, so the record
states their relationship instead of leaving a consumer to guess which to
trust. Rest/bind derives them independently from raw and normalized state;
whole-document conversion records its declared factor in both because it
has no source factor to measure.
Structs§
- Assembly
Scale Basis - Complete versioned semantic basis for one assembly input.
- Assembly
Scale Compatibility Basis - One assembly basis paired with core-validated selector identity.
- Assembly
Scale Compatibility Error - Why two independently supplied assembly inputs do not share one basis.
- Assembly
Scale Named Node - One named normalized node and its exact authored rest basis.
- Assembly
Scale Source Node - One raw source node, including projected/helper layout.
- Assembly
Scale Target Path - One animation channel target and the plan-owned effective multiplier.
- Scale
Candidate - A candidate document supplied to
super::prove_scale. - Scale
Capability Facts - Format-neutral capability facts a frontend projects from its raw source inventory before any scale plan or candidate exists.
- Scale
Field Plan - One exact semantic field row in a compiled scale plan.
- Scale
Plan - Pure, typed plan returned by
plan_scale. - Scale
Plan Ledger - Read-only view of one compiled plan’s exact domain, field, topology, and proof-obligation ledger.
- Scale
Proof - Observed residual maxima from
prove_scale, reported againstScalePlan::tolerance_policy, each paired with the number of comparisons that produced it. - Scale
Proof Residual - One proof claim’s maximum residual and the comparisons behind it.
- Scale
Request - Pure planning input: the operation, the document to plan against, and a format-neutral capability projection of the raw source.
- Scale
Source Topology Row - One row in the canonical source-keyed rest/bind topology.
- Scale
Tolerance Policy - Fixed Appendix D tolerance identity and thresholds. Classification and
proof share this one versioned policy and compute in
f64, narrowing only at the writer model boundary. There is exactly one supported instance,ScaleTolerancePolicy::APPENDIX_D_V6: a policy change is a new policy identity, not a runtime knob.
Enums§
- Assembly
Scale Selector Request - Selector mode requested while deriving an assembly compatibility basis.
- Assembly
Scale Source Rest - Authored raw source-node rest representation retained by a basis.
- Proof
Residual Kind - Which proof obligation produced a
ScaleError::ProofResidualExceededorScaleError::MissingProofEvidence. - Scale
Bone Rest Field - One normalized bone-rest field.
- Scale
Capability Coverage - Whether a format-neutral capability projection covers the whole source.
- Scale
Error - Typed, fail-closed rejection from
plan_scale, reference candidate construction, orprove_scale. - Scale
Field Disposition - Whether a modeled field is preserved exactly or analytically rewritten.
- Scale
Field Target - The exact container-level target of one field disposition.
- Scale
Operation - The two distinct scale operations DESIGN.md Appendix D §D.1 defines.
- Scale
Payload Shape Row - One numeric-value-free payload-shape row used by stale-plan replay.
- Scale
Projected Role - A projected source row’s role in a rest/bind topology.
- Scale
Proof Obligation - One typed proof claim kind derived from the plan’s validated inventory.
- Scale
Rewrite Rule - The structural semantic operation a rewritten field receives.
- Scale
Source Node Kind - The typed kind of one canonical rest/bind source-topology row.
- Scale
Source Rest Field - One authored source-node rest field or component group.
Constants§
- ASSEMBLY_
SCALE_ BASIS_ VERSION - Stable semantic version of
AssemblyScaleBasis.
Functions§
- assembly_
scale_ basis - Project an accepted rest/bind plan into the versioned assembly basis.
- assembly_
scale_ compatibility_ basis - Project one accepted plan and pair it with selector identity derived from the same document.
- plan_
scale - Plan the caller-selected
ScaleOperationagainstrequest.document. - prove_
scale - Independently re-derive and check every claim
ScalePlanmakes. - require_
assembly_ scale_ compatibility - Require two bases to agree on every static semantic field.
- require_
assembly_ scale_ compatibility_ with_ selectors - Require two core-validated compatibility bases to agree.