Skip to content

social: a failed Auto-send settings read is drawn as the setting being off, and the switch stays live - #3370

Open
HugoXK wants to merge 2 commits into
ThinkFlowLab:mainfrom
HugoXK:dev/3-friend-auto-read-error
Open

HugoXK wants to merge 2 commits into
ThinkFlowLab:mainfrom
HugoXK:dev/3-friend-auto-read-error

Conversation

@HugoXK

@HugoXK HugoXK commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #3367

Bot: FlyBot Dev-3
Owner: Dev-3
Written-by: Dev-3
Reviewer: Birfy

What was wrong

A friend Bot's settings card (FriendChatSettings, plugins/social/client.js:3758-3850 at base bab1fe963b65913f5cd1021d30e6598a7f571627) reads the pair's Auto-send setting once, on mount, and its rejection branch was the empty function:

call('social/settings', {}).then(value => setAuto(value?.autoAccept?.[home] === true), () => {})

so a read that failed left the checkbox at its initial false (:3762) — drawn exactly like a setting that is off — while disabled: saving || !home (:3827) kept the switch live. The card therefore told the person "my Bots' replies to this friend go out without asking" as a state they had chosen, when in fact nothing had answered, and a flip from that state sends an explicit value the person never saw.

What changes

Only FriendChatSettings:

  • auto is null until a read answers (true/false only from an answer);
  • the effect keeps a live flag, success sets the value and clears the failure, failure sets errorText(e) and leaves the value unknown;
  • the box draws one quiet status row data-flybot="friend-auto-read-error" through the existing errorText() (:88-96), next to the hint;
  • the checkbox is not offered while the value is unknown (disabled: saving || !home || auto === null);
  • no new copy, no new button: reopening the card remounts it and retries the read.

Red first

New file plugins/social/test/friend-auto-read-error.test.js (harness from poll-visibility.test.js:16-120: hook runner, mount that runs effects, queued call answers, rerender() that reuses the hook table and does not re-run effects). Test-only commit 8ed5b5013683f94cdc5072803c96c8dbe4dfbdd2 (tree 68296107bc5acea3487189fc4f360a3ef1da7315, base bab1fe963b65913f5cd1021d30e6598a7f571627), same command twice:

cd plugins/social && node --import ./test/resolve.mjs --test test/friend-auto-read-error.test.js

Both runs # tests 5 | # pass 2 | # fail 3, identical:

  1. not ok 1 - a settings read that fails is drawn as a failure, not as a setting — expected: 1 / actual: 0, :160 (the row does not exist today).
  2. not ok 2 - a NETWORK failure names the reason the users can act on — expected: 'Could not reach FlyBot. Check that it is still running.' / actual: '', :171.
  3. not ok 3 - a setting nobody read is not offered as a switch to flip — expected: true / actual: false, :182 (the switch is offered although nothing answered).
  4. ok 4 - a read that says the setting is on still draws a checked switch — the green control: checked: true and no failure row.
  5. ok 5 - a read that says the setting is off still draws an unchecked switch — the green control: checked: false and no failure row.

Each assertion has exactly one expected value; ④⑤ are green at the base by design, so the red is 3 real failures, not 5.

Ran / Not run

  • ran test/friend-auto-read-error.test.js → 5/5, 0 fail (twice).
  • ran test/friend-settings-i18n.test.js + test/paused-chat-read-error.test.js + the new file together → 9/9, 0 fail (unchanged neighbours).
  • ran npm --prefix plugins/social test → 785/785, 0 fail (the tri-state changes no existing test; baseline on this base 780 + the 5 new).
  • ran node scripts/i18n-usage.mjs check → 12 bare draws in 4 files, rc 0 — unchanged; the new row draws the existing errorText() sentence, no bare tr().
  • ran node .github/scripts/changelog.mjs check → changelog: 4 fragment(s) in changelog.d/ are well formed.
  • ran ARCH_DOCS_BASE=bab1fe963b65913f5cd1021d30e6598a7f571627 node core/scripts/check-arch-docs.mjs → arch-docs: OK (3 changed file(s)); the fix commit carries the required Docs-not-needed: trailer.
  • not run npm run verify as one command: the core suites and the other plugin suites are outside this change; each stage this change touches is listed above.

Screenshots

Both rendered from the real client module in Chromium (the shipped FriendChatSettings, real DOM, the plugin's own CSS): same fixture (bot.remote.home='@eve.home', handle='@eve.bot'), and its one social/settings read rejects with code:'NETWORK'.

  • before (bab1fe963b65913f5cd1021d30e6598a7f571627): before — 280×131 CSS px, the switch is drawn unchecked and live (checked:false disabled:false), so the card reads as "Auto-send is off": Auto-send my Bots' replies to Eve | Your Bots' replies to Eve go out without asking you first. What you type is not affected. | Remove this Bot
  • after (16fcc4c8ed0eb6b676c656fcc8af717378f824ef): after — 280×173 CSS px, one quiet line says why and the switch is not offered (checked:false disabled:true): Auto-send my Bots' replies to Eve | … | Could not reach FlyBot. Check that it is still running. | Remove this Bot

Evidence branch evidence/3367 carries the two PNGs only (no code, no PR); the raw links are pinned to adcf6e569f841a7ae18c1b7ca89b23267441bfbe, so a later rewrite of that branch cannot change what this body shows.

Verification at tip 16fcc4c8ed0eb6b676c656fcc8af717378f824ef

  • tip 16fcc4c8ed0eb6b676c656fcc8af717378f824ef, tree 321eade1e68f3763f874b884cce5e1ddffb98599, base bab1fe963b65913f5cd1021d30e6598a7f571627
  • 3 files, +225/−4: plugins/social/client.js +16/−4, plugins/social/test/friend-auto-read-error.test.js +208/−0 (new), changelog.d/3367.fixed.md +1/−0
  • no other file touched: no poll-visibility.test.js, no paused-chat-read-error.test.js, nothing at client.js:2592 or :4010-4034, no plugins/social/src/social.js, no core/client.js, no patches/**

Checkpoint

{
  "pr": 3370,
  "claim": "Dev-3",
  "issue": 3367,
  "summary": "A friend Bot's settings card reads the pair's Auto-send setting once on mount, and its rejection branch was the empty function, so a failed read left the checkbox at `false` — drawn exactly like a setting that is off — while the switch stayed live: the person read "my Bots ask first" as the state they chose. The value is now `null` until a read answers, a failure draws one quiet `friend-auto-read-error` status row, and the switch is not offered while the value is unknown; a read that answers draws on and off as before (#3323/#3325/#3359).",
  "files": [
    "plugins/social/client.js",
    "plugins/social/test/friend-auto-read-error.test.js",
    "changelog.d/3367.fixed.md"
  ],
  "checks": {
    "ran": "npm --prefix plugins/social test",
    "result": "green",
    "at": "16fcc4c8ed0eb6b676c656fcc8af717378f824ef"
  },
  "next": "none — ready for review"
}

…inkFlowLab#3367)

`FriendChatSettings` read `social/settings` with an empty rejection branch, so
a failed read left the Auto-send checkbox at its initial `false` and the
switch live: the card drew "my Bots' replies to this friend go out without
asking" as the state the person chose. The value is now `null` until a read
answers, a failure draws one quiet `friend-auto-read-error` status row through
the existing `errorText()`, and the checkbox is not offered while the value is
unknown. A read that answers draws on and off exactly as before, a remount
retries, and there is no new copy or button.

Docs-not-needed: the card's copy, its box and its hint are unchanged; the new
row shows the existing `errorText()` sentence and the issue scopes the diff to
`FriendChatSettings` plus the new test file.
@HugoXK

HugoXK commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

@Birfy — verdict request for this tip, once: 16fcc4c8ed0eb6b676c656fcc8af717378f824ef.

Fixes #3367, base bab1fe963b65913f5cd1021d30e6598a7f571627 (= live main), 3 files +225/−4, maintainer_can_modify: true, non-draft.

At that exact tip: 18 checks = 14 success + 1 cancelled (agent-audience) + 2 skipped (live · real model, window check) + 1 failure — the only red is enqueue-guard (no Verifier report names the tip 16fcc4c8), which is what this request clears. Green: tests-ok, merge-gate, judge, package, plugins (social|timeline|tree|workflow), mock, ubuntu leg, policy-sign, reviewed tip, risk tier.

What it changes, in one line: in FriendChatSettings a failed social/settings read was drawn as "Auto-send off" and the switch stayed clickable (plugins/social/client.js:3762/:3769/:3827); a failed read now renders its own error line from the existing errorText() and the switch is disabled until a read succeeds, so "off" can no longer be a broken read and a click cannot write on top of an unknown state.

Red-first evidence in the body: the new plugins/social/test/friend-auto-read-error.test.js is 5 tests / 2 pass / 3 fail on the base source twice (error line missing; NETWORK text empty; the switch still enabled while the read failed), then 5/5; the three neighbouring test files 9/9; npm --prefix plugins/social test 785/785; i18n-usage check unchanged at 12 bare draws in 4 files; changelog 4 fragment(s) well formed; arch-docs OK (3). UI change carries before/after (280×131 unchecked + live switch → 280×173 disabled + Could not reach FlyBot…).

@HugoXK

HugoXK commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

@Birfy: review request for #3370 at tip 16fcc4c (base bab1fe9)

@github-actions github-actions Bot added the risk:T2 Risk tier T2 (host/plugin code or an unnamed path), set by the controller from the diff label Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:T2 Risk tier T2 (host/plugin code or an unnamed path), set by the controller from the diff

Projects

None yet

Development

Successfully merging this pull request may close these issues.

social: a failed Auto-send settings read is drawn as the setting being off, and the switch stays live

1 participant