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

Refused feed replies and review-line comments keep the typed text #16810

Merged opened this

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

Merged

A refused reply from the feed or board, and a refused review-line comment on a pull's diff, now come back as a 422 page with the typed words in the textarea. The page names the failing field, and nothing redirects with a flash any more.

Notes

opened this

A refused reply from the feed or board, and a refused review-line comment on a pull's diff, now come back as a 422 page with the typed words in the textarea. The page names the failing field, and nothing redirects with a flash any more.

I ran test/feed-reply.test.ts, test/comment-forms-refused.test.ts and test/feed-reply-comment.test.ts (all pass), and bun x tsc --noEmit and bun scripts/design-lint.ts (both clean). I also ran test/diff-review-comment.test.ts, test/board.test.ts, test/issues-comment-on-pull.test.ts, test/come-back.test.ts, test/feed-journey.test.ts and test/guest-pull.test.ts, whose only failures were the old-behaviour tests I updated. scripts/fast.ts named 2,658 of 4,516 test files, so I picked those myself and did not run the whole suite.

What changed

  • Issue comments (src/web/pages/issues.ts): a refused reply from the feed or board is drawn in place on the issue page, as the thread's own form already was. back=feed and back=board still send a successful reply home.
  • Pull comments (src/web/pages/pull.ts): the same for a refused reply from the feed.
  • Review-line comments (pullReviewSubmit): a refusal for a missing line, empty text, over-long text or a bad anchor is drawn on the pull's Files page. The comment form reopens at that line with the typed words and the message beside it. This also covers the Reply form on an existing line thread.
  • Diff view (src/web/diff-view.ts): the line-comment textarea now goes through the shared field and kept helpers, so the words are escaped and the field is marked invalid. It takes a new refused option.
  • What I reused: refuseHere, refusedHere, kept and asRefusal from src/web/form.ts, and the ui field. I added no new function, so scripts/similar.ts had nothing to list.

Tests

  • New: each form, refused, answers 422 with the typed text escaped in its textarea. That covers feed and board replies on an issue, a feed reply on a pull, and a review-line comment.
  • Rewritten: four old tests in comment-forms-refused.test.ts, feed-reply-comment.test.ts and feed-reply.test.ts asserted the redirect and flash for refused feed replies. The behaviour they pinned is what the issue asks to remove, so I changed them to expect the in-place page.
  • docs/features/feed-reply.md describes the new behaviour.

Left alone

  • An origin refusal (someone else's connected origin) still redirects with its flash. test/comment-forms-refused.test.ts pins that, and it has no field to blame.
  • Success still redirects.
  • A retry from the in-place page posts from the thread's composer, so it lands on the thread rather than back on the feed. I took that as the cost of drawing in place.
  • The pre-push hook wanted a commit saying how to try it, so there is an empty Try: commit on the branch.

To try it: on /feed, send a reply over 64 KB, or send a blank one. You get the thread page with your words kept and the box marked. On a pull's Files tab, open a line's +, submit a blank comment, and the form reopens at that line.

[
  {"go":"/feed","look":"Reply under a post with an empty or 70,000-character body","expect":"Thread page at 422, comment box holds the typed words, error beside it, no redirect"},
  {"go":"/<owner>/<repo>/pulls/<n>/files?rc=<path>~new~1","look":"Submit a blank line comment","expect":"Files page redraws with the form open at that line, message shown, typed text kept"}
]

Closes #16272

Show 1 earlier items

7 earlier comments
commented

<!-- look-pages 8fb9ed0e79f2 --> Look pages for 8fb9ed0, from the gate:

  • look pages (inferred): this pull changes src/web/diff-view.ts, src/web/pages/issues.ts, src/web/pages/pull.ts; the forge pictures / (src/web/diff-view.ts), /docs (src/web/diff-view.ts), /explore (src/web/diff-view.ts) and 28 more, the pages whose routes import it. A "Looks: <path>" or "No look: <why>" line in a commit message overrides
commented

A refused reply on the feed or the board, and a refused review-line comment on a pull, now redraws the page in place. The words you typed stay in the box and the refusal message sits beside it. Before this, only a reply typed on the issue's own page did that.

The last check failed on the "both doors" rule. I added a "No door:" line to a new empty commit, 2e31baacd, and pushed it. The terminal composes comments in its own prompt and shows a refusal where it was typed, so it has no form to redraw. I did not add any src/tui/ change.

I did not rerun bun scripts/gate.ts as a pass/fail, tsc or the tests after that commit. The commit changes no code, and the earlier commits' tests passed before the first push. The gate's --fix found nothing to rewrap and left the working tree clean.

What changed

  • src/web/pages/issues.ts sends every refused comment through one in-place redraw, refuse, so the feed and board no longer bounce back with a flash message.
  • src/web/pages/pull.ts and src/web/diff-view.ts do the same for review-line comments.
  • docs/features/feed-reply.md and the tests in test/feed-reply.test.ts, test/feed-reply-comment.test.ts and test/comment-forms-refused.test.ts now cover the in-place behaviour.

Left alone

  • A refusal for a bad origin still goes back with a flash message.
  • One comment line in src/web/diff-view.ts is over 100 columns. The gate only notes it and the nightly rewrap handles it on main.

To try it: open /feed, send a reply of 70,000 characters, and see the refusal drawn in place with your words still in the box.

🤖 Generated with Claude Code

commented

<!-- look-pages 2e31baacdf53 --> Look pages for 2e31baa, from the gate:

  • look pages (inferred): this pull changes src/web/diff-view.ts, src/web/pages/issues.ts, src/web/pages/pull.ts; the forge pictures / (src/web/diff-view.ts), /docs (src/web/diff-view.ts), /explore (src/web/diff-view.ts) and 28 more, the pages whose routes import it. A "Looks: <path>" or "No look: <why>" line in a commit message overrides
commented

The comment from @trevato is the gate's automatic look-pages note, not a request for a change, so I made no change and pushed nothing.

The gate inferred the look pages from the files this pull touches. It lists /, /docs, /explore and 28 more, because their routes import src/web/diff-view.ts. A "Looks:" or "No look:" line in a commit message would override that list.

I'm leaving the inferred list as it is. The diff-view.ts edit only changes how a refused review-line comment is drawn. The listed pages don't show a refusal in their normal state, so a picture of them would look unchanged. The pages this pull actually changes are the feed, the board and the pull's review lines when a comment is refused. I can add a "Looks:" line for those if a person wants them pictured.

The pull's state is unchanged from my previous message: the "No door:" commit 2e31baacd is pushed, and I have not rerun the gate, tsc or the tests since then.

🤖 Generated with Claude Code

commented

Both requested changes are in and pushed (fbea57664). tsc is clean, and test/feed-reply.test.ts and test/comment-forms-refused.test.ts pass, 36 tests. I did not run the full suite.

The fix. A refused review-line comment now always shows its message. When no diff row takes the form, a "Your review comment" box with the message and the typed words (escaped) is drawn above the diff. This covers a missing line, a stale anchor (bad_anchor) and a path not in the diff. When a row does exist, the form still reopens at its line as before. The fallback is in src/web/pages/pull.ts and reuses the existing field and kept, so there are no new component classes.

Tests. I added four to test/feed-reply.test.ts, each asserting the message text is in the 422 page. The blank-body test checks only the message; the other three also check the typed words. The four cases are:

  • a blank body
  • a missing line
  • a stale anchor (line 9999)
  • a path not in the diff

Thread reply claim. I'm removing the claim that the Reply form on an existing line thread reopens with its words kept. This diff doesn't touch thread-reply rendering, and no test covers it.

Import line. I split the over-long import line in src/web/diff-view.ts. The gate still notes a comment line over 100 columns in that file. It only notes it, and the nightly rewrap handles it on main.

The new commit carries a "No door:" line, because the terminal composes review comments in its own prompt.

The gate also flagged pullReviewSubmit as 0.57 similar to pullCommentSubmit ("one implementation?"). I left them separate because their refusal paths differ.

🤖 Generated with Claude Code

commented

<!-- look-pages fbea576643f7 --> Look pages for fbea576, from the gate:

  • look pages (inferred): this pull changes src/web/diff-view.ts, src/web/pages/issues.ts, src/web/pages/pull.ts; the forge pictures / (src/web/diff-view.ts), /docs (src/web/diff-view.ts), /explore (src/web/diff-view.ts) and 28 more, the pages whose routes import it. A "Looks: <path>" or "No look: <why>" line in a commit message overrides
commented

This is the gate's automatic look-pages note for fbea576. It is the same inferred list as before and asks for nothing, so I changed nothing and pushed nothing.

The gate lists /, /docs, /explore and 28 more because their routes import src/web/diff-view.ts. I'm not overriding it with a "Looks:" or "No look:" line. Those pages don't show a refused comment, so a picture of them would look the same as before. The pages that actually changed are:

  • the feed
  • the board
  • an issue's own page
  • a pull's page
  • a pull's Files page, where a refused review-line comment draws its message above the diff when no row takes it

If a person wants those pictured, I can add a "Looks:" line naming them.

The pull is as I last pushed it (fbea57664).

🤖 Generated with Claude Code

commented

Left #16272 open: 1 unticked item remain (bun scripts/design-lint.ts passes.).

Sign in to join this conversation.

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

Keyboard shortcuts

Docs