Issue 51: pose placement and kernel measurement of an assembly

Evidence for src/tolerance_arena/assembly/pose.py and src/tolerance_arena/assembly/measure.py. Every number below comes from a command run in this clone on the tree that the commit holds, on a machine with a load average near 38, so durations are long and only the pass or fail result matters.

What was built

  • pose.py places the parts of an Assembly for a joint coordinate q and a deviation delta. It returns motion.Transform values and loads no CAD library. place(assembly, part, q, delta) gives one part, placements(assembly, q, delta) gives all of them. A q outside the joint range, a delta outside the deviation range, a bool, a string, a non-finite number, an integer too large for a float, an unknown part name and an object that is not an Assembly raise PoseError (a subclass of AssemblyError). Nothing is clamped.
  • measure.py measures the two parts named by assembly.requirement. PoseMeter(assembly) keeps one supervised child process for many poses of one assembly, measure(assembly, q, delta) runs a single query in its own child. Both return a PoseMeasurement (parts, q, delta_mm, distance_mm, the two witness points, overlap).
  • The placement rule is the one in assembly/types.py: the deviation moves the named part along direction in the world frame, the fixed part has its deviation only, the moving part has its deviation first and the joint motion second. A revolute motion is translation(origin) * rotation(axis, q) * translation(-origin). A prismatic motion is a translation by q mm along the axis.
  • PoseMeasurement refuses a result that contradicts itself: a NaN or negative distance, a witness point that is not three finite floats, and an overlap flag that differs from distance_mm == 0.

Overlap

native.measure_distance reports distance_mm == 0.0 for two solids that cross (tests/test_relations.py) and sets inner_solution when one solid lies inside the other, in which case OCCT reports the distance between the shells. Both cases have no gap, so result_from_native reports overlap = inner_solution or distance_mm == 0.0 and distance_mm = 0.0. A touch of 4e-10 mm is not an overlap and keeps its distance (test_a_touch_below_a_nanometre_is_not_called_an_overlap). The kernel tests show a crossing slug (q = 15) and a slug inside a ring (q = 20) both reporting (0.0, True).

How the child process works

worker.CadWorker.measure sends the rotating pin request (an angle and an offset checked against the fixture ranges), so it cannot carry an arbitrary assembly, and worker.serve_loop caps a request at 4096 bytes, which is why the solids travel in the spawn arguments and a query carries two placements. measure.py therefore adds a small subclass, _PoseWorker(worker.CadWorker), and no existing module changed. It reuses the inherited start, the explicit spawn context, the removal of provider keys from the child environment, the deadline, the SIGTERM then SIGKILL, the reap and the fresh process after any failure. Only query is new: it mirrors CadWorker.measure and sends the two placements as seven JSON numbers each (translation, then quaternion xyzw).

  • The solids reach the child once, as BREP text without triangulation, in the arguments of the spawned process. The child loads build123d and OCP, reads both solids, then answers ready. Each query places the two solids with fixture.location_of and calls native.measure_distance, which refuses an empty or invalid shape.
  • The parent never builds, moves or measures a solid. measure.py imports no CAD library at import time (a subprocess test imports pose and measure and finds no build123d or OCP module). PoseMeter imports build123d only to write the caller's solid as BREP text.
  • The default deadline is 10 s (DEFAULT_LIMITS). A timeout, a crash, a protocol error and a kernel error raise NativeQueryError with a reason code (worker_timeout, worker_crashed, worker_protocol_error, invalid_shape, empty_shape, worker_exception, kernel_not_done and the other kernel codes). No path returns a distance after a failure. verify.evaluate already reads that error as indeterminate.
  • before_query is a module-level function that the child calls before each kernel query. The tests use it to inject a hang and a failure into the real child.

Tests added

All test modules have a unique basename. Native modules carry pytest.mark.native.

FileTestsGateWhat it guards
tests/assembly/test_assembly_pose.py43fasthand-computed poses, refusals, no CAD library loaded
tests/assembly/test_assembly_measure_result.py18fastwitness points, overlap rule, refusal of a contradictory result
tests/assembly/test_assembly_measure_runner.py15fastdeadline, kill, reap, restart, crash, protocol errors, placement order, with stand-in children and no kernel
tests/assembly/test_assembly_types_guards.py29fastedges of assembly/types.py guards that the mutation run found open
tests/assembly/test_assembly_measure_pin.py6nativethe rotating pin against verify.measure_scenario on 60 poses
tests/assembly/test_assembly_measure_kernel.py26nativeclosed forms, hand-computed poses, overlap, invalid solids, hang and recovery in the real child, no CAD work in the parent
tests/pose_measure_targets.pyhelperstand-in children and the injected steps

That is 105 fast tests and 32 native tests, 137 in all. The pose tests were written and run red (an ImportError) before pose.py existed, and the runner tests were written and run red the same way before measure.py existed. The result, pin, kernel and guard tests were written after the code they check, so they were not seen red first. Their value rests on the mutants below, which turn them red one guard at a time.

Evidence

Test output

nice -n 10 .venv/bin/python -m pytest -p no:cacheprovider tests/assembly -q ended with 172 passed in 184.15s (0:03:04), exit status 0. That is the 35 tests of test_assembly_types.py already on main plus the 137 added here (105 fast, 32 native).

