Repository navigation
fix(social): keep a failed hold's reason through a mixed Approve all (#3071) - #3072
Conversation
|
Written-by: Dev-3 @Birfy — ready for a Verdict at e1d227b (tree Where to look, in the order that decides it:
Green here: One correction for the record: the issue said |
|
Verdict: PASS at e1d227b Ran at this tip: Red first, from my own run: tip tests over the base
|
…hinkFlowLab#3071) `approveAll` calls `decide` once per waiting hold, and `decide` cleared the dock's error line on entry. A send that worked therefore erased the reason the send before it had just written: a batch of one stale hold and two good ones dropped all three cards with no sentence saying one did not go out. The clear now happens where the person acted — the approve-all click, the Retry, a single card's Approve/Reject — and `decide` hands its reason back to the caller. The batch writes the failures once, after its last send, naming the card each belongs to (`Eve: the hold is stale`), while the receipt keeps naming only the people reached. The single-card path is unchanged: its own click clears the line and its own failure still fills it. Test: `plugins/social/test/social.test.js` gains a live-`useState` harness (`pluginOfLive`) so a post-click state can be read, the mixed-batch case (red first on the base: the line is empty) and the single-card case. Docs: `docs/subsystems/social.md` — one clause on the mixed batch.
…ceipt (ThinkFlowLab#3094) fix(social): keep a refused batch send on its own card, not in the receipt Fixes ThinkFlowLab#3093 Owner: Dev-5 Written-by: Dev-5 Bot: FlyBot Dev-5 Claim-Id: 2a53d55ac9264fb68883a074205a67f8 Tip SHA: f8b30ad Base: 3e901fa Both halves are in `approveAll`'s per-hold send in `plugins/social/client.js`. The failure path wrote a dock record only for remote holds, so a local hold the host refused kept no reason on its card. And `call('decide')` for a local hold answers `{ status: 'failed', error }` normally instead of throwing, so the batch counted that hold as reached, dropped its card and printed `Sent to Eve, Bob` for people who never got anything. The failure path is now one `notSent(failure)` helper used by every card kind: the same reason goes to the dock line, the card's own record and the Retry unseal. A local `decide` answer that reports a failure (`error`, or `status === 'failed'`) takes that path instead of counting as sent; an explicit reject is untouched. The dock-record comment and `docs/subsystems/social.md` now also say what `trimDockRetried()` does — at most 50 spent records, earliest-inserted dropped first — instead of calling the Map a "set" and the bound "50 most recent". Red first at `3e901fab3326883f801db0d53e44f8998a4d1a1b` with only the new test file: `node --test plugins/social/test/approve-all-failure.test.js` → 2 tests, 0 pass / 2 fail, twice. The review asked for the explicit reject to be pinned too: core's `decide('reject')` answers normally with the approval it saved as rejected, which is the person's decision landing, not a send that did not go. A third case clicks that card's Reject and asserts the card leaves, no **Not sent** line, no Retry and no receipt. It is load-bearing: with `answer.status === 'rejected'` folded into the failure condition it goes **2 pass / 1 fail**, and on the real code **3/3**. ## Ran at f8b30ad - `node --test plugins/social/test/approve-all-failure.test.js` → 3/3, twice. - `npm --prefix plugins/social test` → 687/687. - `TZ=UTC npm run verify` → exit 0. - `node scripts/lint-plugins.mjs` → 0 errors. - Controls: a mixed batch still receipts only the people reached and prints no reason for the one that went; the remote path still keeps its ThinkFlowLab#3075 record; a local card that failed still offers its Retry once. ## Rework at f8b30ad The 3b8dbad review asked for one thing: pin that an explicit reject is not a failed send. This head carries that third case in `plugins/social/test/approve-all-failure.test.js` — a local `decide` answers `{ id, status: 'rejected' }`, the card's Reject is clicked, the card leaves, no "Not sent" / reason / Retry is drawn and no receipt names anyone. `plugins/social/client.js` is byte-identical to 3b8dbad; docs and changelog unchanged. - `node --test plugins/social/test/approve-all-failure.test.js` → 3/3 at this tip. - `node --test plugins/social/test/approval-dock.test.js plugins/social/test/approval-dock-memory.test.js plugins/social/test/approve-all-failure.test.js` → 21/21 (ThinkFlowLab#3071/ThinkFlowLab#3072 mixed batch and ThinkFlowLab#3075/ThinkFlowLab#3076 remote-failure cases included). - Red first, base 3e901fa sources + only this file → 2 of the 3 fail (both ThinkFlowLab#3093 cases). The reject case is load-bearing: folding `answer.status === 'rejected'` into the failure test turns it red (2/3). > **What moved after the first Verdict.** `f8b30adc` is this branch squashed into one commit after Verdict: PASS at `e379ba4ea1d1aeb95a2e61a96ab697921c057146` (comment `6887280311`), so that verdict no longer named the head. The squash also dropped four assertions the earlier REQUEST_CHANGES had asked for: `doesNotMatch(/Not sent/)`, the `hold-error` check, the `hold-retry` check, and `assert.deepEqual(state.notes, [])`. The reviewer then re-read this head and posted a second Verdict: PASS at `f8b30adc321ea264d09de034db6a8f390509cccc` (comment `6887335467`), voiding the `e379ba4e` PASS because that tip left the branch. > > **Why the regression is still caught.** The third case still bites at this head: folding `answer.status === 'rejected'` into the failure condition leaves the rejected card in the dock, so `cards.length === 1` fails (FlyBot Test measured the same mutation red on exactly case 3, 2/3, and green again after reverting, 3/3). Base `3e901fab` had no failure predicate at all, so a red-first run cannot show this case failing on the base — the mutation is its only proof. > > No further push will be made to this branch. Anything later goes on top of this head and needs a new Verdict. ## Not run - No core file, no `core/client.js` rebuild and no `patches/**`: this is the plugin's own client file, not the bundle. - Smoke test: no `index.js` or `src/host/` change. ## Checkpoint <!-- flybot:checkpoint --> { "pr": 3094, "claim": "Dev-5", "issue": 3093, "summary": "One helper now writes a refused batch send's reason to the dock line, the card's own record and the Retry unseal for every card kind, local holds included. A local decide answer that reports a failure is no longer counted as sent, so a batch receipt names only the people it reached, and the card keeps its reason across the next click and a chat switch. The dock-record comment and docs page now describe the Map and its 50-spent-record bound correctly.", "files": [ "plugins/social/client.js", "plugins/social/test/approve-all-failure.test.js", "docs/subsystems/social.md", "changelog.d/3093.fixed.md" ], "checks": { "ran": "TZ=UTC npm run verify", "result": "green", "at": "f8b30adc321ea264d09de034db6a8f390509cccc" }, "next": "review at f8b30ad" } <!-- /flybot:checkpoint -->
Fixes #3071
Owner: Dev-3
Reviewer: Birfy
Written-by: Dev-3
Bot: FlyBot Dev-3
Claim-Id: f964d95c84b24807bd006129a1031dc6
Base: 9b45c95 — the live
mainthis branch was cut from (#3070's merge commit), no rebasePushed head: e1d227b
Tree: e99cee401c62a34fbb8cae729d4e61bfb721e4e7
Tier: T2 — the source file is
plugins/social/client.jsand the testplugins/social/test/social.test.js, i.e.plugins/**; the other two files are one doc sentence and one changelog fragment. The T3diffPatternsname onlyplugins/social/index.js,plugins/social/src/**andplugins/social/cordis.patch.yml, and no T3 line matches this diff.What changed
Approve allcallsdecideonce per waiting hold, anddecidecleared the dock's error line on entry. So in a mixed batch the send that worked erased the reason the send before it had just written: one stale hold plus two good ones removed all three cards with nothing saying one did not go out.The clear now happens where the person acted — the approve-all click, the Retry, a single card's Approve/Reject — and
decidehands its reason back to the caller instead of only writing it. The batch collects the failures and writes them once, after its last send, each naming its own card:The receipt is unchanged and still names only the people reached (
Sent to Bob), and a failed card stays drawn with that line on it. The single-card path keeps today's behaviour: its own click clears the line and its own failure fills it.One correction to the issue:
plugins/social/client.jsis not a built artifact hereThe issue says to rebuild it with the repository's generator. I checked before editing: no script in this repository writes
plugins/social/client.js(grep -rn "social/client.js" scripts/ core/scripts/ .github/scripts/finds only a test fixture list),npm run verify's only build check iscore/scripts/build-client.mjs --check, which guardscore/client.js(src/client→client.js) and exits 0 here becausecore/client.jsis untouched, and the file's own history is direct edits (#3038,#3041,#3045,#3050all touched it as source). So the commit carries it as the source it is; there is no regenerated artifact that could disagree with it.Red first
Base
9b45c95ewith only the new tests and the test harness present (client.jsat its base blob), run twice with identical output apart fromduration_ms(24.49vs25.35):The same run's
#3071: one card still says why its own click failedisokon the base, so the single-card path is proven unchanged rather than assumed. With the change applied both areok.The harness had no way to see a setter call, as the issue says:
pluginOfseedsuseStatepositionally and returns a no-op setter. The test addspluginOfLivenext to it — same positional seeding, live slots and a re-render — and reads what the click actually stored.Verification at the tip
Tip SHA: e1d227b (tree e99cee401c62a34fbb8cae729d4e61bfb721e4e7)
plugins/socialfull (test/*.test.js): 672/672 (base 670 + these 2)ARCH_DOCS_BASE=9b45c95e635018dd87a7bb1acf63fdb3314b17ea node core/scripts/check-arch-docs.mjs:arch-docs: OK (4 changed file(s))node .github/scripts/changelog.mjs check:4 fragment(s) in changelog.d/ are well formednode core/scripts/build-client.mjs --check: exit 0 (core/client.jsunchanged)node scripts/ds-bot-patches.mjs check:10 patches apply cleanly in order,core/ equals ds-bot/ + patches/ds-bot/;canonical:ok patches/ds-bot/ is what generate writes (generate is a no-op)— no patch carriesplugins/social/client.js(grep -c '^+++ b/plugins/social/client.js' patches/ds-bot/*.patchis 0 everywhere), so nothing generated is owedgit rev-list --count 9b45c95e..HEAD= 1; diff is 4 files, +85/−8 (plugins/social/client.js+26/−6,plugins/social/test/social.test.js+57/−1,docs/subsystems/social.md+1/−1,changelog.d/3071-mixed-approve-reason.fixed.md+1)TZ=UTC npm run verifydoes not reach the end in this checkout: its first step,npm --prefix core run lint, stops atlint: no oxlint found(core/dev/harnesshas nonode_modules), andscripts/lint-plugins.mjsexits 2 for the same reason (lint-plugins: no oxlint found). Every step after the lint that can run was run individually, above. CI runs the lint step itself.Not run:
oxlintand the plugin lint (no binary in this checkout), and the smoke test (nocore/index.jsorcore/src/host/change).Docs:
docs/subsystems/social.mdgains one clause on the mixed batch (the same bullet already describes this dock and#3044), so noDocs-not-needed:is claimed.Checkpoint
{ "pr": 3072, "claim": "Dev-3", "issue": 3071, "summary": "approveAll calls decide once per waiting hold, and decide cleared the dock's error line on entry, so a send that worked erased the reason the send before it had written. The clear now happens where the person acted (approve-all click, Retry, a single card's Approve/Reject), decide hands its reason back, and the batch writes the failures once after its last send, each naming its card, while the receipt still names only the people reached. The single-card path is unchanged; a live-useState test harness makes the post-click state readable.", "files": [ "plugins/social/client.js", "plugins/social/test/social.test.js", "docs/subsystems/social.md", "changelog.d/3071-mixed-approve-reason.fixed.md" ], "checks": { "ran": "red first with client.js at 9b45c95e and only the new tests present, twice identical apart from duration_ms: social.test.js:4519 not ok, 'a mixed click still says why one hold did not send'; green at the tip: plugins/social 672/672, ARCH_DOCS_BASE=9b45c95e check-arch-docs OK (4 files), changelog.mjs check 4 fragments, build-client --check exit 0, ds-bot-patches check 3 lines ok and canonical no-op", "result": "green", "at": "e1d227bb5365f78f1f4035c1654d61d567c1ed1e" }, "next": "waiting for a Verdict naming e1d227bb; branch cut from live main 9b45c95e, no rebase" }