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

A share can carry one sentence, so it reads as a quote #12450

Merged opened this

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

Merged

A share can now carry one sentence of the sharer's own, and the recipient's feed card reads "shared by X: <note>".

shipped production is serving it deploy 635dde5

opened this

A share can now carry one sentence of the sharer's own, and the recipient's feed card reads "shared by X: <note>".

What changed

  • POST /api/v1/share and the MCP share tool take an optional note. It is trimmed and must be 1–280 characters with no control characters. The same check (parseNote in src/core/shares.ts) runs for both doors. With no note the card reads as it did before.
  • The note is stored on the share row (new migration 20261114090000-a-share-note, pinned). It is not part of the dedupe: sharing the same item to the same person again with a different note still comes back duplicate.
  • The recipient's feed item, the page card and the terminal feed all read their words from the same field. The page card escapes it, so a <script> note renders as text. The terminal prints plain text and I did not add a terminal-specific test.
  • When the recipient is an agent, the steering or told comment carries the note in place of the item's words.
  • The recipient-must-read rule still runs first; the note changes nothing about who can be reached.
  • docs/FEED.md Sharing section has the one line, and the route signature now shows note?.

Chose differently

  • A bad note answers 400 as the issue says, while the neighbouring item and to errors on the same route stay 422. The 400 body names the 280 limit.
  • The new tests are in test/feed-share.test.ts, as the issue asked.

Tests bun test on test/feed-share.test.ts, test/share.test.ts, test/mcp-size.test.ts and test/schema-migrations.test.ts passes (51 tests). tsc --noEmit is clean. scripts/gate.ts and scripts/design-lint.ts ran without reporting a problem. I ran the changed share tests and the MCP size and migration checks, not the full suite. The MCP tool gained one optional parameter, and the size test passes without a ceiling change.

Try it Send POST /api/v1/share with {"item":"event:…","to":["bob"],"note":"worth a look"}, then open bob's feed. A 281-character note, a blank one, or one with a control character returns 400.

I added an empty "Try:" commit because the repository's pre-push hook rejected the first push without one.

🤖 Generated with Claude Code

Closes #12399

3 earlier comments · 1 event
commented

A share can now carry one sentence of the sharer's own, and the recipient's feed card reads "shared by X: <note>".

What changed

  • POST /api/v1/share and the MCP share tool take an optional note. It is trimmed and must be 1–280 characters with no control characters. The same check (parseNote in src/core/shares.ts) runs for both doors. With no note the card reads as it did before.
  • The note is stored on the share row (new migration 20261114090000-a-share-note, pinned). It is not part of the dedupe: sharing the same item to the same person again with a different note still comes back duplicate.
  • The recipient's feed item, the page card and the terminal feed all read their words from the same field. The page card escapes it, so a <script> note renders as text. The terminal prints plain text and I did not add a terminal-specific test.
  • When the recipient is an agent, the steering or told comment carries the note in place of the item's words.
  • The recipient-must-read rule still runs first; the note changes nothing about who can be reached.
  • docs/FEED.md Sharing section has the one line, and the route signature now shows note?.

Chose differently

  • A bad note answers 400 as the issue says, while the neighbouring item and to errors on the same route stay 422. The 400 body names the 280 limit.
  • The new tests are in test/feed-share.test.ts, as the issue asked.

Tests bun test on test/feed-share.test.ts, test/share.test.ts, test/mcp-size.test.ts and test/schema-migrations.test.ts passes (51 tests). tsc --noEmit is clean. scripts/gate.ts and scripts/design-lint.ts ran without reporting a problem. I ran the changed share tests and the MCP size and migration checks, not the full suite. The MCP tool gained one optional parameter, and the size test passes without a ceiling change.

Try it Send POST /api/v1/share with {"item":"event:…","to":["bob"],"note":"worth a look"}, then open bob's feed. A 281-character note, a blank one, or one with a control character returns 400.

I added an empty "Try:" commit because the repository's pre-push hook rejected the first push without one.

🤖 Generated with Claude Code

commented

A share can carry one sentence of the sharer's own, shown escaped on the recipient's card. It is limited at the boundary and is not part of the dedupe.

This push fixes the failed gate check. The header comment on line 1 of test/feed-share.test.ts was 111 columns, over the 100-column limit, so I rewrapped it onto three lines. Nothing else changed.

Before pushing, bun scripts/gate.ts and bun x tsc --noEmit passed, and so did the 5 tests in test/feed-share.test.ts. I ran only that file, not the whole suite.

To try it, POST /api/v1/share with {item, to:["bob"], note:"worth a look"}, then open bob's feed.

commented

A share can carry one sentence of the sharer's own, shown escaped on the recipient's card. It is limited at the boundary and is not part of the dedupe. This push fixes the check's docs failure; I can't tell yet whether the other seven failures are flaky.

  • Fixed: the MCP share tool gained a note argument, so the tool table in docs/MCP.md had gone stale. I regenerated it with bun scripts/mcp-table.ts; test/mcp-table.test.ts now passes (8 of 8). The gate and bun x tsc --noEmit pass.
  • Not reproduced: the check named 8 failures but its log was cut off after three. Two of them, "a writer's shift is the same commit…" (test/render-subtitles-shift.test.ts) and the packs-mirror test (test/packs-mirror.test.ts), pass here. They look like timing problems under load on the check box, and nothing in this pull touches them. I never saw the other five names, so I haven't run them. If they fail again on this push, send me the full list.
  • Not done: I did not run the whole suite locally.

To try it, POST /api/v1/share with {item, to:["bob"], note:"worth a look"}, then open bob's feed.

Changes requested — before the latest push

One thing to fix first: the note never reaches the terminal feed. src/tui/screens/feed.ts:168 builds each row title from item.actor ?? item.app + item.what; it never reads item.reason, which is where the note lives (src/feed/feed.ts said). So a recipient in the terminal sees the item's words and no note. The pull description says the terminal reads the same field. It does not. Box 2 asks for the note on the page and in the terminal feed screen. Fix: for a shared item, show reason (shared by X: <note>, passed through oneLine so a note cannot add rows) in the row title, or in the row's note/secondary line. Add a test in the TUI feed tests that a shared item with a note renders it and a <script> note appears as plain text.

Also: the terminal has no way to share with a note. AGENTS.md wants both doors, and the pull adds the page/API/MCP note only. If a share screen or key exists in src/tui, give it a note input; if none exists, open an issue for it and say so in the pull.

The rest is sound: parseNote at the boundary, the migration and its pin, the dedupe untouched, FEED.md and MCP.md updated, and a 400 naming 280. The card on the page escapes the note.

commented

I disagree with the first point: the note already reaches the terminal feed, so I changed no feed code and added a test that proves it.

  • Why the note is already there: src/feed/rank.ts:165 sets a feed item's what to the candidate's said, and said is shared by X: <note>. The row title in src/tui/screens/feed.ts:168 is built from item.what through oneLine. So the row reads alice shared by alice: <note>, and oneLine already stops a note from adding rows. Adding reason to the title would print the same sentence twice, so I left it out.
  • The new test: test/tui-feed-share-note.test.ts shares an item with the note <script>x</script>\nread this. It renders bob's feed screen in a headless terminal and expects shared by alice: <script>x</script> read this on one line, as plain text. It passes without any change to the feed code. The gate and bun x tsc --noEmit pass; I ran only this test file, not the whole suite.
  • The terminal share door: nothing in src/tui can share an item, with or without a note. That predates this pull, since the terminal feed has no share key at all. I opened issue #12497 for a key that asks for recipients and an optional note, and did not build it here.

The pull adds the note on the page, over the API and through MCP, and the terminal shows it. A terminal door to share with a note waits on #12497.

To try it, POST /api/v1/share with {item, to:["bob"], note:"worth a look"}, then open bob's feed on the page or in the terminal.

Approved

Earlier ask (the terminal feed must show the note, with a test) is met: test/tui-feed-share-note.test.ts renders the recipient terminal feed and finds the note as plain text on one line, and the page card test shows a script note escaped. The note is validated once in parseNote for both the route (400 naming 280) and the MCP tool, stored on the row, and kept out of the dedupe. The migration is pinned and the docs and MCP table are updated. Non-blocking: the terminal still has no key to send a share with a note; that predates this pull and is tracked in #12497. I could not diff against 49a3a120d578 (not in the clone), so I judged the head as a whole.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs