iterate.com / git

git clone https://git.iterate.com/repos/git

A pull's status line says when it was merged, and by whom

The line under a pull's title gave one time, the one it was opened at,
so a merged pull read as merged at the moment it was opened, by the one
who opened it. It now says what became of the pull, when, and who did
it, and beside that who opened it and when.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

Misha Kaletsky, 2026-11-24 23:08 UTC · d1936bf9df92d7abf47e339227ed9dcaae0722bd · parent 9d4d5a9

3 files changed

M pages.ts
@@ -415,11 +415,17 @@
     return `<details ${look}${open}>${summary}${quote}${comments}</details>`;
   });
 
+  // What the pull is, in one line: what it asks while it is open, and then what became of it,
+  // when, and by whom.
   const branch = `<code>${esc(pull.branch)}</code>`;
-  const asks =
-    pull.status === "merged"
-      ? `squashed ${branch} into <code>main</code> as <a href="${esc(repo)}/commit/${pull.commitOid}"><code>${(pull.commitOid || "").slice(0, 7)}</code></a>`
-      : `wants ${branch} squashed into <code>main</code>`;
+  const opened = `${esc(pull.by)} opened it ${utcStamp(Date.parse(pull.openedAt))}`;
+  const done = `${pull.doneBy ? ` by ${esc(pull.doneBy)}` : ""}, ${utcStamp(Date.parse(pull.doneAt || pull.openedAt))}`;
+  const is =
+    pull.status === "open"
+      ? `${esc(pull.by)} wants ${branch} squashed into <code>main</code>, ${utcStamp(Date.parse(pull.openedAt))}`
+      : pull.status === "merged"
+        ? `${branch} was squashed into <code>main</code> as <a href="${esc(repo)}/commit/${pull.commitOid}"><code>${(pull.commitOid || "").slice(0, 7)}</code></a>${done}. ${opened}.`
+        : `${branch} was closed without merging${done}. ${opened}.`;
   const standing =
     pull.status !== "open" || !stand
       ? ""
@@ -431,7 +437,7 @@
     : `<p class="note"><a href="${signInHref(view)}">Sign in</a> to comment or to merge.</p>`;
   const main = [
     `<article class="pull"><h1>${esc(pull.title)} <span class="by">#${pull.number}</span></h1>`,
-    `<p class="by"><span class="tag ${pull.status}">${pull.status}</span> ${esc(pull.by)} ${asks}, ${utcStamp(Date.parse(pull.openedAt))}</p>`,
+    `<p class="by"><span class="tag ${pull.status}">${pull.status}</span> ${is}</p>`,
     pull.body.trim() ? `<div class="body"><pre data-markdown data-dir="">${esc(pull.body)}</pre></div>` : "",
     standing,
     `<h2>Conversation</h2><section id="conversation">${conversation.join("") || note("Nobody has said anything yet.")}</section>`,
M pulls.ts
@@ -80,19 +80,27 @@
   author: { name: string; email: string } | null;
   openedAt: string;
   status: "open" | "merged" | "closed";
+  /** When it was merged or closed, and who did it: null while it is open, and `doneBy` also
+   *  when code did it with nobody behind. */
+  doneAt: string | null;
+  doneBy: string | null;
   /** The commit on main that a merged pull became. */
   commitOid: string | null;
   threads: PullThread[];
 };
 
-/** Who wrote an event, as a page shows them: the name before the `@` of a person's address, or
- *  for code with nobody behind it the context it ran in. */
-export function writerOf(event: Pick<StreamEvent, "source">): string {
+/** The person behind an event, as a page shows them: the name before the `@` of their address.
+ *  They wrote it themselves, or code wrote it for them. Null for code with nobody behind it. */
+function personOf(event: Pick<StreamEvent, "source">): string | null {
   const person = event.source.principal || event.source.onBehalfOf?.principal;
-  if (person?.email) return person.email.split("@")[0]!;
-  return person?.name || event.source.origin;
+  return person?.email?.split("@")[0] || person?.name || null;
 }
 
+/** Who wrote an event: the person behind it, or for code with nobody behind it the context it
+ *  ran in. */
+export const writerOf = (event: Pick<StreamEvent, "source">) =>
+  personOf(event) || event.source.origin;
+
 /** THE PULLS THAT A REPO'S EVENTS MAKE, oldest first. An event that is no pull's, or whose
  *  payload does not parse, changes nothing. */
 export function pullsOf(events: StreamEvent[]): Pull[] {
@@ -111,6 +119,8 @@
         author: person?.email ? { name: writerOf(event), email: person.email } : null,
         openedAt: event.createdAt,
         status: "open",
+        doneAt: null,
+        doneBy: null,
         commitOid: null,
         threads: [],
       });
@@ -134,12 +144,14 @@
     } else if (event.type === "pull/merged") {
       const merged = Merged.safeParse(payload);
       const pull = merged.success ? open(merged.data.pull) : undefined;
+      const done = { doneAt: event.createdAt, doneBy: personOf(event) };
       if (pull?.status === "open" && merged.success)
-        Object.assign(pull, { status: "merged", commitOid: merged.data.commitOid });
+        Object.assign(pull, { status: "merged", commitOid: merged.data.commitOid, ...done });
     } else if (event.type === "pull/closed") {
       const closed = Closed.safeParse(payload);
       const pull = closed.success ? open(closed.data.pull) : undefined;
-      if (pull?.status === "open") pull.status = "closed";
+      if (pull?.status === "open")
+        Object.assign(pull, { status: "closed", doneAt: event.createdAt, doneBy: personOf(event) });
     }
   }
   return pulls;
M tests/pulls.test.mjs
@@ -141,7 +141,12 @@
   assert.deepEqual(mind.events[repo].at(-1).payload, { pull: 1, commitOid });
 
   const merged = await read("/repos/site/pull/1");
-  assert.ok(merged.includes(`<span class="tag merged">merged</span> ada squashed <code>red-header</code> into <code>main</code> as <a href="/repos/site/commit/${commitOid}">`));
+  // what became of it and when, apart from who opened it and when
+  assert.ok(
+    merged.includes(
+      `<span class="tag merged">merged</span> <code>red-header</code> was squashed into <code>main</code> as <a href="/repos/site/commit/${commitOid}"><code>${commitOid.slice(0, 7)}</code></a>, 2026-11-24 12:06 UTC. ada opened it 2026-11-24 12:01 UTC.</p>`,
+    ),
+  );
   // what it shows now is what that commit changed
   assert.deepEqual(linksIn(merged, "changes"), [
     ["#diff-0", "header.css"],
@@ -168,30 +173,42 @@
     event(6, "pull/commented", { pull: 9, body: "Nowhere.", replyTo: null, at: null }, "ada@example.com"),
     event(7, "pull/commented", { pull: 2, body: "A thread of its own.", replyTo: 99, at: null }, "ada@example.com"),
     event(8, "pull/edited", { pull: 1, title: "The first, renamed", body: "now with a body" }, "ada@example.com"),
-    event(9, "pull/closed", { pull: 1 }, "ada@example.com"),
+    event(9, "pull/closed", { pull: 1 }, "grace@example.com"),
     // code with nobody behind it is shown as the context it ran in
     event(10, "pull/commented", { pull: 2, body: "From an agent.", replyTo: 5, at: null }, null),
   ];
 
   assert.deepEqual(
-    pullsOf(events).map(({ number, branch, title, body, by, status, threads }) => ({
+    pullsOf(events).map(({ number, branch, title, body, by, status, doneBy, doneAt, threads }) => ({
       number,
       branch,
       title,
       body,
       by,
       status,
+      done: doneAt && `${doneBy} at ${doneAt}`,
       said: threads.map(({ id, comments }) => [id, ...comments.map(({ by, body }) => `${by}: ${body}`)]),
     })),
     [
-      { number: 1, branch: "one", title: "The first, renamed", body: "now with a body", by: "ada", status: "closed", said: [] },
       {
+        number: 1,
+        branch: "one",
+        title: "The first, renamed",
+        body: "now with a body",
+        by: "ada",
+        status: "closed",
+        // grace closed it, a while after ada opened it
+        done: "grace at 2026-11-24T12:09:00.000Z",
+        said: [],
+      },
+      {
         number: 2,
         branch: "two",
         title: "The second",
         body: "why",
         by: "grace",
         status: "open",
+        done: null,
         said: [
           [5, "ada: On the second.", "/agents/reviewer: From an agent."],
           [7, "ada: A thread of its own."],