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

A tell that is refused for length or emptiness keeps what was typed and names the limit #13610

Merged opened this

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

Merged

An empty tell, or one over TELLMAX (2,000 characters), now answers 422 with the form re-rendered. The typed text stays in the box and one sentence names the limit. Nothing is filed, and the share token is not used up, so a retry goes through.

Notes

shipped production is serving it deploy 59903fa

opened this

An empty tell, or one over TELL_MAX (2,000 characters), now answers 422 with the form re-rendered. The typed text stays in the box and one sentence names the limit. Nothing is filed, and the share token is not used up, so a retry goes through. The new and edited tell tests and tsc pass, and bun scripts/gate.ts passes against the pushed commit. bun scripts/fast.ts found the diff too broad to name, so I ran the eight tell- and share-related test files by hand, not the full suite. I did not try it on a running preview.

What changed

  • POST /tell (composerSubmit): the check runs before the share token is claimed or any tell is made. The new page is src/web/studio/tell_refused.ts. It carries the target app, back, once and from as hidden fields, and the text is escaped. A JSON asker still gets a 422 with the same sentence.
  • GET /tell (share sheet): a share that is empty or too long now gets the normal form with the draft kept, the sentence above it and status 422. A bad link is still a 400 dead end, as before.
  • src/web/share_target.ts: new refuseTell(text), which gives the sentence for empty or too long. refuseShare uses it, so the terminal's share screen reads the same words.
  • test/tell-refused.test.ts covers empty, exactly 2,000 characters (told) and over. It also covers escaping of the kept text, the token not being used up, the share-sheet path and the JSON path.
  • docs/features/share-tell.md has a short section on this.

Existing tests I edited, because the old expectation was what changed

  • test/share-target-tell.test.ts and test/share-tell-tui.test.ts expected the old wording ("Nothing came through", "none of it was kept") or a 400 for empty and too-long shares.

Left out

  • src/web/pages/next-steps.ts is untouched. Its first-tell form posts to /tell, so it gets the refusal page.
  • The first-ask and per-app tell paths still have their own too-long checks. The new check runs ahead of them.
  • The refusal page has no maxlength, so a pasted over-limit text is not cut.
  • The commit says No look and No door with reasons. The gate wanted a Try: line as well: open /tell?text= followed by 2,001 letters on the preview.

Closes #13587

3 earlier comments · 1 event
commented

An empty tell, or one over TELL_MAX (2,000 characters), now answers 422 with the form re-rendered. The typed text stays in the box and one sentence names the limit. Nothing is filed, and the share token is not used up, so a retry goes through. The new and edited tell tests and tsc pass, and bun scripts/gate.ts passes against the pushed commit. bun scripts/fast.ts found the diff too broad to name, so I ran the eight tell- and share-related test files by hand, not the full suite. I did not try it on a running preview.

What changed

  • POST /tell (composerSubmit): the check runs before the share token is claimed or any tell is made. The new page is src/web/studio/tell_refused.ts. It carries the target app, back, once and from as hidden fields, and the text is escaped. A JSON asker still gets a 422 with the same sentence.
  • GET /tell (share sheet): a share that is empty or too long now gets the normal form with the draft kept, the sentence above it and status 422. A bad link is still a 400 dead end, as before.
  • src/web/share_target.ts: new refuseTell(text), which gives the sentence for empty or too long. refuseShare uses it, so the terminal's share screen reads the same words.
  • test/tell-refused.test.ts covers empty, exactly 2,000 characters (told) and over. It also covers escaping of the kept text, the token not being used up, the share-sheet path and the JSON path.
  • docs/features/share-tell.md has a short section on this.

Existing tests I edited, because the old expectation was what changed

  • test/share-target-tell.test.ts and test/share-tell-tui.test.ts expected the old wording ("Nothing came through", "none of it was kept") or a 400 for empty and too-long shares.

Left out

  • src/web/pages/next-steps.ts is untouched. Its first-tell form posts to /tell, so it gets the refusal page.
  • The first-ask and per-app tell paths still have their own too-long checks. The new check runs ahead of them.
  • The refusal page has no maxlength, so a pasted over-limit text is not cut.
  • The commit says No look and No door with reasons. The gate wanted a Try: line as well: open /tell?text= followed by 2,001 letters on the preview.
commented

A tell refused for being empty or too long now comes back as a 422 page. The page keeps what was typed and names the limit. The change touches /tell and the share target.

The check failed on two tests in test/first-ask-new-app.test.ts. They still expected the old refusal, a 303 redirect with a flash cookie. They were wrong, not the code. The refusal is now a 422 page, so I changed them to expect that status and the new sentences:

  • Empty ask: "Nothing to tell yet".
  • Over-long ask: "That is too long: a tell takes at most …".

I also removed two imports the tests no longer use. The file's 9 tests pass and bun x tsc --noEmit is clean. I didn't run the rest of the suite here; the forge's check runs it on this push.

To try it, post an empty or 2,001-character text to /tell on the preview. You get the form back with the text still in the box and the limit named.

commented

I didn't change any code in response to the check failure. None of the three failing tests touches the tell-refusal change, and all three pass when I run them here. I merged current main into the branch and pushed, so the forge re-runs the check against it.

The three failures, run one at a time here

  • test/quotas-running.test.ts, the queued-second-run test: it hit the 120 s timeout in the check. The check log says the file is green on main at 62c2159. Here it passes (7 pass, 0 fail).
  • test/surfaces-adversarial.test.ts, the needsYouCard N+1 test: it passes here (13 pass, 0 fail).
  • test/apps-slow-test.test.ts, the slow-test-step deploy: it passes here (1 pass, 0 fail).

My guess is that these were timing failures under load on a shard run that took 729 s. I haven't confirmed that. If any of them fails again on this push, it needs a closer look.

What I ran before pushing

  • bun x tsc --noEmit is clean.
  • The three tell tests I changed pass (22 tests): test/tell-refused.test.ts, test/share-target-tell.test.ts and test/first-ask-new-app.test.ts.
  • I did not run bun scripts/gate.ts --fix.
  • scripts/fast.ts reports 2,310 test files for this diff, which is over its 5-minute budget. I ran the three tell test files instead of that set.

What the pull does

A tell that is refused for length or emptiness now re-renders as a 422 page. The page keeps what was typed and names the limit. The logic is in src/web/studio/tell_refused.ts, and the callers in share_target.ts, studio/actions.ts and studio/share_tell.ts use it. test/tell-refused.test.ts is new. I updated the first-ask and share-target tests to read the refusal page instead of the old flash message.

Changes requested — before the latest push

Behaviour is right: 422, words kept and escaped, share token not claimed, JSON path covered. Fix these in one round.

  1. (Principle 1) The limit is said twice on the refusal page: the alert names it and a muted line under the box repeats it. Drop the muted line.
  2. (Keyboard and screen reader) A role=alert paragraph present on load is not reliably announced. Give the sentence an id, add aria-describedby and aria-invalid to the textarea, and autofocus it. Do the same in the GET /tell variant in share_tell.ts.
  3. (Clean and tests) The form is written twice (tell_refused.ts and share_tell.ts), and share_tell.ts has inline ternaries inside the markup; render both through one helper. In test/tell-refused.test.ts the share-token test only shows two empty posts both return 422: add a retry with real text and the same once token, asserting 303 and a thought added, so it fails if the refusal burned the token. Merge the two imports from share_target.ts. In share-target-tell.test.ts replace the regex-on-String(words) status trick with an explicit status per case row.

I did not see the new page on a 360px phone; that is still open.

commented

I've made all three changes from the review and pushed. The tell tests, tsc and design-lint pass here. I did not look at the page on a 360px phone, so that is still open.

  1. Limit said once. I dropped the muted "At most 2,000 characters." line. The alert sentence is now the only place the limit appears, and a test checks the line is gone.
  2. Announcement. The refusal sentence has id="tell-refusal". The textarea gets aria-describedby="tell-refusal", aria-invalid="true" and autofocus. This applies to both the POST refusal and the GET /tell share-sheet variant, and a test checks all of it.
  3. One form, tests tightened.

- Shared helper: a new src/web/studio/tell_form.ts renders the form for both tell_refused.ts and share_tell.ts. The ternaries inside the share_tell.ts markup are gone. - Share-token test: after two empty posts that both return 422, it retries with real text and the same once token. It asserts 303 and one more thought, so it fails if the refusal burned the token. - Imports and status cases: the two share_target.ts imports in test/tell-refused.test.ts are merged. Each case row in share-target-tell.test.ts now carries its own expected status (422 or 400) instead of the regex trick.

I also ran bun scripts/gate.ts --fix, which rewrapped comments in one file, and committed that with the rest.

Approved

All three earlier asks are met: the limit is said once (the alert sentence only), the sentence has an id and the box carries aria-describedby, aria-invalid and autofocus on both the POST and share-sheet paths, and the form is one shared helper with tighter tests. The check runs before the share token is claimed, so a retry works. The kept text is escaped, JSON askers get a 422, and the page works with JavaScript off. I could not sign in on the preview, so I read the source and tests, not the page on a phone. Next: (1) look at the refusal page on a 360px phone and confirm the textarea and Send are thumb-reachable; (2) the terminal share screen reads the same refuseTell sentence, so add one TUI test that pins the wording.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs