component_contract_check
Validate a built component against its builder brief before saving or merging. Catch envelope, interface, and performance violations locally and return pass/fail checks without raising on failure.
Instructions
Builder-side contract gate for one component (issue #169) — the local half of
the gate merge_assembly re-runs at fan-in. Any MCP host builds a component with
the full AnkusDrive tool surface, then calls this on its part BEFORE saving,
against its builder brief (a ankusdrive.builder_brief/1 slice), and repairs any
failing check. Catching a violation here turns the expensive loop (build → merge
→ gate-fail → rebuild) into a cheap local one. Never raises on a failing check.
handle: the component's shaped object. brief: a builder brief. Only three of its keys drive checks (the rest guide the build, not the gate): envelope {min:[x,y,z], max:[x,y,z]} the part's LOCAL bbox must fit inside. interfaces {name: {origin?:[x,y,z], z_axis?:[x,y,z], tol_mm?, angle_tol_deg?}} each named frame must be PUBLISHED (publish_interface) with a sane frame, and within tolerance of a pinned origin/axis if the brief gives one. performance {requirements?: [{name, limit}], required?: bool} the quantitative spec (#226) the builder must DECLARE (declare_performance, no looser than briefed) and PROVE (verify_performance) before fan-in.
Checks run: watertight (check_shape's one-clean-solid verdict), envelope (local bbox inside the keep-out box), interface: (published + sane + in tol), performance_spec: (declared as briefed) and performance: (the last RECORDED verify_performance verdict says it is met).
A performance requirement the record says is NOT met fails the gate. One with no
verdict yet — never verified, a solve still in flight, or a verdict invalidated by a
later edit — is neither passed nor failed: it comes back in skipped with a reason,
because "unverified" is not "fine" and must not be actioned as either.
Returns {handle, ok, checks:[{check, passed, detail}], reasons:[...],
skipped:[{check, reason}], performance?} — ok True iff every check passed (skips
never move it); reasons is the failing checks' details. A part that declares no
performance contract gets no performance rows, empty skipped and no performance
key, so the geometric gate is unchanged.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| brief | Yes | ||
| handle | Yes |