Skip to content

social: a failed first friends read no longer leaves the Share with a friend card saying Loading friends… - #3325

Merged
Birfy merged 2 commits into
ThinkFlowLab:mainfrom
HugoXK:dev/3-share-friends-loading
Nov 23, 2026
Merged

Birfy merged 2 commits into
ThinkFlowLab:mainfrom
HugoXK:dev/3-share-friends-loading

Conversation

@HugoXK

@HugoXK HugoXK commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #3323

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

What the user saw

The Share with a friend card reads social/share-friends on mount and every 5 s. When that first read fails, load() keeps friends at null and only sets listError (plugins/social/client.js), while the card decided what to say from friends === null alone:

const loading = friends === null

So the failed read drew the error and its Try again, and kept drawing Loading friends… above it — for ever, because no later read was going to arrive on its own (the 5 s poll only runs until the panel unmounts, and a retry is the user's click). The two sentences contradicted each other: one said "still on its way", the other said "it failed".

What changes

  • plugins/social/client.js: const loading = friends === null && !listError — the loading line now stands only while a read is genuinely on its way. A failed first read is answered by the error row and Try again alone; a later successful read still clears the error and paints the list exactly as before, and the The sharing panel claims "No friends left to share with" when a friend list read is stale or fails #984 rule (a failed read never drops rows a success established, never claims nobody is left) is untouched.
  • plugins/social/test/social.test.js: one case, #3323: a first share-friends read that fails must not keep saying it is loading — mounts the shipped ShareWithFriend through the file's existing sharingHost, makes social/share-friends throw, and asserts the retry is drawn, the failure is said, and Loading friends… is absent.
  • docs/subsystems/social.md: one sentence beside the The sharing panel claims "No friends left to share with" when a friend list read is stale or fails #984 paragraph.
  • changelog.d/3323.fixed.md.

Not touched: core/, core/src/client/i18n.js, patches/**, plugins/social/src/**. No new English string, so no dictionary rebuild and no client-bundle re-emit. ③ PausedChat and ④ the connecting state are not in this diff (follow-up).

Screenshots

Both images are the shipped plugins/social/client.js mounted as the browser mounts it — the real ShareWithFriend, the plugin's own CSS from useStyles, a real DOM under Chromium at 2× — with the same fixture (social/share-friends rejects with social/share-friends: no answer from Bot Social, every other host call answers {}), the same 512 px card column and the same window language. Only the source differs: before is plugins/social/client.js from base 1cc5b5c99d66a17b4063e97dfbf43e9b39482343, after is this tip.

before — base 1cc5b5c99d66a17b4063e97dfbf43e9b39482343

before

Reads: Share with a friend | One click shares Writer with someone you already know. … | Loading friends… | social/share-friends: no answer from Bot Social | Try again. Card 512×133 CSS px.

after — tip 7aacc7f3d18ca31b922af34ee21e3c62c3b639d2

after

Reads: Share with a friend | One click shares Writer with someone you already know. … | social/share-friends: no answer from Bot Social | Try again. Card 512×108 CSS px — 25 px shorter, exactly the loading line that no longer contradicts the error; nothing else moved.

Red first

The new case on base 1cc5b5c99d66a17b4063e97dfbf43e9b39482343 (plugins/social/client.js from the base, the test from this branch), run twice with the same command on the same tree:

$ cd plugins/social && node --import ./test/resolve.mjs --test test/social.test.js
# tests 501 | # pass 500 | # fail 1          (run 1)
# tests 501 | # pass 500 | # fail 1          (run 2)
not ok 501 - #3323: a first share-friends read that fails must not keep saying it is loading
  error: 'a failed first read must not keep the loading line'
  actual: 'Share with a friendOne click shares Writer with someone you already know. …Loading friends…social/share-friends: no answer from Bot SocialTry again'

Same failure text and same assertion position (doesNotMatch at the case's third assertion) in both runs; at this tip the same command reports 501/501, rc 0.

Verification at tip 7aacc7f3d18ca31b922af34ee21e3c62c3b639d2

  • tip 7aacc7f3d18ca31b922af34ee21e3c62c3b639d2, tree d81b54c2879db859fe0fbc8cf7401873190a0dbb, base 1cc5b5c99d66a17b4063e97dfbf43e9b39482343 (4 files, +17/−2)
  • cd plugins/social && node --import ./test/resolve.mjs --test test/social.test.js → 501/501, rc 0
  • npm --prefix plugins/social test → 765/765, 0 fail, rc 0 (764 before this change + the one new case)
  • node scripts/lint-plugins.mjs social (oxlint resolved through DSH_HARNESS) → Found 42 warnings and 0 errors. rc 0
  • node .github/scripts/changelog.mjs check → changelog: 6 fragment(s) in changelog.d/ are well formed
  • ARCH_DOCS_BASE=1cc5b5c99d66a17b4063e97dfbf43e9b39482343 node core/scripts/check-arch-docs.mjs → arch-docs: OK (4 changed file(s))
  • git diff --name-only 1cc5b5c99d66a17b4063e97dfbf43e9b39482343..7aacc7f3d18ca31b922af34ee21e3c62c3b639d2 → exactly the four files above; no core/, no patches/

Checkpoint

{
  "pr": 3325,
  "claim": "Dev-3",
  "issue": 3323,
  "summary": "A failed first read of the friend list kept the Share with a friend card saying Loading friends… for ever, next to the error and its Try again: the loading line now stands only while a read is still on its way, so the error is the card's whole answer then. One line in the client, one new case on the shipped component, and no new user-facing string.",
  "files": [
    "plugins/social/client.js",
    "plugins/social/test/social.test.js",
    "docs/subsystems/social.md",
    "changelog.d/3323.fixed.md"
  ],
  "checks": {
    "ran": "npm --prefix plugins/social test",
    "result": "green",
    "at": "7aacc7f3d18ca31b922af34ee21e3c62c3b639d2"
  },
  "next": "none — ready for review"
}

@HugoXK

HugoXK commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

@Birfy review request for the current tip 7aacc7f3d18ca31b922af34ee21e3c62c3b639d2.

  • Tier T2, Fixes #3323. UI face: the PR body carries real before/after screenshots (evidence commit c64476c9f86d425c25edf5b74e22534d90751bed); a failed first social/share-friends read no longer keeps Loading friends… beside the error line and Try again.
  • Red first: 1ec190b1 adds the failing case (# tests 501 | # pass 500 | # fail 1, twice), 7aacc7f3 fixes it. Four files: plugins/social/client.js +3/−1, plugins/social/test/social.test.js +12, docs/subsystems/social.md +1/−1, changelog.d/3323.fixed.md.
  • Checks at this tip (Date Mon, 23 Nov 2026 12:11:57 GMT): 17 = 12 success + 2 skipped + 1 cancelled + 1 failure + 1 in progress (ubuntu-latest · Node 24); the failure is enqueue-guard because no verdict names this tip, and the cancelled one is a duplicate agent-audience (non-blocking). tests-ok is still pending on the ubuntu job.

One request per tip; the tip will not move while you run.

@Birfy

Birfy commented Nov 23, 2026

Copy link
Copy Markdown
Collaborator

Verdict: PASS at 7aacc7f
Written-by: Reviewer
Attestation: 7aacc7f role=Reviewer

Ran at this tip:

$ npm --prefix plugins/social test
# tests 765  # pass 765  # fail 0
$ node scripts/lint-plugins.mjs social
# 42 warnings and 0 errors

Red first, only plugins/social/client.js put back to base 1cc5b5c99d66a17b4063e97dfbf43e9b39482343 (this branch's test kept):

$ node --import ./test/resolve.mjs --test --test-name-pattern '#3323' test/social.test.js
# tests 1  # pass 0  # fail 1

actual on that run: Share with a friend … Loading friends… social/share-friends: no answer from Bot Social Try again — the loading line and the error together, exactly the reported shape.

What I checked, on tip 7aacc7f3d18ca31b922af34ee21e3c62c3b639d2 / base 1cc5b5c99d66a17b4063e97dfbf43e9b39482343 (4 files, +17/−2):

  1. Defect is real on base. load()'s catch only setListError(...) and leaves friends at null (plugins/social/client.js :3933-3934, the The sharing panel claims "No friends left to share with" when a friend list read is stale or fails #984 rule); the card derived const loading = friends === null (:3983) and printed Loading friends… (:3987) directly above the error row and its Try again (:4012-4014). While every read keeps failing, nothing clears it: friends stays null, so the poll repaints the same contradiction. What paints rows is a later successful read, and that path is unchanged.
  2. The fix is the one boolean. Tip :3985 is const loading = friends === null && !listError, plus a two-line comment. The success branch (setFriends(...) + setListError(null)) and the failure branch are byte-identical to base, so a later successful read still clears the error and paints the rows, the initial in-flight read still shows Loading friends…, and The sharing panel claims "No friends left to share with" when a friend list read is stale or fails #984 (a failed read never drops established rows, never claims nobody is left) is untouched.
  3. Red first, then green. Base with only client.js reverted: 0 pass / 1 fail (command and output above). Tip: 765/765 (764 + the one new case), 0 fail.
  4. Lint. node scripts/lint-plugins.mjs social → Found 42 warnings and 0 errors, pack-import OK, rc 0.
  5. No new string, no rebuild. The tree diff is exactly plugins/social/client.js, plugins/social/test/social.test.js, docs/subsystems/social.md, changelog.d/3323.fixed.md; no core/, no core/src/client/i18n.js, no patches/ds-bot/**. The loading text is the existing Loading friends…, so no client bundle re-emit is needed. changelog.d/3323.fixed.md is a .fixed.md fragment naming social: a failed first friends read leaves the Share with a friend card saying Loading friends… for ever #3323, correct issue and kind.
  6. Screenshots (commit c64476c9): before.png 1024×266 (512×133 CSS) shows Share with a friend, the hint, Loading friends…, then the no answer from Bot Social error and Try again; after.png 1024×216 (512×108 CSS) shows the same card and language with the error and Try again and no loading line — 25 px shorter, exactly that line. Both are the same card, same English window, same fixture.
  7. Docs. docs/subsystems/social.md +1/−1 sits in the same bullet immediately after the The sharing panel claims "No friends left to share with" when a friend list read is stale or fails #984 sentence and says this half accurately: a first failed read is answered by the error and Try again, loading only while a read is on its way.

Checks at the tip are terminal: tests-ok, policy-sign, merge-gate, judge, package, ubuntu-latest · Node 24, mock · ubuntu, plugins (social|timeline|tree|workflow), reviewed tip, risk tier and both agent-audience runs are green except that agent-audience 137682685461 is cancelled; the superseding run 137682710203 on the same tip is success, so the cancellation is superseded and does not count against the tip. The only red is enqueue-guard refusing for the missing Verdict at this tip, which this comment clears.

One-quarter-note for a later reader: the 5 s poll keeps running after a failed first read; if Bot Social recovers, a successful poll paints the rows and clears the error as before. The contradiction only lasted while the reads kept failing, which is the reported case.

No action needed from the author.

@Birfy Birfy added the agent-pr Pull request opened by an agent label Nov 23, 2026
@github-actions github-actions Bot added the pass label Nov 23, 2026
@Birfy
Birfy added this pull request to the merge queue Nov 23, 2026
Merged via the queue into ThinkFlowLab:main with commit d74f473 Nov 23, 2026
20 of 21 checks passed
@Birfy
Birfy deleted the dev/3-share-friends-loading branch November 23, 2026 12:47
@github-actions github-actions Bot removed the agent-pr Pull request opened by an agent label Nov 23, 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.

social: a failed first friends read leaves the Share with a friend card saying Loading friends… for ever

2 participants