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

The client list shows when each sent forge link was first opened and last seen, in plain words #12726

opened this

Closed 19d 1h ago

Each row of the sender's client list at /forges now reads "sent · opened " or "not opened yet", plus "last seen " once the client has signed in. Only the sender's list shows it. The client's own forge shows nothing of it.

Notes

opened this

Each row of the sender's client list at /forges now reads "sent <day> · opened <day>" or "not opened yet", plus "last seen <relative>" once the client has signed in. Only the sender's list shows it. The client's own forge shows nothing of it.

The new test/client-link-seen.test.ts and the existing claim and client-state tests pass. tsc and design-lint printed no errors, and gate.ts printed no failures. I did not run the full suite. scripts/fast.ts found the diff too broad (1960 files), so I ran only the claim and client-state files. I have no before/after screenshots: the sandbox can't reach a preview of this branch.

  • Where the open is recorded: the child stores the first-opened time inside the claim row it already keeps in user_setting. The nullable column the issue allowed turned out not to be needed, so there is no migration. A freshly minted link starts clean.
  • What counts as opening: noteOpened runs when GET /claim serves an open link. It requires an Accept header containing text/html and rejects any Purpose, Sec-Purpose, X-Purpose or X-Moz header naming a prefetch, preview or prerender. HEAD is ignored, and the first open sticks. The check is isBrowserOpen in src/spawn/claim.ts.
  • How it reaches the sender: the child reports openedAt in the link state it already gives the parent, and seenOf in src/spawn/clients.ts turns that into the words. Nothing is shown while the forge is still being made or hasn't answered.
  • Stage badge: an unclaimed link that has been opened now shows the "Opened" stage instead of "Sent".
  • Tests: the new file covers unopened, opened, signed in, the header rules, and a live /claim served to an unfurl and to a browser.
  • Not done: older forges whose link was already spent show their spend time as "opened", because the real open was never recorded. I did not add MCP or terminal wording for this, only the page.

To try it, send a forge, open its claim link in a browser, then reload /forges.

🤖 Generated with Claude Code

Closes #12694

3 earlier comments
commented

Each row of the sender's client list at /forges now reads "sent <day> · opened <day>" or "not opened yet", plus "last seen <relative>" once the client has signed in. Only the sender's list shows it. The client's own forge shows nothing of it.

The new test/client-link-seen.test.ts and the existing claim and client-state tests pass. tsc and design-lint printed no errors, and gate.ts printed no failures. I did not run the full suite. scripts/fast.ts found the diff too broad (1960 files), so I ran only the claim and client-state files. I have no before/after screenshots: the sandbox can't reach a preview of this branch.

  • Where the open is recorded: the child stores the first-opened time inside the claim row it already keeps in user_setting. The nullable column the issue allowed turned out not to be needed, so there is no migration. A freshly minted link starts clean.
  • What counts as opening: noteOpened runs when GET /claim serves an open link. It requires an Accept header containing text/html and rejects any Purpose, Sec-Purpose, X-Purpose or X-Moz header naming a prefetch, preview or prerender. HEAD is ignored, and the first open sticks. The check is isBrowserOpen in src/spawn/claim.ts.
  • How it reaches the sender: the child reports openedAt in the link state it already gives the parent, and seenOf in src/spawn/clients.ts turns that into the words. Nothing is shown while the forge is still being made or hasn't answered.
  • Stage badge: an unclaimed link that has been opened now shows the "Opened" stage instead of "Sent".
  • Tests: the new file covers unopened, opened, signed in, the header rules, and a live /claim served to an unfurl and to a browser.
  • Not done: older forges whose link was already spent show their spend time as "opened", because the real open was never recorded. I did not add MCP or terminal wording for this, only the page.

To try it, send a forge, open its claim link in a browser, then reload /forges.

🤖 Generated with Claude Code

commented

The client list now shows, for each row on the sender's /forges page, when the link was sent, whether and when it was opened, and when the client was last seen. This push fixes what was failing in the gate.

What changed

  • Opened and last seen. The client forge notes the first real browser GET of its claim page in the claim row it already keeps, so there is no migration. A request with a prefetch or preview header, or an Accept header that isn't HTML, doesn't count. That change is in src/spawn/claim.ts and src/spawn/clients.ts, and the row text is built in src/web/pages/forges.ts.
  • Test. test/client-link-seen.test.ts covers it.

The failure and the fix

  • Cause. The preview deploy log I was given showed only /_measure cross-origin warnings, and the preview answers /healthz with 200. The failure I could reproduce was scripts/gate.ts. It rejected five comment lines over 100 columns in claim.ts, clients.ts and forges.ts, and wanted a Looks: or No look: line for the changed pages.
  • Fix. I rewrapped the comments and added a No look: line. /forges shows clients only to a sender who has made forges, and the preview doesn't seed that, so no page in app.looks shows it. I did not look into the /_measure warnings. They are the preview's measure beacon posting from http://…:8080 to an https origin, which the same-origin check refuses, and this change doesn't touch it.

Checks run before pushing

  • bun scripts/gate.ts is clean.
  • bun x tsc --noEmit is clean.
  • bun scripts/design-lint.ts is clean.
  • The new test file passes: 6 tests.
  • I did not run the full suite; the forge runs it on the push.

To try it: as the sender, open /forges and read the sent, opened and last seen words on each client row.

commented

The sender's client list now carries one line, "sent 3d ago · opened 1d ago · last seen 2h ago", on both /forges and the terminal's forges screen. Gate, tsc, design-lint and the 19 tests in the two client test files pass. I ran about 60 related test files before the final edits; the only failure was test/client-states.test.ts, which I updated (below). I did not re-run that wider set afterwards.

  • Terminal: the terminal's client list shows the line to an admin only; a guest sees none of it. The page and the terminal build it from the same seenOf and seenParts.
  • Days: dates are now the row's relative words ("3d ago"), not raw ISO days.
  • One line: the line replaces the separate stage ("Sent", "Opened", "Signed in") and "a person last did something" words, on the page and in the terminal. A resend notice and the last tell keep their own words.
  • Old spent links: a link spent before opens were noted now reads "opened (time not noted)", with no guessed day. This changes seenOf, so its openedAt is null for those links.
  • Docs: docs/features/forge-link-states.md now says what the line means. "Opened" means a browser asked, not that a person read it. Prefetch, unfurl and non-HTML requests don't count. The headers are client-written, so anyone holding the link can mark it opened, once per link and only while it is open. The child's own /welcome never notes an open, and old spent links read "opened (time not noted)".
  • New tests: in test/client-link-seen.test.ts for the terminal line, the guest case, the old-link wording, the folded line, and /welcome noting no open. The /welcome test also checks the child's own / and /forges don't render the words.
  • Weaker than you asked: the child-pages check only looks at / and /forges, which don't list any clients there.
  • Changed test: I changed test/client-states.test.ts, which asserted the old standalone "Sent" stage text on the page. That is the duplication you asked me to remove, so the test was out of date.
  • Not done: I did not add a No door: line, because the terminal door is added. The commit carries No look: …, since no app.looks page lists a made client, which the preview lacks. I did not make the claim page's write on GET authenticated. It can't be, since the visitor is unauthenticated, so I documented the limit instead.
commented

Declined: there is nothing in this pull to fix, and I pushed nothing. The only failure the check counted against it, test/origin-ahead.test.ts ("a reading stuck on a slow origin does not hold the sweep"), passes here three runs out of three (11 tests, 0 failures). Run log: https://forge.open-platform.sh/trevato/forge/runs/01m7dq5yg2nmbt43z0z4k8vhcz

Sign in to join this conversation.

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

Keyboard shortcuts

Docs