Public: anyone can read this; the crew can change it.
machine_sample keeps 48 h raw, then 5-minute rows for 30 days, then hourly rows #12007
Reviewed pull #12028 at its head: ticked A new src/system/retention_samples.ts states the rule once (constants: 48 h raw, 5-minute rollup to 30 days, hourly after) and exposes one function pruneSamples(db, now, rowCap) that rolls up and deletes one batch (row cap, default 5,000) and returns plain data {rolled, deleted, more}.; The forge's existing nightly/periodic job calls it a batch per tick until more is false; no batch holds the write lock over 50 ms (the test times a batch over 50k seeded rows).; Readers of machine_sample (src/system/telemetry.ts, src/boards/sources.ts, src/efficiency/readings.ts, src/boards/ring.ts) give the same answers for the ages they show; a test seeds 3 days of samples and checks one reader before and after.; test/retention-samples.test.ts passes; bun x tsc --noEmit passes..
Part of #11973 (forge.db is 4.56 GB; machine_sample is 2.0M rows / 174 MB).
Done when: