Skip to content

fix(runtime): quote printable binaries with ~p - #96

Merged
mremond merged 1 commit into
mainfrom
infinitary-batch/60d1d8e8
Nov 28, 2026
Merged

mremond merged 1 commit into
mainfrom
infinitary-batch/60d1d8e8

Conversation

@mremond

@mremond mremond commented Nov 28, 2026

Copy link
Copy Markdown
Member

Why

Native Erlang showed numbers for readable binaries where BEAM, Erlang’s usual runtime, showed quoted text.

What changed

  • Plain ~p shows readable binaries as quoted text, alone and inside lists and tuples.
  • Empty binaries and binaries with unreadable bytes or partial bytes print as before.

Before and after

Before: The three calls showed the numbers 97, 98 and 99 instead of the text abc.

After: The three calls show the quoted text abc, just as BEAM does.

Native output for a binary alone, in a list and in a tuple

BeforeAfter

Native stdout shows 97,98,99 as bytes on three lines: alone, in a list and in a tuple.

Native stdout shows <<"abc">> on three lines: alone, in a list and in a tuple.

Checked

Live validation: Demonstrated for this version. 2 of 2 scenarios driven live in the product.

Scenario Result Evidence
Print a binary alone, in a list and in a tuple ✅ Passed live Native Nera and BEAM printed the same three lines.
Run the same regression test on both runtimes ✅ Passed live Both runs printed the same completion line after all assertions passed.
  • Targeted tests: Nine native tests passed, including binary output, depth limits, field formatting and character handling.
  • Rust workspace: Strict lint passed; under standard permissions, 2,265 tests passed and one was ignored.
  • Independent review: The review passed. I clarified the misleading depth-limit description without changing output.
How it was checked

The shared regression failed on the original native runtime. It passed with the fix and on BEAM.

A Rust negative control returned numeric output and failed the exact assertion for quoted output.

An unchanged storage test failed with an inherited group-write permission mask on the original code and the changed code; both passed under the standard mask.

Risk

Risk: low in every dimension.

Full risk assessment
Dimension Level Why
Blast radius low The change is confined to term output formatting.
Behavior low Plain ~p quotes printable binaries without changing the values.
Undo low Reverting restores numeric formatting without changing stored data.
Evidence low Native output matches BEAM byte for byte in all three positions.
Sensitivity low The formatter does not access accounts, keys or external services.
Novelty low The change extends the existing term formatter and reuses its binary view.
Dependencies low No dependencies were added or updated.
Not done

Merge approval queues this change for the next batch. The batch must pass its checks before it merges.

Plain ~p shows readable binaries as quoted text, alone and inside lists and tuples.

Empty binaries and binaries with unreadable bytes or partial bytes print as before.
@github-actions github-actions Bot added this to the 0.1.1 milestone Nov 28, 2026
@mremond
mremond merged commit e565986 into main Nov 28, 2026
22 checks passed
@mremond
mremond deleted the infinitary-batch/60d1d8e8 branch November 28, 2026 20:54
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.

1 participant