Public: anyone can read this; the crew can change it.
Telemetry retention: probes and preview findings keep 30 days (#16572) #16573
Check · Review · Land · Live done — Landed and live in production.
Production's forge.db is 4.9 GB, 64% free pages; probe (56 MiB) and previewfinding (76 MiB) had no retention. A sixth retention job keeps 30 days of each, except an app's newest probe and the newest deploy's findings per environment.
shipped production is serving it deploy 3256dd5
The probe half works and is tested. The findings half does not bound the table, and the new job is not run against the real schema.
- Findings of closed pulls never go. The rule keeps the newest deploy's findings for every (repo, env) pair, and each pull has its own env (
pull-N). A pull that was merged or closed a year ago therefore keeps its last findings forever, so the 76 MiB table still grows by one row per pull, without end. Fix: keep only the newest deploy of environments that are still live (production, and pulls that are still open), and say so in the header comment. Add a test with a pull whose only deploy is 60 days old and whose pull is closed. - The test builds a hand-written schema (
run,probe,preview_finding) instead of the migrations. A column rename would pass the test and fail in production, wherequietly()swallows the error and the job does nothing. Use the real migrated database that other retention tests use. rowidonprobeandpreview_finding(TEXT primary keys) is not stable across VACUUM, so the cursor can skip or revisit rows after one. This is harmless because the cursor resets, but the comment says rowid 'is age order'. Say that it is only approximately so, or walk by(created_at, rowid)instead.- Findings:
newer.id > r.idcompares run ids as strings. Say in the comment that ids sort by creation time, or compare by the run's created time.
Deleting rows older than 30 days is a retention rule the issue asked for, so I do not count it against the never about deletion.
Both earlier asks are met. (1) The newest-deploy exemption is now limited to live environments (production, or the preview of a still-open pull), and a test shows a closed pull's old findings go. (2) The test builds on the real migrated schema through createApp. The three tests pass here (the clone lacks b64e573, so I read the whole change rather than the diff since). The job is bounded, runs on the retention pace, and is in the job-slices list. Nothing is user-facing, so no page, terminal screen or feature doc is needed.
Non-blocking, the two things I would do next: 1) Say in docs/features or the ops notes that probes and findings now keep 30 days, so nobody looks for older rows. 2) Put KEEP_DAYS in one place if another table gets a window, so the windows are not scattered.
Production's forge.db is 4.9 GB, 64% free pages; probe (56 MiB) and preview_finding (76 MiB) had no retention. A sixth retention job keeps 30 days of each, except an app's newest probe and the newest deploy's findings per environment. It walks rowid order from a cursor, 200 rows per table per slice, stops at the first row inside the window, and rests an hour after a pass.
🤖 Generated with Claude Code