Closed forms and hand-computed poses

  • Rotating pin: Assembly built from fixture.build_pin(0.0) and fixture.build_obstacle(0.0), a revolute joint about +Z through the origin on the pin, a deviation along (cos 45 degrees, sin 45 degrees, 0) on the obstacle. At q = 45, delta = -1.2 the distance matches verify.measure_scenario and oracle.reference_clearance_mm. On a grid of 10 angles (0 to 90 degrees in steps of 10) and 6 offsets (-1.2 to 1.2 mm) the 60 poses agree with verify.measure_scenario to 2.665e-14 mm at worst (the limit is 1e-6 mm). The table is below.
  • Prismatic block: a 10 x 6 x 4 mm box slides along the axis (-2/3, -1/3, -2/3), which lies in no coordinate plane, toward a cylinder of radius 3 mm and height 10 mm whose own deviation direction is (0, 0.6, 0.8). The reference in the test is the distance between a rectangle and a disc in plan (distance from the disc centre to the rectangle, less the radius) combined with the gap of the height intervals as hypot(plan gap, height gap). It uses no kernel. The 68 poses of the slide (61 with a gap down to 0.162 mm, 7 crossing) agree to 1.776e-15 mm at worst. A further 30 poses combine six slide positions with five deviations from -5 to 5 mm.
  • Hinge: two cylinders of radius 2 mm. The swing starts 20 mm from the axis (+Z through (10, 0, 0)) and the post stands at (10, 35).
    • q = 90: the swing turns to (10, 20), the gap is 15 - 4 = 11 mm, witness points at plan positions (10, 22) and (10, 33). A turn about the origin would give 7.18 mm.
    • q = -90: the swing goes to (10, -20), the gap is 55 - 4 = 51 mm. The wrong sign would give 11 mm.
    • q = 90, delta = 3 on the moving part: the deviation comes first, the swing is at (33, 0), then turns to (10, 23), the gap is 12 - 4 = 8 mm. The other order would give 11.30 mm.
    • q = 0: the gap is hypot(20, 35) - 4. The kernel tests assert these values within 1e-6 mm.
  • Overlap: a ring (radius 5) and a slug (radius 0.5) sliding toward it give 14.5 mm at q = 0, 0.5 mm at q = 14, (0.0, True) at q = 15 (crossing) and (0.0, True) at q = 20 (inside).
  • Refusals: q and delta outside their ranges (with values a hair beyond each end), NaN, infinity, bool, text, None, a tuple, an integer of 400 digits, an unknown part name and an object that is not an assembly are refused (test_assembly_pose.py). A refused pose never reaches the child: after seven refused calls the child generation and the query count are unchanged, and a refused pose on a fresh PoseMeter starts no process. A part with an invalid solid (a cylinder of radius 0, which the kernel calls invalid) gives invalid_shape, for either part. A part that is not a CAD solid gives invalid_shape and an empty compound gives empty_shape before any process starts.
  • Hang: the real child with an injected step that sleeps for an hour, a deadline of 1 s. The query raises worker_timeout in under 8 s, supervisor.pid is None, /proc/<pid> is gone, the next query starts a new child (generation 2, another pid) and a failing step then gives worker_exception while the child stays. The same deadline logic is tested without the kernel in test_assembly_measure_runner.py (a child that hangs, one that ignores SIGTERM and dies of SIGKILL, a crash, a garbled reply, an oversized reply, a reply that breaks the JSON reader).
  • No CAD object in the parent: with native.measure_distance, fixture.location_of and build123d.Shape.moved replaced by functions that raise in the parent, a query still completes, and the number of live Shape objects in the parent is the same before and after.

Pose grid of the rotating pin (60 poses)

Columns: pose, the distance the assembly measures, the distance verify.measure_scenario measures (the reference), their difference, and the closed-form value of oracle.reference_clearance_mm.

angle_deg offset_mm  assembly_mm      verify_mm        difference_mm    oracle_mm
      0.0     -1.20    28.753157042    28.753157042       +1.776e-14    28.753157042
      0.0     -0.72    28.997799863    28.997799863       +1.421e-14    28.997799863
      0.0     -0.24    29.247572775    29.247572775       +1.066e-14    29.247572775
      0.0      0.24    29.502361037    29.502361037       +1.421e-14    29.502361037
      0.0      0.72    29.762051102    29.762051102       +1.421e-14    29.762051102
      0.0      1.20    30.026530741    30.026530741       +1.421e-14    30.026530741
     10.0     -1.20    21.907509978    21.907509978       +1.421e-14    21.907509978
     10.0     -0.72    22.133924978    22.133924978       +7.105e-15    22.133924978
     10.0     -0.24    22.367134775    22.367134775       +1.066e-14    22.367134775
     10.0      0.24    22.606960701    22.606960701       +1.421e-14    22.606960701
     10.0      0.72    22.853225491    22.853225491       +1.421e-14    22.853225491
     10.0      1.20    23.105753647    23.105753647       +1.066e-14    23.105753647
     20.0     -1.20    14.942884977    14.942884977       +1.243e-14    14.942884977
     20.0     -0.72    15.164265502    15.164265502       +1.243e-14    15.164265502
     20.0     -0.24    15.395000727    15.395000727       +7.105e-15    15.395000727
     20.0      0.24    15.634760864    15.634760864       +1.599e-14    15.634760864
     20.0      0.72    15.883219437    15.883219437       +1.421e-14    15.883219437
     20.0      1.20    16.140054522    16.140054522       +1.066e-14    16.140054522
     30.0     -1.20     8.048312686     8.048312686       +1.776e-14     8.048312686
     30.0     -0.72     8.300759605     8.300759605       +1.066e-14     8.300759605
     30.0     -0.24     8.566476639     8.566476639       +1.066e-14     8.566476639
     30.0      0.24     8.844640259     8.844640259       +1.776e-14     8.844640259
     30.0      0.72     9.134459702     9.134459702       +2.132e-14     9.134459702
     30.0      1.20     9.435180681     9.435180681       +1.421e-14     9.435180681
     40.0     -1.20     2.056253135     2.056253135       +2.220e-14     2.056253135
     40.0     -0.72     2.454666965     2.454666965       +1.465e-14     2.454666965
     40.0     -0.24     2.863530376     2.863530376       +1.643e-14     2.863530376
     40.0      0.24     3.281083217     3.281083217       +2.665e-14     3.281083217
     40.0      0.72     3.705913081     3.705913081       +2.354e-14     3.705913081
     40.0      1.20     4.136880238     4.136880238       +1.599e-14     4.136880238
     50.0     -1.20     2.056253135     2.056253135       +1.732e-14     2.056253135
     50.0     -0.72     2.454666965     2.454666965       +8.438e-15     2.454666965
     50.0     -0.24     2.863530376     2.863530376       +1.776e-14     2.863530376
     50.0      0.24     3.281083217     3.281083217       +1.865e-14     3.281083217
     50.0      0.72     3.705913081     3.705913081       +1.865e-14     3.705913081
     50.0      1.20     4.136880238     4.136880238       +9.770e-15     4.136880238
     60.0     -1.20     8.048312686     8.048312686       +7.105e-15     8.048312686
     60.0     -0.72     8.300759605     8.300759605       +5.329e-15     8.300759605
     60.0     -0.24     8.566476639     8.566476639       +1.243e-14     8.566476639
     60.0      0.24     8.844640259     8.844640259       +8.882e-15     8.844640259
     60.0      0.72     9.134459702     9.134459702       +1.243e-14     9.134459702
     60.0      1.20     9.435180681     9.435180681       +7.105e-15     9.435180681
     70.0     -1.20    14.942884977    14.942884977       +1.066e-14    14.942884977
     70.0     -0.72    15.164265502    15.164265502       +1.066e-14    15.164265502
     70.0     -0.24    15.395000727    15.395000727       +1.421e-14    15.395000727
     70.0      0.24    15.634760864    15.634760864       +1.421e-14    15.634760864
     70.0      0.72    15.883219437    15.883219437       +1.421e-14    15.883219437
     70.0      1.20    16.140054522    16.140054522       +1.066e-14    16.140054522
     80.0     -1.20    21.907509978    21.907509978       +1.421e-14    21.907509978
     80.0     -0.72    22.133924978    22.133924978       +1.066e-14    22.133924978
     80.0     -0.24    22.367134775    22.367134775       +1.776e-14    22.367134775
     80.0      0.24    22.606960701    22.606960701       +1.421e-14    22.606960701
     80.0      0.72    22.853225491    22.853225491       +1.421e-14    22.853225491
     80.0      1.20    23.105753647    23.105753647       +7.105e-15    23.105753647
     90.0     -1.20    28.753157042    28.753157042       +7.105e-15    28.753157042
     90.0     -0.72    28.997799863    28.997799863       +0.000e+00    28.997799863
     90.0     -0.24    29.247572775    29.247572775       +1.066e-14    29.247572775
     90.0      0.24    29.502361037    29.502361037       +7.105e-15    29.502361037
     90.0      0.72    29.762051102    29.762051102       +7.105e-15    29.762051102
     90.0      1.20    30.026530741    30.026530741       +3.553e-15    30.026530741
60 poses, largest |assembly - verify| = 2.665e-14 mm

Slide of the block toward the post (68 poses)

Columns: joint coordinate in mm, the kernel distance through the assembly, the closed-form distance computed in the test, their difference and the overlap flag.

q_mm    kernel_mm        closed_form_mm   difference_mm    overlap
  0.0     10.368303823     10.368303823       -1.776e-15    False
  0.2     10.173602977     10.173602977       +0.000e+00    False
  0.4      9.979110943      9.979110943       +0.000e+00    False
  0.6      9.784840142      9.784840142       +0.000e+00    False
  0.8      9.590803984      9.590803984       +1.776e-15    False
  1.0      9.397016970      9.397016970       +0.000e+00    False
  1.2      9.203494798      9.203494798       +1.776e-15    False
  1.4      9.010254493      9.010254493       +0.000e+00    False
  1.6      8.817314542      8.817314542       +0.000e+00    False
  1.8      8.624695055      8.624695055       +0.000e+00    False
  2.0      8.432417941      8.432417941       +0.000e+00    False
  2.2      8.240507111      8.240507111       +0.000e+00    False
  2.4      8.048988704      8.048988704       +0.000e+00    False
  2.6      7.857891347      7.857891347       +0.000e+00    False
  2.8      7.667246452      7.667246452       +0.000e+00    False
  3.0      7.477088550      7.477088550       +8.882e-16    False
  3.2      7.287455682      7.287455682       -8.882e-16    False
  3.4      7.098389832      7.098389832       +8.882e-16    False
  3.6      6.909937445      6.909937445       +0.000e+00    False
  3.8      6.722150004      6.722150004       +8.882e-16    False
  4.0      6.535084712      6.535084712       -8.882e-16    False
  4.2      6.348805271      6.348805271       +8.882e-16    False
  4.4      6.163382790      6.163382790       -8.882e-16    False
  4.6      5.978896838      5.978896838       +0.000e+00    False
  4.8      5.795436677      5.795436677       +0.000e+00    False
  5.0      5.613102694      5.613102694       -8.882e-16    False
  5.2      5.432008079      5.432008079       +0.000e+00    False
  5.4      5.252280791      5.252280791       +0.000e+00    False
  5.6      5.074065859      5.074065859       +0.000e+00    False
  5.8      4.897528085      4.897528085       +8.882e-16    False
  6.0      4.722855213      4.722855213       -8.882e-16    False
  6.2      4.550261640      4.550261640       +0.000e+00    False
  6.4      4.379992755      4.379992755       -8.882e-16    False
  6.6      4.212329998      4.212329998       -8.882e-16    False
  6.8      4.047596706      4.047596706       +0.000e+00    False
  7.0      3.886164829      3.886164829       -4.441e-16    False
  7.2      3.728462531      3.728462531       +8.882e-16    False
  7.4      3.574982632      3.574982632       -4.441e-16    False
  7.6      3.425643072      3.425643072       +0.000e+00    False
  7.8      3.276941931      3.276941931       +0.000e+00    False
  8.0      3.128258770      3.128258770       -4.441e-16    False
  8.2      2.979594932      2.979594932       -8.882e-16    False
  8.4      2.830951895      2.830951895       +0.000e+00    False
  8.6      2.682331290      2.682331290       +0.000e+00    False
  8.8      2.533734925      2.533734925       -4.441e-16    False
  9.0      2.385164807      2.385164807       +0.000e+00    False
  9.2      2.236623170      2.236623170       -4.441e-16    False
  9.4      2.088112507      2.088112507       -1.332e-15    False
  9.6      1.939635614      1.939635614       -1.110e-15    False
  9.8      1.791195629      1.791195629       -4.441e-16    False
 10.0      1.642796092      1.642796092       +2.220e-16    False
 10.2      1.494441011      1.494441011       +2.220e-16    False
 10.4      1.346134937      1.346134937       +4.441e-16    False
 10.6      1.197883064      1.197883064       +2.220e-16    False
 10.8      1.049691346      1.049691346       -1.110e-15    False
 11.0      0.901566637      0.901566637       -9.992e-16    False
 11.2      0.753516869      0.753516869       -8.882e-16    False
 11.4      0.605551275      0.605551275       -2.220e-16    False
 11.6      0.457680661      0.457680661       +0.000e+00    False
 11.8      0.309917757      0.309917757       -5.551e-17    False
 12.0      0.162277660      0.162277660       +1.110e-16    False
 12.5      0.000000000      0.000000000       +0.000e+00    True
 13.0      0.000000000      0.000000000       +0.000e+00    True
 16.0      0.000000000      0.000000000       +0.000e+00    True
 20.0      0.000000000      0.000000000       +0.000e+00    True
 24.0      0.000000000      0.000000000       +0.000e+00    True
 26.0      0.000000000      0.000000000       +0.000e+00    True
 28.0      0.000000000      0.000000000       +0.000e+00    True
68 poses, largest |difference| = 1.776e-15 mm

Mutants

Command, run once for both prefixes from a fresh empty work directory:

mkdir -p runs/mut_cb && nice -n 10 .venv/bin/python scripts/mutation_check.py --workdir runs/mut_cb --only '^(PJ|AS)[0-9]+$' --python "$PWD/.venv/bin/python"

The harness copies the tree, checks that each edit matches exactly once, reads it back, clears bytecode, runs the mutant's scope under a time and address-space cap, restores the bytes and compares hashes, and runs a control before and after. Each mutant names its own scope. The 17 mutants whose guard only the real kernel exercises run one named test (path::test), the others run a whole fast test file.

  • 66 PJ mutants cover pose.py (28) and measure.py (38): the range checks (each end, each end inclusive), bool, overflow, non-finite, unknown part, assembly type, the prismatic and revolute dispatch, the signs and axes, the rotation about the axis through origin_mm, the order of deviation and motion, which part receives which transform, the overlap rule, the witness order, the result checks, the 10 s default, the placement encoding and order, the deadline, the timeout, crash and protocol branches, the child's reading of its solids and placements, the injected step and the order of the two solids.
  • 44 AS mutants cover assembly/types.py: joint kind, unit axis and its tolerance, finite, bool and text refusal, the width of a range, reversed range, revolute, prismatic and deviation bounds (each side), distinct requirement parts, positive minimum, requirement type, self-joint, unknown part (each of the five names), two-part minimum, requirement parts container, source text, assembly id, part id, names, unchecked storage of axis, direction, origin and range, read-only and copied parts mapping, frozen joint.
  • Nine AS mutants survived the existing tests/assembly/test_assembly_types.py alone (checked by running all 44 against that file only): AS03 and AS04 (width of the unit-vector tolerance), AS07 (a number written as text), AS08 (a range with one or three ends), AS17 (upper deviation bound), AS27 (first requirement part not looked up), AS30 (parts container that is not a mapping), AS32 (requirement parts that are not a tuple or a list) and AS34 (empty assembly id). tests/assembly/test_assembly_types_guards.py kills all nine.
  • Two guards have no mutant because removing them changes nothing observable: the isinstance(value, str) clause in _vector (a string of three characters fails in _number with the same label) and the first clause of the requirement-parts check (a string is also not a tuple or a list). The inherited CadWorker guards (a send to a dead child) have no test here either: that branch is a race between the kill and the write, and test_worker.py covers its twin.
control before: PASS (149 passed) scope=tests/assembly/test_assembly_measure_kernel.py::test_a_child_that_cannot_read_its_solids_says_so_on_every_query tests/assembly/test_assembly_measure_kernel.py::
AS01 KILLED    a joint kind outside the two known kinds is accepted :: tests/assembly/test_assembly_types.py::test_an_unknown_joint_kind_is_refused[fixed], tests/assembly/test_assembly_types.py::test_
AS02 KILLED    an axis or direction that is not a unit vector is accepted :: tests/assembly/test_assembly_types.py::test_a_non_unit_axis_is_refused[axis0], tests/assembly/test_assembly_types.py::test_
AS03 KILLED    the unit-vector tolerance is a thousand times wider :: tests/assembly/test_assembly_types_guards.py::test_the_unit_vector_tolerance_is_a_billionth
AS04 KILLED    the unit-vector tolerance is a thousand times narrower :: tests/assembly/test_assembly_types_guards.py::test_the_unit_vector_tolerance_is_a_billionth
AS05 KILLED    a NaN or an infinity is accepted as a number :: tests/assembly/test_assembly_types.py::test_a_non_finite_number_is_refused_everywhere[nan], tests/assembly/test_assembly_types.py::test_a
AS06 KILLED    a bool is accepted as a number :: tests/assembly/test_assembly_types.py::test_a_bool_is_not_a_number
AS07 KILLED    a number written as text is accepted :: tests/assembly/test_assembly_types_guards.py::test_a_number_written_as_text_is_refused
AS08 KILLED    a range with one or three ends is accepted :: tests/assembly/test_assembly_types_guards.py::test_a_range_needs_exactly_a_lower_and_an_upper_bound[bounds0], tests/assembly/test_assembly_
AS09 KILLED    a reversed range is accepted :: tests/assembly/test_assembly_types.py::test_a_reversed_range_is_refused
AS10 KILLED    a revolute range may reach two turns :: tests/assembly/test_assembly_types.py::test_a_revolute_range_beyond_one_turn_is_refused
AS11 KILLED    a prismatic range may reach twenty metres :: tests/assembly/test_assembly_types.py::test_a_prismatic_range_is_in_millimetres_and_bounded, tests/assembly/test_assembly_types_guards.py::t
AS12 KILLED    the lower joint bound is not checked :: tests/assembly/test_assembly_types.py::test_a_revolute_range_beyond_one_turn_is_refused, tests/assembly/test_assembly_types_guards.py::test_a_pri
AS13 KILLED    the upper joint bound is not checked :: tests/assembly/test_assembly_types.py::test_a_revolute_range_beyond_one_turn_is_refused, tests/assembly/test_assembly_types.py::test_a_prismatic_
AS14 KILLED    the revolute and prismatic bounds trade places :: tests/assembly/test_assembly_types.py::test_a_revolute_range_beyond_one_turn_is_refused, tests/assembly/test_assembly_types.py::test_a_
AS15 KILLED    a deviation range may reach two hundred millimetres :: tests/assembly/test_assembly_types.py::test_a_deviation_range_beyond_one_hundred_millimetres_is_refused, tests/assembly/test_assem
AS16 KILLED    the lower deviation bound is not checked :: tests/assembly/test_assembly_types.py::test_a_deviation_range_beyond_one_hundred_millimetres_is_refused, tests/assembly/test_assembly_types_g
AS17 KILLED    the upper deviation bound is not checked :: tests/assembly/test_assembly_types_guards.py::test_a_deviation_range_may_reach_one_hundred_millimetres_and_not_beyond
AS18 KILLED    a requirement may name one part twice :: tests/assembly/test_assembly_types.py::test_a_requirement_needs_two_distinct_parts_and_a_positive_minimum
AS19 KILLED    a requirement minimum of zero is accepted :: tests/assembly/test_assembly_types.py::test_a_requirement_needs_two_distinct_parts_and_a_positive_minimum
AS20 KILLED    a negative requirement minimum is accepted :: tests/assembly/test_assembly_types.py::test_a_requirement_needs_two_distinct_parts_and_a_positive_minimum
AS21 KILLED    an unknown requirement type is accepted :: tests/assembly/test_assembly_types.py::test_only_the_minimum_clearance_requirement_exists
AS22 KILLED    a joint may join a part to itself :: tests/assembly/test_assembly_types.py::test_a_joint_cannot_join_a_part_to_itself
AS23 KILLED    a name that is not a part is accepted :: tests/assembly/test_assembly_types.py::test_an_assembly_refuses_a_name_that_is_not_a_part, tests/assembly/test_assembly_types_guards.py::test_th
AS24 KILLED    the fixed part of the joint is not looked up :: tests/assembly/test_assembly_types.py::test_an_assembly_refuses_a_name_that_is_not_a_part
AS25 KILLED    the moving part of the joint is not looked up :: tests/assembly/test_assembly_types.py::test_an_assembly_refuses_a_name_that_is_not_a_part
AS26 KILLED    the deviation part is not looked up :: tests/assembly/test_assembly_types.py::test_an_assembly_refuses_a_name_that_is_not_a_part
AS27 KILLED    the first requirement part is not looked up :: tests/assembly/test_assembly_types_guards.py::test_the_first_requirement_part_must_belong_to_the_assembly
AS28 KILLED    the second requirement part is not looked up :: tests/assembly/test_assembly_types.py::test_an_assembly_refuses_a_name_that_is_not_a_part
AS29 KILLED    an assembly of one part is accepted :: tests/assembly/test_assembly_types.py::test_an_assembly_needs_at_least_two_parts
AS30 KILLED    a parts container that is not a mapping is accepted :: tests/assembly/test_assembly_types_guards.py::test_the_parts_must_be_a_mapping[None], tests/assembly/test_assembly_types_guards.py
AS31 KILLED    a requirement with one or three parts is accepted :: tests/assembly/test_assembly_types.py::test_a_requirement_needs_two_distinct_parts_and_a_positive_minimum
AS32 KILLED    requirement parts that are not a tuple or a list are accepted :: tests/assembly/test_assembly_types_guards.py::test_requirement_parts_must_be_a_tuple_or_a_list_of_two_names[None], tests
AS33 KILLED    the source text may be empty :: tests/assembly/test_assembly_types.py::test_the_source_text_is_required, tests/assembly/test_assembly_types_guards.py::test_the_source_must_be_text[No
AS34 KILLED    the assembly id may be empty :: tests/assembly/test_assembly_types_guards.py::test_the_assembly_id_must_be_non_empty_text[], tests/assembly/test_assembly_types_guards.py::test_the_as
AS35 KILLED    a part id may be empty or not text :: tests/assembly/test_assembly_types.py::test_a_part_id_must_be_non_empty_text, tests/assembly/test_assembly_types_guards.py::test_a_part_id_that_is_
AS36 KILLED    an empty name is accepted :: tests/assembly/test_assembly_types.py::test_ids_must_be_non_empty_text[], tests/assembly/test_assembly_types.py::test_a_part_id_must_be_non_empty_text
AS37 KILLED    a name that is not text is accepted :: tests/assembly/test_assembly_types.py::test_ids_must_be_non_empty_text[3], tests/assembly/test_assembly_types_guards.py::test_a_requirement_part_n
AS38 KILLED    the joint axis is stored without a check :: tests/assembly/test_assembly_types.py::test_a_non_unit_axis_is_refused[axis0], tests/assembly/test_assembly_types.py::test_a_non_unit_axis_is
AS39 KILLED    the deviation direction is stored without a check :: tests/assembly/test_assembly_types.py::test_a_deviation_direction_must_be_a_unit_vector, tests/assembly/test_assembly_types_guards.p
AS40 KILLED    the joint origin is stored without a check :: tests/assembly/test_assembly_types.py::test_a_non_finite_number_is_refused_everywhere[nan], tests/assembly/test_assembly_types.py::test_a_n
AS41 KILLED    the joint range is stored without a check :: tests/assembly/test_assembly_types.py::test_a_non_finite_number_is_refused_everywhere[nan], tests/assembly/test_assembly_types.py::test_a_no
AS42 KILLED    the parts mapping can be edited after construction :: tests/assembly/test_assembly_types.py::test_the_parts_mapping_is_read_only
AS43 KILLED    the caller keeps a handle on the parts mapping :: tests/assembly/test_assembly_types.py::test_the_caller_dict_is_copied_not_shared
AS44 KILLED    a joint can be edited after construction :: tests/assembly/test_assembly_types.py::test_the_value_types_are_frozen
PJ01 KILLED    a bool passes for q or delta :: tests/assembly/test_assembly_pose.py::test_a_value_that_is_not_a_plain_number_is_refused[True], tests/assembly/test_assembly_pose.py::test_a_value_tha
PJ02 KILLED    an integer too large for a float escapes as OverflowError :: tests/assembly/test_assembly_pose.py::test_a_value_that_is_not_a_plain_number_is_refused[10000000000000000000000000000000000
PJ03 KILLED    a non-finite q or delta reaches the range check unannounced :: tests/assembly/test_assembly_pose.py::test_a_non_finite_value_is_refused[nan], tests/assembly/test_assembly_pose.py::test_
PJ04 KILLED    the lower end of the range is not checked :: tests/assembly/test_assembly_pose.py::test_a_joint_coordinate_outside_the_range_is_refused_not_clamped[-30.0001], tests/assembly/test_assemb
PJ05 KILLED    the upper end of the range is not checked :: tests/assembly/test_assembly_pose.py::test_a_joint_coordinate_outside_the_range_is_refused_not_clamped[60.0001], tests/assembly/test_assembl
PJ06 KILLED    the lower end of the range is refused :: tests/assembly/test_assembly_pose.py::test_the_ends_of_the_ranges_are_accepted
PJ07 KILLED    the upper end of the range is refused :: tests/assembly/test_assembly_pose.py::test_the_ends_of_the_ranges_are_accepted
PJ08 KILLED    an object that is not an assembly is placed :: tests/assembly/test_assembly_pose.py::test_something_that_is_not_an_assembly_is_refused
PJ09 KILLED    revolute and prismatic placement trade places :: tests/assembly/test_assembly_pose.py::test_a_revolute_joint_turns_the_moving_part_about_an_axis_through_the_origin, tests/assembly/test_
PJ10 KILLED    a prismatic joint slides the wrong way :: tests/assembly/test_assembly_pose.py::test_a_prismatic_joint_slides_the_moving_part_along_its_axis, tests/assembly/test_assembly_pose.py::test_
PJ11 KILLED    the prismatic z slide uses the x axis :: tests/assembly/test_assembly_pose.py::test_a_prismatic_joint_slides_the_moving_part_along_its_axis, tests/assembly/test_assembly_pose.py::test_a
PJ12 KILLED    a revolute joint turns the wrong way :: tests/assembly/test_assembly_pose.py::test_a_revolute_joint_turns_the_moving_part_about_an_axis_through_the_origin, tests/assembly/test_assembly_
PJ13 KILLED    a revolute joint always turns about z :: tests/assembly/test_assembly_pose.py::test_a_revolute_axis_along_x_through_an_offset_origin, tests/assembly/test_assembly_pose.py::test_a_revolu
PJ14 KILLED    a revolute axis always passes through the origin :: tests/assembly/test_assembly_pose.py::test_a_revolute_axis_that_misses_the_origin_turns_the_part_about_its_own_line, tests/assembly/t
PJ15 KILLED    the part is carried back to the axis with the wrong sign :: tests/assembly/test_assembly_pose.py::test_a_revolute_axis_that_misses_the_origin_turns_the_part_about_its_own_line, tests/as
PJ16 KILLED    a deviation loses its z component :: tests/assembly/test_assembly_pose.py::test_a_deviation_moves_the_named_part_along_an_off_axis_direction
PJ17 KILLED    a deviation moves the wrong way :: tests/assembly/test_assembly_pose.py::test_a_deviation_moves_the_named_part_along_an_off_axis_direction, tests/assembly/test_assembly_pose.py::test_th
PJ18 KILLED    the joint motion comes before the deviation :: tests/assembly/test_assembly_pose.py::test_a_deviation_on_the_moving_part_comes_first_and_the_joint_motion_second, tests/assembly/test_ass
PJ19 KILLED    every part but the moving one follows the joint :: tests/assembly/test_assembly_pose.py::test_a_revolute_joint_turns_the_moving_part_about_an_axis_through_the_origin, tests/assembly/tes
PJ20 KILLED    every part follows the joint :: tests/assembly/test_assembly_pose.py::test_the_deviation_direction_is_in_the_world_frame, tests/assembly/test_assembly_pose.py::test_the_fixed_part_is
PJ21 KILLED    every part receives the deviation :: tests/assembly/test_assembly_pose.py::test_a_part_without_a_deviation_stays_where_it_is, tests/assembly/test_assembly_pose.py::test_the_placements_c
PJ22 KILLED    the deviation lands on the fixed part, not the named one :: tests/assembly/test_assembly_pose.py::test_a_deviation_on_the_moving_part_comes_first_and_the_joint_motion_second, tests/asse
PJ23 KILLED    a part that is not in the assembly is placed :: tests/assembly/test_assembly_pose.py::test_an_unknown_part_is_refused[ghost], tests/assembly/test_assembly_pose.py::test_an_unknown_part_
PJ24 KILLED    an unhashable part name escapes as TypeError :: tests/assembly/test_assembly_pose.py::test_an_unknown_part_is_refused[name4]
PJ25 KILLED    q and delta are checked against each other's range :: tests/assembly/test_assembly_pose.py::test_a_revolute_joint_turns_the_moving_part_about_an_axis_through_the_origin, tests/assembly/
PJ26 KILLED    the deviation is dropped from the placement :: tests/assembly/test_assembly_pose.py::test_a_deviation_moves_the_named_part_along_an_off_axis_direction, tests/assembly/test_assembly_pose
PJ27 KILLED    q and delta trade places in the placement :: tests/assembly/test_assembly_pose.py::test_a_revolute_joint_turns_the_moving_part_about_an_axis_through_the_origin, tests/assembly/test_asse
PJ28 KILLED    the placements cover one part only :: tests/assembly/test_assembly_pose.py::test_the_placements_cover_every_part
PJ29 KILLED    a solid inside another is not an overlap :: tests/assembly/test_assembly_measure_result.py::test_the_inclusion_flag_is_an_overlap_and_reports_distance_zero
PJ30 KILLED    a distance of zero is not an overlap :: tests/assembly/test_assembly_measure_result.py::test_a_zero_distance_is_an_overlap
PJ31 KILLED    an overlap keeps the shell distance of the kernel :: tests/assembly/test_assembly_measure_result.py::test_the_inclusion_flag_is_an_overlap_and_reports_distance_zero
PJ32 KILLED    the witness points trade places :: tests/assembly/test_assembly_measure_result.py::test_a_gap_keeps_the_kernel_distance_and_the_witness_points
PJ33 KILLED    the result names the parts in reverse order :: tests/assembly/test_assembly_measure_result.py::test_the_result_names_the_requirement_parts_in_order_and_the_pose
PJ34 KILLED    a result with a NaN distance is accepted :: tests/assembly/test_assembly_measure_result.py::test_a_result_with_an_implausible_field_is_refused[change1], tests/assembly/test_assembly_mea
PJ35 KILLED    a result with a negative distance is accepted :: tests/assembly/test_assembly_measure_result.py::test_a_result_with_an_implausible_field_is_refused[change0]
PJ36 KILLED    a result may contradict its own overlap flag :: tests/assembly/test_assembly_measure_result.py::test_a_result_that_contradicts_itself_is_refused
PJ37 KILLED    a witness point with a NaN is accepted :: tests/assembly/test_assembly_measure_result.py::test_a_result_with_an_implausible_field_is_refused[change8]
PJ38 KILLED    a witness point with two coordinates is accepted :: tests/assembly/test_assembly_measure_result.py::test_a_result_with_an_implausible_field_is_refused[change7]
PJ39 KILLED    the default deadline is a hundred seconds :: tests/assembly/test_assembly_measure_runner.py::test_the_default_deadline_is_ten_seconds
PJ40 KILLED    the placement is sent rotation first :: tests/assembly/test_assembly_measure_runner.py::test_both_placements_reach_the_child_in_the_order_first_then_second, tests/assembly/test_assembly
PJ41 KILLED    a query waits for the start-up time, not the deadline :: tests/assembly/test_assembly_measure_runner.py::test_a_hanging_query_is_killed_at_the_deadline_and_reported_as_a_timeout
PJ42 KILLED    a timeout is read as an empty reply :: tests/assembly/test_assembly_measure_runner.py::test_a_hanging_query_is_killed_at_the_deadline_and_reported_as_a_timeout, tests/assembly/test_asse
PJ43 KILLED    a crash is read as an empty reply :: tests/assembly/test_assembly_measure_runner.py::test_a_crash_is_an_error_not_a_measurement
PJ44 KILLED    an oversized reply is read as a normal one :: tests/assembly/test_assembly_measure_runner.py::test_an_oversized_reply_is_a_protocol_error_and_the_worker_is_replaced
PJ45 KILLED    a child that sent a bad reply is kept :: tests/assembly/test_assembly_measure_runner.py::test_a_garbled_reply_is_a_protocol_error_and_the_worker_is_replaced, tests/assembly/test_assembl
PJ46 KILLED    a child whose reply raised while it was read is kept :: tests/assembly/test_assembly_measure_runner.py::test_a_reply_that_breaks_the_reader_is_a_protocol_error_and_the_worker_is_replace
PJ47 KILLED    a placement that is not a Transform is sent :: tests/assembly/test_assembly_measure_runner.py::test_a_query_that_is_not_a_pair_of_transforms_is_refused_before_a_process_starts
PJ48 KILLED    a closed worker answers queries :: tests/assembly/test_assembly_measure_runner.py::test_a_closed_worker_refuses_queries
PJ49 KILLED    a quarantined slot answers queries :: tests/assembly/test_assembly_measure_runner.py::test_a_quarantined_slot_refuses_queries
PJ50 KILLED    the limits the caller passes are ignored :: tests/assembly/test_assembly_measure_kernel.py::test_a_hang_is_killed_a_failing_step_is_reported_and_the_next_query_recovers
PJ51 KILLED    a part that is not a CAD solid is serialized :: tests/assembly/test_assembly_measure_kernel.py::test_a_part_that_is_not_a_cad_solid_is_refused_before_a_process_starts
PJ52 KILLED    an empty solid is sent to the child :: tests/assembly/test_assembly_measure_kernel.py::test_an_empty_part_is_refused_before_a_process_starts
PJ53 KILLED    a BREP that holds nothing is read as a solid :: tests/assembly/test_assembly_measure_kernel.py::test_a_child_that_cannot_read_its_solids_says_so_on_every_query
PJ54 KILLED    the child swaps the x and y of a translation :: tests/assembly/test_assembly_measure_kernel.py::test_a_quarter_turn_about_an_axis_that_misses_the_origin
PJ55 KILLED    the child reads the quaternion in the wrong order :: tests/assembly/test_assembly_measure_kernel.py::test_a_quarter_turn_about_an_axis_that_misses_the_origin
PJ56 KILLED    the child accepts a placement of the wrong length :: tests/assembly/test_assembly_measure_kernel.py::test_a_malformed_placement_is_refused_by_the_child
PJ57 KILLED    a malformed placement kills the request instead of being refused :: tests/assembly/test_assembly_measure_kernel.py::test_a_malformed_placement_is_refused_by_the_child
PJ58 KILLED    the child places the first solid with the second placement :: tests/assembly/test_assembly_measure_kernel.py::test_a_quarter_turn_about_an_axis_that_misses_the_origin
PJ59 KILLED    the child leaves the second solid unplaced :: tests/assembly/test_assembly_measure_kernel.py::test_a_deviation_along_an_off_axis_direction_matches_the_closed_form
PJ60 KILLED    the injected step is never called :: tests/assembly/test_assembly_measure_kernel.py::test_a_hang_is_killed_a_failing_step_is_reported_and_the_next_query_recovers
PJ61 KILLED    the injected step is not passed to the child :: tests/assembly/test_assembly_measure_kernel.py::test_a_hang_is_killed_a_failing_step_is_reported_and_the_next_query_recovers
PJ62 KILLED    the two solids are sent in swapped order :: tests/assembly/test_assembly_measure_kernel.py::test_a_quarter_turn_about_an_axis_that_misses_the_origin
PJ63 KILLED    the first solid is placed as the second part :: tests/assembly/test_assembly_measure_kernel.py::test_a_quarter_turn_about_an_axis_that_misses_the_origin
PJ64 KILLED    the two placements are sent in swapped order :: tests/assembly/test_assembly_measure_kernel.py::test_a_quarter_turn_about_an_axis_that_misses_the_origin
PJ65 KILLED    the result records delta as q and q as delta :: tests/assembly/test_assembly_measure_pin.py::test_the_headline_pose_matches_the_existing_measurement
PJ66 KILLED    an object that is not an assembly is measured :: tests/assembly/test_assembly_measure_kernel.py::test_something_that_is_not_an_assembly_is_refused
control after: PASS (149 passed)
mutants: 110  KILLED=110  SURVIVED=0  CAPPED=0  INVALID=0  BROKEN=0
RESULT: every mutant killed, controls clean

Gates

$ nice -n 10 bash scripts/check-fast.sh
== ruff check ==
All checks passed!
== ruff format --check ==
156 files already formatted
== mypy --strict (src) ==
Success: no issues found in 40 source files
== pytest -m 'not native and not agents' ==
1773 passed, 272 deselected in 181.41s (0:03:01)
OK check-fast: 1773 tests passed, no native query issued
rc=0

$ GEOMETRY_TIMEOUT_S=2400 nice -n 10 bash scripts/check-geometry.sh
== pytest -m native ==
230 passed, 1815 deselected in 595.94s (0:09:55)
OK check-geometry: 230 native tests passed
rc=0

$ nice -n 10 bash scripts/check-agents.sh
== pytest -m agents ==
411 passed, 2003 deselected in 191.98s (0:03:11)
OK check-agents: 411 tests passed; all 2414 collected tests belong to a gate
rc=0

Observed counts for the integrator: fast 1773 (floor 1633), geometry 230 (floor 198), agents 411 (floor 411). No floor was edited. The 105 fast and 32 native tests added here are included, and the sum 1773 + 230 + 411 = 2414 equals the collected total, so every new test belongs to one gate.

Two earlier runs did not go as the plain command would, and are recorded here:

  • check-fast.sh under nice -n 10 failed twice earlier on one test of tests/test_kiro_hooks_prompt_facts.py that spawns a hook with a one-second timeout (test_the_wrapper_finishes_within_one_second_and_never_blocks in one run, test_the_module_entrypoint_prints_nothing_and_exits_zero_outside_git in the other). That file alone failed in 2 of 3 runs under nice -n 10 and passed 3 of 3 without it, and it does not import this work. The last run of the gate, reported above, used nice -n 10 as written and passed once the machine was less loaded.
  • check-geometry.sh ran with GEOMETRY_TIMEOUT_S=2400 and took 604 s. An earlier run, when the new native tests started 15 child processes instead of the 11 they start now, hit the 900 s default at 92 percent of the tests. The native tests were then merged to start fewer children.

Limits and what is deferred

  • The result is as exact as the kernel. The closed forms cover products of a plane figure and an interval (boxes and cylinders with axis along z). No second kernel and no non-convex solid were compared.
  • The parent still holds the caller's solids, because Assembly.parts holds them by contract. The claim is that a query creates, moves and measures nothing in the parent.
  • A child needs the build123d import before it answers (6 to 8 s measured here under load), so one PoseMeter should serve a whole search. A new child starts after each failure.
  • PoseMeter sends the BREP of the solids once. Changing a solid after the meter exists has no effect on it.
  • Not done, by scope: the sidecar and STEP import (#50), generated families (#52), the CLI and the search pipeline (#53). No hook was added to cli.py, and pyproject.toml, uv.lock, motion.py, worker.py, docs/progress.md and docs/KIRO_USAGE.md are unchanged. scripts/mutation_check.py gained the 110 mutants at the end of MUTANTS.