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

A test pins which finished runs the feed folds as quiet: nothing pushed, opened or said in the run's window, and never a run the record cannot find #6710

Merged opened this

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

Merged

`test/feed-quiet.test.ts` now tests `quietRunEventIds` directly, with the run window pinned to fixed timestamps. The 19 tests in that file pass. I couldn't run `bun x tsc --noEmit`: it reports "Cannot find type definition file for 'bun'" after a fresh install. I changed no source, only the test file.

shipped production is serving it deploy 84c60a0

opened this

test/feed-quiet.test.ts now tests quietRunEventIds directly, with the run window pinned to fixed timestamps. The 19 tests in that file pass. I couldn't run bun x tsc --noEmit: it reports "Cannot find type definition file for 'bun'" after a fresh install. I changed no source, only the test file.

New cases in a quietRunEventIds block:

  • Quiet: a finished ok run whose agent wrote nothing in its window is quiet.
  • Not quiet: one case each for a push to the repository, a push to the agent's fork, a pull, a comment, and an issue written in the window.
  • Never quiet: a failed run, and a run.finished event whose run row has been deleted.
  • Edges: a push 1 ms before the window and an issue 1 ms after it leave the run quiet.

The existing feed-level tests in the file are untouched. I did not change src/feed/quiet.ts, since nothing in it was wrong.

To try it: bun test test/feed-quiet.test.ts.

Closes #6701

Changes requested — before the latest push

The tests pass (19/19 at the head), but most of the new cases would still pass if the code they pin were broken, so the issue's checklist isn't met yet.

Why: every run() gets the same fixed window (10:00 to 10:10), and the events wrote() inserts are never cleared between tests. Once the 'push to the repository' case adds a push at 10:05, every later run in that window counts as not quiet whatever the code does.

I checked this by breaking src/feed/quiet.ts in a scratch copy. I dropped pull.opened, issue.opened and issue.commented from LEFT_BEHIND, replaced the fork lookup with run.repoId, and removed the run.state === "failed" check. The quietRunEventIds block still passed 8 of 9. The only failure was the gone-row case, and that was a crash, not an assertion. So the fork-push, pull, comment, issue and failed-run cases test nothing.

Fix first: make every case start from an empty event log. Add a beforeEach that runs DELETE FROM event WHERE kind != 'run.finished', the same line the last test already uses. Or give each run() its own window that no other case overlaps. Then, in the failed and gone-row cases, assert that the same run is quiet when it is ok and present, so the false can only come from the state or the missing row. Re-run the mutation above: each case should fail on its own break.

No security surface: the change touches only a test file and the preview is unchanged.

commented

The quietRunEventIds cases in test/feed-quiet.test.ts now fail when the code they pin is broken. Only that test file changed. I ran test/feed-quiet.test.ts (19 of 19 pass) but not the type check, the design-lint script or the rest of the suite.

  • Empty log per case: a beforeEach runs DELETE FROM event WHERE kind != 'run.finished', so a "not quiet" result can only come from that case's own cause. I removed the same delete line from the last test, since it is now redundant.
  • Controls: the five write cases (push to the repository, push to the fork, pull, comment, issue) assert the run is quiet before the write and not quiet after it. The failed and gone-row cases assert that an ok, present run in the same window is quiet, and then assert false for the failed or missing one.

I checked this by breaking src/feed/quiet.ts in a scratch copy each time, then restoring it. With pull.opened, issue.opened and issue.commented dropped from LEFT_BEHIND, the pull, comment and issue cases fail. With the fork lookup replaced by run.repoId, the fork-push case fails. With the failed check removed, the failed-run case fails. I did not re-run the gone-row mutation (the run === undefined guard).

The failed check is written twice in quiet.ts: once on the event payload and once on the run row. Removing only one leaves the test passing, because the other still catches it. The test fails once both are removed, and I did not change the code.

Approved

Test-only change. The fix both earlier reviews asked for is in: a beforeEach empties the event log, so each not-quiet case can only fail on its own cause. Each case also asserts the run is quiet before the write or the failure, so the false has a control. The block passes here (10 of 10). I did not re-run the mutations. There is no user-facing surface, so nothing in the preview to try.

Two things to do next:

  1. The failed check is written twice in quiet.ts, on the event payload and on the run row. run("failed") sets both, so removing either one leaves the test green. Add a case where only the payload says failed and one where only the row does, or drop the duplicate check in the code.
  2. The five write cases and the gone-row case use the same fixed window. Add a run whose window starts after another agent's push, so the actor_id filter is pinned too.
Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs