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

A forge link that is about to expire says so to its owner, and renews in one tap #14175

Merged opened this

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

Merged

The client list now shows how long each unclaimed link has left. The other three items in the issue were already built, so I only added the days-left part. On /forges, an unclaimed row reads "3 days left", "1 day left", "expires today" or "expired" beside "Link open".

Notes

shipped production is serving it deploy 4adf612

opened this

The client list now shows how long each unclaimed link has left. The other three items in the issue were already built, so I only added the days-left part.

On /forges, an unclaimed row reads "3 days left", "1 day left", "expires today" or "expired" beside "Link open". The terminal row says the same, for example link open, 3 days left. A spent or withdrawn link shows nothing.

Already in the repo, which I left alone:

  • Renew: "Send a new link" (or "Resend") on the row issues a fresh link and ends the old one at once. It is also available through the API and the claim_link MCP tool (test/forge-link-reissue.test.ts).
  • Expired link page: an expired link gives a plain 410 page naming the sender, with an "Ask for a new link" button. A link that never existed gets the generic 404, so nothing leaks about whether it did.

What I changed

  • The child's expiry date was being dropped when its link state was read. It is now parsed, and the new daysLeftWords in src/spawn/clients.ts turns it into the text above.
  • A new test file, test/client-link-days-left.test.ts, covers the rounding and the cases that show nothing. test/client-list.test.ts now checks that the page shows it.
  • docs/features/client-link-times.md has a short section on this.

Checks: bun x tsc --noEmit, scripts/gate.ts --fix, design-lint and the four affected test files (including test/mcp-size.test.ts) all pass. No MCP change was needed, so it adds no tool.

What I left out: I did not add a reminder or notification as a link nears expiry, and the page has no one-tap renew button beyond the existing "Send a new link" link.

To try it: open /forges with an unclaimed forge and read the row.

Closes #14155

5 earlier comments · 1 event
commented

The client list now shows how long each unclaimed link has left. The other three items in the issue were already built, so I only added the days-left part.

On /forges, an unclaimed row reads "3 days left", "1 day left", "expires today" or "expired" beside "Link open". The terminal row says the same, for example link open, 3 days left. A spent or withdrawn link shows nothing.

Already in the repo, which I left alone:

  • Renew: "Send a new link" (or "Resend") on the row issues a fresh link and ends the old one at once. It is also available through the API and the claim_link MCP tool (test/forge-link-reissue.test.ts).
  • Expired link page: an expired link gives a plain 410 page naming the sender, with an "Ask for a new link" button. A link that never existed gets the generic 404, so nothing leaks about whether it did.

What I changed

  • The child's expiry date was being dropped when its link state was read. It is now parsed, and the new daysLeftWords in src/spawn/clients.ts turns it into the text above.
  • A new test file, test/client-link-days-left.test.ts, covers the rounding and the cases that show nothing. test/client-list.test.ts now checks that the page shows it.
  • docs/features/client-link-times.md has a short section on this.

Checks: bun x tsc --noEmit, scripts/gate.ts --fix, design-lint and the four affected test files (including test/mcp-size.test.ts) all pass. No MCP change was needed, so it adds no tool.

What I left out: I did not add a reminder or notification as a link nears expiry, and the page has no one-tap renew button beyond the existing "Send a new link" link.

To try it: open /forges with an unclaimed forge and read the row.

commented

<!-- look-pages 494d5a72771c --> Look pages for 494d5a7, from the gate:

  • look pages (none): this pull changes src/web/pages/forges.ts but the forge could not trace the route of /settings/security/controls (an inline or wrapped handler), so it could not infer a page; the reviewer decides. A "Looks: <path>" line naming the nearest page, or a "No look: <why>" line (10+ characters), says it
commented

Looks: /forges

Nothing in the code changed for this round. The gate's note only asks the description to name the page that src/web/pages/forges.ts renders. That page is /forges, routed in src/http/server.ts:957.

What the pull does: the client list at /forges says how many days an unclaimed link has left. It also says so in the forge terminal screen (src/tui/screens/forges.ts). The calculation is in src/spawn/clients.ts. Tests are in test/client-link-days-left.test.ts and test/client-list.test.ts, and the behaviour is described in docs/features/client-link-times.md.

What I left out: the "renews in one tap" half of the title. The days-left line is the only change here.

How to try it: open /forges on the preview at https://lab--14175--forge-trevato-apps.open-platform.sh and look at a client with an unclaimed link. The /settings/security/controls path the gate failed to trace is not touched by this change.

🤖 Generated with Claude Code

Changes requested — before the latest push

Days left is built and tested as a function, but the title promises renew in one tap and the pull leaves that out. Fix first: make the renew a one-tap post on the unclaimed row (a button in a post form) so it matches the title, or retitle and re-scope. Also: the TUI shows nothing for an expired link, the TUI has no test, and the parse line in clients.ts is hard to read. Boxes 2-4 pre-exist this pull, but 2 asks for renew in one tap and today it goes through a confirm page.

commented

The pull now renews a link in one tap, and the terminal says "expired". One test in test/client-list.test.ts fails here, and it fails the same way on the previous commit. That is the "GET /api/v1/forges answers the MCP tool's rows" test: its row order differs from the list's, with maria in a different place. It is probably the sandbox blocking the *.forge.test hosts the test calls. I did not look further, so I could not confirm that.

I ran the tests for the touched files (test/tui-forges.test.ts, test/client-list.test.ts, the days-left test and the two link tests) plus bun x tsc --noEmit. Everything passes except that one test. bun scripts/design-lint.ts is clean.

Looks: /forges

What changed:

  • Renew in one tap: an unclaimed row on /forges now has a post-form button, Renew link when the link is open and carries an expiry, otherwise Resend or Send a new link. It posts straight to /forges/:name/claim-link, so there is no confirm page. The new link appears once on the next page and the old one stops working. The button is the same-origin-checked claim-link post that already existed, so no new route.
  • Row (src/web/pages/forges.ts): days left is computed once per row and shown in a muted data-days-left span.
  • Terminal (src/tui/screens/forges.ts): forgeLines takes now, so it no longer reads Date.now() per row. An unclaimed row reads "link open, 3 days left", or "link expired, press n for a new one" when the link has lapsed. That holds whether the link's state is open or ended.
  • Parse line (src/spawn/clients.ts): linkOfBody destructures the fields once and spreads expiresAt only when it is valid.
  • Tests: a new terminal test covers days left, expired and no expiry. test/client-list.test.ts now expects the renew form and the "Renew link" label.

What I left out: the terminal still has no renew key beyond the existing n.

I committed and pushed before noticing the failing test, so the branch went up with it red.

🤖 Generated with Claude Code

commented

I merged main into the branch and pushed it. The only conflict was in src/web/pages/forges.ts.

  • How I resolved it: main had turned "Send a new link" and "Resend" into a button that opens a confirm page, while my side made the renewal a one-tap post. I kept both. "Renew link" is still a one-tap post, shown only for an open link with days left. The other sends use main's confirm page, and main's "Recovery link" button is kept.
  • Checks: tsc --noEmit is clean, and the 7 test files that cover the link, client list and design lint pass (106 tests). I did not run the whole suite. It timed out here, and scripts/fast.ts said the diff was too broad to name tests, so I picked those files by hand.
  • gate.ts: bun scripts/gate.ts --fix could not trace the route of /settings/security/controls, so it inferred no look page. It asks for a "Looks: <path>" or "No look: <why>" line in the pull description, which I have not added.
commented

<!-- look-pages 9bd393c6a845 --> Look pages for 9bd393c, from the gate:

  • look pages (none): this pull changes src/web/pages/forges.ts but the forge could not trace the route of /settings/security/controls (an inline or wrapped handler), so it could not infer a page; the reviewer decides. A "Looks: <path>" line naming the nearest page, or a "No look: <why>" line (10+ characters), says it
Approved

All three earlier asks are met: linkOfBody destructures once, the row computes days left once and offers a Renew link post-form button, and the terminal takes now, says expired and has a test. Next, non-blocking: (1) Renew link skips the confirm page that says what stops working, so add a line to the button title or the next page that the old link ended. (2) The terminal says press n for a new one, so check that n really renews there and not only opens the confirm.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs