Skip to content

Fold a long reply to its preview with Show more (#3114) - #3178

Merged
Birfy merged 2 commits into
mainfrom
dev/3114-message-folding
Nov 18, 2026
Merged

Birfy merged 2 commits into
mainfrom
dev/3114-message-folding

Conversation

@Birfy

@Birfy Birfy commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

Written-by: Dev

Fixes #3177
Part of #3114

Owner: Dev
Reviewer: Reviewer
Tier: T1

What changed

A reply over the standard cap (12 lines or 800 characters, whichever comes first) now draws a whole-line preview inside its bubble with one Show more control; pressing it draws the whole reply and the control becomes Show less. A reply still streaming, and one at or under the cap, are never folded, and a preview never leaves a code block open. foldingOf(roster.prefs) reads the mode — standard by default, none folding nothing — so the Settings slice has a read to write through. The document card and the Settings preference are the next slice, not this one.

The bubble hands the renderer over as the draw property, not as children: a cell component is expanded from its props alone (core/test/tool-cells.test.js L55–60), and a children-based fold made five of those cases red. core/client.js, patches/ds-bot/0003, patches/ds-bot/0008 and the two patches/ds-bot/files/ mirrors are generated by npm run build and node scripts/ds-bot-patches.mjs generate; core/src/client/i18n.js is untouched because Show more / Show less were already there.

Twelve files, not the eleven the slice counted: core/client.js is carried by patch 0008-client-bundle, and ds-bot-patches check fails unless that patch moves with it, so the generated set is five files. Hand-written is exactly 282 changed lines (+280/−2) across the seven source files.

Checkpoint

{
"pr": 3178, "claim": "Dev", "issue": 3177,
"summary": "A long chat reply now folds to a whole-line preview with one Show more control in the bubble; the control opens the whole reply and becomes Show less. Streaming replies and replies at or under the standard cap are never folded, and a preview never leaves a code block open. foldingOf(roster.prefs) reads the mode so the Settings slice has a read to write through. The renderer reaches the bubble as the draw property, not as children, because a cell component is expanded from its props alone.",
"files": ["changelog.d/3114-message-folding.added.md", "core/client.js", "core/src/client/cells.js", "core/src/client/message-fold.js", "core/src/client/styles.js", "core/src/client/user-message.js", "core/test/message-fold.test.js", "docs/subsystems/core-client.md", "patches/ds-bot/0003-flybot-api-client.patch", "patches/ds-bot/0008-client-bundle.patch", "patches/ds-bot/files/src/client/message-fold.js", "patches/ds-bot/files/test/message-fold.test.js"],
"checks": { "ran": "TZ=UTC TMPDIR=/data/flybot-tmp npm run verify", "result": "green", "at": "e8025b4ea2d23b56ca3871928937f4c58880b0d0" },
"next": "none — ready for review"
}

Verification at the tip

Ran:

  • cd core && TZ=UTC node --import ./test/harness-resolve.mjs --test test/message-fold.test.js → # tests 5 / # pass 5 / # fail 0
  • cd core && TZ=UTC node --import ./test/harness-resolve.mjs --test "test/{empty-message-cell,tool-cells,palette-preview}.test.js" → # tests 37 / # pass 37 / # fail 0 (3 / 19 / 15)
  • cd core && TZ=UTC node --import ./test/harness-resolve.mjs --test test/client-bundle.test.js → # tests 2 / # pass 2 / # fail 0
  • node core/scripts/build-client.mjs --check → exit 0, then git diff --exit-code core/client.js → exit 0 (on the tree with client.js committed)
  • node scripts/ds-bot-patches.mjs check → pin, 10 patches, core/ equals ds-bot/ + patches/ds-bot/ all ok; canonical → generate is a no-op
  • npm --prefix core run arch-docs → arch-docs: OK
  • git diff --name-only origin/main...HEAD | grep -E '^(\.github/|policy/|scripts/|core/scripts/|.*package\.json$|.*package-lock\.json$)' → empty; -- core/src/client/i18n.js → empty
  • git diff --numstat origin/main...HEAD over the seven hand-written files → 280+2 = 282
  • red first: with only message-fold.js and its test on the tree (no call site) → # tests 5 / # pass 3 / # fail 2, the bubble carries a fold control and Cannot read properties of undefined (reading 'props')
  • TZ=UTC TMPDIR=/data/flybot-tmp npm run verify → exit 0

Not run:

  • No browser click-through: the fold is drawn through the cell harness (a stateful React mock), not a real page.
  • No npm ci / npm run harness in this checkout: node_modules was carried over from the previous slice at the same core/package-lock.json; npm run build and every suite above ran on it.
  • git fetch is unavailable on this box (no git on PATH by default; a bundled git 2.53 was used for the repo's own git-dependent gates), so origin/main is a local ref to base b303da8a2dd8, whose tree equals main's tree read through the API.

Five cases: the caps, the preview cut and code-block closing, the bubble's
single control, opening and folding back, and no fold while streaming or
under the cap. The module exists but no bubble draws it yet, so the two draw
cases are the red half.
A reply over the standard cap (12 lines or 800 characters) now draws a
whole-line preview with one Show more control in the bubble; the control
opens the whole reply and becomes Show less. A streaming reply and one at
or under the cap are never folded, and the preview closes a code block it
opens. foldingOf(roster.prefs) reads the mode, standard by default.

The bubble hands the renderer over as the draw property, not as children: a
cell component is expanded from its props alone. The document card and the
Settings preference are the next slice.

core/client.js and patches/ds-bot/ are generated (npm run build,
ds-bot-patches generate); docs/subsystems/core-client.md carries the rule.
@Birfy Birfy added the agent-pr Pull request opened by an agent label Nov 18, 2026
@Birfy Birfy self-assigned this Nov 18, 2026
@Birfy
Birfy marked this pull request as ready for review November 18, 2026 17:14
@Birfy

Birfy commented Nov 18, 2026

Copy link
Copy Markdown
Collaborator Author

Written-by: Dev

PR opened at tip e8025b4ea2d23b56ca3871928937f4c58880b0d0: 12 files, hand-written +282/−2 across 7 source files, the other 5 generated by npm run build and ds-bot-patches generate. Not enqueued, no Verdict.

@Birfy
Birfy added this pull request to the merge queue Nov 18, 2026
Merged via the queue into main with commit 5ca430c Nov 18, 2026
16 of 21 checks passed
@Birfy
Birfy deleted the dev/3114-message-folding branch November 18, 2026 17:30
@github-actions github-actions Bot removed the agent-pr Pull request opened by an agent label Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[#3114] 长回复折叠:超阈值消息先画预览,Show more 展开全文

1 participant