Skip to content

feat: the inbox page — one click from a prepared review to a live diffity session - #83

Merged
fiddur merged 3 commits into
developfrom
inbox-page
Sep 2, 2026
Merged

feat: the inbox page — one click from a prepared review to a live diffity session#83
fiddur merged 3 commits into
developfrom
inbox-page

Conversation

@fiddur

@fiddur fiddur commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

Part of #79, the last of the three inbox PRs (after #80 bundles and #82 the daemon). This is the pinned-tab surface and the open flow.

What it adds

The daemon's server now serves more than JSON:

  • GET / — a self-contained dashboard (no build step, no external requests; theme-aware): polls /api/inbox every few seconds and renders Ready to review (smallest diff first, each a one-click link), Preparing, and Other (skipped/failed with the reason).
  • GET /open/:id — brings a prepared review up as a live session: reuses or starts a diffity server over the kept worktree, diffing against the pull request's base (read from the bundle), imports the prepared findings, and 302-redirects the browser to the session. The session runs in your own diffity (shows in diffity list), so from there it behaves like any review you opened yourself. Import is idempotent and best-effort — a stale anchor never blocks opening the diff.

Shape

  • inbox/open.ts — pure resolveOpen guard (must be prepared/stale with a worktree + bundle).
  • inbox/open-session.tsopenPreparedSession orchestration with its side effects injected; the real deps reuse a healthy instance (findInstanceForRepo, realpath-hashed) or start one, and import via the CLI.
  • inbox/page.ts — the HTML.
  • inbox/daemon.ts — the two new routes; startInboxServer/runDaemon take the open deps (injectable for tests).

Tests

inbox-open.test.ts: the resolve guard (accept / 404 / 409), baseRefOf (reads/refuses), openPreparedSession (ensures at base then imports, and still opens when import throws), and the routes against a real server (page HTML, /api/inbox, /open 302 to the session URL, 409 for a not-ready PR). Smoke-tested the whole chain live: daemon prepared a PR, the page listed it, /open redirected to a real diffity session started at the bundle's base commit with the prepared finding imported (idempotent on a second import).

fiddur and others added 3 commits September 2, 2026 21:43
…ne click

Serves a self-contained dashboard at the daemon's port: it polls
/api/inbox and shows what's ready (smallest first), what's preparing, and
what was skipped or failed. Clicking a ready pull request hits /open/<id>,
which brings its prepared review up as a live diffity session — a server
over the kept worktree, diffing against the pull request's base, with the
prepared findings imported — and redirects the browser to it. A healthy
session already serving that worktree is reused; the import is idempotent
and best-effort, so a stale anchor never blocks opening the diff.

Part of #79

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018PkYQzbsnMihHesafWvXKs
…ce is guarded

The whole request handler is wrapped, and a bad percent-escape in /open
answers 400 instead of throwing uncaught and taking the long-running
daemon down. Every request must carry this loopback server's own Host, so
a page that rebinds its hostname to 127.0.0.1 cannot read the reviewer's
pull requests; a state-changing /open refuses a cross-site fetch. An
import that fails on open is now logged with its reason rather than
swallowed. The real ensureServer path gains tests — the hash it looks a
server up by matches what diffity registers, and the start times out.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018PkYQzbsnMihHesafWvXKs
The page's links are built from the host the reader actually reached it
by, so opening from 127.0.0.1 is not a cross-site click against a
localhost link. resolveOpen moves inside the open handler's try, so a
store failure answers 500 rather than leaving the request to hang.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018PkYQzbsnMihHesafWvXKs
@fiddur
fiddur marked this pull request as ready for review September 2, 2026 20:09
@fiddur
fiddur merged commit eb112d4 into develop Sep 2, 2026
2 checks passed
@fiddur
fiddur deleted the inbox-page branch September 2, 2026 20:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant