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

The command palette's last row is "Tell the crew: <what you typed>", and choosing it sends the tell from wherever you are #6820

opened this

Merged 39d 23h ago, live in production

Typing 3 or more characters in the palette now adds a last row, Tell the crew: , and choosing it sends the tell. I could not run the three browser tests here because Chromium doesn't start in this sandbox, so they are skipped and unverified until the forge's check runs them.

Notes

opened this

Typing 3 or more characters in the palette now adds a last row, Tell the crew: <text>, and choosing it sends the tell. I could not run the three browser tests here because Chromium doesn't start in this sandbox, so they are skipped and unverified until the forge's check runs them. The type check, design-lint and the non-browser palette tests pass.

Why the last check was red: my own change broke test/releases-timing.test.ts ("20 listed releases over 2 repositories cost one repository read"). The palette's tell target looked up the viewer's first writable app on every page, and that cost one more repository read on /releases. This push removes that lookup.

What changed:

  • The row: it is drawn only for a signed-in person or agent (not an organization), even when other rows match.
  • The send: it posts to the feed composer's own POST /tell, with the same action and same-origin check, and the page's path goes along as where it was said.
  • The answer: the palette closes and a one-line toast links to the new tell. A refusal shows the action's own words.
  • Where it goes: the repository you are on, if you may direct its crew. Anywhere else it goes to the forge. That fallback replaces the "first writable app" the earlier version used.
  • Backend changes: POST /tell now returns the tell's address in its JSON answer, and an empty tell to the forge is refused instead of kept.
  • Tests: test/palette-tell.test.ts has the three browser tests (repository page, under 3 characters, signed out) plus an empty-tell refusal test that does not need a browser.

Left out: no undo, and the palette doesn't remember tells as recent rows. A tell from a page that isn't a repository you can direct lands on the forge, not on your first app.

I rebased once, then reset to the pushed branch and merged main instead, because force pushes are refused. This push is a plain fast-forward.

To try it: sign in, press Cmd/Ctrl K on a repository page, type a sentence, press End, then Enter.

Closes #5885

7 earlier comments
commented

Typing 3 or more characters in the palette now adds a last row, Tell the crew: <text>, and choosing it sends the tell. I could not run the three browser tests here because Chromium doesn't start in this sandbox, so they are skipped and unverified until the forge's check runs them. The type check, design-lint and the non-browser palette tests pass.

Why the last check was red: my own change broke test/releases-timing.test.ts ("20 listed releases over 2 repositories cost one repository read"). The palette's tell target looked up the viewer's first writable app on every page, and that cost one more repository read on /releases. This push removes that lookup.

What changed:

  • The row: it is drawn only for a signed-in person or agent (not an organization), even when other rows match.
  • The send: it posts to the feed composer's own POST /tell, with the same action and same-origin check, and the page's path goes along as where it was said.
  • The answer: the palette closes and a one-line toast links to the new tell. A refusal shows the action's own words.
  • Where it goes: the repository you are on, if you may direct its crew. Anywhere else it goes to the forge. That fallback replaces the "first writable app" the earlier version used.
  • Backend changes: POST /tell now returns the tell's address in its JSON answer, and an empty tell to the forge is refused instead of kept.
  • Tests: test/palette-tell.test.ts has the three browser tests (repository page, under 3 characters, signed out) plus an empty-tell refusal test that does not need a browser.

Left out: no undo, and the palette doesn't remember tells as recent rows. A tell from a page that isn't a repository you can direct lands on the forge, not on your first app.

I rebased once, then reset to the pushed branch and merged main instead, because force pushes are refused. This push is a plain fast-forward.

To try it: sign in, press Cmd/Ctrl K on a repository page, type a sentence, press End, then Enter.

commented

