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

The owner resends a client's forge link from the client list: the old link stops working and a receipt names the new one's expiry #15706

Merged opened this

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

Merged

Each unclaimed client row now has a "Resend link" button that opens a confirm page. The old link answers "This link has been replaced", and the same action is on the forges MCP tool. I ran about 790 tests across the client, claim, forges, first-screen and MCP test files, and one failed.

Notes

shipped production is serving it deploy 2b4fce5

opened this

Each unclaimed client row now has a "Resend link" button that opens a confirm page. The old link answers "This link has been replaced", and the same action is on the forges MCP tool. I ran about 790 tests across the client, claim, forges, first-screen and MCP test files, and one failed. That one is fixed in the pull (it expected 404 for the old link), but I did not re-run the whole group afterwards. I did not run the full suite. bun x tsc --noEmit printed nothing, and bun test test/mcp-size.test.ts passes. The gate's rules are satisfied through the No door and Direction lines in commits.

  • Row action: the confirm page says who the link is for and that the earlier link stops working, and changes nothing until you confirm. The old inline "Renew link" form posted without that step, so it is gone.
  • Old link: the claim page now keeps the hash of the link it replaced, never the token. A POST with the old link gets 410 and "This link has been replaced". Before, it got the generic 404.
  • Receipt: the row reads "link replaced <when> · new link works until <when>". The expiry part appears only while the new link is open and unclaimed.
  • MCP: forges with action: "resend" and forge previews by default, and dryRun: false replaces the link and returns it with its expiry.
  • Tests: test/client-link-replace.test.ts covers the old link refused with the replaced page, the new link accepted, the confirm page changing nothing, a cross-origin POST refused with 403, and the MCP dry run and live call. Other tests that expected a 404 for the old link, or the old button labels, were updated to match.

Left out:

  • forges lost its kind enum to stay under the 6000-byte tools/list ceiling, which I did not raise. The handler still rejects other kinds, and the doc string lists them.
  • Terminal: no new screen. Its client rows already carry the receipt through seenParts, and the claim-link screen already previews and confirms the resend. The commit says No door for that.
  • Pictures: no before/after look. Only the button label changed, and the commit says No look.

Try it: as the owner, open /forges, press "Resend link" on an unclaimed client and confirm. Then open the old link and you should see the replaced page. The feature note is docs/features/client-resend-link.md.

🤖 Generated with Claude Code

Closes #15655

4 earlier comments · 1 event
commented

Each unclaimed client row now has a "Resend link" button that opens a confirm page. The old link answers "This link has been replaced", and the same action is on the forges MCP tool. I ran about 790 tests across the client, claim, forges, first-screen and MCP test files, and one failed. That one is fixed in the pull (it expected 404 for the old link), but I did not re-run the whole group afterwards. I did not run the full suite. bun x tsc --noEmit printed nothing, and bun test test/mcp-size.test.ts passes. The gate's rules are satisfied through the No door and Direction lines in commits.

  • Row action: the confirm page says who the link is for and that the earlier link stops working, and changes nothing until you confirm. The old inline "Renew link" form posted without that step, so it is gone.
  • Old link: the claim page now keeps the hash of the link it replaced, never the token. A POST with the old link gets 410 and "This link has been replaced". Before, it got the generic 404.
  • Receipt: the row reads "link replaced <when> · new link works until <when>". The expiry part appears only while the new link is open and unclaimed.
  • MCP: forges with action: "resend" and forge previews by default, and dryRun: false replaces the link and returns it with its expiry.
  • Tests: test/client-link-replace.test.ts covers the old link refused with the replaced page, the new link accepted, the confirm page changing nothing, a cross-origin POST refused with 403, and the MCP dry run and live call. Other tests that expected a 404 for the old link, or the old button labels, were updated to match.

Left out:

  • forges lost its kind enum to stay under the 6000-byte tools/list ceiling, which I did not raise. The handler still rejects other kinds, and the doc string lists them.
  • Terminal: no new screen. Its client rows already carry the receipt through seenParts, and the claim-link screen already previews and confirms the resend. The commit says No door for that.
  • Pictures: no before/after look. Only the button label changed, and the commit says No look.

Try it: as the owner, open /forges, press "Resend link" on an unclaimed client and confirm. Then open the old link and you should see the replaced page. The feature note is docs/features/client-resend-link.md.

🤖 Generated with Claude Code

commented

Resending a client's forge link now makes the old link answer 410 "This link has been replaced by a newer one." This was already so since 9096a30ba; the failing test was still expecting the old 404 and its old wording.

What changed

  • test/forge-link-reissue.test.ts now expects 410 and the "replaced" sentence in its three failing cases.
  • The earlier assertion that a refused username is not a dead link is unchanged.

Why the other check failures are not touched

  • The landing-past-a-broken-gate tests (shard 14) and the fork-that-never-followed test (shard 79) failed on the forge's run, but not here.
  • I ran test/forge-link-reissue.test.ts, test/gate-bypass.test.ts and test/fork-last-follow.test.ts locally and all 21 tests pass.
  • I changed no code for those two groups, so I read them as flakes from the sharded run, not as caused by this pull. I did not check the cause beyond that. The forge's check on this push will show whether they recur.

Checks

  • bun x tsc --noEmit is clean.
  • bun scripts/gate.ts --fix found one comment over 100 columns in test/claim-link.test.ts. It is not from this change, and the nightly rewrap handles it.

To try

  • Open /forges as the owner and press Resend link on an unclaimed client.
  • Confirm, then open the old link: it says it has been replaced.
commented

I merged main into the branch and pushed it. The only conflict was in src/http/mcp/tools/forges.ts.

The conflict

  • On main, the tool's kind input became an enum of refused and clients, and its description was reworded.
  • My side had added the action input for resend.
  • I took main's description and kind enum and kept action. I also gave it enum: ["resend"] to match the new enum style.

Checks

  • bun x tsc --noEmit printed nothing.
  • bun scripts/gate.ts --fix reported only the same over-long comment in test/claim-link.test.ts as before, which the nightly rewrap handles.
  • scripts/fast.ts could not name tests: it matched 3,378 of 4,103 files, so I ran the 27 forges, claim-link and clients test files myself (141 pass, 0 fail). That includes the resend-link tests.
  • The forge's full check on this push is still to come.
Changes requested — before the latest push

No high security finding: the replaced state keeps only a hash, the POST is same-origin checked, and the MCP action is admin-only and dry by default. Three things to fix in one round, tests first.

  1. Box 4 is only partly proven. The new link is checked with not.toBe(404), which a 410 or 500 also passes. Assert 200, or that the claim page offers the form. The cross-origin test says it "replaces nothing" but never checks that the old link still works or that no forge.claim_reissued event was written.
  2. The MCP test only checks for the substrings "Nothing changed yet" and "expiresAt". Parse the result. On the dry run, assert the old link still works. On the live call, assert the old link answers 410 and the returned link works.
  3. The receipt expiry (box 3) is tested only with a hand-built link.expiresAt. Add a test that the row from clientRows, after a real resend, carries link.expiresAt and shows "new link works until", so the row proves the receipt without a fabricated link.

Also: the stale-link emphasis is gone. Resend versus Send a new link used to tell the owner the link was unopened for 3 days, and every row now reads the same. Keep that cue, for example in the button title or the stage text. And p keeps only one earlier link, so a link replaced twice answers the generic 404. Say that in the feature doc or keep a short list.

commented

All of sentinel's points are addressed and pushed in 13f6c4749. The 56 tests I ran across the resend-link, claim-link, forges and clients test files pass, and tsc and design-lint are clean. I did not run the full suite, and the forge's check on this push is still to come.

Tests (test/client-link-replace.test.ts)

  • A new works() helper asks the claim page's passkey challenge (POST /claim/options), which answers 200 for a live link without using it up. The old not.toBe(404) checks are gone.
  • After a real resend, the old link answers 410 and the new one answers 200.
  • The cross-origin POST answers 403, leaves the forge.claim_reissued count unchanged, and the current link still works.
  • The MCP test parses the result.
    • Dry run: reissued is false, no link is returned, the event count is unchanged, and the old link still works.
    • Live call: the old link answers 410, the returned link answers 200, expiresAt is present, and the count goes up by one.
  • The receipt test asks the real child through useChildFetch and clientRows. The row's link.expiresAt is set and it shows "new link works until", with no hand-built link.
  • Counts are taken before each request, so the "claimed forge" test no longer depends on test order.

Stale-link cue

  • The Resend link button's title now reads "Not opened in 3 days: send it again…" when the link has gone unopened for three days. A test covers both cases.
  • I put the cue in the title, not the button label, so every row's label stays "Resend link".

One link remembered

  • Only the one link before the current one is remembered, so a link replaced twice answers the generic 404. I wrote that into docs/features/client-resend-link.md and did not add a list.
commented

The owner can now resend a client's forge link: a preview first, then, with dryRun: false, a new link replaces the old one. The check had failed on two tests. I fixed one and left the other alone.

  • tools/list size: my action argument pushed the forges tool's answer to 6042 bytes, over the 6000 ceiling. I dropped the enum: ["resend"] from its schema. The handler still rejects any other value with invalid, and test/mcp-size.test.ts now passes.
  • needsYouCard N+1 test: it passes on its own, and this branch touches nothing near it. It failed under full-suite load, so I read it as a timing flake. I did not change it, and the check will show whether it holds.
  • Local checks: tsc is clean, and the 209 MCP-related test files pass (1231 tests), including test/client-link-replace.test.ts. I did not run the whole suite.
  • Branch base: the branch is still based on an older main; I did not merge in newer commits.

To try it, call the forges tool as an admin: { action: "resend", forge: "<name>" } previews, and adding dryRun: false replaces the link.

Approved

Earlier asks met: tests now probe liveness without spending the link (410 old, 200 new), the cross-origin POST is checked, the MCP dry run and live paths are asserted, the receipt is tested against a real child, the stale cue and the one-link limit are documented. The new p field stores only a hash, replaced is reachable only with the exact old token, and the admin check runs before the new MCP action. The how-to is in docs/features/client-resend-link.md, not README. Non-blocking: the MCP description string is long; trim when the tools/list budget next tightens.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs