Skip to content

STABILIZE group C: the run record against the logs it was made from

Written 2026-12-04. Scripts: scripts/stabilize/check_c.py and the C plants in scripts/stabilize/plant.py. Data: the 730 imported runs under /work/microduck-nav-runs/r6. The statements are STABILIZE.md, C; A and B are in STABILIZE-AB.md.

How the checks stay independent

As for A and B: the checks read ticks.jsonl (the navigator's own log), truth.jsonl (the simulator's), result.json and the .mcap record through runfile.mcapio.read only. No labrunner, duck_lab or observatory code.

nice apps/observatory/.venv/bin/python scripts/stabilize/check_c.py [--only PREFIX] [--json F]
nice apps/observatory/.venv/bin/python scripts/stabilize/plant.py --only C

Each record tick is paired with the navigator's tick by content, not by time: its belief is the pose of a ticks.jsonl row (to 0.1 mm), taken in order. A tick the record moved in time is still found, and the move is measured. A first version paired by time; it paired a moved tick with its neighbour and reported the wrong thing.

Results

Statement Result Counts Evidence
C1 a record tick's truth is a truth.jsonl row, one of the two around the navigator's tick (by its wall time) HOLDS 175 runs tested, 0 violations; 555 runs skipped (their truth.jsonl has no t) Navigator tick wall time less its truth row's: 87,770 ticks, median 1.8 ms, range -94.6 to +82.3 ms
C1u a record tick has no truth only where truth.jsonl has no row within 0.1 s BROKEN (1 run, 5 ticks) 175 runs tested item7-slow/ch1-s4/run-20261203-222821, the run slowed on purpose for A5 (rtf 0.92, no verdict). See C1u below
C2 every navigator tick is in the record, none added, each at the navigator's own t BROKEN (97 of 730 runs) 386,654 ticks; 0 missing, 0 added; 162 moved later, 0 moved earlier See C2 below
C3h a harness alert's true place is truth.jsonl at its truth time HOLDS 17 alerts, 0 violations Only proximity alerts carry a true place (see not covered)
C3n a navigator event is in the record at the navigator's t, with the pose it wrote BROKEN (10 events in 10 runs) 32,986 events matched to their ticks.jsonl rows, none unmatched All 10 moved later, pose unchanged; the same cause as C2

C2: the record moves late ticks forward in time

162 ticks in 97 runs are in the record later than the navigator wrote them:

Moved by Ticks
2.5 to 20 ms 87
20 to 100 ms 56
100 to 500 ms 14
over 0.5 s 5

Largest: 1.65 s (minilab-eb/off/ch28-s5/run-20261201-195435, navigator t 36.275 s), 0.918 s (baseline-floor-loaded/rep1/ch30-s308/run-20261203-172912), 0.665 s, 0.640 s, 0.561 s. The same 10 times for events: plan_kept, pace, replan_new_obstacle, 3 to 239 ms. No tick or event moved earlier, none lost, none invented, and each kept its pose.

The cause, from the records. The duck's run log (robots/duck/src/duck_lab/nav/runlog.py) is written by three threads under one lock: the navigator's rows (ticks and events), the depth frames and the signals. DuckLog._time (libs/runfile/src/runfile/adapters/duck.py) never lets time go back: t = max(_r(ts + self.offset), self.last_t). When a depth frame or a signals record with a later source time is written first, the navigator's row that comes after it is written at the frame's time. For 147 of the moved ticks (the first 4 per run), the other record at the moved tick's record time is a depth frame (72) or a signals record (75); for the 1.65 s move it is a signals record at 37.925 s.

