Repository navigation
Description
Implementation: FlyBot (ours) — PR follows within 24h. Do not pick up without a pickup-ok comment on this issue.
Written-by: FlyBot Lead
Claimed-by: FlyBot Lead
Claim-Id: c8bd164584284f5a814359fa3b13c168
Branch: dev/4-social-size-rollover
Base: 92a4cf2
At: 2026-10-30T05:09:53Z
Implementation: FlyBot (ours) — PR follows within 24h. Do not pick up without a pickup-ok comment.
Written-by: FlyBot Lead
What a person sees
Bot Social's attachment line prints a file just under 1 MiB as 1024.0 KB instead of 1.0 MB, and the oversize refusal (… is over 1024.0 KB) can say the same. The unit prints a number it cannot hold.
Where
plugins/social/src/social.js:97
const sizeLabel = n => (n < 1024 ? `${n} B` : n < 1048576 ? `${(n / 1024).toFixed(1)} KB` : `${(n / 1048576).toFixed(1)} MB`)1_048_575 / 1024 = 1023.999… → toFixed(1) → 1024.0, printed with the KB it already overflowed.
Reproduction (live main 92a4cf262cb8f2469f800f12e5cfe006abb4d538)
The label reaches the person on the attached-files line (:2501, Attached files: report.pdf (1024.0 KB, id …)) and in the refusal (:581/:584/:609/:622).
// same expression as :97, evaluated on main
const sizeLabel = n => (n < 1024 ? `${n} B` : n < 1048576 ? `${(n / 1024).toFixed(1)} KB` : `${(n / 1048576).toFixed(1)} MB`)
sizeLabel(1_048_570) // '1024.0 KB'
sizeLabel(1_048_575) // '1024.0 KB'
sizeLabel(1_048_576) // '1.0 MB'Expected
1.0 MB for 1,048,570–1,048,575 — round once, then carry into the next unit, the rule already stated in plugins/timeline/src/digest.js:22-30 (formatMs, #761) and applied to counts by #1779.
Scope
sizeLabel only (~2 lines): compute the KB result after rounding and switch to MB when it reaches 1024, plus one case in plugins/social/test/ covering the 1_048_570 / 1_048_575 / 1_048_576 boundaries (wherever sizeLabel is exercised today — it is module-local, so export it or assert through the message that carries it), plus a changelog.d/ fragment. plugins/ is outside the patch chain: no patches/, no generate.
Dedupe (searched 2026-10-30, open + closed)
sizeLabel→ Review nits from PR #2 #20 and FlyBot plugin layer (ctx.flybot) with social and tree plugins #2, both closed, neither about sizes."1024.0 KB"→ 0 hits.- timeline digest: a count between 999,950 and 999,999 prints 1000.0k instead of 1.0M #1779 is the same class in the timeline digest's counts; different file, different unit ladder, and it is being fixed separately. This one is only about Bot Social's file sizes.
Activity