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

A reply under a feed post is written as a comment on its issue and shows under the post without a reload #13692

Merged opened this

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

Merged

Most of this was already on main: the reply box on a feed post posts a comment on the post's issue through the issue's own comment handler. That handler is same-origin checked and has a plain-form path. I added only two missing pieces: a refused reply now keeps its text, and the tests below.

Notes

shipped production is serving it deploy 59903fa

opened this

Most of this was already on main: the reply box on a feed post posts a comment on the post's issue through the issue's own comment handler. That handler is same-origin checked and has a plain-form path. I added only two missing pieces: a refused reply now keeps its text, and the tests below.

I ran the new test file and test/feed-reply.test.ts; both pass, and tsc and the gate are clean. I did not run the full suite; the forge's check does that on the push.

What changed

  • Text kept on refusal: src/web/pages/issues.ts now puts the typed words in the refusal flash, in its copyable code block. The feed card's reply form posts with back=feed, so a refused reply returns to /feed.
  • New tests: test/feed-reply-comment.test.ts covers three things:

- A plain form post creates the comment. The issue page lists it after the redirect, and the issue comments API returns it. - A cross-origin post gets 403 and writes nothing. - A refused reply returns to /feed with its words in the flash.

  • Not touched: src/feed/reply.ts and src/web/comments.ts needed no change.

What I chose not to do

  • Kept text is capped at 512 characters. A flash cookie can't hold more, so the words are kept to copy back. They are not put back into the box. Putting them back would need a client-side draft on reply boxes, which I left out.
  • No live append on the feed card. The task title says "without a reload", but the plain-form path follows the redirect. A live append would be a separate change.

How to try it: open /feed and use "Reply" on a post about an issue. You return to the feed with "Reply posted.", and the comment shows on the issue page.

Closes #13679

7 earlier comments · 1 event
commented

Most of this was already on main: the reply box on a feed post posts a comment on the post's issue through the issue's own comment handler. That handler is same-origin checked and has a plain-form path. I added only two missing pieces: a refused reply now keeps its text, and the tests below.

I ran the new test file and test/feed-reply.test.ts; both pass, and tsc and the gate are clean. I did not run the full suite; the forge's check does that on the push.

What changed

  • Text kept on refusal: src/web/pages/issues.ts now puts the typed words in the refusal flash, in its copyable code block. The feed card's reply form posts with back=feed, so a refused reply returns to /feed.
  • New tests: test/feed-reply-comment.test.ts covers three things:

- A plain form post creates the comment. The issue page lists it after the redirect, and the issue comments API returns it. - A cross-origin post gets 403 and writes nothing. - A refused reply returns to /feed with its words in the flash.

  • Not touched: src/feed/reply.ts and src/web/comments.ts needed no change.

What I chose not to do

  • Kept text is capped at 512 characters. A flash cookie can't hold more, so the words are kept to copy back. They are not put back into the box. Putting them back would need a client-side draft on reply boxes, which I left out.
  • No live append on the feed card. The task title says "without a reload", but the plain-form path follows the redirect. A live append would be a separate change.

How to try it: open /feed and use "Reply" on a post about an issue. You return to the feed with "Reply posted.", and the comment shows on the issue page.

commented

<!-- look-pages e3a4528f277f --> Look pages for e3a4528, from the gate:

  • look pages (none): this pull changes src/web/pages/issues.ts but the forge could not trace the route of /settings/security/controls (an inline or wrapped handler), so it could not infer a page; the reviewer decides. A "Looks: <path>" line naming the nearest page, or a "No look: <why>" line (10+ characters), says it
commented

I pushed an empty commit with a Looks: /feed line. That is the line the look-pages gate asked for. The code is unchanged since the last push.

The gate couldn't trace which page src/web/pages/issues.ts serves, so it asked for a named page. /feed is the right one. The change is a refused reply keeping its words in the flash, and a refused reply returns to /feed.

The gate message named /settings/security/controls. That route isn't touched by this pull. It looks like the gate matched on something other than my change.

What changed (unchanged from before):

  • Reply as a comment: a reply on a feed post is a comment on the post's issue. It goes through the existing same-origin-checked comment handler.
  • Text kept on refusal: a refused reply now returns to /feed with its first 512 characters in the flash's copyable block. The new tests are in test/feed-reply-comment.test.ts.
  • Left out: there's no live append on the feed card, and the kept text isn't put back into the reply box.

Try it: open /feed, reply on an issue post, and the comment shows on the issue page.

commented

<!-- look-pages 10f13eda3e2a --> Look pages for 10f13ed, from the gate:

  • look pages (none): "Looks: /feed" is not a page of app.looks in forge.json; this pull changes src/web/pages/issues.ts but the forge could not trace the route of /settings/security/controls (an inline or wrapped handler), so it could not infer a page; the reviewer decides. A "Looks: <path>" line naming the nearest page, or a "No look: <why>" line (10+ characters), says it
commented

A refused comment on the web form now keeps its words in the flash message. The user can copy them back. This push adds no code. It's an empty commit that carries the two lines the gate asked for. I didn't re-run the gate or the tests after it, so the forge's check on this push is the first verdict.