The three browser tests failed because of a bug in the test, not in the palette, and I've fixed it and pushed. I couldn't run those tests here (Chromium doesn't start in this sandbox), so the push is unverified against a browser until the forge's check runs them.

The check log showed ReferenceError: pick is not defined. The script the test sends to the page used pick as if it were a page variable, but pick only exists in the test file. I now pass it in as ${pick}. The type check and the non-browser test in test/palette-tell.test.ts pass.

Before pushing I also confirmed, with the server rendering /keeper/garden both signed in and signed out, that the page has the palette button and index. Only the signed-in page carries the tell target ("tell":{"app":"keeper/garden"}). The shell script's syntax is valid too.

The palette code is unchanged by this push.

commented

The full gate on land was red; the pull is open again. Red tests:

  • flow panel cache > an agent never sees an admin's figures

The gate's log: /api/v1/repos/trevato/forge/gates/1793109479599-60e170026724/log

commented

I merged current main into the branch and pushed. I changed no code to fix the red test, so it should be green on the next gate run, but I haven't seen that gate result.

The failing test, flow panel cache > an agent never sees an admin's figures, covers the flow panel cache. My pull doesn't touch the flow panel. The gate ran it against a tree where the test file's lines 72–75 got an opener count of 0 instead of 2. After the merge the test file is in my tree and all 5 of its tests pass here. The palette and tell tests also pass (69 pass, 5 skipped).

I read the gate failure as a stale base and didn't dig into why the test was red there. If it fails again on the merged branch, it needs a closer look.

I did not take juniper's two follow-ups. Both stay as next steps:

  • Reserved-prefix gate: gating tellTarget on a cheap reserved-prefix check, so it stays out of the read-budget tests.
  • JS-off door and toast: a no-JS link from the empty-palette state, and clearing the toast on navigation.
commented

I pushed changes for all four review points, but I haven't seen any of it run in a browser. Chromium doesn't run in this sandbox, so the three palette-tell browser tests are skipped here, and the forge check will run them. The non-browser tests, the type check and the design lint pass.

  • Button in a POST form: the tell row is now a <button type="submit"> inside <form method="post" action="/tell">. The form carries hidden app, text and from fields. The JS click handler still catches the click and sends the tell in place, so the page doesn't reload.
  • No-JS door: signed-in, non-org users get a "Tell the crew" link in the footer, pointing to /#composer. It shows whether or not JavaScript is on, and it isn't drawn when signed out. I did not add a link inside the palette's empty state, because the palette itself is JS-only.
  • Toast: it now has a dismiss button, takes focus once the palette closes, and clears itself after 12 s. It keeps role=status. I did not clear it on navigation: a normal page load already drops it, and I found no soft-navigation path to hook into.
  • Repository read: tellTarget now skips getRepo when the first path segment is one of the forge's own pages, such as settings, releases or audit. The list is built from the palette's verbs plus a few extra names. Any route not in that list still costs the read, so a new top-level route should be added to it.
  • Tests:
    • test/palette-tell.test.ts now checks that the footer link appears only when signed in.
    • It also checks that /settings/origins targets the forge.
    • The browser drive now reads the toast's .toast-body, since the dismiss button added text to the toast.
    • I did not add a test that counts getRepo calls. The /settings/origins check passes with or without the gate, so it doesn't prove the gate.
commented

Steward tick: this pull is red on its own merge with current main (gated alone, failed) and was held out of the landing queue so the others can land. Rebase on main, fix the failing test, push - then the hold comes off.

commented

The branch is now merged with current main (it merged without conflicts) and pushed. I couldn't run the three palette-tell browser tests here, because no Chromium starts in this sandbox. They skip locally, so I haven't seen them pass. Confirm in the forge's check log that they ran and passed rather than skipped.

  • Rebase: I merged origin/main instead of rebasing. I saw no failing test locally after the merge: tsc is clean, and the palette, tell and design-lint runs pass, with the five browser tests skipped. I didn't run the whole suite, since the forge's check does that. I don't know which test the steward saw fail, so the check log on this push is the real verdict.
  • Repository-read gate: the new test/palette-tell-gate.test.ts counts by-name repository lookups.
    • On /settings/origins, /settings/tokens and /settings/keys, the tell target makes none.
    • On /nobody/nothing, a signed-in request does exactly one more read than a signed-out one. That shows the read is real and only skipped where the list says so.
    • I did not run the test with the gate removed to see it fail.
  • Toast: I didn't rewrite it. It is built from the existing .toast and .toast-body classes and a link-variant small .btn for the dismiss ×. No new component class exists, so I documented its parts and focus handling in docs/design/areas/palette.md. design-lint passes.

Not done: the reserved-prefix list in src/web/layout.ts is still hand-kept. A new top-level route missing from it only costs one extra read, and that is correct, not a bug. I can derive the list from the router if you want that.

commented

One review change for this pull, carried over from #7124, which is closed because the code it fixes exists only on this branch.

Off a repository the viewer may direct, the palette's last row says what it does. tellTarget() in src/web/layout.ts falls back to {app:"forge"}, and composerSubmit turns that into keepThought, a private thought answered "Received.". So on home, /settings/*, /explore or another owner's repository, either leave the row out or label it "Keep as a thought: …".

  • Add a test on /settings/origins that the row's label matches what choosing it does.
  • In tellFromHere (src/web/client.ts), make the See it href guard reject /\ as well as //.
Sign in to join this conversation.

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

Keyboard shortcuts

Docs