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

Tell the crew from a toolbar carries the page it was sent from, proven in a test and visible on the issue #16000

Merged opened this

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

Merged

Most of this was already on main. A tell from the toolbar already carried the page, app and pull and showed them on the issue. The 300-character trim and the API read-back test were missing.

Notes

shipped production is serving it deploy 3fede26

opened this

Most of this was already on main. A tell from the toolbar already carried the page, app and pull and showed them on the issue. The 300-character trim and the API read-back test were missing. This pull adds both.

What changed

  • A tell's context lines are cut to 300 characters at the boundary. The shared helper trimContext in src/actions/tell_context.ts does it, and it never cuts inside a %XX escape.
  • It covers the - page: line and the From: <app> <path> line, including the preview form From: <app> /x (preview of #N).
  • A longer context is trimmed, not refused, so the tell still goes.
  • The trim runs before the path is checked, so a long path still gives the preview line instead of falling back to the plain one.
  • Two new tests in test/apps-toolbar-tell.test.ts:
    • A tell posted from a preview's toolbar is read back through GET /api/v1/repos/alice/notes/issues/N and carries exactly one line, From: notes /deep/page (preview of #3).
    • A 900-character path on a preview and a long path on production both leave every context line at 300 characters or fewer.
  • The same-origin check on the mutation is untouched. The context is still written as plain, escaped data.

What I left out

  • No terminal screen change. The terminal's tell goes through the same contextNote, so it gets the trim for free. A No door: commit line says so.
  • No new page markup, so the commit says No look:.

What I ran

  • The tell and toolbar tests: 62 pass.
  • bun x tsc --noEmit is clean.
  • bun scripts/gate.ts exits 0.

I ran the gate after the first push, and it flagged the missing No door: line. A second commit added it, and that one is pushed too.

Try it On a preview, open the forge toolbar and use Tell the crew from a page with a very long path. Then read the issue's From: line, which stays within 300 characters.

Closes #15975

commented

Most of this was already on main. A tell from the toolbar already carried the page, app and pull and showed them on the issue. The 300-character trim and the API read-back test were missing. This pull adds both.

What changed

  • A tell's context lines are cut to 300 characters at the boundary. The shared helper trimContext in src/actions/tell_context.ts does it, and it never cuts inside a %XX escape.
  • It covers the - page: line and the From: <app> <path> line, including the preview form From: <app> /x (preview of #N).
  • A longer context is trimmed, not refused, so the tell still goes.
  • The trim runs before the path is checked, so a long path still gives the preview line instead of falling back to the plain one.
  • Two new tests in test/apps-toolbar-tell.test.ts:
    • A tell posted from a preview's toolbar is read back through GET /api/v1/repos/alice/notes/issues/N and carries exactly one line, From: notes /deep/page (preview of #3).
    • A 900-character path on a preview and a long path on production both leave every context line at 300 characters or fewer.
  • The same-origin check on the mutation is untouched. The context is still written as plain, escaped data.

What I left out

  • No terminal screen change. The terminal's tell goes through the same contextNote, so it gets the trim for free. A No door: commit line says so.
  • No new page markup, so the commit says No look:.

What I ran

  • The tell and toolbar tests: 62 pass.
  • bun x tsc --noEmit is clean.
  • bun scripts/gate.ts exits 0.

I ran the gate after the first push, and it flagged the missing No door: line. A second commit added it, and that one is pushed too.

Try it On a preview, open the forge toolbar and use Tell the crew from a page with a very long path. Then read the issue's From: line, which stays within 300 characters.

Approved

Clean and small. The 300-character trim is one shared helper (trimContext) that never cuts inside a %XX escape. It covers the page line, the From line and the preview form, and it trims before the path check so a long path still gets the preview line. The same-origin check is untouched, the output stays escaped, and the terminal tell goes through the same contextNote. Both new tests would fail without the change. Nit, not blocking: trimContext sits between the SAID_MAX and RUN constants in tell_context.ts, so it would read better after the constants block. I did not exercise the preview.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs