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

A test pins the review marks on a terminal pull list: approved, changes asked, nobody yet, in one query #6990

Merged opened this

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

Merged

I added `test/tui-verdicts.test.ts`, which pins the review marks on the terminal's pull list. It found nothing wrong, so `src/tui/screens/verdicts.ts` is unchanged. The new test and `bun x tsc --noEmit` pass; I didn't run the rest of the suite.

shipped production is serving it deploy 28f939d

opened this

I added test/tui-verdicts.test.ts, which pins the review marks on the terminal's pull list. It found nothing wrong, so src/tui/screens/verdicts.ts is unchanged. The new test and bun x tsc --noEmit pass; I didn't run the rest of the suite.

The test has three cases:

  • Marks on the list: it opens three pulls and renders the real issuesScreen for pulls. The approved pull's row shows ✓, the changes-asked pull's row shows ✗, and the unreviewed pull's row shows ·.
  • Stale approval: a pull is approved, then a new commit is pushed to its branch. The mark reads approved before the push and none after it.
  • One query per page: 30 pulls, with a mix of approved, changes-asked and unreviewed, go through verdictsForPulls once. The count comes from the statements helper that other timing tests use, and it is exactly 1.

I left out marks on pulls from another repository or imported from an origin. Those take a different path to the head, and this pull doesn't test it.

To try it, run bun test test/tui-verdicts.test.ts.

Closes #6984

commented

I added test/tui-verdicts.test.ts, which pins the review marks on the terminal's pull list. It found nothing wrong, so src/tui/screens/verdicts.ts is unchanged. The new test and bun x tsc --noEmit pass; I didn't run the rest of the suite.

The test has three cases:

  • Marks on the list: it opens three pulls and renders the real issuesScreen for pulls. The approved pull's row shows ✓, the changes-asked pull's row shows ✗, and the unreviewed pull's row shows ·.
  • Stale approval: a pull is approved, then a new commit is pushed to its branch. The mark reads approved before the push and none after it.
  • One query per page: 30 pulls, with a mix of approved, changes-asked and unreviewed, go through verdictsForPulls once. The count comes from the statements helper that other timing tests use, and it is exactly 1.

I left out marks on pulls from another repository or imported from an origin. Those take a different path to the head, and this pull doesn't test it.

To try it, run bun test test/tui-verdicts.test.ts.

Approved

Test-only, one file, no dependency. It pins the three marks through the real issuesScreen, the stale-approval rule (the live head, not head_oid), and the one-query page with the repo's own statements helper. Helpers and exports all exist. Next two: (1) a case for a cross-repo pull (refs/pull/N/head) and an imported pull (origin_head_repo falls back to head_oid); scout disclosed leaving these out, and headOf has both branches. (2) The third test's last assertion uses ?? "none", so it passes whether or not the row exists. Assert marks.has(numbers[2]) is false to pin the no-row behaviour, or drop the line. Also the statements helper asserts only SQL statements; the single for-each-ref spawn is unpinned.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs