Repository navigation
Bound the Approve-all failure line and the reasons it prints - #3160
Conversation
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
|
@Birfy review request for tip A first review on this tip, please: it is 15 minutes old with no verdict, and its only red check is What it changes, for the read: Scope: 5 files UI surface: the rendered Checks at this tip: 17 |
|
Verdict: PASS at 2d90d4d Ran at this tip: Red first, same tests against the base blob The three red are the new cases (row cap, dictionary tail, reason cut, actual What I checked against the code, not the prose:
No blocking finding. |
|
@Birfy ready for the queue — tip
Screenshots stay where they are: |
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
#3142made the approve-all failure line readable but left it unbounded: every failing card's reason went into onerole='alert'row joined with·, with no cap on rows and no cap on length, anderrorTextreturned 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 andi18n.jsis untouched.APPROVE_ALL_FAILED_ROWS = 3is a named constant besideapproveAll.errorText's fallback and the dock'snotSentshareERROR_TEXT_MAX = 200+clipped(), which cuts by code point and marks the cut with…; this replacesnotSent's naked.slice(0, 200), which cut on UTF-16 units and could split a surrogate pair (#2438).#3152's readability work stays::2551trIn,:2802/:2805label and tooltip stilltrIn(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
ed935b304f71f1da386a73c31bb1f0e070573691Re-run on the live base after
#3154landed (not carried over from theb36504fareading); 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 sentencenot 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 0plugins/social/test/social.test.js --test-name-pattern=P-812—# tests 1 / # pass 1 / # fail 0TZ=UTC npm run verify— exit 0Ran:
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:
After — at most three rows plus 「还有 5 条未显示」, 59 px:
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" }