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

A client list row offers Send again: it replaces the forge link with a fresh one and the old link stops working, with a receipt #13507

Merged opened this

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

Merged

Most of this issue was already on main from #13181 (#13166): the Send again action, its link-replacing logic, the event and the MCP tool. This pull adds the one missing piece: the client list now says "link replaced ". What was already there A row's "Send a new link" button previews who the link is for, then confirms.

Notes

shipped production is serving it deploy 8e1361f

opened this

Most of this issue was already on main from #13181 (#13166): the Send again action, its link-replacing logic, the event and the MCP tool. This pull adds the one missing piece: the client list now says "link replaced <when>".

What was already there

  • A row's "Send a new link" button previews who the link is for, then confirms. Confirming mints a new link and the old one answers "this link does not work any more".
  • The same action exists as the API call and the claim_link MCP tool, and each send writes a forge.claim_reissued event.
  • A claimed forge is refused with "already claimed", so a link already claimed is never revoked.

What changed

  • src/spawn/clients.ts: each row gets replacedAt, read from the latest forge.claim_reissued event for that forge in one grouped query.
  • The row's status line (the "sent … · opened … · last seen …" one) now includes "link replaced <when>" in both the web /forges page and the terminal, which share seenParts.
  • test/client-link-replace.test.ts covers four things:

- a row shows no replaced time before any resend; - after a resend the old link gets 404 and the new link does not; - the row carries the receipt time and the line reads "link replaced"; - a claimed forge is refused and writes no second event.

What I did not do

  • No new tool or action, so the MCP size ceilings are untouched.
  • Forge orders that reissue a link through reissueClaimFor still write no event, so they do not show "link replaced". Only the confirmed Send again path does.

Checks

  • bun test on the new test, forge-link-reissue, client-list, client-states and mcp-size passes (40 tests), and tsc --noEmit is clean.
  • gate.ts --fix rewrapped comments in two files. The push went through, so that rewrap was committed.

To try it

  • Open /forges as the sender, use "Send a new link" on an unclaimed row, and confirm.
  • The row now reads "link replaced just now".

Closes #13485

1 earlier comment · 1 event
commented

Most of this issue was already on main from #13181 (#13166): the Send again action, its link-replacing logic, the event and the MCP tool. This pull adds the one missing piece: the client list now says "link replaced <when>".

What was already there

  • A row's "Send a new link" button previews who the link is for, then confirms. Confirming mints a new link and the old one answers "this link does not work any more".
  • The same action exists as the API call and the claim_link MCP tool, and each send writes a forge.claim_reissued event.
  • A claimed forge is refused with "already claimed", so a link already claimed is never revoked.

What changed

  • src/spawn/clients.ts: each row gets replacedAt, read from the latest forge.claim_reissued event for that forge in one grouped query.
  • The row's status line (the "sent … · opened … · last seen …" one) now includes "link replaced <when>" in both the web /forges page and the terminal, which share seenParts.
  • test/client-link-replace.test.ts covers four things:

- a row shows no replaced time before any resend; - after a resend the old link gets 404 and the new link does not; - the row carries the receipt time and the line reads "link replaced"; - a claimed forge is refused and writes no second event.

What I did not do

  • No new tool or action, so the MCP size ceilings are untouched.
  • Forge orders that reissue a link through reissueClaimFor still write no event, so they do not show "link replaced". Only the confirmed Send again path does.

Checks

  • bun test on the new test, forge-link-reissue, client-list, client-states and mcp-size passes (40 tests), and tsc --noEmit is clean.
  • gate.ts --fix rewrapped comments in two files. The push went through, so that rewrap was committed.

To try it

  • Open /forges as the sender, use "Send a new link" on an unclaimed row, and confirm.
  • The row now reads "link replaced just now".
Changes requested — before the latest push

The change is small and the query is sound, but three things need fixing in one round.

  1. No how-to. The pull adds a visible behaviour, 'link replaced <when>', and touches no docs/features/*.md. Add a line to docs/features/forge-link-states.md or forge-link-revoke.md saying what the phrase means and when it shows.
  2. The test does not reach the doors. It builds a Seen by hand and calls seenParts. Nothing renders /forges or the TUI forges screen, so dropping replacedAt from the page or the terminal would not fail it. Add one assertion on the rendered /forges HTML and one on the TUI row, after a send again, for 'link replaced'.
  3. The line goes stale. seenParts keeps saying 'link replaced <when>' after the forge is claimed, where it sits beside 'last seen'. The receipt only matters while the replacement link is waiting. Drop the part when claimed is true, and test that.

Smaller: linksReplaced scans every forge.claim_reissued event on each list render. Say whether it is indexed or bounded.

Boxes 1 and 3 already exist on main from #13181, and this pull does not change them.

commented

All three review points are addressed. tsc, gate.ts --fix, design-lint and the two client-link test files pass.

  • How-to: docs/features/forge-link-states.md now explains "link replaced". It shows after Send again, with the time of the forge.claim_reissued receipt. It appears only while the forge is unclaimed.
  • Stale after claim: seenOf in src/spawn/clients.ts now sets replacedAt to null once the forge is claimed. The line then reads "last seen" alone. A new test builds a claimed row and asserts "last seen" is there and "link replaced" is not.
  • Doors: after a send again, the test now asserts "link replaced" on the forgeRow HTML (the row that /forges renders) and on the forgeLines TUI row.
  • Query: linksReplaced filters on kind, which the existing event_kind_seq(kind, seq) index covers. It reads one row per Send again tap, so it is small. I added a comment saying so and did not add an index.

Not done: the test does not fetch /forges itself. In the sandbox the child forge never answers the probe, so the page shows the row as unknown and hides the seen line. I render the page's row with a row forced to made/unclaimed. A full-page assertion would need a reachable child.

Approved

Approved. The row line now says "link replaced <when>" on the /forges page and in the terminal, from one shared seenParts. It drops the part once claimed. The how-to is in docs/features/forge-link-states.md, not the README. The query filters on the indexed kind. The test covers old link refused, new link works, receipt read, and claimed not replaced. I did not exercise the preview as a signed-in sender, so the line itself is judged from the diff and tests.

Two things I would do next:

  1. linksReplaced keys events by forge name. If a forge is deleted and a new one is made with the same name, the old receipt would show on the new row. Key by body id, or ignore receipts older than the forge's creation.
  2. The test renders forgeRow and forgeLines with a forced row, because the sandbox child never answers the probe. Add a full /forges page assertion once a child can be probed. Also, orders that reissue through reissueClaimFor write no event, so they never show "link replaced"; open an issue if that matters.
Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs