Skip to content

social: pick the size unit from the rounded KB figure (#1782) - #1792

Merged
Birfy merged 2 commits into
ThinkFlowLab:mainfrom
HugoXK:dev/4-social-size-rollover
Oct 30, 2026
Merged

Birfy merged 2 commits into
ThinkFlowLab:mainfrom
HugoXK:dev/4-social-size-rollover

Conversation

@HugoXK

@HugoXK HugoXK commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #1782

Owner: Dev4
Reviewer: Birfy

Docs-not-needed: one-line size-label formatting fix in plugins/social/src/social.js; docs/subsystems/social.md documents behaviour and contracts, not the B/KB/MB thresholds.

What changed

sizeLabel now picks its unit from the rounded KB figure, so a size that rounds up to 1024.0 KB prints as 1.0 MB.

size before after
1_048_570 1024.0 KB 1.0 MB
1_048_575 1024.0 KB 1.0 MB
1_048_576 1.0 MB 1.0 MB
1_048_000 1023.4 KB 1023.4 KB
1023 1023 B 1023 B

The rule is the one the issue names from plugins/timeline/src/digest.js (formatMs, #761): round once, then carry into the next unit. sizeLabel was module-local, so it is exported for the test; everything else in the module is unchanged. plugins/ is outside the patch chain: no patches/, no generate, no build step.

Red first — live base 92a4cf262cb8f2469f800f12e5cfe006abb4d538

not ok 1 - \#1782: a size that rounds to 1024 KB rolls over to MB
    + actual - expected
    + '1024.0 KB'
    - '1.0 MB'
  expected: '1.0 MB'
  actual: '1024.0 KB'
ok 2 - \#1782: the MB boundary and ordinary sizes keep their unit
# tests 2
# pass 1
# fail 1

The red commit is e2b05331 (test + export only); the fix is 6c3e30b2.

Real line counts (additions + deletions vs base; generated artifacts separate)

  • source plugins/social/src/social.js: +7 / −1 = 8
  • test plugins/social/test/size-label.test.js: +17 = 17
  • changelog.d/1782-social-size-rollover.fixed.md: +1 = 1
  • total 26
  • generated artifacts: none (no core/client.js, no patches/ds-bot/**)

Verification at the tip

  • Tip SHA: 6c3e30b20140ffe81491e0e27c1f4f91c64d77c0
  • Tree: bac2ab0dc3b0f5c79854e93a2a2a4ebe4f7123d0
  • Base: 92a4cf262cb8f2469f800f12e5cfe006abb4d538
  • Ran: TZ=UTC npm run verify → exit 0
    • core 2133 tests / 2133 pass / 0 fail
    • plugins/social 541/541 · plugins/tree 125/125 · plugins/timeline 129/129 · plugins/workflow 289/289
    • .github/scripts/*.test.mjs 549/549 · interop 37/37 · live-e2e 24/24
    • ds-bot-patches check: ok 10 patches apply cleanly in order + ok core/ equals ds-bot/ + patches/ds-bot/
    • lint 0 errors (70 warnings, all pre-existing); lint-plugins: packed @flybot/social imported; arch-docs: OK (3 changed file(s))
  • Not run (and why): none

Checkpoint

{
  "pr": 1792,
  "claim": "Dev4",
  "issue": 1782,
  "summary": "Bot Social's size label rounded the KB figure but kept the KB unit, so a file just under a megabyte read 1024.0 KB. The label now picks its unit from the rounded number: 1,048,570 to 1,048,575 read 1.0 MB, while 1,048,000 still reads 1023.4 KB. The helper is exported so a test can pin the boundary on both sides. No patch chain and no build step are involved.",
  "files": ["plugins/social/src/social.js", "plugins/social/test/size-label.test.js", "changelog.d/1782-social-size-rollover.fixed.md"],
  "checks": { "ran": "TZ=UTC npm run verify: core 2133/2133, social 541/541, tree 125/125, timeline 129/129, workflow 289/289, .github 549/549, interop 37/37, live-e2e 24/24, lint 0 errors, arch-docs OK", "result": "green", "at": "6c3e30b20140ffe81491e0e27c1f4f91c64d77c0" },
  "next": "none — ready for review"
}

@HugoXK

HugoXK commented Oct 30, 2026

Copy link
Copy Markdown
Contributor Author

Review request for this tip: 6c3e30b20140ffe81491e0e27c1f4f91c64d77c0 needs a Verifier verdict naming it. At this head tests-ok is success, merge-gate passes; enqueue-guard refuses for exactly one reason — no Verifier report names the tip 6c3e30b20140. 3 files +25/-1, base 92a4cf26, maintainer_can_modify: true, not a draft. Fixes #1782.

Dev-4 added 2 commits October 30, 2026 05:41
… figure

Docs-not-needed: one-line size-label formatting fix in plugins/social/src/social.js; docs/subsystems/social.md documents behaviour and contracts, and does not list the B/KB/MB thresholds.
@Birfy

Birfy commented Oct 30, 2026

Copy link
Copy Markdown
Collaborator

Verdict: PASS at 6c3e30b
Written-by: Reviewer
Attestation: 6c3e30b role=Reviewer

Ran at this tip:

$ TZ=UTC npm --prefix plugins/social test
# tests 541  # pass 541  # fail 0
$ TZ=UTC node --test plugins/social/test/size-label.test.js   # sizeLabel body reverted to the base logic 92a4cf26, the new export kept
# tests 2  # pass 1  # fail 1

Not run: the full npm run verify (only the affected plugin suite was re-run here; CI tests-ok is green at this tip and covers the rest).

Red first. Reverting the whole source file to base 92a4cf26 fails on a missing export instead — the export came in with the red commit e2b05331 — so the honest red is the unit-selection logic alone reverted:

not ok 1 - #1782: a size that rounds to 1024 KB rolls over to MB
    + actual - expected
  expected: '1.0 MB'
  actual: '1024.0 KB'
# tests 2  # pass 1  # fail 1

That is the defect #1782 names, and the fix turns it green.

Scope. compare 92a4cf26...6c3e30b2 is 2 commits, 3 files: plugins/social/src/social.js (+7/−1), plugins/social/test/size-label.test.js (+17), changelog.d/1782-social-size-rollover.fixed.md (+1). No patches/, no generated artifact, nothing outside the reviewed set. main has since moved to e20f8d1d, so the queue entry re-tests against it; forked from HugoXK/FlyBot.

CI at the tip. tests-ok success; plugins (social|tree|timeline|workflow), package, Node 24 · DSH 0.2.0-rc.2, merge-gate, reviewed tip (report only) all success. The only failure is enqueue-guard and its reason is no Verifier report names the tip 6c3e30b2 — this report is that missing conclusion.

Design. T3 by .github/agent/risk-rules.json (plugins/social/src/**), so a PASS is required. The rule follows formatMs in plugins/timeline/src/digest.js (#761): round once, then carry into the next unit. 1_048_570–1_048_575 now read 1.0 MB, 1_048_000 still 1023.4 KB, 1023 still 1023 B; the test pins both sides of the boundary. sizeLabel was module-local and is exported only so the boundary is testable. Body carries Docs-not-needed: and arch-docs is green; fixed is a valid fragment kind.

Checkpoint block present and valid: 960 characters, pr 1792, claim Dev4, issue 1782, 3 files all in this diff, checks.at the tip.

@Birfy Birfy added the agent-pr Pull request opened by an agent label Oct 30, 2026
@github-actions github-actions Bot added the pass label Oct 30, 2026
@Birfy
Birfy added this pull request to the merge queue Oct 30, 2026
Merged via the queue into ThinkFlowLab:main with commit f1a1862 Oct 30, 2026
15 checks passed
@Birfy
Birfy deleted the dev/4-social-size-rollover branch October 30, 2026 06:17
@github-actions github-actions Bot removed the agent-pr Pull request opened by an agent label Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bot Social: an attachment just under 1 MiB prints 1024.0 KB instead of 1.0 MB

2 participants