What the gate wanted. The "both doors" rule failed because the pull edits src/web/pages/issues.ts and has nothing under src/tui/ or docs/features/. The edit is two lines: issueCommentSubmit passes code: body.slice(0, 512) to the flash when a comment is refused. The terminal has no flash to keep the words in, so I added a No door: line saying that instead of adding terminal code.

Look pages. The gate also could not trace the route for look pages and named "Looks: /feed" as not being a page in app.looks. That part was only a warning, not what failed the check. I added a No look: line to the same commit.

What's in the pull. The issues.ts change and test/feed-reply-comment.test.ts, which covers a reply under a feed post being written as a comment.

To try it. Open /feed and reply on an issue post. The comment shows on the issue page. When a reply is refused, the flash shows the words so they can be copied back.

Changes requested — before the latest push

Most of the issue was already on main; this adds kept text and tests. One real bug, and two gaps.

  1. FIRST: the kept text can destroy the whole flash. flashCookie encodes the JSON, then cuts the ENCODED string at 2000 chars (src/web/flash.ts:39). 512 chars of ordinary reply text with newlines, quotes or non-ASCII (3 to 9 encoded chars each) pass 2000, so the JSON is cut mid-way, parses as invalid and is dropped. The person then gets no "not posted" message and no words. The test only uses 512 plain x, which encodes short. Fix: cap the kept text by its encoded size (shrink it until encodeURIComponent(JSON.stringify(flash)) fits), and add a test with a multi-line or non-ASCII 70k body that still shows the danger message.
  2. The title says the reply shows under the post without a reload. Not delivered, and the pull says so. Either do it with the form still working with JS off, or say plainly the issue is only partly met. No test covers the success path from the feed (back=feed returns to /feed with Reply posted).
  3. Both doors: no src/tui/ screen or docs/features/ how-to is touched. Name the terminal reply path in docs/features/ or state in the pull why none is needed.

Boxes: 1 and 2 are met on the wording; 3 is met by the API assertion.

commented

This pull is only partly done: a reply under a feed post is written as a comment, but it does not show under the post without a reload. The first and third review points are fixed. The second is an honest "no", not a fix.

Fixes

  • Kept words: a refused reply's words are now cut by their encoded size, so the whole flash fits the 2000-character cookie. The new flashKeeping in src/web/flash.ts shrinks the text until it fits. The "not posted" message and as many of the words as fit now always survive. The test in test/feed-reply-comment.test.ts posts a 70k body of quotes, newlines and non-ASCII and checks the danger flash comes back readable, and that /feed shows it. I did not confirm that this test fails without the fix.
  • Success path: a new test sends a reply from the feed (back=feed). It checks the redirect to /feed, the "Reply posted." flash, and that the comment exists.
  • Both doors: docs/features/feed-reply.md names the reply path. The terminal has no reply screen, and the page change is a flash detail, so I added no terminal code. The only terminal route is the existing API comment endpoint.

Not done

  • No live reply: the reply returns to /feed with "Reply posted." after a reload, and the form works with JS off. Showing it under the post without a reload would take new client JavaScript. I left that out, and the how-to says so.

I ran the five tests in test/feed-reply-comment.test.ts and the gate. Both passed. tsc --noEmit printed nothing.

commented

A reply under a feed post is now written as a comment on the issue. A refused reply keeps its words in the flash so they can be copied back.

The check failed on the "pipeline first" gate rule. The pull adds docs/features/feed-reply.md and changes nothing in scripts/, src/flow/, src/nightly/, src/checks/ or forge.json.

I did not change the pipeline. I added an empty commit whose message carries the line the gate asks for: "Direction: a reply under a feed post is lost on refusal today; this is a user-facing bug fix (#13679) that goes ahead of pipeline items". No code changed, so the earlier tests and type check still apply.

bun scripts/gate.ts printed nothing when I re-ran it, and the push went through. I did not re-run tsc or the tests, because nothing in the code changed.

To try it, open /feed and reply on an issue post. The comment shows on the issue page.

commented

The two feature-note tests failed because docs/features/feed-reply.md had no row in the feature index. I added the row, "Reply to an issue post in the feed", to docs/features/README.md under the feed notes and pushed. test/feature-orphans.test.ts now passes here, with 4 of 4 green.

The third failure, the client-size ceiling test, is red on main at 6d30f7f too, and the check log says it isn't counted against this pull. I didn't touch it, and I didn't re-run it here. This pull only changes docs, so it shouldn't affect that test.

Approved

Earlier asks: kept words now fit the cookie (flashKeeping, tested with quotes/newlines/non-ASCII) - met. Success path test - met. Feature note and index row - met. Cannot diff since 28bd26ea79f9 (commit not in clone), so I read the whole change. The reply is a same-origin-checked comment, works as a plain form, and a refused reply keeps its words to copy back. Two things I would do next, both non-blocking: 1) Non-blocking: the title promises the reply shows under the post without a reload; it returns to /feed with a flash instead. Open a follow-up for a small live append, and put the kept words back in the reply box rather than only in the flash. 2) Non-blocking: there is no terminal screen for replying to a feed post; the how-to admits it. Add one in src/tui/ so both doors match.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs