Repository navigation
social: the paused-chat card and the connecting settings page stop polling while the tab is hidden - #3328
Open
HugoXK wants to merge 2 commits into
Open
social: the paused-chat card and the connecting settings page stop polling while the tab is hidden#3328HugoXK wants to merge 2 commits into
HugoXK wants to merge 2 commits into
Conversation
Collaborator
|
但这条 PR 的 check 跑在旧的 merge ref 上(13:10–13:13Z 那轮,base 还是 新 tip 上来后我这边跑结论线: Written-by: Chief |
…gs page stop while hidden (ThinkFlowLab#3327)
…lling while hidden (ThinkFlowLab#3327) PausedChat rebuilt its 5 s social/paused timer whatever the tab did: the read returned early while document.hidden, so a hidden tab kept a timer ticking for nothing and a tab that came back waited out the rest of the period. The connecting state of SocialServerSettings was worse: a bare 2 s social/server interval with no visibility check at all. Both now use the existing pollWhileVisible: a hidden tab holds no timer, a tab that comes back reads once at once and the cadence restarts from that read, and unmount removes the listener. Nothing on screen changes; only when the reads happen while hidden changes.
HugoXK
force-pushed
the
dev/3-social-hidden-poll-panels
branch
from
November 23, 2026 13:56
7771293 to
0df60c3
Compare
HugoXK
added a commit
to HugoXK/FlyBot
that referenced
this pull request
Nov 23, 2026
…t the trailer in its body fails tests-ok (ThinkFlowLab#3330) Fixes ThinkFlowLab#3329 Owner: Dev-1 Reviewer: hsliuustc0106 Written-by: Dev-1 No UI face, test only. ## Why `core/test/check-arch-docs.test.js` passed `undefined` as the `event` of `filesNeedDocs`. `undefined` is the default parameter, so the function fell back to `pullRequestEvent()` and read the runner's own pull request — the test passed only while the pull request that ran it carried `Docs-not-needed:` in its title/body. ThinkFlowLab#3324 carried it and passed; ThinkFlowLab#3328 does not, so `tests-ok` goes red at `core/test/check-arch-docs.test.js:164` (CI job `137715430235`, `false !== true`). The script's judgement is unchanged: `core/scripts/**` and `policy/**` are untouched, and `patches/ds-bot/files/test/check-arch-docs.test.js` moves only as the mirror of this test change. ## What changed - The merge-queue/local loop passes `null` ("no event supplied"), not `undefined` (the default parameter), and asserts `entry.trailer.event === (event?.name ?? 'local')`. - `patches/ds-bot/files/test/check-arch-docs.test.js` regenerated by `node scripts/ds-bot-patches.mjs generate` (core/ is ds-bot/ + patches; `check` and `canonical` both ok). - One new guard case: `GITHUB_EVENT_NAME=pull_request` with an unreadable `GITHUB_EVENT_PATH` fails closed — the body counts as no trailer, so a branch-commit trailer alone stays red — while a run with no event at all is local and the log decides. ## Readings All from `core/`, Node 22.23.2, `TZ=UTC`, `PATH` with the workspace toolbin, `DSH_HARNESS=repo/core/dev/harness`. Event file (kept out of the PR): `{"pull_request":{"title":"Change the thing","body":"A plain body with no documentation trailer."}}` **A. Pre-fix test file on the live base, trigger-condition run (twice).** `GITHUB_EVENT_NAME=pull_request GITHUB_EVENT_PATH=…/event-plain.json node --import ./test/harness-resolve.mjs --test test/tmp-3329-prefix.test.js` `test/tmp-3329-prefix.test.js` is `git show 7af546b:core/test/check-arch-docs.test.js`, deleted afterwards. → run 1: `# tests 10 / # pass 9 / # fail 1`, exit 1; run 2 identical. `not ok 8 - ThinkFlowLab#3322: a pull request needs the trailer in the branch commits and in its own title/body`; the assertion at `:164` is `assert.equal(entry.ok, true)` → `expected: true`, `actual: false`. **B. The new guard case dropped into that pre-fix file (loop still `undefined`), same event env (twice).** `… --test test/tmp-3329-prefix-guard.test.js` → run 1: `# tests 11 / # pass 10 / # fail 1`, exit 1; run 2 identical. The guard case itself is `ok 11`; the red is still the `ThinkFlowLab#3322` test at `:164` (`expected: true`, `actual: false`). So the new case alone does not fix the ambient read. **C. This patch, same event env (twice).** `GITHUB_EVENT_NAME=pull_request GITHUB_EVENT_PATH=…/event-plain.json node --import ./test/harness-resolve.mjs --test test/check-arch-docs.test.js` → run 1: `# tests 11 / # pass 11 / # fail 0`, exit 0; run 2 identical. Plain run (no event env): `# tests 11 / # pass 11 / # fail 0`, exit 0. **Suite at this tip.** `npm --prefix core test` → `# tests 3450 / # pass 3449 / # fail 1`; the one red is `bench.sh refuses before writing the profile when pnpm is missing`, which fails identically on the untouched base `7af546b6` (same file, same assertion, run on a clean worktree at that sha) — it is this box's pnpm preflight, not the change. With that environment case skipped (`--test-skip-pattern`): `# tests 3449 / # pass 3449 / # fail 0`. `arch-docs` at this tip: `arch-docs: OK (1 changed file(s))`. Not run: full `npm run verify` past the core suite (only one test file changed; plugin, build, patch and interop stages do not read it), smoke (no `index.js` / `src/host/` change). Docs-not-needed: test-only hermeticity fix; no behaviour change. ## Checkpoint <!-- flybot:checkpoint --> ```json { "pr": 3330, "claim": "Dev-1", "issue": 3329, "summary": "The arch-docs test passed `undefined` as filesNeedDocs' event, which is the default parameter, so it read the runner's own pull request and passed only while that PR body carried the trailer. It now passes `null` for “no event”, pins the trailer's event name, and adds a guard that an unreadable pull_request event fails closed. The script's judgement is unchanged; test only, with the patches mirror regenerated.", "files": [ "core/test/check-arch-docs.test.js", "patches/ds-bot/files/test/check-arch-docs.test.js" ], "checks": { "ran": "GITHUB_EVENT_NAME=pull_request GITHUB_EVENT_PATH=<plain body> node --import ./test/harness-resolve.mjs --test test/check-arch-docs.test.js (11/11 twice); plain run 11/11; npm --prefix core test 3449/3450 with one pre-existing environment case; ds-bot-patches check + canonical ok; arch-docs OK (2 changed file(s))", "result": "green", "at": "1edfde4013d584cc59cd14e57536c1b3ab9344da" }, "next": "none — ready for review" } ``` <!-- /flybot:checkpoint -->
Contributor
Author
|
@Birfy — verdict request at tip
The tip stays as it is; if a reading is needed after the queue, ask and I will read it without moving the head. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3327
Bot: FlyBot Dev-3
Owner: Dev-3
Written-by: Dev-3
Reviewer: Birfy
What the tab did
Both panels polled on a bare
setInterval, whatever the tab was doing.PausedChat(plugins/social/client.js:4036at the base):setInterval(load, 5000), with the visibility check insideload(:4031). A hidden tab therefore rebuilt its timer every 5 s and read nothing, and a tab that came back waited out the rest of the current period before its first read.SocialServerSettings(:4151):setInterval(() => void refresh(), 2000)with no visibility check at all — a hidden tab readsocial/serverat full rate, and a tab that came back did not read at once.Every other poll in this client already goes through
pollWhileVisible(client.js:3059, #3315): no timer while hidden, one read as the tab comes back, the cadence restarted from that read, the listener removed on unmount. These two were the last of that family listed as follow-ups.What changes
plugins/social/client.js—PausedChat's effect dropssetIntervaland thedocument.hiddenearly return insideload(the helper never calls it while hidden), and keepsconst stop = pollWhileVisible(load, 5000); unmount doeslive = false; stop?.(). The connecting effect returnspollWhileVisible(() => { void refresh() }, 2000)instead of its own interval. Visible cadence stays 5 s / 2 s.plugins/social/test/poll-visibility.test.js— two cases on the shipped components, through the file's existingscene()/mount()harness: a hidden mount makes no read and keeps no timer,visibilitychangeback to visible reads exactly once and the cadence restarts at that read, going hidden again stops it, unmount removes the listener. They count observed calls over time rather than compare a golden.docs/subsystems/social.md— one sentence beside the social client: three face-room polls keep running in a hidden tab and none of them refill on becoming visible #3315 polling rule.changelog.d/3327.fixed.md.One known read-count difference: entering the connecting state now reads
social/serveronce at once (the helper's start semantics); the visible 2 s cadence is unchanged.Not touched:
core/,core/src/client/i18n.js,patches/**,plugins/social/src/**. No new string, so no dictionary rebuild and no client-bundle re-emit.No UI face
The screen does not change, only when the reads happen while hidden. Nothing is drawn differently — no text, row, or layout moves — so there is nothing for a before/after screenshot to show, and this section says so for the verdict.
Red first
The two new cases on base
7af546b60ed464a9568018f733c2889562579960(plugins/social/client.jsfrom the base, the test file from this branch), the same command twice on the same tree:Both runs fail on the same two assertions (
poll-visibility.test.js:218and:248): a hidden mount already keeps a poll timer, which is the defect and the line the case reads first. The four #3315 cases above them stay green throughout.Re-run on the base this branch now sits on,
352a6f03241b1ec1333ba38a4e84ff8e4c1d6eed(#3330had just fixed the arch-docs test), same command twice,client.jsfrom that base and the test file from this branch:Same two assertions and same values:
:218actual [ 5000 ],:248actual [ 2000 ]; the four #3315 cases stay green. The two added cases keep their#3315names because they are that issue's follow-ups ③ and ④, the rows #3315's own table listed outside its diff.Verification at tip
0df60c36d302eb7965feae371b00718e1d3484400df60c36d302eb7965feae371b00718e1d348440, treef2a33e002959f3ceeddfd1d38a51edbd7ac78d7c, base352a6f03241b1ec1333ba38a4e84ff8e4c1d6eedgit diff --name-only 352a6f03241b1ec1333ba38a4e84ff8e4c1d6eed..0df60c36d302eb7965feae371b00718e1d348440→ exactly the four files above (client.js+8/−9, test +56, docs +1, changelog +1)cd plugins/social && node --import ./test/resolve.mjs --test test/poll-visibility.test.js→ 6/6, rc 0npm --prefix plugins/social test→ 767/767, 0 fail, rc 0node scripts/lint-plugins.mjs social→Found 42 warnings and 0 errors., rc 0node .github/scripts/changelog.mjs check→changelog: 7 fragment(s) in changelog.d/ are well formedARCH_DOCS_BASE=352a6f03241b1ec1333ba38a4e84ff8e4c1d6eed node core/scripts/check-arch-docs.mjs→arch-docs: OK (4 changed file(s))0df60c36d302eb7965feae371b00718e1d348440checks (APIDate Mon, 23 Nov 2026 14:00:13 GMT): 15 success + 2 skipped + 0 cancelled + 1 failure — the failure isenqueue-guard(no Verifier report names the tip 0df60c36d302), which is the verdict gate;tests-ok,plugins (social),plugins (tree),package,merge-gate,policy-signare successCheckpoint
{ "pr": 3328, "claim": "Dev-3", "issue": 3327, "summary": "The paused-chat card and the connecting settings page both kept reading on a bare interval whatever the tab did: the card rebuilt its 5 s timer while hidden and the settings page read the server every 2 s with no visibility check at all. Both now go through the existing `pollWhileVisible`, so a hidden tab makes no read, coming back reads once at once and restarts the cadence, and unmount removes the listener. Nothing on screen changes; only when the reads happen while hidden changes.", "files": [ "plugins/social/client.js", "plugins/social/test/poll-visibility.test.js", "docs/subsystems/social.md", "changelog.d/3327.fixed.md" ], "checks": { "ran": "npm --prefix plugins/social test", "result": "green", "at": "0df60c36d302eb7965feae371b00718e1d348440" }, "next": "none — ready for review" }