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

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

opened this

Merged 18d 13h ago, live in production

A share can now carry one sentence of the sharer's own, and the recipient's feed card reads "shared by X: ". 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.

Notes

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
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.

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.

Sign in to join this conversation.

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

Keyboard shortcuts

Docs