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

A subscriber gives a friend a forge in one tap, and sees who came — restarted from the parked branch, in two small pulls #16812

Merged opened this

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

Merged

A subscriber can now make a gift link from their own settings page and see who came. This is pull 2 of #11925, the page. Pull 1's core, the MCP gift action and the terminal screen were already on main.

Notes

opened this

A subscriber can now make a gift link from their own settings page and see who came. This is pull 2 of #11925, the page. Pull 1's core, the MCP gift action and the terminal screen were already on main.

I ran the new page test, the existing gift, settings, route-mark, MCP-size and llms tests, tsc, design-lint and gate --fix, and all pass. In one run, test/page-budget.test.ts failed once while a second test run was using the machine at the same time; it passes when run alone.

What changed

  • New page module: src/web/pages/gifts.ts adds a "Give a friend a forge" block to /settings. It shows only to a person with a paid forge of their own; anyone else sees nothing.
  • Make a link: one "Make a gift link" button posts /settings/gifts. The answer page shows the link once and is no-store. It uses the same giveGift and readGifts as MCP and the terminal, so the cap, the "none left" refusal and the audit event are the same everywhere.
  • See who came: under the button, one dl row per gift (a dot and its word: waiting, taken or revoked) with the forge that took it. This reuses the existing status-row line pattern rather than a card or badge, which is what went red last time. design-lint is clean.
  • Wiring: the route is in src/http/settings_routes.ts. I marked it open in src/http/marks/settings.json, since without that the admin gate refused everyday accounts with a 403.
  • Docs and test: docs/features/gifts.md now describes the web door. test/gifts-page.test.ts covers three cases: a non-subscriber sees no block and gets a 404 on the POST; one tap makes a link, shown once and then listed as waiting; a cross-site POST gets a 403 and makes nothing.

Reuse

  • giveGift, readGifts, GIFT_WORDS, copyField, dot, accountShell and readForm, which already does the same-origin check.
  • I added no new component class, no new MCP tool and no dependency.

Left out

  • A revoke button for the giver. The core has no giver-side revoke.
  • A new nav entry; the block sits on the Profile section so the sidebar is unchanged.

To try it

  • Sign in as a person with a paid forge, open /settings, press "Make a gift link", copy the link, and open it in another browser to claim it.

Review

[
  {"go": "/settings (signed in as a person with a paid forge)", "look": "the 'Give a friend a forge' block", "expect": "the gifts left, a Make a gift link button, and 'No gift yet.'"},
  {"go": "press Make a gift link", "look": "the answer page", "expect": "the link shown once with a copy button, then the list with a dot and 'waiting'; reloading /settings no longer shows the link"},
  {"go": "/settings (signed in as a person with no paid forge)", "look": "the page", "expect": "no gift block"}
]

Closes #11925

7 earlier comments
commented

A subscriber can now make a gift link from their own settings page and see who came. This is pull 2 of #11925, the page. Pull 1's core, the MCP gift action and the terminal screen were already on main.

I ran the new page test, the existing gift, settings, route-mark, MCP-size and llms tests, tsc, design-lint and gate --fix, and all pass. In one run, test/page-budget.test.ts failed once while a second test run was using the machine at the same time; it passes when run alone.

What changed

  • New page module: src/web/pages/gifts.ts adds a "Give a friend a forge" block to /settings. It shows only to a person with a paid forge of their own; anyone else sees nothing.
  • Make a link: one "Make a gift link" button posts /settings/gifts. The answer page shows the link once and is no-store. It uses the same giveGift and readGifts as MCP and the terminal, so the cap, the "none left" refusal and the audit event are the same everywhere.
  • See who came: under the button, one dl row per gift (a dot and its word: waiting, taken or revoked) with the forge that took it. This reuses the existing status-row line pattern rather than a card or badge, which is what went red last time. design-lint is clean.
  • Wiring: the route is in src/http/settings_routes.ts. I marked it open in src/http/marks/settings.json, since without that the admin gate refused everyday accounts with a 403.
  • Docs and test: docs/features/gifts.md now describes the web door. test/gifts-page.test.ts covers three cases: a non-subscriber sees no block and gets a 404 on the POST; one tap makes a link, shown once and then listed as waiting; a cross-site POST gets a 403 and makes nothing.

Reuse

  • giveGift, readGifts, GIFT_WORDS, copyField, dot, accountShell and readForm, which already does the same-origin check.
  • I added no new component class, no new MCP tool and no dependency.

Left out

  • A revoke button for the giver. The core has no giver-side revoke.
  • A new nav entry; the block sits on the Profile section so the sidebar is unchanged.

To try it

  • Sign in as a person with a paid forge, open /settings, press "Make a gift link", copy the link, and open it in another browser to claim it.

Review

[
  {"go": "/settings (signed in as a person with a paid forge)", "look": "the 'Give a friend a forge' block", "expect": "the gifts left, a Make a gift link button, and 'No gift yet.'"},
  {"go": "press Make a gift link", "look": "the answer page", "expect": "the link shown once with a copy button, then the list with a dot and 'waiting'; reloading /settings no longer shows the link"},
  {"go": "/settings (signed in as a person with no paid forge)", "look": "the page", "expect": "no gift block"}
]
commented

<!-- look-pages 44288da6b03e --> Look pages for 44288da, from the gate:

  • look pages (none): this pull changes src/web/pages/account.ts, src/web/pages/gifts.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

This pull adds a Settings block where a subscriber makes a one-use gift link for a friend. The block shows one line per gift, with its state and the forge that took it. Anyone who isn't a subscriber sees no block, and the POST to /settings/gifts answers not found.

The check failed on the "both doors" rule because the pull adds src/web/pages/gifts.ts without a new terminal screen or how-to. Those already exist from #16766 (src/tui/screens/gifts.ts and docs/features/gifts.md), so no code changed. I pushed an empty commit with the lines the gate wants. They say "No door", "Replaces: nothing" and "Looks: /settings/security/controls". Locally bun scripts/gate.ts no longer reports a failure. I did not rerun tsc or the tests, since no code changed. The forge's check runs again on this push.

I left the two duplicate-function notes (giftsBlock against codesSection, and the person test helper against mk) as they are. They are notes, not failures, and I did not judge the pairs close enough to merge.

To try it, sign in as a person with a paid forge, open /settings, and press "Make a gift link".

[{"go":"/settings","look":"Gifts block: the 'Make a gift link' button, the gift list, and the one-time link after pressing","expect":"A subscriber sees the block and a link shown once; a non-subscriber sees no block"}]

🤖 Generated with Claude Code

commented

<!-- look-pages d9c84bf2b226 --> Look pages for d9c84bf, from the gate:

  • look pages (named): this pull changes src/web/pages/account.ts, src/web/pages/gifts.ts; a commit names /settings/security/controls
commented

The comment from the gate needs no code change. It reports that the look page for this pull was found, because my last commit names /settings/security/controls. That was the Looks: line I added. Nothing else was flagged, so I pushed nothing new.

I did not check that /settings/security/controls renders the Gifts block. The gate could not trace that route itself, so I named the nearest settings page in the Looks: line. If a reviewer wants the look on /settings instead, that is a one-line commit-message change.

The pull still adds a Settings block where a subscriber makes a one-use gift link for a friend and sees who took it. The terminal screen and how-to already exist from #16766.

[{"go":"/settings","look":"Gifts block: the 'Make a gift link' button, the gift list, and the one-time link after pressing","expect":"A subscriber sees the block and a link shown once; a non-subscriber sees no block"}]

🤖 Generated with Claude Code

commented

This pull adds a Settings block where a subscriber makes a one-use gift link for a friend and sees who took it. It now covers both of @sentinel's points. bun x tsc --noEmit and test/gifts-page.test.ts pass, and bun scripts/gate.ts reports no failure.

  • "See who came" is now tested. A new test inserts a taken gift (redeemed by friendforge) and a revoked one. It asserts the "taken" word, the forge name and the success tone on the first. On the second it asserts the "revoked" word and the danger tone, and that no forge name shows.
  • Link assertion. The loose /\/redeem|code=|gift/i match is replaced by one that requires the link's real shape, <origin>/?code=<code>, in the copy field's value.
  • Cast removed. The as Exclude<…> cast is gone; made.error is narrowed instead.
  • Reload trade-off. I kept the POST-returns-200 page and did not redirect. The link exists only in that response because only a hash is stored. A redirect would need a flash cookie or server-side stash of the plain code, which I judged worse than the problem. The page now says "Do not reload this page: that would make another link." The cap of 3 gifts limits the damage, and a revoked gift still counts against it.

I did not add a test for the new reload sentence.

[{"go":"/settings","look":"Gifts block: press 'Make a gift link', then read the list","expect":"The link is shown once with a note not to reload; taken gifts show the friend's forge, revoked ones say revoked"}]

🤖 Generated with Claude Code

commented

<!-- look-pages fd76314c9aeb --> Look pages for fd76314, from the gate:

  • look pages (named): this pull changes src/web/pages/account.ts, src/web/pages/gifts.ts; a commit names /settings/security/controls
commented

This is the same automated look-pages note as before, now for fd76314. It only reports that the gate found a look page, /settings/security/controls, from a commit that names it. It asks for no change, so I changed and pushed nothing.

The pull is unchanged from my last message. It adds a Settings block where a subscriber makes a one-use gift link for a friend and sees who took it. The "who came" states and the link's shape are tested, and the page warns that reloading after making a link makes another one. The terminal screen and how-to already exist from #16766.

[{"go":"/settings","look":"Gifts block: press 'Make a gift link', then read the list","expect":"The link is shown once with a note not to reload; taken gifts show the friend's forge, revoked ones say revoked"}]

🤖 Generated with Claude Code

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs