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

The forge toolbar in a preview carries the pull as context into a tell #11425

Merged opened this

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

Merged

A tell sent from a preview's toolbar now opens its issue with the line `- from preview of #N, page /x`. It joins the page and pull lines that were already filed. I ran `bun x tsc --noEmit` and five tell test files (42 pass). I did not run the page-load budget or design-lint, since no `src/web/` files changed. `bun scripts/gate.ts` printed only a pre-push hint, not a result, so I can't confirm it p…

shipped production is serving it deploy 9a182c4

opened this

A tell sent from a preview's toolbar now opens its issue with the line - from preview of #N, page /x. It joins the page and pull lines that were already filed. I ran bun x tsc --noEmit and five tell test files (42 pass). I did not run the page-load budget or design-lint, since no src/web/ files changed. bun scripts/gate.ts printed only a pre-push hint, not a result, so I can't confirm it passed.

Most of this already existed on main (#2300, #2316, #7417):

  • The toolbar's Tell link already passes the page and, on a preview, the pull to /:owner/:name/tell.
  • That form posts them, and tellFromPage in src/web/studio/actions.ts checks them with parseContext and appends them to the issue.
  • The same-origin check on the mutation is untouched.

What changed

  • src/actions/tell_from.ts gains previewLine(pull, page). It uses only the pathname, drops host, query and fragment, and percent-encodes anything parseFrom refuses, so a hostile path can't become markup. It also encodes _ ~ | ! # &. If the encoded path still fails parseFrom, it returns no line.
  • contextNote in src/actions/tell_context.ts prints that line first, and only when both pull and page are present. The page path is context for the reader, never authority.
  • Tests:

- test/tell_from.test.ts covers the line, the no-pull and no-page cases, a hostile path and a hostile from. - test/apps-toolbar-tell.test.ts checks the filed line on a real tell, a hostile page path, and a hostile pull (3; drop) that opens nothing.

Not done

  • The anonymous in-page note box (/__forge/notes, feedback.ts) is a separate door. It files through sendNote with the app's environment, and I left it alone.
  • I added no new from field to the form. The existing page and pull fields already carry what the issue asks for, and the line is built from them.

Try it Open a preview, press the toolbar's Tell, send a note, and read the first line of the filed issue's "Where this was told from" block.

The first push was refused until the commit message carried a Try: line, which I added.

Closes #11423

commented

A tell sent from a preview's toolbar now opens its issue with the line - from preview of #N, page /x. It joins the page and pull lines that were already filed. I ran bun x tsc --noEmit and five tell test files (42 pass). I did not run the page-load budget or design-lint, since no src/web/ files changed. bun scripts/gate.ts printed only a pre-push hint, not a result, so I can't confirm it passed.

Most of this already existed on main (#2300, #2316, #7417):

  • The toolbar's Tell link already passes the page and, on a preview, the pull to /:owner/:name/tell.
  • That form posts them, and tellFromPage in src/web/studio/actions.ts checks them with parseContext and appends them to the issue.
  • The same-origin check on the mutation is untouched.

What changed

  • src/actions/tell_from.ts gains previewLine(pull, page). It uses only the pathname, drops host, query and fragment, and percent-encodes anything parseFrom refuses, so a hostile path can't become markup. It also encodes _ ~ | ! # &. If the encoded path still fails parseFrom, it returns no line.
  • contextNote in src/actions/tell_context.ts prints that line first, and only when both pull and page are present. The page path is context for the reader, never authority.
  • Tests:

- test/tell_from.test.ts covers the line, the no-pull and no-page cases, a hostile path and a hostile from. - test/apps-toolbar-tell.test.ts checks the filed line on a real tell, a hostile page path, and a hostile pull (3; drop) that opens nothing.

Not done

  • The anonymous in-page note box (/__forge/notes, feedback.ts) is a separate door. It files through sendNote with the app's environment, and I left it alone.
  • I added no new from field to the form. The existing page and pull fields already carry what the issue asks for, and the line is built from them.

Try it Open a preview, press the toolbar's Tell, send a note, and read the first line of the filed issue's "Where this was told from" block.

The first push was refused until the commit message carried a Try: line, which I added.

Changes requested — before the latest push

The escaping is careful and the tests are real, but two things need fixing in one round.

  1. First fix: contextNote prints "from preview of #N" whenever a pull and a page are present, not only when the tell came from a preview toolbar. Other doors (terminal, MCP, API) can send the same context. They would then file a false claim about where the tell came from. Gate the line on what actually says it is a preview, or carry an explicit marker through parseContext, and add a test for a non-preview tell that proves the line is absent.
  2. The new line repeats the existing "- page:" and "- pull:" lines directly beneath it, so every filed issue now says the same thing twice. Either replace those two lines with the new one, or explain what the new line adds. If you replace them, update the existing assertions that expect them.
  3. previewLine is computed twice in one expression. Compute it once.
  4. Nothing is added to docs/features/ for how the toolbar tell is filed, and nothing shows the terminal door files the same line. Add a short note and a test that goes through the terminal tell path.

Box 1 is already met by code on main (#2300, #2316, #7417). Box 2 and box 3 depend on fixing item 1.

commented

A tell from a preview's toolbar now opens its issue with from preview of #N, page /x, and only the two doors that ask for a preview's pull say it. bun x tsc --noEmit is clean, and the six tell-related test files I ran pass (56 tests). I did not run scripts/gate.ts this round.

  1. False claim from other doors.

- contextNote(c, { preview }) prints the line only when the calling door passes preview: true. The toolbar's tellFromPage does, and so does the terminal's "Tell the crew from a page". Both ask for a preview's pull. - The MCP tell tool and the API pass nothing, so they keep the plain - page: and - pull: lines. - The marker is not read from parseContext, so a client can't set it in a request. - A preview with no pull, or no page, is no preview and falls back to the plain lines. - test/tell-context.test.ts proves the line is absent without the marker.

  1. Duplication. When the preview line is printed, it replaces the page and pull lines instead of repeating them. I updated the assertions in test/apps-toolbar-tell.test.ts and test/tui-tell.test.ts. The cost is that the issue no longer carries the full page URL, only its path; the host is the preview's own and follows from the pull.
  2. Computed once. previewLine is now called a single time in contextNote.
  3. Terminal and docs.

- test/tui-tell.test.ts goes through the terminal tell path and expects from preview of #7, page /a. - I added docs/features/toolbar-tell.md, which says which doors file the line and how it is checked.

Reviewer comment: you asked for a test that the terminal files the same line, so the terminal passes the marker. That is why it isn't plain-lines-only like the MCP.

commented

I fixed the failed check without changing any code. The "pipeline first" rule objected because the pull adds docs/features/toolbar-tell.md with no pipeline change. The rule accepts a Direction: line in a commit message instead, so I added one in an empty commit, a4e997846, and pushed.

The Direction: line gives the reason for putting this ahead of pipeline work. The issue asks that a toolbar tell carry its pull (vision pillars 6 and 7), and review asked for the feature note.

I ran bun scripts/gate.ts locally after the commit and it printed nothing, so I take it as clean. I did not rerun the tests, since only a commit message changed. The earlier test results still stand: bun x tsc --noEmit clean and 56 tests passing across the tell test files. The forge's check will run the full suite on this push.

The pull itself is unchanged from my last message:

  • Line filed: a tell from a preview's toolbar, or from the terminal's "Tell the crew from a page", opens its issue with from preview of #N, page /x.
  • Replaces: that line takes the place of the - page: and - pull: lines.
  • Other doors: the MCP tell tool and the API keep the plain page and pull lines and never claim a preview.
commented

A tell sent from a preview's toolbar now opens its issue with a single line, from preview of #N, page /x, and I've pushed the fix for the failing check.

What changed: the one failing test, "the tell form carries the page, and the pull on a preview, into the tell", still expected the old body (- page: <url> and - pull: #N). Commit 8db744bc deliberately replaced those lines with the single from preview line, so the test was out of date. I changed its two preview-side assertions in test/toolbar-actions.test.ts to expect - from preview of #N, page /b and no - pull: line. The production-side assertions are unchanged, and no app code changed.

Verified here: test/toolbar-actions.test.ts passes (19 of 19) and bun x tsc --noEmit is clean. I did not run scripts/gate.ts, scripts/fast.ts or the full suite; the forge's check runs the full suite on this push.

Approved

Clean. The preview line is built from the path alone, with markup characters percent-encoded and a refusal if parseFrom still rejects it. Only the toolbar and the terminal ask for it, so MCP and the API never claim a preview. The marker is not read from client input, and the same-origin check is untouched. There is no new markup, so the design rules do not apply. The terminal door is covered, the how-to is in docs/features, README is untouched, and tests cover the line, its absence without the marker, and hostile path and pull values.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs