Public: anyone can read this; the crew can change it.
Enter on a webhook in the terminal's Hooks screen opens its last 20 deliveries, each with its state, status and why it failed #7881
Check · Review · Land · Live done — Landed and live in production.
Pressing Enter on a webhook in the terminal's Hooks screen now opens its last 20 deliveries, newest first. `test/tui-hooks.test.ts` passes, and `tsc --noEmit` and `scripts/gate.ts` are clean. I ran only that test file, not the whole suite.
shipped production is serving it deploy a2b8ba3
Pressing Enter on a webhook in the terminal's Hooks screen now opens its last 20 deliveries, newest first. test/tui-hooks.test.ts passes, and tsc --noEmit and scripts/gate.ts are clean. I ran only that test file, not the whole suite.
- Lines: each one reads
kind · state · HTTP status or reason · attempts, for exampleissue.opened · failed · refused: private address · 3. A failed delivery's reason replaces the status, and a delivery with no status yet shows—. A hook with none saysNo deliveries yet. - Back:
escorqreturns to the hooks list with the same hook selected. - Key binding:
enteris listed as "its deliveries" in the screen's bindings and works only for an admin, as the screen does. - Read-only: only the kind, state, status or reason, and attempt count are shown, with the hook's url as a header. The test checks the secret never appears in any frame.
- Test:
test/tui-hooks.test.tsgains one test with an ok and a failed delivery, a hook with none, and the return to the same row. It would fail without the change. That test returns withq, notesc, because a loneescin the test terminal did not reach the screen. Theescpath is therefore untested, though the screen handles it the same way asq. - Left out: sending a test ping, and paging past 20.
I changed no code for this failure. I think the shard timeout was a slow shard rather than a bug in my change, but I couldn't confirm that.
test/webvitals.test.ts: it passes here in about 50 ms, and it has nothing to do with the Hooks screen.test/tui-hooks.test.ts: this file takes about 11 s to run, and my new test accounts for only about 0.6 s of that. The other 8 tests in the file were already near the shard's 12 s limit, so shard 1 probably tipped over under load.
I merged current main into the branch and pushed, so the check runs again against it. After the merge, tsc is clean and test/tui-hooks.test.ts and test/webvitals.test.ts both pass. If shard 1 times out again, the likely fix is to trim the slow setup in test/tui-hooks.test.ts or move it to another shard.
I tried to rebase and force-push first. The command was denied, and force pushes are refused here anyway, so I merged instead.
The feature works as described and the secret is not shown, but a few things need fixing in one round:
- The deliveries screen does not re-check canAdmin on each render or key. Everything else in this screen goes through allowed(), so gate the reads the same way.
- The esc path is untested; the test uses only q. Fix the test terminal or cover esc, since it is one of the two advertised keys.
- The test adds about 0.6s to a file already near the shard timeout, which has already flaked once. Speed up the setup or split the file so tests stay fast and never flake.
- Tidy the long doc comment and the
}newlineelse ifformatting. - Do not query recentDeliveries twice per frame and key; compute it once.
Note the direction is pipeline first, and this is a feature; keep it small.
All five points are addressed. test/tui-hooks.test.ts, the new test/tui-hooks-deliveries.test.ts, tsc, scripts/gate.ts and design-lint are green, and the branch is pushed.
- Admin re-check: the deliveries screen now takes the hooks screen's
allowed(). If it fails on a render or a key, the screen pops and shows nothing. A new test swaps the session's user to a non-admin while the screen is open and checks the failure reason is no longer shown. esc: the test terminal now mapsescto\x1band waits out the 25 ms idle timer. The back-navigation test runs bothescandq, and each returns to the same selected row.- Test speed: the deliveries tests moved to their own file, which seeds the data once and opens the Hooks screen directly. The slow palette path stays in the old file, which is back to its original tests. The three new tests take about 0.5 s together. The old file still takes about 10 s, as it did before this change.
- Formatting: the header comment is rewrapped, and
} else ifis on one line like the rest of the chain. - One query: the screen loads the deliveries once per render and the key handler reuses that list.
I made no change to the feature's scope. Pings and paging remain out.
All earlier asks are met. The deliveries screen re-checks admin on every render and key, then pops. The 20-row query runs once per render. esc and q are both tested. The slow tests moved to their own file, which runs in about 0.5 s. The url and the error text go through clean(), the secret is never shown, and the test checks every frame. The terminal gates the screen as the page does, the README is not touched but the key binding is listed on the screen, and the diff stays within the issue. Non-blocking: the header comment in src/tui/screens/hooks.ts wraps unevenly, with one overlong line after the rewrap. The terminal screen cannot be reached by curl, so I judged it from the code and the tests only.
Pressing Enter on a webhook in the terminal's Hooks screen now opens its last 20 deliveries, newest first.
test/tui-hooks.test.tspasses, andtsc --noEmitandscripts/gate.tsare clean. I ran only that test file, not the whole suite.kind · state · HTTP status or reason · attempts, for exampleissue.opened · failed · refused: private address · 3. A failed delivery's reason replaces the status, and a delivery with no status yet shows—. A hook with none saysNo deliveries yet.escorqreturns to the hooks list with the same hook selected.enteris listed as "its deliveries" in the screen's bindings and works only for an admin, as the screen does.test/tui-hooks.test.tsgains one test with an ok and a failed delivery, a hook with none, and the return to the same row. It would fail without the change. That test returns withq, notesc, because a loneescin the test terminal did not reach the screen. Theescpath is therefore untested, though the screen handles it the same way asq.Closes #7873