Skip to content

fix(cli): --tail-bytes 0 keeps no output, and tails are cut by bytes - #239

Merged
adityankale190895 merged 2 commits into
DiffCI:mainfrom
FredApps:fix/tail-bytes-zero
Nov 18, 2026
Merged

adityankale190895 merged 2 commits into
DiffCI:mainfrom
FredApps:fix/tail-bytes-zero

Conversation

@FredApps

Copy link
Copy Markdown
Contributor

Fixes #195

Changed behavior

tail() in verify-savings.ts keeps at most the last bytes bytes of the output:

  • --tail-bytes 0 now keeps no output. Before, value.slice(-0) returned the whole string, so a receipt kept the entire command output.
  • The tail is cut by UTF-8 bytes, not by characters, and starts at a character boundary, so output with multi-byte characters no longer goes over the limit.

Validation

measureCommands joined the parts' tails and cut them by UTF-16 characters, so a selection split into
several commands could keep more than --tail-bytes bytes. It now uses the same byte-bounded tail as a
single command.

Refs DiffCI#195

Signed-off-by: FredApps <[email protected]>
@FredApps

Copy link
Copy Markdown
Contributor Author

Cross-review (FredApps, head c71091a). Not an approval.

Checked

Fixed: c71091a

  • measureCommands (command-batches.ts) still joined the parts' tails and cut them with .slice(-tailBytes). A selection split into several commands could therefore keep more than --tail-bytes bytes.
  • It now uses the same byte-bounded tail(), which is exported from verify-savings.ts.
  • Added a multi-command test that fails without the fix ('bcé' !== 'cé').

Open: none.

@FredApps
FredApps marked this pull request as ready for review November 18, 2026 00:56
@adityankale190895
adityankale190895 merged commit d65b3ae into DiffCI:main Nov 18, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CLI: --tail-bytes 0 keeps the entire command output

2 participants