Keep replay transitions through the SAM pose decimation (#142)
build / mod (push) Failing after 36s

Sampling slowed by the pose budget skipped whole short stages: the six-tick
tube cover opening, the ejection and the radar switch fell between samples,
and thinning then halved already recorded transitions along with poses.

Poses still share the adaptive sam_step grid and the unchanged 32768-key
budget, but the recording is now sampled every tick for facts: a discrete
change (spent_cells, cap_cell, radar_on, mode, role) and every frame of the
cover's own movement are kept on the tick they happen, with the stage's start
backdated one tick so the opening still spans exactly OPEN_TICKS. These keys
carry an event mark and decimation halves poses only, keeping events, the
first and the last key.

Events get their own explicit 4096-key budget instead of raising the pose
budget: when it runs out the oldest stop being critical and thin as poses
while the newest stay exact.

Test: 64 turning radars plus an S-400 at sam_step 16, ejection on tick 4103
(cover 0.8333333 a tick before, spent cell on the ejection tick), a cancelled
opening and a radar switch off the pose grid, all surviving further thinning;
a 64-radar chattering recording stays exactly at the event budget with the
newest switch exact.

Co-Authored-By: Kimi Code <noreply@moonshot.ai>
This commit is contained in:
2026-11-21 09:12:18 +03:00
parent 433e1500e2
commit 41ab52e802
2 changed files with 232 additions and 26 deletions
+27
View File
@@ -33,6 +33,33 @@
137346889/300M, command 129151/1B, failures=0. Лимит памяти 64 MiB не увеличивался. Это
синтетический host без GPU и не приёмка Windows GUI.
### Прореживание не съедает короткие переходы (#142)
Прореживание #122 не различало непрерывную позу и дискретный факт: при большом числе меняющихся
РЛС оно пропускало целиком открытие крышки ТПК (`launch::OPEN_TICKS = 6` тиков, короче шага
sampling) и могло убрать уже записанный переход — ракета в реплее вылетала с нарисованной
закрытой крышкой, а `spent_cells` менялось только на следующем общем сэмпле.
Теперь `Recording::note_sams` вызывается каждый тик: позы по-прежнему снимаются на адаптивной
сетке `sam_step` из прежнего бюджета 32768, а дискретные переходы (`cap_cell`, `spent_cells`,
`radar_on`, режим и роль) и кадры открытия крышки пишутся на том тике, когда произошли, и
помечаются как события. Начало открытия дотягивается отдельным ключом на тик раньше, поэтому
ramp занимает ровно `OPEN_TICKS`, а не «примерно». Прореживание поз половинит только позы и
сохраняет события, первую и последнюю позу.
У событий свой явный бюджет — 4096 ключей на запись поверх 32768 поз; общий бюджет поз не
поднимался. При переполнении старые события перестают быть критическими (прореживаются как
позы), новейшие сохраняются: под записью с «болтливым» датчиком реплей остаётся ограниченным,
а свежий пуск — точным.
Проверки: `airdef-core` `sim::record::tests::decimation_keeps_a_cold_launch_cover_ejection_and_the_radar_switch`
— 64 вращающихся РЛС + С-400 при `sam_step = 16`, выброс на тике 4103: за тик до выброса
`cap_open = 0.8333333` (как в контрольной записи без давления на бюджет), `spent_cells = 0`
до и `1` на тике выброса, отмена/закрытие и `radar_on` читаются на своих тиках, повторное
прореживание их не убирает;
`critical_transitions_have_their_own_explicit_budget` — 64 РЛС, переключающихся каждый тик,
1500 тиков: событий ровно 4096, позы в своём бюджете, новейшее переключение точное.
## Второй налёт из UI: событие, не тик
Точный лог Windows: `Horizon: mod airdef stopped in UI event (fuel budget 1000000000,