Repository navigation
fix(pstack): read statechart action names without the arguments TLC 1.8.0 adds - #1288
Open
buildwithme wants to merge 1 commit into
Open
buildwithme wants to merge 1 commit into
buildwithme wants to merge 1 commit into
Conversation
….8.0 adds TLC 1.8.0 prints a parameterized action with its arguments, as Run(TRUE) in the error trace and label="Run(TRUE)" in the graph dump. TLC 2.19 prints Run in both. actionOf read the trace name up to a space or >, and parseDot read the graph label up to a quote. So a view that maps Run missed Run(TRUE), Send(1,"a b") became Send(1,"a in the trace and Send(1,\ in the graph, and lasso found no graph step for a trace step. The report then said only "TLC found a counterexample". Both readers now stop the name at (. TLC 1.8.0 puts the arguments last, also after an INSTANCE prefix, so the name is the one TLC 2.19 prints. everystate prints the trace as 1.8.0 does and the graph as 2.19 does, and its reports now match TLC 2.19 too. messages.test.ts and chart.test.ts check trace lines and a graph dump copied from TLC 2.19 and TLC 1.8.0 runs.
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.
Why
TLC 1.8.0 prints the arguments of a parameterized action after its name. TLC 2.19 (
tla2tools1.7.4, the version that the skill installs) prints the name only:-dump dot,actionlabels<Run line 4, col 16 ...>label="Run"<Run(TRUE) line 4, col 16 ...>label="Run(TRUE)"everystate, a TLA+ checker with a TLC command line, prints the trace as 1.8.0 does and the graph as 2.19 does.
The skill reads the action name with
[^\s>]+inactionOfand with[^"]*inparseDot. With TLC 1.8.0 this gives these results:step()that mapsRungetsRun(TRUE). The chart and the report show the raw name.Send(1, "a b")isSend(1,"ain the trace andSend(1,\in the graph, because the trace stops at the space and the graph stops at the escaped quote.Send(1, "a b")andSend(2, "c"), are two graph steps.lassofinds no graph step for a trace step. The report then says only "TLC found a counterexample", with no path and no loop. This is the failure that fix(pstack): keep qualified action names in statechart property traces #982 fixed for INSTANCE names. With everystate,Run(TRUE)againstRungives the same failure.Fix
Both readers stop the name at
(. TLC 1.8.0 puts the arguments last, also after an INSTANCE prefix (C!Up(1)). So the name before(is the name that TLC 2.19 prints. Steps that differ only in their arguments become one graph step, as in TLC 2.19's graph.tlc-NAME.outdoes not change. It keeps TLC's lines as TLC prints them.Tests
messages.test.ts: trace lines from TLC 2.19 and TLC 1.8.0 for a Boolean argument, a string with a space, an INSTANCE action, and a "Back to state" step with a tuple. Each line gives the TLC 2.19 name.chart.test.ts: the full TLC 1.8.0 graph dump of theArgsspec below.parseDotgives oneSendstep for each pair of states, and oneBackstep.All test lines are TLC's output, copied from runs of TLC 2.19 and of the
v1.8.0tla2tools.jar.End to end, with the view
step = (a) => ({ Send: "you send", Back: "you go back" })[a] ?? a:With this PR, the
report.mdandchart.mmdof all three checkers are the same, byte for byte. On theActionNamespec (an INVARIANT thatRun(TRUE)breaks), TLC 1.8.0 on main labels each arrow and the bug pathRun(TRUE). With this PR they get the view's label, as with TLC 2.19.Checks
In
pstack/skills/statechart/scripts, on macOS with Node 26:TLA2TOOLS=<tla2tools 1.7.4> JAVA=<Temurin 25> npm test: 374 pass, 1 fail.npm testwithoutTLA2TOOLS, as CI runs it: 271 pass, 70 skip, 1 fail.TLA2TOOLSandJAVAset to everystate 0.4.1: 347 pass, 28 fail. Main fails the same 28 tests. They compare the checker's own text, such as progress lines and SANY's error text, with TLC 2.19's recording, and everystate prints other text. The 2 new tests pass.node scripts/generate-pstack-harness-trees.mjs --check: up to date.node scripts/validate-plugins.mjs: pass.node scripts/check-pstack-docs.mjs: 0 problems.The one failure in each run is
the launcher reached through an absolute and a relative symlink writes the committed chart on this Nodeincli.test.ts. It fails on main too, and only on macOS. There,os.tmpdir()is under/var, which is a link to/private/var. The test computes its relative link from the/varpath, but the link resolves from the real folder, one level deeper, so it misses the launcher. CI runs on Linux.This PR does not change the plugin version.