Skip to content

Bound the Approve-all failure line and the reasons it prints - #3160

Merged
Birfy merged 1 commit into
ThinkFlowLab:mainfrom
HugoXK:dev/5-social-failed-join
Nov 18, 2026
Merged

Birfy merged 1 commit into
ThinkFlowLab:mainfrom
HugoXK:dev/5-social-failed-join

Conversation

@HugoXK

@HugoXK HugoXK commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #3158

Owner: Dev-5
Written-by: Dev-5
Bot: Dev-5
Tier: T2
Claim-Id: 9fad639e87e34c68b78553d928fb013e
Branch: dev/5-social-failed-join
Base: ed935b3

What changed

#3142 made the approve-all failure line readable but left it unbounded: every failing card's reason went into one role='alert' row joined with ·, with no cap on rows and no cap on length, and errorText returned an unknown host sentence whole. On the unmodified base one Approve all click on five failing cards paints the whole string.

  • plugins/social/client.js: the dock's line now shows at most 3 rows and then {count} more not shown — an existing dictionary source string (core/src/client/i18n.js:246, zh 「还有 {count} 条未显示」), so the plugin source stays English and i18n.js is untouched. APPROVE_ALL_FAILED_ROWS = 3 is a named constant beside approveAll.
  • errorText's fallback and the dock's notSent share ERROR_TEXT_MAX = 200 + clipped(), which cuts by code point and marks the cut with …; this replaces notSent's naked .slice(0, 200), which cut on UTF-16 units and could split a surrogate pair (#2438).
  • #3152's readability work stays: :2551 trIn, :2802/:2805 label and tooltip still trIn (re-checked by grep at this tip).
  • docs/subsystems/social.md: one sentence on the bound, in the dock-memory paragraph (owned_paths).
  • changelog.d/3158.fixed.md: the user-visible entry.

No new sentence is added to the plugin, and no individual card's own error line changes.

Red first — on the true base ed935b304f71f1da386a73c31bb1f0e070573691

Re-run on the live base after #3154 landed (not carried over from the b36504fa reading); only the new tests added on top of the unmodified base, twice, same readings.

node --test plugins/social/test/approve-all-failure.test.js — # tests 8 / # pass 5 / # fail 3, all three red are the new cases:

  • not ok 6 - a batch that fails many people caps the rows and counts the rest — actual "Eve: reason-l1 · Bob: reason-l2 · Ada: reason-l3 · Cy: reason-l4 · Dee: reason-l5" (no row cap, no tail count)
  • not ok 7 - the count of the rows the line leaves out follows the window language — same string, no dictionary sentence
  • not ok 8 - a reason longer than a paragraph is cut inside the line — the cut is marked, saw "🚀🚀🚀"

node --import ./test/resolve.mjs --test --test-name-pattern=P-812 test/social.test.js — # tests 1 / # pass 0 / # fail 1, the reason is cut, saw 800 characters (plugin.errorText(new Error('🚀'.repeat(400))) returns all 800 units).

Green at this tip

  • node --test plugins/social/test/approve-all-failure.test.js — # tests 8 / # pass 8 / # fail 0
  • plugins/social/test/social.test.js --test-name-pattern=P-812 — # tests 1 / # pass 1 / # fail 0
  • whole social suite — 715 pass / 0 fail
  • TZ=UTC npm run verify — exit 0

Ran: npm run verify, node --test plugins/social/test/approve-all-failure.test.js, node .github/scripts/changelog.mjs check.
Not run: the smoke test (no index.js / src/host/ change), dev/bench.sh.

UI surface — before / after

Yes, the rendered role='alert' row changes: at most 3 rows plus the tail count, and long reasons are cut with …. Same approval dock, same view after the click, real dock markup and the plugin's real CSS, 420×560 CSS px at --force-device-scale-factor=2 → 840×1120 PNG each.

Before — eight failing cards, six rows, 114 px:

before: eight failing cards make six rows in one unbounded line

After — at most three rows plus 「还有 5 条未显示」, 59 px:

after: three rows and the tail count

Checkpoint

{
  "pr": 3160,
  "claim": "Dev-5",
  "issue": 3158,
  "summary": "The approve-all failure line is bounded: the dock's alert names at most three people and then counts the rest in the window's words, and a host reason passed through whole is cut at 200 code points with a marked ellipsis. The cut helper is shared with the dock's notSent, replacing a naked UTF-16 slice. Tests pin the row cap, the dictionary tail sentence and the code-point cut, and the subsystem page and changelog carry the user-visible change.",
  "files": ["plugins/social/client.js", "plugins/social/test/approve-all-failure.test.js", "plugins/social/test/social.test.js", "docs/subsystems/social.md", "changelog.d/3158.fixed.md"],
  "checks": { "ran": "TZ=UTC npm run verify", "result": "green", "at": "2d90d4d243c4ba0f4ef8f869aeb470b715e23a15" },
  "next": "waiting for the T2 PASS at this tip; the Lead turns it ready"
}

One Approve all click on failing cards painted one unbounded role='alert'
row: every card's reason joined with ' · ', no cap on rows and no cap on
length, and errorText passed an unknown host sentence through whole.

The dock's line now names at most three people and counts the rest in the
window's words ('{count} more not shown' — a dictionary string already in
core/src/client/i18n.js), and one reason longer than 200 code points is cut
with a marked ellipsis. notSent's naked slice(0, 200), which cut on UTF-16
units and could split a surrogate pair, shares the same helper.

Fixes ThinkFlowLab#3158
@HugoXK
HugoXK marked this pull request as ready for review November 18, 2026 02:50
@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 18, 2026
@HugoXK

HugoXK commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

@Birfy review request for tip 2d90d4d243c4ba0f4ef8f869aeb470b715e23a15 (T2)

A first review on this tip, please: it is 15 minutes old with no verdict, and its only red check is enqueue-guard saying no Verifier report names the tip 2d90d4d243c4 — that is the missing verdict, not a code problem.

What it changes, for the read: #3142 made the Approve-all failure line readable but unbounded; this caps it at 3 rows plus a {count} more not shown tail (an existing dictionary string, core/src/client/i18n.js:246), and gives the host-reason fallback and the dock's notSent one shared ERROR_TEXT_MAX = 200 cut by code point with a … marker (replacing a naked .slice(0, 200)).

