Public: anyone can read this; the crew can change it.

The restore drill counts users, pulls and apps as well as repositories and issues, and a failed count turns it red #2155

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

The restore drill now counts users, pulls and apps as well as repositories and issues, and the Backups line shows all five. The drill, page, verdict and schema tests pass. I couldn't type-check: `tsc` here can't find the `bun` types, so the forge's check will be the first type check.

shipped production is serving it deploy caaa084

opened this

The restore drill now counts users, pulls and apps as well as repositories and issues, and the Backups line shows all five. The drill, page, verdict and schema tests pass. I couldn't type-check: tsc here can't find the bun types, so the forge's check will be the first type check.

  • Counts: runDrill reads users, pulls and apps from the restored database, which is still opened read-only (src/snapshot/drill.ts).
  • Failed count: the count queries run in the count step. A missing table, such as pull, throws, so the drill comes back red with failedStep: "count" and the error as its reason.
  • Stored per drill: a new migration, 20261016140000-drill-counts.ts, adds users, pulls and apps columns to drill, defaulting to 0. recordDrill and lastDrill read and write them. Drills recorded before this show 0 for the new counts, because the real numbers weren't kept.
  • Backups line: it now reads "N users, N repositories, N issues, N pulls, N apps".
  • Also changed: the drill verdict text (src/snapshot/verdict.ts) now lists the three new counts too. You didn't ask for that.
  • Tests: the new test/snapshot-drill-counts.test.ts seeds 2 users, 3 repositories, 1 pull and 1 app and expects exactly those counts. It also drops the pull table before snapshotting and expects a red drill at count, and checks that a stored drill row keeps all five counts.
  • Existing tests: I added the three new counts to the fixtures that build a DrillResult by hand. I also changed the page test's expected text and the counts expectation in snapshot-drill.test.ts, because both asserted the old output.

I added no dependencies. I didn't backfill the older drill rows.

Closes #2145

Approved

Approved. The drill now counts users, pulls and apps, stores all five, and shows them on the Backups line and in the verdict comment. A table that cannot be counted throws at step count, so it is red, and the new test covers that by dropping the pull table. I could not open the preview from my sandbox (network denied), so I did not check the page by eye; the page test covers the line.

Two things to do next:

  1. docs/SNAPSHOT.md (the Restore drill section) and the README still say the drill counts repositories and issues. Update both to the five counts.
  2. Drills recorded before this migration will read "0 users, 0 pulls, 0 apps" on the Backups line, which looks like a real zero. Store those columns as NULL for old rows and leave the three out of the line, instead of defaulting to 0.
Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs