docs: round-trip byte-stability scope + minusOne/minusOneFast state counts#230
Merged
Conversation
β¦ounts Refine the round-trip stability claim across CLAUDE.md, the engine README, and test/round-trip.spec.ts. Previous wording said "stable for all wrapped states including shared-bare cases" β that overstated the guarantee. The accurate model: - Simple wrappers (scanToX(eraseHere)-style): bytewise stable across toMermaid β fromMermaid β toGraph β toMermaid. The #139 regression test pins this. - Shared-bare cases (library-binary-numbers/minusOne where invertNumber backs both the outermost bare and wrapper-W1's bare): emit a SINGLE de-duped node with &-joined call arrows; sharing survives the round-trip. But GraphNode ids are runtime State ids reassigned on every fromGraph rebuild, and a shared bare's post-rebuild id no longer follows the original emission order, so the byte stream reorders. Verify behavioural identity with equivalentOn β allAgree:true instead. Also syncs in-source state-count comments for minusOne (15 β 18) and minusOneFast (8 β 10) β the graphs.spec.ts test fixture already pins these counts via summarizeGraph(graph).stateCount, so the comments were lagging behind the source of truth.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Post-merge follow-up to #229. Refines the round-trip stability claim across docs and syncs the in-source state-count comments to match the test fixtures.
What changed
Round-trip stability framing β narrowed
Previous wording across
CLAUDE.md,packages/machine/README.md, andtest/round-trip.spec.tssaid `toMermaid β fromMermaid β toGraph β toMermaid` was "stable for all wrapped states including shared-bare cases" after #174's callable-subtree emit. That overstated the guarantee.The accurate model:
Updated in three places:
State-count comments synced
`packages/library-binary-numbers/src/index.ts`:
The `graphs.spec.ts` fixture (lines 17-18) already pins these via `summarizeGraph(graph).stateCount`. The source comments were lagging behind the test-pinned source of truth.
Test plan