What a moved tick does downstream: the Observatory draws the believed pose that much later; the truth paired with it is still right (the truth is paired by the tick's wall time, C1 holds); a clearance or tightest point computed on the record's time puts the believed side late by the same amount.

Not looked at: why the navigator's row reaches the writer up to 1.65 s after a frame or signals record with a later time.

Fixed 2026-12-04 (the operator chose a hold in the run log over re-timing at compaction or in the readers). RunLog holds each record 2 s (HOLD_S) on the navigator's clock and writes what it holds in time order, so a row that comes up to 2 s after a later frame or state keeps its own time; the live page is 2 s behind. A record later than that is written at once where the writer has got to, as before, and DuckLog.moved counts it (said on stderr when the run closes). test_replay.py has a row 0.2 s behind a frame and a state, and one behind what was written; the three checks fail with HOLD_S = 0. Four live runs with the hold (c2-hold: ch30-s308, ch28-s5, ch31-s304, ch29-s301; rtf 1.0): C1, C1u, C2 and C3n hold, 179 events. The old code moved ticks in 13 % of runs, so four runs do not show the hold at work; the test does. It also cures C1u on the one slowed run repeated with it (c1u-hold/ch1-s4, the same 0.3 s pauses every 2 s, rtf 0.92): 13 ticks have no truth and none of them has a truth.jsonl row within 0.1 s; C1u holds (5 of 18 failed it before). The truth copy reads a tick up to 2 s later, by when the sample after it has come.

C1u: the live truth copy does not wait for a later sample

In the slowed run the simulator pauses about every 2 s: truth.jsonl has a 343 ms gap there. For 5 ticks the row before is 246 to 258 ms away and the row after 85 to 95 ms away, inside the 0.1 s (MAX_GAP_NS) the copy accepts. The record has no truth on them. By reading libs/runfile/src/runfile/truthcopy.py (_pair): a tick is paired when it is copied, against the truth samples that have arrived by then, and is not revisited, so a sample that arrives after the tick is never considered. Not reproduced by a test. C1u holds on the other 174 runs; this run is the only one whose simulator stalls on purpose. The run's own truth_copy counts 18 unpaired; the other 13 have no row within 0.1 s at all.

Info: the navigator's event poses and its own tick path

Not a record finding, reported because the first version of C3n flagged it: of 30,253 navigator events with a pose, 97 lie more than 1 cm from the navigator's own tick path around their time (median 0, max 7.1 cm). The record has the pose the navigator wrote (C3n); whether the navigator's event pose and tick pose should agree is the navigator's matter.

Planted errors: each check can fail

The C plants in plant.py rewrite a copy of a real run's record (read with keep_raw, so raw and t_src survive) and run all the A, B and C checks on the control and the planted copy. Full run with the A and B plants: 43 of 43 caught, MISSED 0, EXIT=0.

Check Planted error Caught
C1 a tick's truth moved 5 mm (no longer a row); a tick's truth replaced by the truth of the tick 20 later (a real row, 488 ms away) both
C1u a tick's truth removed where truth.jsonl has a row 11.5 ms away yes
C2 a tick 30 ms late; a tick deleted; a tick the navigator never wrote, 1 cm beside a real one all 3
C3h the alert's true place moved 5 cm yes
C3n an event 50 ms late; an event's pose moved 1 cm both

Not covered

  • 555 of 730 runs have no t in truth.jsonl, so C1, C1u and C3h apply to 175 runs. C2 and C3n apply to all 730.
  • Contact events. Only one record has one (item6-touch/ch31-s304-probe-4d212a); it carries the touch point (deep_pos) and its time, not the trunk's place, so C3h does not apply. A first version of check_c.py had a contact branch looking for a truth field no contact event has; it never ran and is removed. Touches are B1's.
  • Ticks standing still. Pairing by pose cannot tell two consecutive identical poses apart; a move between them is invisible to C2.
  • Events without a pose are checked for time only. Events are matched by kind (an anomaly by its name) in order, within 50 rows; a wrong match between two events of one kind close together would go unseen.
  • The other record kinds (plans, the world, objects, sightings, depth frames, signals) are not compared with the logs. Signals carry no source time (t_src), so a moved signals record cannot be seen at all.
  • Only the simulator's duck. No NXT run, no real robot.
  • The navigator's log is taken as the truth of what it believed. If the navigator logs a pose it did not act on, nothing here sees it.