Repository navigation
fix(pstack): read TLC interval sets such as 1..3 as their integers in statechart - #889
Open
rudycelekli wants to merge 1 commit into
Open
rudycelekli wants to merge 1 commit into
rudycelekli wants to merge 1 commit into
Conversation
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.
Anyone charting a spec whose variable starts as a range of integers hits this. For example,
Init == free = SeatswithSeats == 1..3, or anyx \in SUBSET (1..N). TLC prints a set it has not rebuilt as1..3in both the state graph and the traces.parseValueonly read numbers, so the whole value came back as the string"1..3". A map that writes${v.free.length} freethen labels the start state "4 free" (the string's length), and the chart and the replay disagree with the spec on the very first state.parseValuenow readsa..bafter an integer as the list of integers from a to b, the same shape it already gives a set like{1, 2, 3}. An empty range such as1..0becomes an empty list. Every other value form is read exactly as before.Validation: a new
test/tlc-interval.test.mjschecksparseValueon plain, negative, and nested ranges plusparseState, and runstlc-to-chart.mjson a hand-written graph whose start state isfree = 1..3. It expects "3 free, 0 held" and no "4 free". Both tests fail on origin/main and pass with this change. With TLC 1.7.4,statechart.mjs from-specon the seat spec now starts its trace at "3 free, 0 held" where it said "4 free" before.node scripts/validate-plugins.mjs,node scripts/generate-pstack-harness-trees.mjs --check, andgit diff --checkpass. On macOS, the rest of the statechart suite gives the same results as origin/main: 13 tests there expect a/tmptemp path and fail on both.Note
Low Risk
Narrow parser change for TLC output format with regression tests; no auth, data, or API surface changes.
Overview
parseValuein the statechart TLC parser now expands TLC’s interval shorthanda..b(consecutive integer sets) into a numeric array, matching how explicit sets like{1, 2, 3}were already represented. Before this, values such as1..3stayed as strings, which broke maps that use.lengthon set variables and produced wrong initial state labels (e.g. “4 free” instead of “3 free”).Empty or inverted ranges resolve to an empty list via
Math.max(0, …). Other literal forms (booleans, bare numbers, records, etc.) are unchanged.A new
tlc-interval.test.mjscoversparseValue/parseStatefor positive and negative ranges and an end-to-endtlc-to-chart.mjsrun on a DOT graph whose start state usesfree = 1..3.Reviewed by Cursor Bugbot for commit 059eaa8. Bugbot is set up for automated code reviews on this repo. Configure here.