Repository navigation
Conversation
…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.
|
@Birfy — verdict request for this tip, once:
At that exact tip: 18 checks = 14 success + 1 cancelled ( What it changes, in one line: in Red-first evidence in the body: the new |
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-3850at basebab1fe963b65913f5cd1021d30e6598a7f571627) reads the pair's Auto-send setting once, on mount, and its rejection branch was the empty function:so a read that failed left the checkbox at its initial
false(:3762) — drawn exactly like a setting that is off — whiledisabled: 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:autoisnulluntil a read answers (true/falseonly from an answer);liveflag, success sets the value and clears the failure, failure setserrorText(e)and leaves the value unknown;data-flybot="friend-auto-read-error"through the existingerrorText()(:88-96), next to the hint;disabled: saving || !home || auto === null);Red first
New file
plugins/social/test/friend-auto-read-error.test.js(harness frompoll-visibility.test.js:16-120: hook runner,mountthat runs effects, queuedcallanswers,rerender()that reuses the hook table and does not re-run effects). Test-only commit8ed5b5013683f94cdc5072803c96c8dbe4dfbdd2(tree68296107bc5acea3487189fc4f360a3ef1da7315, basebab1fe963b65913f5cd1021d30e6598a7f571627), same command twice:cd plugins/social && node --import ./test/resolve.mjs --test test/friend-auto-read-error.test.jsBoth runs
# tests 5 | # pass 2 | # fail 3, identical: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).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.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).ok 4 - a read that says the setting is on still draws a checked switch— the green control:checked: trueand no failure row.ok 5 - a read that says the setting is off still draws an unchecked switch— the green control:checked: falseand 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
test/friend-auto-read-error.test.js→ 5/5, 0 fail (twice).test/friend-settings-i18n.test.js+test/paused-chat-read-error.test.js+ the new file together → 9/9, 0 fail (unchanged neighbours).npm --prefix plugins/social test→ 785/785, 0 fail (the tri-state changes no existing test; baseline on this base 780 + the 5 new).node scripts/i18n-usage.mjs check→12 bare draws in 4 files, rc 0 — unchanged; the new row draws the existingerrorText()sentence, no baretr().node .github/scripts/changelog.mjs check→changelog: 4 fragment(s) in changelog.d/ are well formed.ARCH_DOCS_BASE=bab1fe963b65913f5cd1021d30e6598a7f571627 node core/scripts/check-arch-docs.mjs→arch-docs: OK (3 changed file(s)); the fix commit carries the requiredDocs-not-needed:trailer.npm run verifyas 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 onesocial/settingsread rejects withcode:'NETWORK'.bab1fe963b65913f5cd1021d30e6598a7f571627):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 Bot16fcc4c8ed0eb6b676c656fcc8af717378f824ef):checked:false disabled:true):Auto-send my Bots' replies to Eve | … | Could not reach FlyBot. Check that it is still running. | Remove this BotEvidence branch
evidence/3367carries the two PNGs only (no code, no PR); the raw links are pinned toadcf6e569f841a7ae18c1b7ca89b23267441bfbe, so a later rewrite of that branch cannot change what this body shows.Verification at tip
16fcc4c8ed0eb6b676c656fcc8af717378f824ef16fcc4c8ed0eb6b676c656fcc8af717378f824ef, tree321eade1e68f3763f874b884cce5e1ddffb98599, basebab1fe963b65913f5cd1021d30e6598a7f571627plugins/social/client.js+16/−4,plugins/social/test/friend-auto-read-error.test.js+208/−0 (new),changelog.d/3367.fixed.md+1/−0poll-visibility.test.js, nopaused-chat-read-error.test.js, nothing atclient.js:2592or:4010-4034, noplugins/social/src/social.js, nocore/client.js, nopatches/**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" }