Assembly families: evidence log (issue 52)
This log records what ran, where it ran and what it printed for assembly.families and
assembly.references. The numbers in docs/assembly-families.md come from the runs below.
What was built
src/tolerance_arena/assembly/families.py: the three familieshinged-flap-post,sliding-block-postandlever-stop, each with an id, version 1, named parameters with unit suffixes and closed bounds,build,reference_distance,joint_range,deviation_rangeandplanted.src/tolerance_arena/assembly/references.py: the closed forms. It importsmathandcollections.abconly.tests/assembly/test_assembly_references.py(60 tests, no kernel),tests/assembly/test_assembly_families.py(122 tests, no kernel) andtests/assembly/test_assembly_families_native.py(28 tests, markernative): 210 tests.docs/assembly-families.mdand the FY01 to FY84 mutants inscripts/mutation_check.py(appended after CM17, nothing else in that file changed).
Baseline: commit 7fe0eba on main of the scratch clone. The tested tree is commit 5d665ed. The
machine ran with a load average between 33 and 50 on 12 cores during every run below, which
matters for the timing failures in the gate section.
Test first
The tests were written before the code and run to see them fail.
nice -n 10 .venv/bin/python -m pytest -q -p no:cacheprovider tests/assembly/test_assembly_references.pyprintedImportError: cannot import name 'references' from 'tolerance_arena.assembly'and1 error. Afterreferences.pyexisted the same command printed51 passed in 0.43s.- The same command on
tests/assembly/test_assembly_families.pyprintedImportError: cannot import name 'families' from 'tolerance_arena.assembly'. Afterfamilies.pyexisted it printed4 failed, 113 passed; the four failures were the document tests withFileNotFoundError: ... docs/assembly-families.md. They passed once the document existed. - The first native run of the 200-pose test failed with
assert 5 >= 8on the overlapping poses (the test helper produced too few). A later run failed withFamilyError: q must lie between 0 and 118.463 deg, got 118.462578675126: the helper computed the last joint position aslow + (high - low) * k / steps, which rounds one unit in the last place above the bound. The code refused it as designed, and the helper now ends the scan athighexactly. Both were defects of the test, found by the code refusing or the count failing.
Kernel against reference on at least 200 poses
Command: nice -n 10 .venv/bin/python -m pytest -q -p no:cacheprovider -s tests/assembly/test_assembly_families_native.py -k "equals_the_reference or kernel_reads or contact_level or both_range". Result: 15 passed, 13 deselected in 42.81s. The test places the
solids with a local helper that follows the rule in assembly/types.py using Location and
Shape.rotate, and measures with native.measure_distance. It does not import assembly/pose.py
or assembly/measure.py.
Per family, the test printed:
hinged-flap-post: 226 poses, 24 within 0.05 mm of contact, 15 overlapping; largest |kernel - reference| = 1.776e-14 mm at overlap q=42.2317 delta=-1.2
sliding-block-post: 218 poses, 18 within 0.05 mm of contact, 12 overlapping; largest |kernel - reference| = 1.421e-14 mm at random q=76.5127 delta=0.0778363
lever-stop: 226 poses, 26 within 0.05 mm of contact, 26 overlapping; largest |kernel - reference| = 2.132e-14 mm at grid q=11.3211 delta=0.866574
The poses of one family are:
- the planted configuration on a grid of 17 joint positions (both range ends included) by five deviations (both range ends, their halves and 0);
- a configuration where the moving part reaches the fixed part (
flap_length_mm48,post_y_mm5 andlever_length_mm44) on 9 joint positions by the same five deviations; - for each of the five deviations, the joint positions where the reference equals 1e-9, 0.005 and 0.05 mm, found by bisection (the 1e-9 level is the touching position, and the poses 0.01 beside it that overlap are included);
- four configurations with every parameter drawn uniformly inside its bounds (seed 20261202), each with both joint range ends at the five deviations and four random poses.
A pose counts as next to contact when 0 < reference <= 0.05 mm. The test asserts at least 200 poses,
at least 8 next to contact and at least 8 overlapping, then asserts
abs(kernel - reference) <= 1e-6 on every pose. A separate test asserts that the grid holds the
corner pairs (both joint ends with both deviation ends) and that every contact level is present.
Planted pose
The same run printed the four-point grid and the interior pose at the adverse deviation -1.2 mm. The requirement is 1.5 mm.
hinged-flap-post: requirement 1.5 mm, delta -1.2 mm
q reference kernel
0 29.000000 29.000000
30 9.373523 9.373523
60 7.807108 7.807108
90 27.800000 27.800000
45 0.906306 0.906306
sliding-block-post: requirement 1.5 mm, delta -1.2 mm
q reference kernel
0 52.094732 52.094732
40 12.361058 12.361058
80 12.361058 12.361058
120 52.094732 52.094732
60 1.200000 1.200000
lever-stop: requirement 1.5 mm, delta -1.2 mm
q reference kernel
0 23.667976 23.667976
30 4.037953 4.037953
60 4.037953 4.037953
90 23.667976 23.667976
45 1.300000 1.300000
In each family the grid reads at or above 1.5 mm and the interior pose reads below it, by the kernel and by the reference. The tests also show that the nominal deviation passes everywhere on a 900-step sweep, so the deviation causes each violation, and that the violation window holds no grid point (flap 42.1 to 50.1 degrees, block 52.6 to 67.4 mm, lever 35.7 to 54.3 degrees).
Mutants
Command: mkdir -p runs/mut_cc && nice -n 10 .venv/bin/python scripts/mutation_check.py --workdir runs/mut_cc --only 'FY[0-9]+' --python "$PWD/.venv/bin/python" in a fresh empty work directory.
Output, last lines:
control before: PASS (210 passed) scope=tests/assembly/test_assembly_families.py tests/assembly/test_assembly_families_native.py tests/assembly/test_assembly_references.py
control after: PASS (210 passed)
mutants: 84 KILLED=84 SURVIVED=0 CAPPED=0 INVALID=0 BROKEN=0
RESULT: every mutant killed, controls clean
Before the run, a script confirmed that the old text of each of the 84 FY mutants matches
exactly once in its file and differs from new. The harness reads each edit back and compares the
restored file hash, and it printed no INVALID or BROKEN row. The duplicate check
/usr/bin/grep -oE '^ "[A-Z]+[0-9]+",$' scripts/mutation_check.py | sort | uniq -d
printed nothing, and 84 lines match "FY[0-9]+".
The mutants fall in three groups, each killed by the test named in the harness row:
- FY01 to FY26 (
families.py, killed intest_assembly_families.py): the family lookup, the number checks (boolean, integer, NaN), both bounds and their edges, a clamp in place of a refusal, unknown, missing and non-mapping parameters, the joint and deviation ranges of the reference, the planted adverse sign, grid, interior pose and requirement, the unit suffix andbuildskipping the check. - FY27 to FY51 (
families.py, killed intest_assembly_families_native.py): what each family builds: ranges, requirement, parts, axes, deviation directions, box and post placement, the stop angle and normal. For FY39, FY43 and FY45 (the flap post x and y swapped, the stop depth and width swapped, the stop turned the wrong way) the first failing test is the 200-pose test, not a contract test, because the planted values hide them from the contract tests (the planted post sits at 32 and 32, and the stop turns by 45 degrees). - FY52 to FY84 (
references.py, killed intest_assembly_references.py): the input checks, the point to box and point to segment distances, the crossing test, containment, rotation, each family's signs and dimensions, and the clamp at zero.
Mutants that were considered and left out because no test can tell them from the original: the
sign of the stop tangent (the stop is symmetric about its normal), and the >= 0.0 edge of the
containment test (a corner on the boundary is at distance 0 from the outline anyway). The collinear
and endpoint terms of the segment crossing test were removed from the code instead of mutated, for
the same reason: point_segment_distance_mm finds a touching end.
Gates
All three gates ran on the same tree, commit 5d665ed, with nice -n 10.
OK check-fast: 1850 tests passed, no native query issued
OK check-geometry: 226 native tests passed
OK check-agents: 411 tests passed; all 2487 collected tests belong to a gate
The floors in the scripts are 1633, 198 and 411 and none was changed. My 210 tests add 182 to the fast gate and 28 to the geometry gate, and none to the agents gate. The geometry gate counted 198 plus 28 = 226 native tests.
Two earlier gate runs failed in tests that measure wall-clock time, while the load average was between 36 and 50:
- First
check-fast.shrun:2 failed, 1848 passed, both intests/test_kiro_hooks_prompt_facts.py(subprocess.TimeoutExpired: ... timed out after 1 secondstwice). Second run:1 failed, 1849 passed,test_the_wrapper_finishes_within_one_second_and_never_blocks. Third run:1850 passed, exit 0. - First
check-agents.shrun:1 failed, 410 passed,tests/agents/test_analyst.py::test_the_deadline_counts_the_time_the_phase_already_usedwithassert (154630.942868591 - 154630.62787638) < 0.25. Second run:411 passed, exit 0.
None of those tests imports assembly.families or assembly.references. The one-second wrapper
test failed in two of the three full fast-gate runs on this tree and passed in the third. Run
alone it failed once with a measured 1.0197 s against the 1 s limit, and on the pristine baseline
tree (git archive 7fe0eba) it passed in four of four isolated runs. This log does not show that
the baseline fails it in a full run under the same load. It shows that the failures came with a
load average above 36 and that the third full run was green.
Decisions and limits
- The requirement is a parameter (
minimum_mm, 0.1 to 10), sobuild(family_id, params)needs no third argument.plantedreturns it with the parameters. - The adverse deviation is the lower end of the deviation range in all three families: the post moves toward the flap (x), toward the block's path (y), and the stop moves toward the pivot along its normal.
flap_width_mmis the extent along the hinge axis and the common height of both solids. The other two families name that heightheight_mm.FamilyErrorsubclassesAssemblyError, so oneexceptcovers every contract refusal.- The reference is planar and models extruded solids of one common height. The kernel agreement is a measurement on 218 to 226 poses per family and four random parameter draws, not a proof for all parameters.
docs/progress.md,docs/KIRO_USAGE.mdand everyMIN_TESTSfloor are untouched. The steering file.kiro/steering/testing.mdstill lists the floors 751, 161 and 332; the scripts hold the current ones.- Scratch outputs are in
runs/of the clone (ignored by git):runs/mut_cc_run1.log,runs/gate_fast.log,runs/gate_geometry.log,runs/gate_agents.logandruns/pose_evidence.log.