Skip to content

Choose the message folding mode in Settings → General (#3114) - #3180

Merged
Birfy merged 2 commits into
mainfrom
dev/3114-fold-prefs
Nov 18, 2026
Merged

Birfy merged 2 commits into
mainfrom
dev/3114-fold-prefs

Conversation

@Birfy

@Birfy Birfy commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

Written-by: Dev

Fixes #3179
Part of #3114

Owner: Dev
Reviewer: Reviewer
Tier: T3

What changed

The reader half shipped in the previous slice: foldingOf already folds a bubble by
prefs.folding.mode and none already folds nothing, but nothing could write the mode, so every
window folded at the default and Settings had no picker. This closes the writing half only —
core/src/client/message-fold.js and core/test/message-fold.test.js are untouched (A12).

Host (core/src/host/channel.js, +12): set-prefs takes folding: { mode }, checks it against
a FOLD_MODES set next to NOTIFY_KINDS, stores state.prefs.folding, deletes the record on
null, and refuses anything else with Message folding must be compact, standard or none. The
check is inline, like motion's three-way choice beside it; no core/src/shared/ module was added.

Client (core/src/client/settings.js, +17): General reads foldingOf(prefs) and draws a
Message folding section — a Segmented picker (Compact / Standard / No folding) in a writable
window, and one plain-text row naming the mode in a read-only one, so #2474's rule still holds.
core/src/client/i18n.js (+6) carries the section title, the hint, the three labels and the
refusal. core/client.js is rebuilt, not hand-edited.

Tests: core/test/install.test.js pins the host half (store, refusal, null clear, none), and
core/test/settings-readonly-pages.test.js pins the picker and its one write. The #2474 count of
General's controls moves from 7 to 8 because the page really draws one more control; the
Send shortcut assertion on the same line still holds.

Fourteen files: eight hand-written (+81/−4 lines, of which the tests are 40) and six generated
(core/client.js, patches 0001, 0005, 0008, 0014, and the files/ mirror of the test).
ds-bot/, patches/ds-bot/topics.json, .github/**, policy/**, scripts/**,
core/scripts/**, every package.json/package-lock.json, core/src/shared/** and plugins/**
are unchanged.

Checkpoint

{
  "pr": 3180,
  "claim": "Dev",
  "issue": 3179,
  "summary": "`set-prefs` now stores the message folding mode and refuses anything that is not compact, standard or none, while `null` clears it back to the default. Settings → General draws a Message folding picker whose three choices write that field, and a read-only window keeps the mode in use as text instead of drawing a control. The client already folded by `prefs.folding.mode`, so this slice only closes the writing half: no bubble, threshold or existing Chinese sentence about folding changed.",
  "files": [
    "core/src/host/channel.js",
    "core/src/client/settings.js",
    "core/src/client/i18n.js",
    "core/test/install.test.js",
    "core/test/settings-readonly-pages.test.js",
    "docs/subsystems/core-host.md",
    "docs/subsystems/core-client.md",
    "changelog.d/3114-fold-prefs.added.md"
  ],
  "checks": { "ran": "TZ=UTC TMPDIR=/data/flybot-tmp npm run verify", "result": "green", "at": "d8ed1f3ead793d77c961b7b360fa271e5e4a62b3" },
  "next": "Reviewer: a PASS at this tip (T3), then the queue. No gate file changed; nothing was enqueued from here."
}

Verification at the tip

Ran: cd core && TZ=UTC node --import ./test/harness-resolve.mjs --test test/install.test.js → 5/5.
Ran: cd core && TZ=UTC node --import ./test/harness-resolve.mjs --test test/settings-readonly-pages.test.js → 14/14.
Ran: cd core && TZ=UTC node --import ./test/harness-resolve.mjs --test test/message-fold.test.js test/tool-cells.test.js test/client-bundle.test.js test/empty-message-cell.test.js → 29/29 (5 / 19 / 2 / 3).
Ran: node core/scripts/build-client.mjs --check from the repo root → exit 0, and git diff --exit-code -- core/client.js → exit 0 on the tree with client.js committed.
Ran: node scripts/ds-bot-patches.mjs check → ok 10 patches apply cleanly in order + ok core/ equals ds-bot/ + patches/ds-bot/; node scripts/ds-bot-patches.mjs canonical → generate is a no-op.
Ran: npm --prefix core run arch-docs → arch-docs: OK (2 changed file(s)).
Ran: TZ=UTC TMPDIR=/data/flybot-tmp npm run verify at this tip → exit 0 (lint, build check, patches check/canonical, core suite, social/tree/timeline/workflow/project suites).
Red first: on a branch carrying only the two tests, install.test.js read # tests 5 / # pass 4 / # fail 1 (red at actual: undefined) and settings-readonly-pages.test.js read # tests 14 / # pass 13 / # fail 1 (red at General draws the folding picker, 0 !== 1). With channel.js and settings.js restored to main on this tree the two files read 5/4/1 and 14/12/2 — the second red there is the same new test plus the 7→8 count, which necessarily fails while the picker is gone.

Not run: no browser click-through (the picker is pressed through the cell harness, a stateful React mock that runs the real onClick). No npm ci / npm run harness in this checkout — node_modules was carried over at this same core/package-lock.json (byte-identical to the previous slice's). No smoke test: the change touches no index.js and no host turn path.

…preferences (#3114)

The reader half shipped in the previous slice: `foldingOf` already folds a bubble by
`prefs.folding.mode` and `none` already folds nothing, but nothing could write the mode, so
every window folded at the default and the picker was missing.

`set-prefs` now takes `folding: { mode }`, refuses a mode no bubble can draw, and clears it on
`null`; Settings → General draws Compact / Standard / No folding through `Segmented` and writes
one `set-prefs` per change, while the read-only window keeps the mode in use as text. The
Chinese dictionary carries the new sentences, and the host and client pages say so.
@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 commented Nov 18, 2026

Copy link
Copy Markdown
Collaborator Author

Verdict: PASS at d8ed1f3
Written-by: Reviewer
Attestation: d8ed1f3 role=Reviewer

Ran at this tip:

$ node core/scripts/build-client.mjs --check && git diff --exit-code -- core/client.js
# exit 0 — the committed core/client.js is exactly what build writes
$ node scripts/ds-bot-patches.mjs check && node scripts/ds-bot-patches.mjs canonical
# ok 10 patches apply cleanly in order / ok core/ equals ds-bot/ + patches/ds-bot/ / generate is a no-op
$ cd core && TZ=UTC node --import ./test/harness-resolve.mjs --test test/install.test.js
# tests 5  # pass 5  # fail 0
$ cd core && TZ=UTC node --import ./test/harness-resolve.mjs --test test/settings-readonly-pages.test.js
# tests 14  # pass 14  # fail 0

Red first — the same tree with only core/src/host/channel.js and core/src/client/settings.js restored to base 5ca430cb, tests and every other file untouched

$ cd core && TZ=UTC node --import ./test/harness-resolve.mjs --test test/install.test.js
# tests 5  # pass 4  # fail 1
$ cd core && TZ=UTC node --import ./test/harness-resolve.mjs --test test/settings-readonly-pages.test.js
# tests 14  # pass 12  # fail 2

The three reds are the new expectations plus the 7→8 count that cannot hold without the picker: actual: undefined vs { mode: 'compact' }, General draws the folding picker 0 !== 1, and General keeps its four switches… count. Restoring the tip files returns 5/5 and 14/14.

What I checked

  • Scope (14 files, T3, no cap): exactly the 8 hand-written (channel.js +12, settings.js +17, i18n.js +6, install.test.js +17, settings-readonly-pages.test.js +23/−3, core-host.md +4, core-client.md +1/−1, changelog.d/…added.md +1) and the 6 generated (core/client.js, patches 0001/0005/0008/0014, files/test/settings-readonly-pages.test.js). No .github/**, policy/**, scripts/**, core/scripts/**, package*.json, core/src/shared/**, plugins/**, ds-bot/topics.json.
  • Host half (channel.js set-prefs, L316–323): FOLD_MODES sits beside the other pref readers; null deletes state.prefs.folding; a non-object, an array, or a mode outside the set throws Message folding must be compact, standard or none and stores nothing (the test asserts the refusal twice and the stored value stays compact); a legal mode stores { mode } in place on state.prefs, like motion/turnBudget. install.test.js covers store → read back through state → refusal → null clear → none.
  • Client half (settings.js L120–180): writable General draws one Segmented labelled Message folding with Compact/Standard/No folding, aria-pressed on the stored mode, and one setPrefs({ folding: { mode: id } }) only when the picked mode differs; the read-only window draws no Segmented for this section — one plain SetRow naming the mode — so Settings: a read-only window still draws the write controls on seven pages #2474's rule holds. The new test pins all three (picker, aria-pressed, a single write) and both windows.
  • Settings: a read-only window still draws the write controls on seven pages #2474 count: the only existing assertion touched is counts(general) 7 → 8 (plus its message text); the Send shortcut Segmented assertion on the same line is intact, and the mount() helper gained an optional override parameter — no existing expectation weakened, no test deleted or skipped.
  • i18n: exactly 6 new keys (title, hint, three labels, the refusal), no dictionary re-take from Add staged Teamily-style chat tools and owner-scoped history search #3112. core/src/client/message-fold.js and core/test/message-fold.test.js are not in the diff — read side untouched, as A12 requires.
  • T3 keywords on added lines (\bfence, sanitiz, displayName, eval(, new Function(, untrusted-(message|file), .only(, .skip(): 0 hits, including the two generated blobs.
  • Generated half: build-client --check and git diff --exit-code -- core/client.js both exit 0 on the committed tree; ds-bot-patches check = 10 patches apply in order + core/ equals ds-bot/ + patches; canonical = generate is a no-op.
  • Checks at this tip (read 18:19Z): 19 check-runs, all terminal; everything success except enqueue-guard, which is red only for no Verifier report names the tip d8ed1f3ead79 — this comment is that report. No in_progress / action_required anywhere.
  • Base: 5ca430cb = main head as read at 18:19Z; umbrella [#3110] 已落地聊天壳、设置、搜索与历史命中的收口 #3114 still open, closing issue [#3114] 消息折叠设置档:General 里可选紧凑/标准/不折叠并落盘 #3179 open.

Queued next from here; nothing was merged or labelled by this review.

@github-actions github-actions Bot added the pass label Nov 18, 2026
@Birfy
Birfy added this pull request to the merge queue Nov 18, 2026
Merged via the queue into main with commit 98d2390 Nov 18, 2026
17 of 19 checks passed
@Birfy
Birfy deleted the dev/3114-fold-prefs branch November 18, 2026 18:23
@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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[#3114] 消息折叠设置档:General 里可选紧凑/标准/不折叠并落盘

1 participant