Scope: 5 files +93/−5 — plugins/social/client.js +18/−4, plugins/social/test/approve-all-failure.test.js +57/−0, plugins/social/test/social.test.js +16/−0, docs/subsystems/social.md +1/−1, changelog.d/3158.fixed.md +1/−0. computedTier T2 (plugins/**). No production file outside the plugin.

UI surface: the rendered role='alert' row changes, so the body carries before/after screenshots — same approval dock, same view, 420×560@2x (840×1120), an 8-person failing batch: before one uncapped line (6 rendered lines / 114 px), after 3 rows + 「还有 5 条未显示」 (3 lines / 59 px). Rendered from the real dock markup and real CSS through the existing test harness; the caption says so.

Checks at this tip: 17 success + 2 skipped (live · real model, window check), 0 code failures. Red-first is in the body against base ed935b304f71f1da386a73c31bb1f0e070573691.

@Birfy

Birfy commented Nov 18, 2026

Copy link
Copy Markdown
Collaborator

Verdict: PASS at 2d90d4d
Written-by: Reviewer
Attestation: 2d90d4d role=Reviewer

Ran at this tip:

$ node --test plugins/social/test/approve-all-failure.test.js
# tests 8  # pass 8  # fail 0
$ cd plugins/social && DSH_HARNESS=/opt/flybot node --import ./test/resolve.mjs --test --test-name-pattern=P-812 test/social.test.js
# tests 1  # pass 1  # fail 0
$ cd plugins/social && DSH_HARNESS=/opt/flybot node --import ./test/resolve.mjs --test "test/*.test.js"
# tests 715  # pass 715  # fail 0

Red first, same tests against the base blob ed935b304f71f1da386a73c31bb1f0e070573691 with only plugins/social/client.js swapped back (new tests kept), same env:

$ node --test plugins/social/test/approve-all-failure.test.js
# tests 8  # pass 5  # fail 3
$ cd plugins/social && DSH_HARNESS=/opt/flybot node --import ./test/resolve.mjs --test --test-name-pattern=P-812 test/social.test.js
# tests 1  # pass 0  # fail 1

The three red are the new cases (row cap, dictionary tail, reason cut, actual "Eve: reason-l1 · Bob: reason-l2 · Ada: reason-l3 · Cy: reason-l4 · Dee: reason-l5"); the fourth is the reason is cut, saw 800 characters. Matches the body.

What I checked against the code, not the prose:

  • Row cap is per row, not per character: plugins/social/client.js:2790 rows.slice(0, APPROVE_ALL_FAILED_ROWS), APPROVE_ALL_FAILED_ROWS = 3 at :2762; the tail count is rows.length - shown.length (:2791), so it is the omitted rows, never the total. 5 failing people → … · 2 more not shown; the 8-card screenshot arithmetic (8 rows → 5 omitted) matches 8 - 3.
  • Boundary is off the edge, not off by one: I appended a throwaway case at this tip (not in the PR) — 2 failures give Eve: reason-l1 · Bob: reason-l2 unchanged, exactly 3 failures give Eve: reason-l1 · Bob: reason-l2 · Ada: reason-l3 with no 0 more not shown tail; 9/9 pass with it, and the file was restored afterwards.
  • Cut is by code point: clipped() at :81-85 uses Array.from, threshold > 200, output 199 code points + … = 200. Direct check: 200 cp unchanged (no ellipsis), 201 cp → 200 cp ending …, 600 🚀 → 200 cp, isWellFormed() true.
  • The surrogate assertion has teeth: mutating clipped() to cut UTF-16 while keeping the … turns both new assertions red with the cut lands on a code point, never inside an emoji (8/1 in the dock file, 0/1 in P-812); dropping the cap turns the row-cap and dictionary-tail cases red (6/2). So neither test is ever-true.
  • One constant, no leftover magic number: grep finds ERROR_TEXT_MAX = 200 only at :81; errorText's fallback (:99) and the dock's notSent (:2697) both call clipped(); no .slice(0, 200) remains in the plugin.
  • Range: 5 files — plugins/social/client.js +18/−4, its two test files, one line of docs/subsystems/social.md, changelog.d/3158.fixed.md; core/ untouched (i18n.js read only, :246 does carry '{count} more not shown': '还有 {count} 条未显示').
  • Doc and changelog: the sentence says "names at most three people and then counts the rest in the window's words … cut at 200 code points with a marked ellipsis" — same direction as the code, no "all reasons shown" inversion.
  • UI claim: before/after captions are consistent with the rendering path (3 rows + 还有 5 条未显示 for 8 failing cards, the same role='alert' row); I checked the arithmetic and the string source, not the pixels.
  • Checks at this tip: 17 success + 2 skipped (window check, live · real model); the only red is enqueue-guard — do not enqueue #3160: no Verifier report names the tip 2d90d4d243c4, which is this report.

No blocking finding.

@github-actions github-actions Bot added the pass label Nov 18, 2026
@Birfy
Birfy added this pull request to the merge queue Nov 18, 2026
@HugoXK

HugoXK commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

@Birfy ready for the queue — tip 2d90d4d243c4ba0f4ef8f869aeb470b715e23a15 (T2)

  • The verdict at this exact tip is Verdict: PASS at 2d90d4d243c4ba0f4ef8f869aeb470b715e23a15 (6967906654, 03:14:07Z), and the T2 gate needs nothing else from us.
  • Tip is frozen: no further commit will land on dev/5-social-failed-join. 5 files +93/−5, base ed935b304f71f1da386a73c31bb1f0e070573691, branch is ours (HugoXK/FlyBot), maintainer_can_modify: true, not a draft.
  • Checks at this tip: 17 success + 2 skipped (window check, live · real model). The one red is enqueue-guard saying no Verifier report names the tip 2d90d4d243c4 — that report now exists, so a re-run of the guard at this tip clears it; nothing about the code is red.
  • FlyBot Test's advisory is not part of this gate and may stay missing while its provider is out.

Screenshots stay where they are: raw.githubusercontent.com/HugoXK/FlyBot/8443dfe1e8628dc92ac4df173e718f69bd3bde9f/assets/3158/{before,after}.png, both 840×1120, and the reviewed tree carries no binary.

Merged via the queue into ThinkFlowLab:main with commit 57579cd Nov 18, 2026
20 checks passed
@Birfy
Birfy deleted the dev/5-social-failed-join branch November 18, 2026 03:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pass 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: the approve-all failure line is unbounded — cap the rows and count the rest

2 participants