diff --git a/harness/pstack/claude-code/skills/statechart/SKILL.md b/harness/pstack/claude-code/skills/statechart/SKILL.md index f5a64a8db..05d3d9585 100644 --- a/harness/pstack/claude-code/skills/statechart/SKILL.md +++ b/harness/pstack/claude-code/skills/statechart/SKILL.md @@ -67,6 +67,7 @@ Aim for about 20 arrows or fewer, because a busier chart is hard to read. First - With a VIEW or a SYMMETRY, TLC counts states that it treats as the same as one state, and the chart draws that one state. An arrow can lead to it rather than to the state that the step reaches, and the report says so. - TLC checks the rules in each state past a CONSTRAINT or an ACTION_CONSTRAINT, but it does not explore that state or check it for deadlock. When TLC's shortest path for a rule ends in such a state, the chart draws that state, and the report gives that path. The chart does not draw the other states past the bound. A deadlock in such a state does not show. TLC also checks the rules after each step that an ACTION_CONSTRAINT excludes, also when it reaches the next state another way. When TLC's shortest path for a rule ends with such a step, the chart draws that step. - The command checks the rules with TLC on the config as written, with one worker. When a rule breaks, the command removes that rule and runs TLC again, until no rule breaks. After the first break, each run stops at 100,000 distinct states, so that a large model does not run without end. When a run reaches that bound or stops on an error, the report lists the rules that it did not check under "Rules not checked", and the chart does not mark them. A rule that is not checked can hold or break. To check it, remove the rules that break from the config, or make the model smaller. The bound adds a module that changes TLC's order of the variables, so for a property TLC can find a different counterexample than a run without the bound. +- Under "TLC warnings", above "Rules that hold", the report gives each warning that TLC printed in the runs that check the rules, once each. It leaves out TLC's advice on Java's garbage collector, and the warning about the bound that the command adds after the first break. A run that stops at a break can stop before TLC warns, so a later run can print a warning that the first run does not. A rule can hold only because of what a warning names, such as an action that changes a variable that it also lists as UNCHANGED, so read the warnings before you trust a rule that holds. - `tlc.out` is what TLC printed on the config as written. When the chart does not show the bug path of a rule that breaks, `tlc-RULE.out` is what TLC printed for the run that found it. When TLC repeats its first warning, plain TLC prints it twice, but `tlc.out` shows it once, because TLC leaves the second copy out of the output that this command reads. That happens only when Java runs with `-XX:+UseParallelGC`, since otherwise TLC's first warning is its advice to pass that flag, which it prints once. ## Show the chart diff --git a/harness/pstack/claude-code/skills/statechart/scripts/backends/report.ts b/harness/pstack/claude-code/skills/statechart/scripts/backends/report.ts index 62e2a8533..1ed6064f7 100644 --- a/harness/pstack/claude-code/skills/statechart/scripts/backends/report.ts +++ b/harness/pstack/claude-code/skills/statechart/scripts/backends/report.ts @@ -48,6 +48,7 @@ export function report( stop, drawing, states, + warnings, }: { spec: Spec; graph: Graph; @@ -57,6 +58,7 @@ export function report( stop: Stop | undefined; drawing: { status: number | null } | undefined; states: { distinct: number; initial: number; complete: boolean; cut: boolean }; + warnings: string[]; }, found: Bug[], chart: Chart | undefined, @@ -153,6 +155,13 @@ export function report( `TLC found a counterexample. It is in tlc-${rule.name}.out.`, ); } + if (warnings.length) + out.push( + "", + "## TLC warnings", + `TLC printed ${warnings.length === 1 ? "this warning" : "these warnings"} while it checked the rules. A rule can hold only because of the problem that ${warnings.length === 1 ? "the" : "a"} warning names.`, + ...warnings.map(fenced), + ); if (holds.length) out.push("", "## Rules that hold", holds.join(", ")); if (unchecked.length) out.push("", "## Rules not checked", unchecked.join(", ")); if (unchecked.length && states.cut) diff --git a/harness/pstack/claude-code/skills/statechart/scripts/frontends/verdict.ts b/harness/pstack/claude-code/skills/statechart/scripts/frontends/verdict.ts index 4f2ddd925..464b774e1 100644 --- a/harness/pstack/claude-code/skills/statechart/scripts/frontends/verdict.ts +++ b/harness/pstack/claude-code/skills/statechart/scripts/frontends/verdict.ts @@ -1,4 +1,4 @@ -import { EC, type Part } from "../ir.ts"; +import { EC, LEVEL, type Part } from "../ir.ts"; import { textOf } from "./messages.ts"; export type Break = @@ -19,12 +19,18 @@ const DISTINCT = new Map([ [EC.TLC_STATS, /(\d+) distinct states found/], ]); -export function readVerdict(messages: Iterable) { +const aboutTheRun = (code: number, bounded: boolean) => + code === EC.TLC_ENVIRONMENT_JVM_GC || + (bounded && code === EC.TLC_FEATURE_LIVENESS_CONSTRAINTS); + +export function readVerdict(messages: Iterable, bounded = false) { let broke: Break | undefined; let distinct = 0; let initial = 0; + const warnings: string[] = []; for (const m of messages) { if (typeof m === "string") continue; + if (m.level === LEVEL.WARNING && !aboutTheRun(m.code, bounded)) warnings.push(textOf(m)); const count = DISTINCT.get(m.code)?.exec(textOf(m)); if (count) distinct = Math.max(distinct, Number(count[1])); if (m.code === EC.TLC_INIT_GENERATED1 || m.code === EC.TLC_INIT_GENERATED2) @@ -36,5 +42,5 @@ export function readVerdict(messages: Iterable) { const name = named?.[1].exec(textOf(m))?.[1]; if (named && name) broke = { kind: named[0], name }; } - return { broke, distinct, initial }; + return { broke, distinct, initial, warnings }; } diff --git a/harness/pstack/claude-code/skills/statechart/scripts/ir.ts b/harness/pstack/claude-code/skills/statechart/scripts/ir.ts index 80fd403fe..bea804ef3 100644 --- a/harness/pstack/claude-code/skills/statechart/scripts/ir.ts +++ b/harness/pstack/claude-code/skills/statechart/scripts/ir.ts @@ -105,6 +105,8 @@ export const EC = { TLC_STATE_PRINT3: 2218, TLC_SANY_END: 2219, TLC_SANY_START: 2220, + TLC_FEATURE_LIVENESS_CONSTRAINTS: 2284, + TLC_ENVIRONMENT_JVM_GC: 2401, } as const; export const LEVEL = { NONE: 0, ERROR: 1, TLCBUG: 2, WARNING: 3, STATE: 4 } as const; @@ -132,6 +134,7 @@ export type CheckResult = { drawing: { status: number | null } | undefined; states: { distinct: number; initial: number; complete: boolean; cut: boolean }; messages: Iterable; + warnings: string[]; }; export const RERUN_STATES = 100_000; diff --git a/harness/pstack/claude-code/skills/statechart/scripts/run.ts b/harness/pstack/claude-code/skills/statechart/scripts/run.ts index 017684f82..4e0688f4a 100644 --- a/harness/pstack/claude-code/skills/statechart/scripts/run.ts +++ b/harness/pstack/claude-code/skills/statechart/scripts/run.ts @@ -346,6 +346,7 @@ export async function check(specFile: string, configFile: string): Promise(); for (let k = 1; groups.length;) { const group: Rule[] = []; for (const rule of groups[0]) if (!verdicts.has(ruleKey(rule))) group.push(rule); @@ -369,7 +370,9 @@ export async function check(specFile: string, configFile: string): Promise { + const r = run(path.join(corpus, "UnchangedWarning")); + assert.equal(r.stderr, ""); + assert.equal(r.status, 0); + const warning = [ + "The variable paid was changed while it is specified as UNCHANGED at", + "line 9, col 62 to line 9, col 65 of module UnchangedWarning", + ].join("\n"); + const at = r.report.indexOf(warning); + assert.notEqual(at, -1, r.report); + assert.equal(r.report.indexOf(warning, at + 1), -1, r.report); + assert.ok(at < r.report.indexOf("\n## Rules that hold\nNeverPaidTwice, NoDeadlock"), r.report); + assert.doesNotMatch(r.report, /UseParallelGC/); +}); + +test("a TLC warning that only a later verdict run prints is in the report too", () => { + const r = run(path.join(corpus, "UnchangedAfterDeadlock")); + assert.equal(r.stderr, ""); + assert.equal(r.status, 1); + assert.match(r.report, /^## NoDeadlock breaks$/m); + const warning = [ + "The variable paid was changed while it is specified as UNCHANGED at", + "line 11, col 61 to line 11, col 64 of module UnchangedAfterDeadlock", + ].join("\n"); + const at = r.report.indexOf(warning); + assert.notEqual(at, -1, r.report); + assert.equal(r.report.indexOf(warning, at + 1), -1, r.report); + assert.ok(at < r.report.indexOf("\n## Rules that hold\nNeverPaidLate"), r.report); +}); + test("TLC checks the rules and draws the chart with VIEW and SYMMETRY, and the report says an arrow can lead to a representative", () => { const dir = copyCase("MediaPlayer", (d) => fs.appendFileSync(path.join(d, "MediaPlayer.cfg"), "\nVIEW vars\nSYMMETRY Perms\n"), diff --git a/harness/pstack/claude-code/skills/statechart/scripts/test/corpus/PickWorker/report.md b/harness/pstack/claude-code/skills/statechart/scripts/test/corpus/PickWorker/report.md index 505b488b1..6a8326726 100644 --- a/harness/pstack/claude-code/skills/statechart/scripts/test/corpus/PickWorker/report.md +++ b/harness/pstack/claude-code/skills/statechart/scripts/test/corpus/PickWorker/report.md @@ -3,5 +3,11 @@ TLC reached 2 states and 1 steps. The chart draws 2 states and 1 arrows. With SYMMETRY, TLC keeps one representative for each group of states that it counts as the same. An arrow can lead to the representative rather than to the state that the step reaches. +## TLC warnings +TLC printed this warning while it checked the rules. A rule can hold only because of the problem that the warning names. +``` +Declaring symmetry during liveness checking is dangerous. It might cause TLC to miss violations of the stated liveness properties. Please check liveness without symmetry defined. +``` + ## Rules that hold PicksFirst diff --git a/harness/pstack/claude-code/skills/statechart/scripts/test/corpus/UnchangedAfterDeadlock/ChartRun.out b/harness/pstack/claude-code/skills/statechart/scripts/test/corpus/UnchangedAfterDeadlock/ChartRun.out new file mode 100644 index 000000000..bd59e4ed7 --- /dev/null +++ b/harness/pstack/claude-code/skills/statechart/scripts/test/corpus/UnchangedAfterDeadlock/ChartRun.out @@ -0,0 +1,61 @@ +@!@!@STARTMSG 2262:0 @!@!@ +TLC2 Version 2.19 of 08 August 2024 (rev: 5a47802) +@!@!@ENDMSG 2262 @!@!@ +@!@!@STARTMSG 2401:3 @!@!@ +Please run the Java VM which executes TLC with a throughput optimized garbage collector by passing the "-XX:+UseParallelGC" property. +@!@!@ENDMSG 2401 @!@!@ +@!@!@STARTMSG 2187:0 @!@!@ +Running breadth-first search Model-Checking with fp 0 and seed -2025214825465097377 with 1 worker on 4 cores with 1986MB heap and 64MB offheap memory [pid: 2656086] (Linux 6.8.0-149-generic amd64, Eclipse Adoptium 21.0.13 x86_64, MSBDiskFPSet, DiskStateQueue). +@!@!@ENDMSG 2187 @!@!@ +@!@!@STARTMSG 2220:0 @!@!@ +Starting SANY... +@!@!@ENDMSG 2220 @!@!@ +Parsing file /tmp/statechart-NiGJcX/statechart-58Br8c/ChartRun.tla +Parsing file /root/projects/cursor-plugins/pstack/skills/statechart/scripts/test/corpus/UnchangedAfterDeadlock/UnchangedAfterDeadlock.tla +Parsing file /tmp/statechart-NiGJcX/statechart-58Br8c/tmp-ChartRun/Naturals.tla +Parsing file /tmp/statechart-NiGJcX/statechart-58Br8c/tmp-ChartRun/TLC.tla +Parsing file /tmp/statechart-NiGJcX/statechart-58Br8c/tmp-ChartRun/Sequences.tla +Parsing file /tmp/statechart-NiGJcX/statechart-58Br8c/tmp-ChartRun/FiniteSets.tla +Semantic processing of module Naturals +Semantic processing of module UnchangedAfterDeadlock +Semantic processing of module Sequences +Semantic processing of module FiniteSets +Semantic processing of module TLC +Semantic processing of module ChartRun +@!@!@STARTMSG 2219:0 @!@!@ +SANY finished. +@!@!@ENDMSG 2219 @!@!@ +@!@!@STARTMSG 2185:0 @!@!@ +Starting... (2026-11-17 00:46:43) +@!@!@ENDMSG 2185 @!@!@ +@!@!@STARTMSG 2189:0 @!@!@ +Computing initial states... +@!@!@ENDMSG 2189 @!@!@ +@!@!@STARTMSG 2190:0 @!@!@ +Finished computing initial states: 2 distinct states generated at 2026-11-17 00:46:45. +@!@!@ENDMSG 2190 @!@!@ +@!@!@STARTMSG 2143:3 @!@!@ +The variable paid was changed while it is specified as UNCHANGED at +line 11, col 61 to line 11, col 64 of module UnchangedAfterDeadlock +@!@!@ENDMSG 2143 @!@!@ +@!@!@STARTMSG 2193:0 @!@!@ +Model checking completed. No error has been found. + Estimates of the probability that TLC did not check all reachable states + because two distinct states had the same fingerprint: + calculated (optimistic): val = 3.8E-19 +@!@!@ENDMSG 2193 @!@!@ +@!@!@STARTMSG 2200:0 @!@!@ +Progress(6) at 2026-11-17 00:46:45: 8 states generated (124 s/min), 7 distinct states found (108 ds/min), 0 states left on queue. +@!@!@ENDMSG 2200 @!@!@ +@!@!@STARTMSG 2199:0 @!@!@ +8 states generated, 7 distinct states found, 0 states left on queue. +@!@!@ENDMSG 2199 @!@!@ +@!@!@STARTMSG 2194:0 @!@!@ +The depth of the complete state graph search is 6. +@!@!@ENDMSG 2194 @!@!@ +@!@!@STARTMSG 2268:0 @!@!@ +The average outdegree of the complete state graph is 1 (minimum is 0, the maximum 1 and the 95th percentile is 1). +@!@!@ENDMSG 2268 @!@!@ +@!@!@STARTMSG 2186:0 @!@!@ +Finished in 3900ms at (2026-11-17 00:46:45) +@!@!@ENDMSG 2186 @!@!@ diff --git a/harness/pstack/claude-code/skills/statechart/scripts/test/corpus/UnchangedAfterDeadlock/UnchangedAfterDeadlock.cfg b/harness/pstack/claude-code/skills/statechart/scripts/test/corpus/UnchangedAfterDeadlock/UnchangedAfterDeadlock.cfg new file mode 100644 index 000000000..ee94e7b7e --- /dev/null +++ b/harness/pstack/claude-code/skills/statechart/scripts/test/corpus/UnchangedAfterDeadlock/UnchangedAfterDeadlock.cfg @@ -0,0 +1,2 @@ +SPECIFICATION Spec +INVARIANT NeverPaidLate diff --git a/harness/pstack/claude-code/skills/statechart/scripts/test/corpus/UnchangedAfterDeadlock/UnchangedAfterDeadlock.tla b/harness/pstack/claude-code/skills/statechart/scripts/test/corpus/UnchangedAfterDeadlock/UnchangedAfterDeadlock.tla new file mode 100644 index 000000000..67c5decde --- /dev/null +++ b/harness/pstack/claude-code/skills/statechart/scripts/test/corpus/UnchangedAfterDeadlock/UnchangedAfterDeadlock.tla @@ -0,0 +1,18 @@ +---- MODULE UnchangedAfterDeadlock ---- +EXTENDS Naturals +VARIABLES x, paid, side + +Init == x = 0 /\ paid = FALSE /\ side \in {0, 1} + +Stuck == side = 1 /\ FALSE + +Step == side = 0 /\ x < 5 /\ x' = x + 1 /\ UNCHANGED <> + +Pay == side = 0 /\ x >= 3 /\ paid' = TRUE /\ UNCHANGED <> + +Next == Step \/ Pay \/ Stuck \/ (x = 5 /\ UNCHANGED <>) + +Spec == Init /\ [][Next]_<> + +NeverPaidLate == ~(paid /\ x > 3) +==== diff --git a/harness/pstack/claude-code/skills/statechart/scripts/test/corpus/UnchangedAfterDeadlock/chart.mmd b/harness/pstack/claude-code/skills/statechart/scripts/test/corpus/UnchangedAfterDeadlock/chart.mmd new file mode 100644 index 000000000..89eab5ee9 --- /dev/null +++ b/harness/pstack/claude-code/skills/statechart/scripts/test/corpus/UnchangedAfterDeadlock/chart.mmd @@ -0,0 +1,24 @@ +stateDiagram-v2 + state "Legend" as legend { + lg0: Breaks NoDeadlock + lg1: Path to the NoDeadlock bug + } + class lg0 breaks + class lg1 bugPath + s0: side=0 x=0 paid=FALSE + s1: side=1 x=0 paid=FALSE + s2: side=0 x=1 paid=FALSE + s3: side=0 x=2 paid=FALSE + s4: side=0 x=3 paid=FALSE + s5: side=0 x=4 paid=FALSE + s6: side=0 x=5 paid=FALSE + [*] --> s0 + [*] --> s1 + s0 --> s2: Step + s2 --> s3: Step + s3 --> s4: Step + s4 --> s5: Step + s5 --> s6: Step + classDef breaks fill:#ffecee,stroke:#e72e3b,stroke-width:2.5px,color:#cd2834 + class s1 breaks + class s1 bugPath diff --git a/harness/pstack/claude-code/skills/statechart/scripts/test/corpus/UnchangedAfterDeadlock/graph.dot b/harness/pstack/claude-code/skills/statechart/scripts/test/corpus/UnchangedAfterDeadlock/graph.dot new file mode 100644 index 000000000..860103f84 --- /dev/null +++ b/harness/pstack/claude-code/skills/statechart/scripts/test/corpus/UnchangedAfterDeadlock/graph.dot @@ -0,0 +1,25 @@ +strict digraph DiskGraph { +nodesep=0.35; +subgraph cluster_graph { +color="white"; +-5243620187527078639 [label="/\\ side = 0\n/\\ x = 0\n/\\ paid = FALSE",style = filled] +7331602431577323913 [label="/\\ side = 1\n/\\ x = 0\n/\\ paid = FALSE",style = filled] +-5243620187527078639 -> 2592443193205854937 [label="Step",color="black",fontcolor="black"]; +2592443193205854937 [label="/\\ side = 0\n/\\ x = 1\n/\\ paid = FALSE"]; +2592443193205854937 -> -4858708178491410644 [label="Step",color="black",fontcolor="black"]; +-4858708178491410644 [label="/\\ side = 0\n/\\ x = 2\n/\\ paid = FALSE"]; +-4858708178491410644 -> 2905587872829569252 [label="Step",color="black",fontcolor="black"]; +2905587872829569252 [label="/\\ side = 0\n/\\ x = 3\n/\\ paid = FALSE"]; +2905587872829569252 -> -6887147292129408661 [label="Step",color="black",fontcolor="black"]; +-6887147292129408661 [label="/\\ side = 0\n/\\ x = 4\n/\\ paid = FALSE"]; +-6887147292129408661 -> 3795178130618893987 [label="Step",color="black",fontcolor="black"]; +3795178130618893987 [label="/\\ side = 0\n/\\ x = 5\n/\\ paid = FALSE"]; +3795178130618893987 -> 3795178130618893987 [label="Next",color="black",fontcolor="black"]; +{rank = same; -5243620187527078639;7331602431577323913;} +{rank = same; 2592443193205854937;} +{rank = same; -4858708178491410644;} +{rank = same; 2905587872829569252;} +{rank = same; -6887147292129408661;} +{rank = same; 3795178130618893987;} +} +} \ No newline at end of file diff --git a/harness/pstack/claude-code/skills/statechart/scripts/test/corpus/UnchangedAfterDeadlock/report.md b/harness/pstack/claude-code/skills/statechart/scripts/test/corpus/UnchangedAfterDeadlock/report.md new file mode 100644 index 000000000..f1f883f8f --- /dev/null +++ b/harness/pstack/claude-code/skills/statechart/scripts/test/corpus/UnchangedAfterDeadlock/report.md @@ -0,0 +1,18 @@ +# UnchangedAfterDeadlock + +TLC reached 7 states and 6 steps. The chart draws 7 states and 5 arrows. +The chart does not draw 1 steps that stay in one chart state. + +## NoDeadlock breaks +The shortest path has 0 steps: +0. side=1 x=0 paid=FALSE + +## TLC warnings +TLC printed this warning while it checked the rules. A rule can hold only because of the problem that the warning names. +``` +The variable paid was changed while it is specified as UNCHANGED at +line 11, col 61 to line 11, col 64 of module UnchangedAfterDeadlock +``` + +## Rules that hold +NeverPaidLate diff --git a/harness/pstack/claude-code/skills/statechart/scripts/test/corpus/UnchangedAfterDeadlock/sany.out b/harness/pstack/claude-code/skills/statechart/scripts/test/corpus/UnchangedAfterDeadlock/sany.out new file mode 100644 index 000000000..794c3bdb1 --- /dev/null +++ b/harness/pstack/claude-code/skills/statechart/scripts/test/corpus/UnchangedAfterDeadlock/sany.out @@ -0,0 +1,2 @@ +UnchangedAfterDeadlock10000--TLA+ BUILTINS--0FALSE020000--TLA+ BUILTINS--0TRUE040000--TLA+ BUILTINS--0=2565Formal_006Formal_10130000--TLA+ BUILTINS--2'11414Formal_00150000--TLA+ BUILTINS--0\lnot11627216799UnchangedAfterDeadlock2Step096799UnchangedAfterDeadlock21993999UnchangedAfterDeadlock21992599UnchangedAfterDeadlock11991699UnchangedAfterDeadlock1491299UnchangedAfterDeadlock1232161699UnchangedAfterDeadlock00212599UnchangedAfterDeadlock1188212199UnchangedAfterDeadlock1230252599UnchangedAfterDeadlock05303999UnchangedAfterDeadlock24303199UnchangedAfterDeadlock213303099UnchangedAfterDeadlock1230353999UnchangedAfterDeadlock1162353599UnchangedAfterDeadlock1230393999UnchangedAfterDeadlock01446799UnchangedAfterDeadlock267546799UnchangedAfterDeadlock1125565999UnchangedAfterDeadlock1231626599UnchangedAfterDeadlock123216Formal_00190000--TLA+ BUILTINS--0\land2202120Formal_0021Formal_10220000--TLA+ BUILTINS--0\lor2232423Formal_0024Formal_10154177136NaturalsNaturals1561621721761821881942002062122182241561161414Naturals0Nat014161414Naturals0106157111515Naturals0a0158331515Naturals0b01621191515Naturals0+214191515Naturals010615151515Naturals015718181515Naturals0158157158163111717Naturals0a02911721111UnchangedAfterDeadlock2Pay08721111UnchangedAfterDeadlock2198411111UnchangedAfterDeadlock2198251111UnchangedAfterDeadlock1198151111UnchangedAfterDeadlock148111111UnchangedAfterDeadlock123215151111UnchangedAfterDeadlock0020251111UnchangedAfterDeadlock120620201111UnchangedAfterDeadlock123025251111UnchangedAfterDeadlock0330411111UnchangedAfterDeadlock2430341111UnchangedAfterDeadlock21330331111UnchangedAfterDeadlock123138411111UnchangedAfterDeadlock0246721111UnchangedAfterDeadlock26756721111UnchangedAfterDeadlock112558581111UnchangedAfterDeadlock123061641111UnchangedAfterDeadlock123167701111UnchangedAfterDeadlock1232164331717Naturals0b016514191717Naturals0n0400000--TLA+ BUILTINS--0\in2414241Formal_0042Formal_101721331717Naturals0-214331717Naturals012625331717Naturals0425291717Naturals016225251717Naturals016429291717Naturals016533331717Naturals0163165163164173111818Naturalsa0174331818Naturalsb01761171818Naturals0*214171818Naturals02173174177111919Naturals0a0178331919Naturals0b03071701313UnchangedAfterDeadlock2Next09701313UnchangedAfterDeadlock2229281313UnchangedAfterDeadlock2229191313UnchangedAfterDeadlock2229121313UnchangedAfterDeadlock227217191313UnchangedAfterDeadlock229124281313UnchangedAfterDeadlock125234691313UnchangedAfterDeadlock21934381313UnchangedAfterDeadlock1434341313UnchangedAfterDeadlock123038381313UnchangedAfterDeadlock0543691313UnchangedAfterDeadlock26753691313UnchangedAfterDeadlock112555551313UnchangedAfterDeadlock123058611313UnchangedAfterDeadlock123164671313UnchangedAfterDeadlock12321821191919Naturals0^214191919Naturals010615151919Naturals017718181919Naturals0178177178183112020Naturals0a0184332020Naturals0b01881192020Naturals0<215192020Naturals0415152020Naturals018319192020Naturals0184183184189112121Naturals0a0610000--TLA+ BUILTINS--3[]1623171421515UnchangedAfterDeadlock3Spec09421515UnchangedAfterDeadlock3199121515UnchangedAfterDeadlock124617421515UnchangedAfterDeadlock36119421515UnchangedAfterDeadlock211320231515UnchangedAfterDeadlock230726421515UnchangedAfterDeadlock112528281515UnchangedAfterDeadlock123031341515UnchangedAfterDeadlock123137401515UnchangedAfterDeadlock1232190332121Naturals0b062Formal_001941192121Naturals0>215192121Naturals0415152121Naturals018919192121Naturals0190189190195112222Naturals0a0670000--TLA+ BUILTINS--2UNCHANGED168196882222Naturals0b068Formal_003241331717UnchangedAfterDeadlock1NeverPaidLate018331717UnchangedAfterDeadlock11520321717UnchangedAfterDeadlock11920231717UnchangedAfterDeadlock123128321717UnchangedAfterDeadlock119428281717UnchangedAfterDeadlock123032321717UnchangedAfterDeadlock032001192222Naturals0\leq215192222Naturals0415152222Naturals019519192222Naturals0196195196201112323Naturals0a0202882323Naturals0b02061192323Naturals0\geq215192323Naturals0415152323Naturals020119192323Naturals0202201202207113333Naturals0a0208553333Naturals0b02121203333Naturals0%215203333Naturals010616163333Naturals020719193333Naturals0208207208213113434Naturals0a0214883434Naturals0b02181203434Naturals0\div215203434Naturals010616163434Naturals021319193434Naturals0214213214219113535Naturals0a0220663535Naturals0b02241203535Naturals0..215203535Naturals010616163535Naturals021919193535Naturals022021922022914118UnchangedAfterDeadlockUnchangedAfterDeadlock232230231156162172176182188194200206212218224246252272291307317324230111133UnchangedAfterDeadlock1x03231141733UnchangedAfterDeadlock1paid03232202333UnchangedAfterDeadlock1side031060000--TLA+ BUILTINS--0$SetEnumerate-11130000--TLA+ BUILTINS--2$SquareAct2114115114Formal_00115Formal_1024614855UnchangedAfterDeadlock1Init094855UnchangedAfterDeadlock11992955UnchangedAfterDeadlock11991355UnchangedAfterDeadlock149955UnchangedAfterDeadlock1230131355UnchangedAfterDeadlock00182955UnchangedAfterDeadlock14182155UnchangedAfterDeadlock1231252955UnchangedAfterDeadlock01344855UnchangedAfterDeadlock140343755UnchangedAfterDeadlock1232434855UnchangedAfterDeadlock0106444455UnchangedAfterDeadlock00474755UnchangedAfterDeadlock0125212677UnchangedAfterDeadlock1Stuck0102677UnchangedAfterDeadlock119101777UnchangedAfterDeadlock14101377UnchangedAfterDeadlock1232171777UnchangedAfterDeadlock01222677UnchangedAfterDeadlock011250000--TLA+ BUILTINS--0$Tuple-11260000--TLA+ BUILTINS--0$UnboundedChoose1127127Formal_00154229Semantic processing of module Naturals +Semantic processing of module UnchangedAfterDeadlock diff --git a/harness/pstack/claude-code/skills/statechart/scripts/test/corpus/UnchangedAfterDeadlock/verdict-1.exit b/harness/pstack/claude-code/skills/statechart/scripts/test/corpus/UnchangedAfterDeadlock/verdict-1.exit new file mode 100644 index 000000000..b4de39476 --- /dev/null +++ b/harness/pstack/claude-code/skills/statechart/scripts/test/corpus/UnchangedAfterDeadlock/verdict-1.exit @@ -0,0 +1 @@ +11 diff --git a/harness/pstack/claude-code/skills/statechart/scripts/test/corpus/UnchangedAfterDeadlock/verdict-1.out b/harness/pstack/claude-code/skills/statechart/scripts/test/corpus/UnchangedAfterDeadlock/verdict-1.out new file mode 100644 index 000000000..badea5584 --- /dev/null +++ b/harness/pstack/claude-code/skills/statechart/scripts/test/corpus/UnchangedAfterDeadlock/verdict-1.out @@ -0,0 +1,56 @@ +@!@!@STARTMSG 2262:0 @!@!@ +TLC2 Version 2.19 of 08 August 2024 (rev: 5a47802) +@!@!@ENDMSG 2262 @!@!@ +@!@!@STARTMSG 2401:3 @!@!@ +Please run the Java VM which executes TLC with a throughput optimized garbage collector by passing the "-XX:+UseParallelGC" property. +@!@!@ENDMSG 2401 @!@!@ +@!@!@STARTMSG 2187:0 @!@!@ +Running breadth-first search Model-Checking with fp 0 and seed -2761778670377416215 with 1 worker on 4 cores with 1986MB heap and 64MB offheap memory [pid: 2655518] (Linux 6.8.0-149-generic amd64, Eclipse Adoptium 21.0.13 x86_64, MSBDiskFPSet, DiskStateQueue). +@!@!@ENDMSG 2187 @!@!@ +@!@!@STARTMSG 2220:0 @!@!@ +Starting SANY... +@!@!@ENDMSG 2220 @!@!@ +Parsing file /root/projects/cursor-plugins/pstack/skills/statechart/scripts/test/corpus/UnchangedAfterDeadlock/UnchangedAfterDeadlock.tla +Parsing file /tmp/statechart-NiGJcX/statechart-58Br8c/tmp-verdict-1/Naturals.tla +Semantic processing of module Naturals +Semantic processing of module UnchangedAfterDeadlock +@!@!@STARTMSG 2219:0 @!@!@ +SANY finished. +@!@!@ENDMSG 2219 @!@!@ +@!@!@STARTMSG 2185:0 @!@!@ +Starting... (2026-11-17 00:46:32) +@!@!@ENDMSG 2185 @!@!@ +@!@!@STARTMSG 2189:0 @!@!@ +Computing initial states... +@!@!@ENDMSG 2189 @!@!@ +@!@!@STARTMSG 2190:0 @!@!@ +Finished computing initial states: 2 distinct states generated at 2026-11-17 00:46:34. +@!@!@ENDMSG 2190 @!@!@ +@!@!@STARTMSG 2114:1 @!@!@ +Deadlock reached. +@!@!@ENDMSG 2114 @!@!@ +@!@!@STARTMSG 2121:1 @!@!@ +The behavior up to this point is: +@!@!@ENDMSG 2121 @!@!@ +@!@!@STARTMSG 2217:4 @!@!@ +1: +/\ side = 1 +/\ x = 0 +/\ paid = FALSE + +@!@!@ENDMSG 2217 @!@!@ +@!@!@STARTMSG 2200:0 @!@!@ +Progress(2) at 2026-11-17 00:46:34: 3 states generated (46 s/min), 3 distinct states found (46 ds/min), 1 states left on queue. +@!@!@ENDMSG 2200 @!@!@ +@!@!@STARTMSG 2199:0 @!@!@ +3 states generated, 3 distinct states found, 1 states left on queue. +@!@!@ENDMSG 2199 @!@!@ +@!@!@STARTMSG 2194:0 @!@!@ +The depth of the complete state graph search is 2. +@!@!@ENDMSG 2194 @!@!@ +@!@!@STARTMSG 2268:0 @!@!@ +The average outdegree of the complete state graph is 1 (minimum is 0, the maximum 1 and the 95th percentile is 1). +@!@!@ENDMSG 2268 @!@!@ +@!@!@STARTMSG 2186:0 @!@!@ +Finished in 3899ms at (2026-11-17 00:46:34) +@!@!@ENDMSG 2186 @!@!@ diff --git a/harness/pstack/claude-code/skills/statechart/scripts/test/corpus/UnchangedAfterDeadlock/verdict-2.out b/harness/pstack/claude-code/skills/statechart/scripts/test/corpus/UnchangedAfterDeadlock/verdict-2.out new file mode 100644 index 000000000..ebb9eb698 --- /dev/null +++ b/harness/pstack/claude-code/skills/statechart/scripts/test/corpus/UnchangedAfterDeadlock/verdict-2.out @@ -0,0 +1,61 @@ +@!@!@STARTMSG 2262:0 @!@!@ +TLC2 Version 2.19 of 08 August 2024 (rev: 5a47802) +@!@!@ENDMSG 2262 @!@!@ +@!@!@STARTMSG 2401:3 @!@!@ +Please run the Java VM which executes TLC with a throughput optimized garbage collector by passing the "-XX:+UseParallelGC" property. +@!@!@ENDMSG 2401 @!@!@ +@!@!@STARTMSG 2187:0 @!@!@ +Running breadth-first search Model-Checking with fp 0 and seed -999565353588904235 with 1 worker on 4 cores with 1986MB heap and 64MB offheap memory [pid: 2655815] (Linux 6.8.0-149-generic amd64, Eclipse Adoptium 21.0.13 x86_64, MSBDiskFPSet, DiskStateQueue). +@!@!@ENDMSG 2187 @!@!@ +@!@!@STARTMSG 2220:0 @!@!@ +Starting SANY... +@!@!@ENDMSG 2220 @!@!@ +Parsing file /tmp/statechart-NiGJcX/statechart-58Br8c/ChartBound.tla +Parsing file /root/projects/cursor-plugins/pstack/skills/statechart/scripts/test/corpus/UnchangedAfterDeadlock/UnchangedAfterDeadlock.tla +Parsing file /tmp/statechart-NiGJcX/statechart-58Br8c/tmp-verdict-2/Naturals.tla +Parsing file /tmp/statechart-NiGJcX/statechart-58Br8c/tmp-verdict-2/TLC.tla +Parsing file /tmp/statechart-NiGJcX/statechart-58Br8c/tmp-verdict-2/Sequences.tla +Parsing file /tmp/statechart-NiGJcX/statechart-58Br8c/tmp-verdict-2/FiniteSets.tla +Semantic processing of module Naturals +Semantic processing of module UnchangedAfterDeadlock +Semantic processing of module Sequences +Semantic processing of module FiniteSets +Semantic processing of module TLC +Semantic processing of module ChartBound +@!@!@STARTMSG 2219:0 @!@!@ +SANY finished. +@!@!@ENDMSG 2219 @!@!@ +@!@!@STARTMSG 2185:0 @!@!@ +Starting... (2026-11-17 00:46:38) +@!@!@ENDMSG 2185 @!@!@ +@!@!@STARTMSG 2189:0 @!@!@ +Computing initial states... +@!@!@ENDMSG 2189 @!@!@ +@!@!@STARTMSG 2190:0 @!@!@ +Finished computing initial states: 2 distinct states generated at 2026-11-17 00:46:39. +@!@!@ENDMSG 2190 @!@!@ +@!@!@STARTMSG 2143:3 @!@!@ +The variable paid was changed while it is specified as UNCHANGED at +line 11, col 61 to line 11, col 64 of module UnchangedAfterDeadlock +@!@!@ENDMSG 2143 @!@!@ +@!@!@STARTMSG 2193:0 @!@!@ +Model checking completed. No error has been found. + Estimates of the probability that TLC did not check all reachable states + because two distinct states had the same fingerprint: + calculated (optimistic): val = 3.8E-19 +@!@!@ENDMSG 2193 @!@!@ +@!@!@STARTMSG 2200:0 @!@!@ +Progress(6) at 2026-11-17 00:46:39: 8 states generated (118 s/min), 7 distinct states found (103 ds/min), 0 states left on queue. +@!@!@ENDMSG 2200 @!@!@ +@!@!@STARTMSG 2199:0 @!@!@ +8 states generated, 7 distinct states found, 0 states left on queue. +@!@!@ENDMSG 2199 @!@!@ +@!@!@STARTMSG 2194:0 @!@!@ +The depth of the complete state graph search is 6. +@!@!@ENDMSG 2194 @!@!@ +@!@!@STARTMSG 2268:0 @!@!@ +The average outdegree of the complete state graph is 1 (minimum is 0, the maximum 1 and the 95th percentile is 1). +@!@!@ENDMSG 2268 @!@!@ +@!@!@STARTMSG 2186:0 @!@!@ +Finished in 4086ms at (2026-11-17 00:46:39) +@!@!@ENDMSG 2186 @!@!@ diff --git a/harness/pstack/claude-code/skills/statechart/scripts/test/corpus/UnchangedWarning/ChartRun.out b/harness/pstack/claude-code/skills/statechart/scripts/test/corpus/UnchangedWarning/ChartRun.out new file mode 100644 index 000000000..6aa5012a0 --- /dev/null +++ b/harness/pstack/claude-code/skills/statechart/scripts/test/corpus/UnchangedWarning/ChartRun.out @@ -0,0 +1,61 @@ +@!@!@STARTMSG 2262:0 @!@!@ +TLC2 Version 2.19 of 08 August 2024 (rev: 5a47802) +@!@!@ENDMSG 2262 @!@!@ +@!@!@STARTMSG 2401:3 @!@!@ +Please run the Java VM which executes TLC with a throughput optimized garbage collector by passing the "-XX:+UseParallelGC" property. +@!@!@ENDMSG 2401 @!@!@ +@!@!@STARTMSG 2187:0 @!@!@ +Running breadth-first search Model-Checking with fp 0 and seed 4304451973971592144 with 1 worker on 4 cores with 1986MB heap and 64MB offheap memory [pid: 2422409] (Linux 6.8.0-149-generic amd64, Eclipse Adoptium 21.0.13 x86_64, MSBDiskFPSet, DiskStateQueue). +@!@!@ENDMSG 2187 @!@!@ +@!@!@STARTMSG 2220:0 @!@!@ +Starting SANY... +@!@!@ENDMSG 2220 @!@!@ +Parsing file /tmp/statechart-LTGrgW/statechart-APR1B4/ChartRun.tla +Parsing file /root/projects/cursor-plugins/pstack/skills/statechart/scripts/test/corpus/UnchangedWarning/UnchangedWarning.tla +Parsing file /tmp/statechart-LTGrgW/statechart-APR1B4/tmp-ChartRun/Naturals.tla +Parsing file /tmp/statechart-LTGrgW/statechart-APR1B4/tmp-ChartRun/TLC.tla +Parsing file /tmp/statechart-LTGrgW/statechart-APR1B4/tmp-ChartRun/Sequences.tla +Parsing file /tmp/statechart-LTGrgW/statechart-APR1B4/tmp-ChartRun/FiniteSets.tla +Semantic processing of module Naturals +Semantic processing of module UnchangedWarning +Semantic processing of module Sequences +Semantic processing of module FiniteSets +Semantic processing of module TLC +Semantic processing of module ChartRun +@!@!@STARTMSG 2219:0 @!@!@ +SANY finished. +@!@!@ENDMSG 2219 @!@!@ +@!@!@STARTMSG 2185:0 @!@!@ +Starting... (2026-11-16 23:38:33) +@!@!@ENDMSG 2185 @!@!@ +@!@!@STARTMSG 2189:0 @!@!@ +Computing initial states... +@!@!@ENDMSG 2189 @!@!@ +@!@!@STARTMSG 2190:0 @!@!@ +Finished computing initial states: 1 distinct state generated at 2026-11-16 23:38:34. +@!@!@ENDMSG 2190 @!@!@ +@!@!@STARTMSG 2143:3 @!@!@ +The variable paid was changed while it is specified as UNCHANGED at +line 9, col 62 to line 9, col 65 of module UnchangedWarning +@!@!@ENDMSG 2143 @!@!@ +@!@!@STARTMSG 2193:0 @!@!@ +Model checking completed. No error has been found. + Estimates of the probability that TLC did not check all reachable states + because two distinct states had the same fingerprint: + calculated (optimistic): val = 1.6E-19 +@!@!@ENDMSG 2193 @!@!@ +@!@!@STARTMSG 2200:0 @!@!@ +Progress(3) at 2026-11-16 23:38:34: 4 states generated (113 s/min), 3 distinct states found (85 ds/min), 0 states left on queue. +@!@!@ENDMSG 2200 @!@!@ +@!@!@STARTMSG 2199:0 @!@!@ +4 states generated, 3 distinct states found, 0 states left on queue. +@!@!@ENDMSG 2199 @!@!@ +@!@!@STARTMSG 2194:0 @!@!@ +The depth of the complete state graph search is 3. +@!@!@ENDMSG 2194 @!@!@ +@!@!@STARTMSG 2268:0 @!@!@ +The average outdegree of the complete state graph is 1 (minimum is 0, the maximum 1 and the 95th percentile is 1). +@!@!@ENDMSG 2268 @!@!@ +@!@!@STARTMSG 2186:0 @!@!@ +Finished in 2132ms at (2026-11-16 23:38:34) +@!@!@ENDMSG 2186 @!@!@ diff --git a/harness/pstack/claude-code/skills/statechart/scripts/test/corpus/UnchangedWarning/UnchangedWarning.cfg b/harness/pstack/claude-code/skills/statechart/scripts/test/corpus/UnchangedWarning/UnchangedWarning.cfg new file mode 100644 index 000000000..e16365ebd --- /dev/null +++ b/harness/pstack/claude-code/skills/statechart/scripts/test/corpus/UnchangedWarning/UnchangedWarning.cfg @@ -0,0 +1,2 @@ +SPECIFICATION Spec +INVARIANT NeverPaidTwice diff --git a/harness/pstack/claude-code/skills/statechart/scripts/test/corpus/UnchangedWarning/UnchangedWarning.tla b/harness/pstack/claude-code/skills/statechart/scripts/test/corpus/UnchangedWarning/UnchangedWarning.tla new file mode 100644 index 000000000..fe0e98bbb --- /dev/null +++ b/harness/pstack/claude-code/skills/statechart/scripts/test/corpus/UnchangedWarning/UnchangedWarning.tla @@ -0,0 +1,18 @@ +---- MODULE UnchangedWarning ---- +EXTENDS Naturals +VARIABLES sent, paid + +Init == sent = 0 /\ paid = FALSE + +YouPressPay == sent < 2 /\ sent' = sent + 1 /\ UNCHANGED paid + +BankAccepts == sent > 0 /\ paid' = TRUE /\ UNCHANGED <> + +Done == sent = 2 /\ UNCHANGED <> + +Next == YouPressPay \/ BankAccepts \/ Done + +Spec == Init /\ [][Next]_<> + +NeverPaidTwice == ~(paid /\ sent > 1) +==== diff --git a/harness/pstack/claude-code/skills/statechart/scripts/test/corpus/UnchangedWarning/chart.mmd b/harness/pstack/claude-code/skills/statechart/scripts/test/corpus/UnchangedWarning/chart.mmd new file mode 100644 index 000000000..75ed53a6b --- /dev/null +++ b/harness/pstack/claude-code/skills/statechart/scripts/test/corpus/UnchangedWarning/chart.mmd @@ -0,0 +1,7 @@ +stateDiagram-v2 + s0: sent=0 paid=FALSE + s1: sent=1 paid=FALSE + s2: sent=2 paid=FALSE + [*] --> s0 + s0 --> s1: YouPressPay + s1 --> s2: YouPressPay diff --git a/harness/pstack/claude-code/skills/statechart/scripts/test/corpus/UnchangedWarning/graph.dot b/harness/pstack/claude-code/skills/statechart/scripts/test/corpus/UnchangedWarning/graph.dot new file mode 100644 index 000000000..3735b29e5 --- /dev/null +++ b/harness/pstack/claude-code/skills/statechart/scripts/test/corpus/UnchangedWarning/graph.dot @@ -0,0 +1,15 @@ +strict digraph DiskGraph { +nodesep=0.35; +subgraph cluster_graph { +color="white"; +-3952272340217912252 [label="/\\ sent = 0\n/\\ paid = FALSE",style = filled] +-3952272340217912252 -> 6766213544992975756 [label="YouPressPay",color="black",fontcolor="black"]; +6766213544992975756 [label="/\\ sent = 1\n/\\ paid = FALSE"]; +6766213544992975756 -> -4427539119762059655 [label="YouPressPay",color="black",fontcolor="black"]; +-4427539119762059655 [label="/\\ sent = 2\n/\\ paid = FALSE"]; +-4427539119762059655 -> -4427539119762059655 [label="Done",color="black",fontcolor="black"]; +{rank = same; -3952272340217912252;} +{rank = same; 6766213544992975756;} +{rank = same; -4427539119762059655;} +} +} \ No newline at end of file diff --git a/harness/pstack/claude-code/skills/statechart/scripts/test/corpus/UnchangedWarning/report.md b/harness/pstack/claude-code/skills/statechart/scripts/test/corpus/UnchangedWarning/report.md new file mode 100644 index 000000000..9e971a85b --- /dev/null +++ b/harness/pstack/claude-code/skills/statechart/scripts/test/corpus/UnchangedWarning/report.md @@ -0,0 +1,14 @@ +# UnchangedWarning + +TLC reached 3 states and 3 steps. The chart draws 3 states and 2 arrows. +The chart does not draw 1 steps that stay in one chart state. + +## TLC warnings +TLC printed this warning while it checked the rules. A rule can hold only because of the problem that the warning names. +``` +The variable paid was changed while it is specified as UNCHANGED at +line 9, col 62 to line 9, col 65 of module UnchangedWarning +``` + +## Rules that hold +NeverPaidTwice, NoDeadlock diff --git a/harness/pstack/claude-code/skills/statechart/scripts/test/corpus/UnchangedWarning/sany.out b/harness/pstack/claude-code/skills/statechart/scripts/test/corpus/UnchangedWarning/sany.out new file mode 100644 index 000000000..4738573b0 --- /dev/null +++ b/harness/pstack/claude-code/skills/statechart/scripts/test/corpus/UnchangedWarning/sany.out @@ -0,0 +1,2 @@ +UnchangedWarning10000--TLA+ BUILTINS--0FALSE020000--TLA+ BUILTINS--0TRUE040000--TLA+ BUILTINS--0=2565Formal_006Formal_1026716799UnchangedWarning2BankAccepts0166799UnchangedWarning219163999UnchangedWarning219162399UnchangedWarning1194161999UnchangedWarning1230232399UnchangedWarning00283999UnchangedWarning24283299UnchangedWarning213283199UnchangedWarning1231363999UnchangedWarning02446799UnchangedWarning267546799UnchangedWarning1125565999UnchangedWarning1230626599UnchangedWarning1231130000--TLA+ BUILTINS--2'11414Formal_00150000--TLA+ BUILTINS--0\lnot11616Formal_00190000--TLA+ BUILTINS--0\land2202120Formal_002761441111UnchangedWarning2Done09441111UnchangedWarning2199161111UnchangedWarning149121111UnchangedWarning123016161111UnchangedWarning0221441111UnchangedWarning26731441111UnchangedWarning112533361111UnchangedWarning123039421111UnchangedWarning123121Formal_10220000--TLA+ BUILTINS--0\lor2232423Formal_0024Formal_10154177136NaturalsNaturals1561621721761821881942002062122182242821421313UnchangedWarning2Next09421313UnchangedWarning2229341313UnchangedWarning2229191313UnchangedWarning225324341313UnchangedWarning226739421313UnchangedWarning22761561161414Naturals0Nat014161414Naturals0106157111515Naturals0a0158331515Naturals0b01621191515Naturals0+214191515Naturals010615151515Naturals015718181515Naturals0158157158163111717Naturals0a02911391515UnchangedWarning3Spec09391515UnchangedWarning3199121515UnchangedWarning123917391515UnchangedWarning36119391515UnchangedWarning211320231515UnchangedWarning228226391515UnchangedWarning112528311515UnchangedWarning123034371515UnchangedWarning1231164331717Naturals0b016514191717Naturals0n02981371717UnchangedWarning1NeverPaidTwice019371717UnchangedWarning11521361717UnchangedWarning11921241717UnchangedWarning123129361717UnchangedWarning119429321717UnchangedWarning123036361717UnchangedWarning011721331717Naturals0-214331717Naturals012625331717Naturals0425291717Naturals016225251717Naturals016429291717Naturals016533331717Naturals0163165163164173111818Naturalsa0174331818Naturalsb01761171818Naturals0*214171818Naturals02173174177111919Naturals0a0178331919Naturals0b01821191919Naturals0^214191919Naturals010615151919Naturals017718181919Naturals0178177178183112020Naturals0a0184332020Naturals0b01881192020Naturals0<215192020Naturals0415152020Naturals018319192020Naturals0184183184189112121Naturals0a0610000--TLA+ BUILTINS--3[]162190332121Naturals0b062Formal_001941192121Naturals0>215192121Naturals0415152121Naturals018919192121Naturals0190189190195112222Naturals0a0670000--TLA+ BUILTINS--2UNCHANGED168196882222Naturals0b068Formal_002001192222Naturals0\leq215192222Naturals0415152222Naturals019519192222Naturals0196195196201112323Naturals0a0202882323Naturals0b02061192323Naturals0\geq215192323Naturals0415152323Naturals020119192323Naturals0202201202207113333Naturals0a0208553333Naturals0b02121203333Naturals0%215203333Naturals010616163333Naturals020719193333Naturals0208207208213113434Naturals0a0214883434Naturals0b02181203434Naturals0\div215203434Naturals010616163434Naturals021319193434Naturals0214213214219113535Naturals0a0220663535Naturals0b02241203535Naturals0..215203535Naturals010616163535Naturals021919193535Naturals022021922022914118UnchangedWarningUnchangedWarning230231156162172176182188194200206212218224239253267276282291298230111433UnchangedWarning1sent03231172033UnchangedWarning1paid031060000--TLA+ BUILTINS--0$SetEnumerate-123913255UnchangedWarning1Init093255UnchangedWarning11991655UnchangedWarning1491255UnchangedWarning1230161655UnchangedWarning00213255UnchangedWarning14212455UnchangedWarning1231283255UnchangedWarning011130000--TLA+ BUILTINS--2$SquareAct2114115114Formal_00115Formal_1025316177UnchangedWarning2YouPressPay0166177UnchangedWarning219164377UnchangedWarning219162377UnchangedWarning1188161977UnchangedWarning1230232377UnchangedWarning02284377UnchangedWarning24283277UnchangedWarning213283177UnchangedWarning1230364377UnchangedWarning1162363977UnchangedWarning1230434377UnchangedWarning01486177UnchangedWarning267586177UnchangedWarning12311250000--TLA+ BUILTINS--0$Tuple-11260000--TLA+ BUILTINS--0$UnboundedChoose1127127Formal_00154229Semantic processing of module Naturals +Semantic processing of module UnchangedWarning diff --git a/harness/pstack/claude-code/skills/statechart/scripts/test/corpus/UnchangedWarning/verdict-1.out b/harness/pstack/claude-code/skills/statechart/scripts/test/corpus/UnchangedWarning/verdict-1.out new file mode 100644 index 000000000..bee82948f --- /dev/null +++ b/harness/pstack/claude-code/skills/statechart/scripts/test/corpus/UnchangedWarning/verdict-1.out @@ -0,0 +1,53 @@ +@!@!@STARTMSG 2262:0 @!@!@ +TLC2 Version 2.19 of 08 August 2024 (rev: 5a47802) +@!@!@ENDMSG 2262 @!@!@ +@!@!@STARTMSG 2401:3 @!@!@ +Please run the Java VM which executes TLC with a throughput optimized garbage collector by passing the "-XX:+UseParallelGC" property. +@!@!@ENDMSG 2401 @!@!@ +@!@!@STARTMSG 2187:0 @!@!@ +Running breadth-first search Model-Checking with fp 0 and seed -4267136552748306321 with 1 worker on 4 cores with 1986MB heap and 64MB offheap memory [pid: 2422224] (Linux 6.8.0-149-generic amd64, Eclipse Adoptium 21.0.13 x86_64, MSBDiskFPSet, DiskStateQueue). +@!@!@ENDMSG 2187 @!@!@ +@!@!@STARTMSG 2220:0 @!@!@ +Starting SANY... +@!@!@ENDMSG 2220 @!@!@ +Parsing file /root/projects/cursor-plugins/pstack/skills/statechart/scripts/test/corpus/UnchangedWarning/UnchangedWarning.tla +Parsing file /tmp/statechart-LTGrgW/statechart-APR1B4/tmp-verdict-1/Naturals.tla +Semantic processing of module Naturals +Semantic processing of module UnchangedWarning +@!@!@STARTMSG 2219:0 @!@!@ +SANY finished. +@!@!@ENDMSG 2219 @!@!@ +@!@!@STARTMSG 2185:0 @!@!@ +Starting... (2026-11-16 23:38:30) +@!@!@ENDMSG 2185 @!@!@ +@!@!@STARTMSG 2189:0 @!@!@ +Computing initial states... +@!@!@ENDMSG 2189 @!@!@ +@!@!@STARTMSG 2190:0 @!@!@ +Finished computing initial states: 1 distinct state generated at 2026-11-16 23:38:31. +@!@!@ENDMSG 2190 @!@!@ +@!@!@STARTMSG 2143:3 @!@!@ +The variable paid was changed while it is specified as UNCHANGED at +line 9, col 62 to line 9, col 65 of module UnchangedWarning +@!@!@ENDMSG 2143 @!@!@ +@!@!@STARTMSG 2193:0 @!@!@ +Model checking completed. No error has been found. + Estimates of the probability that TLC did not check all reachable states + because two distinct states had the same fingerprint: + calculated (optimistic): val = 1.6E-19 +@!@!@ENDMSG 2193 @!@!@ +@!@!@STARTMSG 2200:0 @!@!@ +Progress(3) at 2026-11-16 23:38:31: 4 states generated (90 s/min), 3 distinct states found (67 ds/min), 0 states left on queue. +@!@!@ENDMSG 2200 @!@!@ +@!@!@STARTMSG 2199:0 @!@!@ +4 states generated, 3 distinct states found, 0 states left on queue. +@!@!@ENDMSG 2199 @!@!@ +@!@!@STARTMSG 2194:0 @!@!@ +The depth of the complete state graph search is 3. +@!@!@ENDMSG 2194 @!@!@ +@!@!@STARTMSG 2268:0 @!@!@ +The average outdegree of the complete state graph is 1 (minimum is 0, the maximum 1 and the 95th percentile is 1). +@!@!@ENDMSG 2268 @!@!@ +@!@!@STARTMSG 2186:0 @!@!@ +Finished in 2709ms at (2026-11-16 23:38:31) +@!@!@ENDMSG 2186 @!@!@ diff --git a/harness/pstack/claude-code/skills/statechart/scripts/test/pipeline.test.ts b/harness/pstack/claude-code/skills/statechart/scripts/test/pipeline.test.ts index 81a5056a3..edec05833 100644 --- a/harness/pstack/claude-code/skills/statechart/scripts/test/pipeline.test.ts +++ b/harness/pstack/claude-code/skills/statechart/scripts/test/pipeline.test.ts @@ -164,6 +164,7 @@ const twoStates = (breaks: Rule[], property = "Settles"): CheckResult => ({ drawing: undefined, states: { distinct: 2, initial: 1, complete: true, cut: false }, messages: [{ code: EC.TLC_FINISHED, level: LEVEL.NONE, body: ["Finished in 394ms at (T)"] }], + warnings: [], }); const body = (files: Map>, name: string) => { diff --git a/pstack/skills/statechart/SKILL.md b/pstack/skills/statechart/SKILL.md index f5a64a8db..05d3d9585 100644 --- a/pstack/skills/statechart/SKILL.md +++ b/pstack/skills/statechart/SKILL.md @@ -67,6 +67,7 @@ Aim for about 20 arrows or fewer, because a busier chart is hard to read. First - With a VIEW or a SYMMETRY, TLC counts states that it treats as the same as one state, and the chart draws that one state. An arrow can lead to it rather than to the state that the step reaches, and the report says so. - TLC checks the rules in each state past a CONSTRAINT or an ACTION_CONSTRAINT, but it does not explore that state or check it for deadlock. When TLC's shortest path for a rule ends in such a state, the chart draws that state, and the report gives that path. The chart does not draw the other states past the bound. A deadlock in such a state does not show. TLC also checks the rules after each step that an ACTION_CONSTRAINT excludes, also when it reaches the next state another way. When TLC's shortest path for a rule ends with such a step, the chart draws that step. - The command checks the rules with TLC on the config as written, with one worker. When a rule breaks, the command removes that rule and runs TLC again, until no rule breaks. After the first break, each run stops at 100,000 distinct states, so that a large model does not run without end. When a run reaches that bound or stops on an error, the report lists the rules that it did not check under "Rules not checked", and the chart does not mark them. A rule that is not checked can hold or break. To check it, remove the rules that break from the config, or make the model smaller. The bound adds a module that changes TLC's order of the variables, so for a property TLC can find a different counterexample than a run without the bound. +- Under "TLC warnings", above "Rules that hold", the report gives each warning that TLC printed in the runs that check the rules, once each. It leaves out TLC's advice on Java's garbage collector, and the warning about the bound that the command adds after the first break. A run that stops at a break can stop before TLC warns, so a later run can print a warning that the first run does not. A rule can hold only because of what a warning names, such as an action that changes a variable that it also lists as UNCHANGED, so read the warnings before you trust a rule that holds. - `tlc.out` is what TLC printed on the config as written. When the chart does not show the bug path of a rule that breaks, `tlc-RULE.out` is what TLC printed for the run that found it. When TLC repeats its first warning, plain TLC prints it twice, but `tlc.out` shows it once, because TLC leaves the second copy out of the output that this command reads. That happens only when Java runs with `-XX:+UseParallelGC`, since otherwise TLC's first warning is its advice to pass that flag, which it prints once. ## Show the chart diff --git a/pstack/skills/statechart/scripts/backends/report.ts b/pstack/skills/statechart/scripts/backends/report.ts index 62e2a8533..1ed6064f7 100644 --- a/pstack/skills/statechart/scripts/backends/report.ts +++ b/pstack/skills/statechart/scripts/backends/report.ts @@ -48,6 +48,7 @@ export function report( stop, drawing, states, + warnings, }: { spec: Spec; graph: Graph; @@ -57,6 +58,7 @@ export function report( stop: Stop | undefined; drawing: { status: number | null } | undefined; states: { distinct: number; initial: number; complete: boolean; cut: boolean }; + warnings: string[]; }, found: Bug[], chart: Chart | undefined, @@ -153,6 +155,13 @@ export function report( `TLC found a counterexample. It is in tlc-${rule.name}.out.`, ); } + if (warnings.length) + out.push( + "", + "## TLC warnings", + `TLC printed ${warnings.length === 1 ? "this warning" : "these warnings"} while it checked the rules. A rule can hold only because of the problem that ${warnings.length === 1 ? "the" : "a"} warning names.`, + ...warnings.map(fenced), + ); if (holds.length) out.push("", "## Rules that hold", holds.join(", ")); if (unchecked.length) out.push("", "## Rules not checked", unchecked.join(", ")); if (unchecked.length && states.cut) diff --git a/pstack/skills/statechart/scripts/frontends/verdict.ts b/pstack/skills/statechart/scripts/frontends/verdict.ts index 4f2ddd925..464b774e1 100644 --- a/pstack/skills/statechart/scripts/frontends/verdict.ts +++ b/pstack/skills/statechart/scripts/frontends/verdict.ts @@ -1,4 +1,4 @@ -import { EC, type Part } from "../ir.ts"; +import { EC, LEVEL, type Part } from "../ir.ts"; import { textOf } from "./messages.ts"; export type Break = @@ -19,12 +19,18 @@ const DISTINCT = new Map([ [EC.TLC_STATS, /(\d+) distinct states found/], ]); -export function readVerdict(messages: Iterable) { +const aboutTheRun = (code: number, bounded: boolean) => + code === EC.TLC_ENVIRONMENT_JVM_GC || + (bounded && code === EC.TLC_FEATURE_LIVENESS_CONSTRAINTS); + +export function readVerdict(messages: Iterable, bounded = false) { let broke: Break | undefined; let distinct = 0; let initial = 0; + const warnings: string[] = []; for (const m of messages) { if (typeof m === "string") continue; + if (m.level === LEVEL.WARNING && !aboutTheRun(m.code, bounded)) warnings.push(textOf(m)); const count = DISTINCT.get(m.code)?.exec(textOf(m)); if (count) distinct = Math.max(distinct, Number(count[1])); if (m.code === EC.TLC_INIT_GENERATED1 || m.code === EC.TLC_INIT_GENERATED2) @@ -36,5 +42,5 @@ export function readVerdict(messages: Iterable) { const name = named?.[1].exec(textOf(m))?.[1]; if (named && name) broke = { kind: named[0], name }; } - return { broke, distinct, initial }; + return { broke, distinct, initial, warnings }; } diff --git a/pstack/skills/statechart/scripts/ir.ts b/pstack/skills/statechart/scripts/ir.ts index 80fd403fe..bea804ef3 100644 --- a/pstack/skills/statechart/scripts/ir.ts +++ b/pstack/skills/statechart/scripts/ir.ts @@ -105,6 +105,8 @@ export const EC = { TLC_STATE_PRINT3: 2218, TLC_SANY_END: 2219, TLC_SANY_START: 2220, + TLC_FEATURE_LIVENESS_CONSTRAINTS: 2284, + TLC_ENVIRONMENT_JVM_GC: 2401, } as const; export const LEVEL = { NONE: 0, ERROR: 1, TLCBUG: 2, WARNING: 3, STATE: 4 } as const; @@ -132,6 +134,7 @@ export type CheckResult = { drawing: { status: number | null } | undefined; states: { distinct: number; initial: number; complete: boolean; cut: boolean }; messages: Iterable; + warnings: string[]; }; export const RERUN_STATES = 100_000; diff --git a/pstack/skills/statechart/scripts/run.ts b/pstack/skills/statechart/scripts/run.ts index 017684f82..4e0688f4a 100644 --- a/pstack/skills/statechart/scripts/run.ts +++ b/pstack/skills/statechart/scripts/run.ts @@ -346,6 +346,7 @@ export async function check(specFile: string, configFile: string): Promise(); for (let k = 1; groups.length;) { const group: Rule[] = []; for (const rule of groups[0]) if (!verdicts.has(ruleKey(rule))) group.push(rule); @@ -369,7 +370,9 @@ export async function check(specFile: string, configFile: string): Promise { + const r = run(path.join(corpus, "UnchangedWarning")); + assert.equal(r.stderr, ""); + assert.equal(r.status, 0); + const warning = [ + "The variable paid was changed while it is specified as UNCHANGED at", + "line 9, col 62 to line 9, col 65 of module UnchangedWarning", + ].join("\n"); + const at = r.report.indexOf(warning); + assert.notEqual(at, -1, r.report); + assert.equal(r.report.indexOf(warning, at + 1), -1, r.report); + assert.ok(at < r.report.indexOf("\n## Rules that hold\nNeverPaidTwice, NoDeadlock"), r.report); + assert.doesNotMatch(r.report, /UseParallelGC/); +}); + +test("a TLC warning that only a later verdict run prints is in the report too", () => { + const r = run(path.join(corpus, "UnchangedAfterDeadlock")); + assert.equal(r.stderr, ""); + assert.equal(r.status, 1); + assert.match(r.report, /^## NoDeadlock breaks$/m); + const warning = [ + "The variable paid was changed while it is specified as UNCHANGED at", + "line 11, col 61 to line 11, col 64 of module UnchangedAfterDeadlock", + ].join("\n"); + const at = r.report.indexOf(warning); + assert.notEqual(at, -1, r.report); + assert.equal(r.report.indexOf(warning, at + 1), -1, r.report); + assert.ok(at < r.report.indexOf("\n## Rules that hold\nNeverPaidLate"), r.report); +}); + test("TLC checks the rules and draws the chart with VIEW and SYMMETRY, and the report says an arrow can lead to a representative", () => { const dir = copyCase("MediaPlayer", (d) => fs.appendFileSync(path.join(d, "MediaPlayer.cfg"), "\nVIEW vars\nSYMMETRY Perms\n"), diff --git a/pstack/skills/statechart/scripts/test/corpus/PickWorker/report.md b/pstack/skills/statechart/scripts/test/corpus/PickWorker/report.md index 505b488b1..6a8326726 100644 --- a/pstack/skills/statechart/scripts/test/corpus/PickWorker/report.md +++ b/pstack/skills/statechart/scripts/test/corpus/PickWorker/report.md @@ -3,5 +3,11 @@ TLC reached 2 states and 1 steps. The chart draws 2 states and 1 arrows. With SYMMETRY, TLC keeps one representative for each group of states that it counts as the same. An arrow can lead to the representative rather than to the state that the step reaches. +## TLC warnings +TLC printed this warning while it checked the rules. A rule can hold only because of the problem that the warning names. +``` +Declaring symmetry during liveness checking is dangerous. It might cause TLC to miss violations of the stated liveness properties. Please check liveness without symmetry defined. +``` + ## Rules that hold PicksFirst diff --git a/pstack/skills/statechart/scripts/test/corpus/UnchangedAfterDeadlock/ChartRun.out b/pstack/skills/statechart/scripts/test/corpus/UnchangedAfterDeadlock/ChartRun.out new file mode 100644 index 000000000..bd59e4ed7 --- /dev/null +++ b/pstack/skills/statechart/scripts/test/corpus/UnchangedAfterDeadlock/ChartRun.out @@ -0,0 +1,61 @@ +@!@!@STARTMSG 2262:0 @!@!@ +TLC2 Version 2.19 of 08 August 2024 (rev: 5a47802) +@!@!@ENDMSG 2262 @!@!@ +@!@!@STARTMSG 2401:3 @!@!@ +Please run the Java VM which executes TLC with a throughput optimized garbage collector by passing the "-XX:+UseParallelGC" property. +@!@!@ENDMSG 2401 @!@!@ +@!@!@STARTMSG 2187:0 @!@!@ +Running breadth-first search Model-Checking with fp 0 and seed -2025214825465097377 with 1 worker on 4 cores with 1986MB heap and 64MB offheap memory [pid: 2656086] (Linux 6.8.0-149-generic amd64, Eclipse Adoptium 21.0.13 x86_64, MSBDiskFPSet, DiskStateQueue). +@!@!@ENDMSG 2187 @!@!@ +@!@!@STARTMSG 2220:0 @!@!@ +Starting SANY... +@!@!@ENDMSG 2220 @!@!@ +Parsing file /tmp/statechart-NiGJcX/statechart-58Br8c/ChartRun.tla +Parsing file /root/projects/cursor-plugins/pstack/skills/statechart/scripts/test/corpus/UnchangedAfterDeadlock/UnchangedAfterDeadlock.tla +Parsing file /tmp/statechart-NiGJcX/statechart-58Br8c/tmp-ChartRun/Naturals.tla +Parsing file /tmp/statechart-NiGJcX/statechart-58Br8c/tmp-ChartRun/TLC.tla +Parsing file /tmp/statechart-NiGJcX/statechart-58Br8c/tmp-ChartRun/Sequences.tla +Parsing file /tmp/statechart-NiGJcX/statechart-58Br8c/tmp-ChartRun/FiniteSets.tla +Semantic processing of module Naturals +Semantic processing of module UnchangedAfterDeadlock +Semantic processing of module Sequences +Semantic processing of module FiniteSets +Semantic processing of module TLC +Semantic processing of module ChartRun +@!@!@STARTMSG 2219:0 @!@!@ +SANY finished. +@!@!@ENDMSG 2219 @!@!@ +@!@!@STARTMSG 2185:0 @!@!@ +Starting... (2026-11-17 00:46:43) +@!@!@ENDMSG 2185 @!@!@ +@!@!@STARTMSG 2189:0 @!@!@ +Computing initial states... +@!@!@ENDMSG 2189 @!@!@ +@!@!@STARTMSG 2190:0 @!@!@ +Finished computing initial states: 2 distinct states generated at 2026-11-17 00:46:45. +@!@!@ENDMSG 2190 @!@!@ +@!@!@STARTMSG 2143:3 @!@!@ +The variable paid was changed while it is specified as UNCHANGED at +line 11, col 61 to line 11, col 64 of module UnchangedAfterDeadlock +@!@!@ENDMSG 2143 @!@!@ +@!@!@STARTMSG 2193:0 @!@!@ +Model checking completed. No error has been found. + Estimates of the probability that TLC did not check all reachable states + because two distinct states had the same fingerprint: + calculated (optimistic): val = 3.8E-19 +@!@!@ENDMSG 2193 @!@!@ +@!@!@STARTMSG 2200:0 @!@!@ +Progress(6) at 2026-11-17 00:46:45: 8 states generated (124 s/min), 7 distinct states found (108 ds/min), 0 states left on queue. +@!@!@ENDMSG 2200 @!@!@ +@!@!@STARTMSG 2199:0 @!@!@ +8 states generated, 7 distinct states found, 0 states left on queue. +@!@!@ENDMSG 2199 @!@!@ +@!@!@STARTMSG 2194:0 @!@!@ +The depth of the complete state graph search is 6. +@!@!@ENDMSG 2194 @!@!@ +@!@!@STARTMSG 2268:0 @!@!@ +The average outdegree of the complete state graph is 1 (minimum is 0, the maximum 1 and the 95th percentile is 1). +@!@!@ENDMSG 2268 @!@!@ +@!@!@STARTMSG 2186:0 @!@!@ +Finished in 3900ms at (2026-11-17 00:46:45) +@!@!@ENDMSG 2186 @!@!@ diff --git a/pstack/skills/statechart/scripts/test/corpus/UnchangedAfterDeadlock/UnchangedAfterDeadlock.cfg b/pstack/skills/statechart/scripts/test/corpus/UnchangedAfterDeadlock/UnchangedAfterDeadlock.cfg new file mode 100644 index 000000000..ee94e7b7e --- /dev/null +++ b/pstack/skills/statechart/scripts/test/corpus/UnchangedAfterDeadlock/UnchangedAfterDeadlock.cfg @@ -0,0 +1,2 @@ +SPECIFICATION Spec +INVARIANT NeverPaidLate diff --git a/pstack/skills/statechart/scripts/test/corpus/UnchangedAfterDeadlock/UnchangedAfterDeadlock.tla b/pstack/skills/statechart/scripts/test/corpus/UnchangedAfterDeadlock/UnchangedAfterDeadlock.tla new file mode 100644 index 000000000..67c5decde --- /dev/null +++ b/pstack/skills/statechart/scripts/test/corpus/UnchangedAfterDeadlock/UnchangedAfterDeadlock.tla @@ -0,0 +1,18 @@ +---- MODULE UnchangedAfterDeadlock ---- +EXTENDS Naturals +VARIABLES x, paid, side + +Init == x = 0 /\ paid = FALSE /\ side \in {0, 1} + +Stuck == side = 1 /\ FALSE + +Step == side = 0 /\ x < 5 /\ x' = x + 1 /\ UNCHANGED <> + +Pay == side = 0 /\ x >= 3 /\ paid' = TRUE /\ UNCHANGED <> + +Next == Step \/ Pay \/ Stuck \/ (x = 5 /\ UNCHANGED <>) + +Spec == Init /\ [][Next]_<> + +NeverPaidLate == ~(paid /\ x > 3) +==== diff --git a/pstack/skills/statechart/scripts/test/corpus/UnchangedAfterDeadlock/chart.mmd b/pstack/skills/statechart/scripts/test/corpus/UnchangedAfterDeadlock/chart.mmd new file mode 100644 index 000000000..89eab5ee9 --- /dev/null +++ b/pstack/skills/statechart/scripts/test/corpus/UnchangedAfterDeadlock/chart.mmd @@ -0,0 +1,24 @@ +stateDiagram-v2 + state "Legend" as legend { + lg0: Breaks NoDeadlock + lg1: Path to the NoDeadlock bug + } + class lg0 breaks + class lg1 bugPath + s0: side=0 x=0 paid=FALSE + s1: side=1 x=0 paid=FALSE + s2: side=0 x=1 paid=FALSE + s3: side=0 x=2 paid=FALSE + s4: side=0 x=3 paid=FALSE + s5: side=0 x=4 paid=FALSE + s6: side=0 x=5 paid=FALSE + [*] --> s0 + [*] --> s1 + s0 --> s2: Step + s2 --> s3: Step + s3 --> s4: Step + s4 --> s5: Step + s5 --> s6: Step + classDef breaks fill:#ffecee,stroke:#e72e3b,stroke-width:2.5px,color:#cd2834 + class s1 breaks + class s1 bugPath diff --git a/pstack/skills/statechart/scripts/test/corpus/UnchangedAfterDeadlock/graph.dot b/pstack/skills/statechart/scripts/test/corpus/UnchangedAfterDeadlock/graph.dot new file mode 100644 index 000000000..860103f84 --- /dev/null +++ b/pstack/skills/statechart/scripts/test/corpus/UnchangedAfterDeadlock/graph.dot @@ -0,0 +1,25 @@ +strict digraph DiskGraph { +nodesep=0.35; +subgraph cluster_graph { +color="white"; +-5243620187527078639 [label="/\\ side = 0\n/\\ x = 0\n/\\ paid = FALSE",style = filled] +7331602431577323913 [label="/\\ side = 1\n/\\ x = 0\n/\\ paid = FALSE",style = filled] +-5243620187527078639 -> 2592443193205854937 [label="Step",color="black",fontcolor="black"]; +2592443193205854937 [label="/\\ side = 0\n/\\ x = 1\n/\\ paid = FALSE"]; +2592443193205854937 -> -4858708178491410644 [label="Step",color="black",fontcolor="black"]; +-4858708178491410644 [label="/\\ side = 0\n/\\ x = 2\n/\\ paid = FALSE"]; +-4858708178491410644 -> 2905587872829569252 [label="Step",color="black",fontcolor="black"]; +2905587872829569252 [label="/\\ side = 0\n/\\ x = 3\n/\\ paid = FALSE"]; +2905587872829569252 -> -6887147292129408661 [label="Step",color="black",fontcolor="black"]; +-6887147292129408661 [label="/\\ side = 0\n/\\ x = 4\n/\\ paid = FALSE"]; +-6887147292129408661 -> 3795178130618893987 [label="Step",color="black",fontcolor="black"]; +3795178130618893987 [label="/\\ side = 0\n/\\ x = 5\n/\\ paid = FALSE"]; +3795178130618893987 -> 3795178130618893987 [label="Next",color="black",fontcolor="black"]; +{rank = same; -5243620187527078639;7331602431577323913;} +{rank = same; 2592443193205854937;} +{rank = same; -4858708178491410644;} +{rank = same; 2905587872829569252;} +{rank = same; -6887147292129408661;} +{rank = same; 3795178130618893987;} +} +} \ No newline at end of file diff --git a/pstack/skills/statechart/scripts/test/corpus/UnchangedAfterDeadlock/report.md b/pstack/skills/statechart/scripts/test/corpus/UnchangedAfterDeadlock/report.md new file mode 100644 index 000000000..f1f883f8f --- /dev/null +++ b/pstack/skills/statechart/scripts/test/corpus/UnchangedAfterDeadlock/report.md @@ -0,0 +1,18 @@ +# UnchangedAfterDeadlock + +TLC reached 7 states and 6 steps. The chart draws 7 states and 5 arrows. +The chart does not draw 1 steps that stay in one chart state. + +## NoDeadlock breaks +The shortest path has 0 steps: +0. side=1 x=0 paid=FALSE + +## TLC warnings +TLC printed this warning while it checked the rules. A rule can hold only because of the problem that the warning names. +``` +The variable paid was changed while it is specified as UNCHANGED at +line 11, col 61 to line 11, col 64 of module UnchangedAfterDeadlock +``` + +## Rules that hold +NeverPaidLate diff --git a/pstack/skills/statechart/scripts/test/corpus/UnchangedAfterDeadlock/sany.out b/pstack/skills/statechart/scripts/test/corpus/UnchangedAfterDeadlock/sany.out new file mode 100644 index 000000000..794c3bdb1 --- /dev/null +++ b/pstack/skills/statechart/scripts/test/corpus/UnchangedAfterDeadlock/sany.out @@ -0,0 +1,2 @@ +UnchangedAfterDeadlock10000--TLA+ BUILTINS--0FALSE020000--TLA+ BUILTINS--0TRUE040000--TLA+ BUILTINS--0=2565Formal_006Formal_10130000--TLA+ BUILTINS--2'11414Formal_00150000--TLA+ BUILTINS--0\lnot11627216799UnchangedAfterDeadlock2Step096799UnchangedAfterDeadlock21993999UnchangedAfterDeadlock21992599UnchangedAfterDeadlock11991699UnchangedAfterDeadlock1491299UnchangedAfterDeadlock1232161699UnchangedAfterDeadlock00212599UnchangedAfterDeadlock1188212199UnchangedAfterDeadlock1230252599UnchangedAfterDeadlock05303999UnchangedAfterDeadlock24303199UnchangedAfterDeadlock213303099UnchangedAfterDeadlock1230353999UnchangedAfterDeadlock1162353599UnchangedAfterDeadlock1230393999UnchangedAfterDeadlock01446799UnchangedAfterDeadlock267546799UnchangedAfterDeadlock1125565999UnchangedAfterDeadlock1231626599UnchangedAfterDeadlock123216Formal_00190000--TLA+ BUILTINS--0\land2202120Formal_0021Formal_10220000--TLA+ BUILTINS--0\lor2232423Formal_0024Formal_10154177136NaturalsNaturals1561621721761821881942002062122182241561161414Naturals0Nat014161414Naturals0106157111515Naturals0a0158331515Naturals0b01621191515Naturals0+214191515Naturals010615151515Naturals015718181515Naturals0158157158163111717Naturals0a02911721111UnchangedAfterDeadlock2Pay08721111UnchangedAfterDeadlock2198411111UnchangedAfterDeadlock2198251111UnchangedAfterDeadlock1198151111UnchangedAfterDeadlock148111111UnchangedAfterDeadlock123215151111UnchangedAfterDeadlock0020251111UnchangedAfterDeadlock120620201111UnchangedAfterDeadlock123025251111UnchangedAfterDeadlock0330411111UnchangedAfterDeadlock2430341111UnchangedAfterDeadlock21330331111UnchangedAfterDeadlock123138411111UnchangedAfterDeadlock0246721111UnchangedAfterDeadlock26756721111UnchangedAfterDeadlock112558581111UnchangedAfterDeadlock123061641111UnchangedAfterDeadlock123167701111UnchangedAfterDeadlock1232164331717Naturals0b016514191717Naturals0n0400000--TLA+ BUILTINS--0\in2414241Formal_0042Formal_101721331717Naturals0-214331717Naturals012625331717Naturals0425291717Naturals016225251717Naturals016429291717Naturals016533331717Naturals0163165163164173111818Naturalsa0174331818Naturalsb01761171818Naturals0*214171818Naturals02173174177111919Naturals0a0178331919Naturals0b03071701313UnchangedAfterDeadlock2Next09701313UnchangedAfterDeadlock2229281313UnchangedAfterDeadlock2229191313UnchangedAfterDeadlock2229121313UnchangedAfterDeadlock227217191313UnchangedAfterDeadlock229124281313UnchangedAfterDeadlock125234691313UnchangedAfterDeadlock21934381313UnchangedAfterDeadlock1434341313UnchangedAfterDeadlock123038381313UnchangedAfterDeadlock0543691313UnchangedAfterDeadlock26753691313UnchangedAfterDeadlock112555551313UnchangedAfterDeadlock123058611313UnchangedAfterDeadlock123164671313UnchangedAfterDeadlock12321821191919Naturals0^214191919Naturals010615151919Naturals017718181919Naturals0178177178183112020Naturals0a0184332020Naturals0b01881192020Naturals0<215192020Naturals0415152020Naturals018319192020Naturals0184183184189112121Naturals0a0610000--TLA+ BUILTINS--3[]1623171421515UnchangedAfterDeadlock3Spec09421515UnchangedAfterDeadlock3199121515UnchangedAfterDeadlock124617421515UnchangedAfterDeadlock36119421515UnchangedAfterDeadlock211320231515UnchangedAfterDeadlock230726421515UnchangedAfterDeadlock112528281515UnchangedAfterDeadlock123031341515UnchangedAfterDeadlock123137401515UnchangedAfterDeadlock1232190332121Naturals0b062Formal_001941192121Naturals0>215192121Naturals0415152121Naturals018919192121Naturals0190189190195112222Naturals0a0670000--TLA+ BUILTINS--2UNCHANGED168196882222Naturals0b068Formal_003241331717UnchangedAfterDeadlock1NeverPaidLate018331717UnchangedAfterDeadlock11520321717UnchangedAfterDeadlock11920231717UnchangedAfterDeadlock123128321717UnchangedAfterDeadlock119428281717UnchangedAfterDeadlock123032321717UnchangedAfterDeadlock032001192222Naturals0\leq215192222Naturals0415152222Naturals019519192222Naturals0196195196201112323Naturals0a0202882323Naturals0b02061192323Naturals0\geq215192323Naturals0415152323Naturals020119192323Naturals0202201202207113333Naturals0a0208553333Naturals0b02121203333Naturals0%215203333Naturals010616163333Naturals020719193333Naturals0208207208213113434Naturals0a0214883434Naturals0b02181203434Naturals0\div215203434Naturals010616163434Naturals021319193434Naturals0214213214219113535Naturals0a0220663535Naturals0b02241203535Naturals0..215203535Naturals010616163535Naturals021919193535Naturals022021922022914118UnchangedAfterDeadlockUnchangedAfterDeadlock232230231156162172176182188194200206212218224246252272291307317324230111133UnchangedAfterDeadlock1x03231141733UnchangedAfterDeadlock1paid03232202333UnchangedAfterDeadlock1side031060000--TLA+ BUILTINS--0$SetEnumerate-11130000--TLA+ BUILTINS--2$SquareAct2114115114Formal_00115Formal_1024614855UnchangedAfterDeadlock1Init094855UnchangedAfterDeadlock11992955UnchangedAfterDeadlock11991355UnchangedAfterDeadlock149955UnchangedAfterDeadlock1230131355UnchangedAfterDeadlock00182955UnchangedAfterDeadlock14182155UnchangedAfterDeadlock1231252955UnchangedAfterDeadlock01344855UnchangedAfterDeadlock140343755UnchangedAfterDeadlock1232434855UnchangedAfterDeadlock0106444455UnchangedAfterDeadlock00474755UnchangedAfterDeadlock0125212677UnchangedAfterDeadlock1Stuck0102677UnchangedAfterDeadlock119101777UnchangedAfterDeadlock14101377UnchangedAfterDeadlock1232171777UnchangedAfterDeadlock01222677UnchangedAfterDeadlock011250000--TLA+ BUILTINS--0$Tuple-11260000--TLA+ BUILTINS--0$UnboundedChoose1127127Formal_00154229Semantic processing of module Naturals +Semantic processing of module UnchangedAfterDeadlock diff --git a/pstack/skills/statechart/scripts/test/corpus/UnchangedAfterDeadlock/verdict-1.exit b/pstack/skills/statechart/scripts/test/corpus/UnchangedAfterDeadlock/verdict-1.exit new file mode 100644 index 000000000..b4de39476 --- /dev/null +++ b/pstack/skills/statechart/scripts/test/corpus/UnchangedAfterDeadlock/verdict-1.exit @@ -0,0 +1 @@ +11 diff --git a/pstack/skills/statechart/scripts/test/corpus/UnchangedAfterDeadlock/verdict-1.out b/pstack/skills/statechart/scripts/test/corpus/UnchangedAfterDeadlock/verdict-1.out new file mode 100644 index 000000000..badea5584 --- /dev/null +++ b/pstack/skills/statechart/scripts/test/corpus/UnchangedAfterDeadlock/verdict-1.out @@ -0,0 +1,56 @@ +@!@!@STARTMSG 2262:0 @!@!@ +TLC2 Version 2.19 of 08 August 2024 (rev: 5a47802) +@!@!@ENDMSG 2262 @!@!@ +@!@!@STARTMSG 2401:3 @!@!@ +Please run the Java VM which executes TLC with a throughput optimized garbage collector by passing the "-XX:+UseParallelGC" property. +@!@!@ENDMSG 2401 @!@!@ +@!@!@STARTMSG 2187:0 @!@!@ +Running breadth-first search Model-Checking with fp 0 and seed -2761778670377416215 with 1 worker on 4 cores with 1986MB heap and 64MB offheap memory [pid: 2655518] (Linux 6.8.0-149-generic amd64, Eclipse Adoptium 21.0.13 x86_64, MSBDiskFPSet, DiskStateQueue). +@!@!@ENDMSG 2187 @!@!@ +@!@!@STARTMSG 2220:0 @!@!@ +Starting SANY... +@!@!@ENDMSG 2220 @!@!@ +Parsing file /root/projects/cursor-plugins/pstack/skills/statechart/scripts/test/corpus/UnchangedAfterDeadlock/UnchangedAfterDeadlock.tla +Parsing file /tmp/statechart-NiGJcX/statechart-58Br8c/tmp-verdict-1/Naturals.tla +Semantic processing of module Naturals +Semantic processing of module UnchangedAfterDeadlock +@!@!@STARTMSG 2219:0 @!@!@ +SANY finished. +@!@!@ENDMSG 2219 @!@!@ +@!@!@STARTMSG 2185:0 @!@!@ +Starting... (2026-11-17 00:46:32) +@!@!@ENDMSG 2185 @!@!@ +@!@!@STARTMSG 2189:0 @!@!@ +Computing initial states... +@!@!@ENDMSG 2189 @!@!@ +@!@!@STARTMSG 2190:0 @!@!@ +Finished computing initial states: 2 distinct states generated at 2026-11-17 00:46:34. +@!@!@ENDMSG 2190 @!@!@ +@!@!@STARTMSG 2114:1 @!@!@ +Deadlock reached. +@!@!@ENDMSG 2114 @!@!@ +@!@!@STARTMSG 2121:1 @!@!@ +The behavior up to this point is: +@!@!@ENDMSG 2121 @!@!@ +@!@!@STARTMSG 2217:4 @!@!@ +1: +/\ side = 1 +/\ x = 0 +/\ paid = FALSE + +@!@!@ENDMSG 2217 @!@!@ +@!@!@STARTMSG 2200:0 @!@!@ +Progress(2) at 2026-11-17 00:46:34: 3 states generated (46 s/min), 3 distinct states found (46 ds/min), 1 states left on queue. +@!@!@ENDMSG 2200 @!@!@ +@!@!@STARTMSG 2199:0 @!@!@ +3 states generated, 3 distinct states found, 1 states left on queue. +@!@!@ENDMSG 2199 @!@!@ +@!@!@STARTMSG 2194:0 @!@!@ +The depth of the complete state graph search is 2. +@!@!@ENDMSG 2194 @!@!@ +@!@!@STARTMSG 2268:0 @!@!@ +The average outdegree of the complete state graph is 1 (minimum is 0, the maximum 1 and the 95th percentile is 1). +@!@!@ENDMSG 2268 @!@!@ +@!@!@STARTMSG 2186:0 @!@!@ +Finished in 3899ms at (2026-11-17 00:46:34) +@!@!@ENDMSG 2186 @!@!@ diff --git a/pstack/skills/statechart/scripts/test/corpus/UnchangedAfterDeadlock/verdict-2.out b/pstack/skills/statechart/scripts/test/corpus/UnchangedAfterDeadlock/verdict-2.out new file mode 100644 index 000000000..ebb9eb698 --- /dev/null +++ b/pstack/skills/statechart/scripts/test/corpus/UnchangedAfterDeadlock/verdict-2.out @@ -0,0 +1,61 @@ +@!@!@STARTMSG 2262:0 @!@!@ +TLC2 Version 2.19 of 08 August 2024 (rev: 5a47802) +@!@!@ENDMSG 2262 @!@!@ +@!@!@STARTMSG 2401:3 @!@!@ +Please run the Java VM which executes TLC with a throughput optimized garbage collector by passing the "-XX:+UseParallelGC" property. +@!@!@ENDMSG 2401 @!@!@ +@!@!@STARTMSG 2187:0 @!@!@ +Running breadth-first search Model-Checking with fp 0 and seed -999565353588904235 with 1 worker on 4 cores with 1986MB heap and 64MB offheap memory [pid: 2655815] (Linux 6.8.0-149-generic amd64, Eclipse Adoptium 21.0.13 x86_64, MSBDiskFPSet, DiskStateQueue). +@!@!@ENDMSG 2187 @!@!@ +@!@!@STARTMSG 2220:0 @!@!@ +Starting SANY... +@!@!@ENDMSG 2220 @!@!@ +Parsing file /tmp/statechart-NiGJcX/statechart-58Br8c/ChartBound.tla +Parsing file /root/projects/cursor-plugins/pstack/skills/statechart/scripts/test/corpus/UnchangedAfterDeadlock/UnchangedAfterDeadlock.tla +Parsing file /tmp/statechart-NiGJcX/statechart-58Br8c/tmp-verdict-2/Naturals.tla +Parsing file /tmp/statechart-NiGJcX/statechart-58Br8c/tmp-verdict-2/TLC.tla +Parsing file /tmp/statechart-NiGJcX/statechart-58Br8c/tmp-verdict-2/Sequences.tla +Parsing file /tmp/statechart-NiGJcX/statechart-58Br8c/tmp-verdict-2/FiniteSets.tla +Semantic processing of module Naturals +Semantic processing of module UnchangedAfterDeadlock +Semantic processing of module Sequences +Semantic processing of module FiniteSets +Semantic processing of module TLC +Semantic processing of module ChartBound +@!@!@STARTMSG 2219:0 @!@!@ +SANY finished. +@!@!@ENDMSG 2219 @!@!@ +@!@!@STARTMSG 2185:0 @!@!@ +Starting... (2026-11-17 00:46:38) +@!@!@ENDMSG 2185 @!@!@ +@!@!@STARTMSG 2189:0 @!@!@ +Computing initial states... +@!@!@ENDMSG 2189 @!@!@ +@!@!@STARTMSG 2190:0 @!@!@ +Finished computing initial states: 2 distinct states generated at 2026-11-17 00:46:39. +@!@!@ENDMSG 2190 @!@!@ +@!@!@STARTMSG 2143:3 @!@!@ +The variable paid was changed while it is specified as UNCHANGED at +line 11, col 61 to line 11, col 64 of module UnchangedAfterDeadlock +@!@!@ENDMSG 2143 @!@!@ +@!@!@STARTMSG 2193:0 @!@!@ +Model checking completed. No error has been found. + Estimates of the probability that TLC did not check all reachable states + because two distinct states had the same fingerprint: + calculated (optimistic): val = 3.8E-19 +@!@!@ENDMSG 2193 @!@!@ +@!@!@STARTMSG 2200:0 @!@!@ +Progress(6) at 2026-11-17 00:46:39: 8 states generated (118 s/min), 7 distinct states found (103 ds/min), 0 states left on queue. +@!@!@ENDMSG 2200 @!@!@ +@!@!@STARTMSG 2199:0 @!@!@ +8 states generated, 7 distinct states found, 0 states left on queue. +@!@!@ENDMSG 2199 @!@!@ +@!@!@STARTMSG 2194:0 @!@!@ +The depth of the complete state graph search is 6. +@!@!@ENDMSG 2194 @!@!@ +@!@!@STARTMSG 2268:0 @!@!@ +The average outdegree of the complete state graph is 1 (minimum is 0, the maximum 1 and the 95th percentile is 1). +@!@!@ENDMSG 2268 @!@!@ +@!@!@STARTMSG 2186:0 @!@!@ +Finished in 4086ms at (2026-11-17 00:46:39) +@!@!@ENDMSG 2186 @!@!@ diff --git a/pstack/skills/statechart/scripts/test/corpus/UnchangedWarning/ChartRun.out b/pstack/skills/statechart/scripts/test/corpus/UnchangedWarning/ChartRun.out new file mode 100644 index 000000000..6aa5012a0 --- /dev/null +++ b/pstack/skills/statechart/scripts/test/corpus/UnchangedWarning/ChartRun.out @@ -0,0 +1,61 @@ +@!@!@STARTMSG 2262:0 @!@!@ +TLC2 Version 2.19 of 08 August 2024 (rev: 5a47802) +@!@!@ENDMSG 2262 @!@!@ +@!@!@STARTMSG 2401:3 @!@!@ +Please run the Java VM which executes TLC with a throughput optimized garbage collector by passing the "-XX:+UseParallelGC" property. +@!@!@ENDMSG 2401 @!@!@ +@!@!@STARTMSG 2187:0 @!@!@ +Running breadth-first search Model-Checking with fp 0 and seed 4304451973971592144 with 1 worker on 4 cores with 1986MB heap and 64MB offheap memory [pid: 2422409] (Linux 6.8.0-149-generic amd64, Eclipse Adoptium 21.0.13 x86_64, MSBDiskFPSet, DiskStateQueue). +@!@!@ENDMSG 2187 @!@!@ +@!@!@STARTMSG 2220:0 @!@!@ +Starting SANY... +@!@!@ENDMSG 2220 @!@!@ +Parsing file /tmp/statechart-LTGrgW/statechart-APR1B4/ChartRun.tla +Parsing file /root/projects/cursor-plugins/pstack/skills/statechart/scripts/test/corpus/UnchangedWarning/UnchangedWarning.tla +Parsing file /tmp/statechart-LTGrgW/statechart-APR1B4/tmp-ChartRun/Naturals.tla +Parsing file /tmp/statechart-LTGrgW/statechart-APR1B4/tmp-ChartRun/TLC.tla +Parsing file /tmp/statechart-LTGrgW/statechart-APR1B4/tmp-ChartRun/Sequences.tla +Parsing file /tmp/statechart-LTGrgW/statechart-APR1B4/tmp-ChartRun/FiniteSets.tla +Semantic processing of module Naturals +Semantic processing of module UnchangedWarning +Semantic processing of module Sequences +Semantic processing of module FiniteSets +Semantic processing of module TLC +Semantic processing of module ChartRun +@!@!@STARTMSG 2219:0 @!@!@ +SANY finished. +@!@!@ENDMSG 2219 @!@!@ +@!@!@STARTMSG 2185:0 @!@!@ +Starting... (2026-11-16 23:38:33) +@!@!@ENDMSG 2185 @!@!@ +@!@!@STARTMSG 2189:0 @!@!@ +Computing initial states... +@!@!@ENDMSG 2189 @!@!@ +@!@!@STARTMSG 2190:0 @!@!@ +Finished computing initial states: 1 distinct state generated at 2026-11-16 23:38:34. +@!@!@ENDMSG 2190 @!@!@ +@!@!@STARTMSG 2143:3 @!@!@ +The variable paid was changed while it is specified as UNCHANGED at +line 9, col 62 to line 9, col 65 of module UnchangedWarning +@!@!@ENDMSG 2143 @!@!@ +@!@!@STARTMSG 2193:0 @!@!@ +Model checking completed. No error has been found. + Estimates of the probability that TLC did not check all reachable states + because two distinct states had the same fingerprint: + calculated (optimistic): val = 1.6E-19 +@!@!@ENDMSG 2193 @!@!@ +@!@!@STARTMSG 2200:0 @!@!@ +Progress(3) at 2026-11-16 23:38:34: 4 states generated (113 s/min), 3 distinct states found (85 ds/min), 0 states left on queue. +@!@!@ENDMSG 2200 @!@!@ +@!@!@STARTMSG 2199:0 @!@!@ +4 states generated, 3 distinct states found, 0 states left on queue. +@!@!@ENDMSG 2199 @!@!@ +@!@!@STARTMSG 2194:0 @!@!@ +The depth of the complete state graph search is 3. +@!@!@ENDMSG 2194 @!@!@ +@!@!@STARTMSG 2268:0 @!@!@ +The average outdegree of the complete state graph is 1 (minimum is 0, the maximum 1 and the 95th percentile is 1). +@!@!@ENDMSG 2268 @!@!@ +@!@!@STARTMSG 2186:0 @!@!@ +Finished in 2132ms at (2026-11-16 23:38:34) +@!@!@ENDMSG 2186 @!@!@ diff --git a/pstack/skills/statechart/scripts/test/corpus/UnchangedWarning/UnchangedWarning.cfg b/pstack/skills/statechart/scripts/test/corpus/UnchangedWarning/UnchangedWarning.cfg new file mode 100644 index 000000000..e16365ebd --- /dev/null +++ b/pstack/skills/statechart/scripts/test/corpus/UnchangedWarning/UnchangedWarning.cfg @@ -0,0 +1,2 @@ +SPECIFICATION Spec +INVARIANT NeverPaidTwice diff --git a/pstack/skills/statechart/scripts/test/corpus/UnchangedWarning/UnchangedWarning.tla b/pstack/skills/statechart/scripts/test/corpus/UnchangedWarning/UnchangedWarning.tla new file mode 100644 index 000000000..fe0e98bbb --- /dev/null +++ b/pstack/skills/statechart/scripts/test/corpus/UnchangedWarning/UnchangedWarning.tla @@ -0,0 +1,18 @@ +---- MODULE UnchangedWarning ---- +EXTENDS Naturals +VARIABLES sent, paid + +Init == sent = 0 /\ paid = FALSE + +YouPressPay == sent < 2 /\ sent' = sent + 1 /\ UNCHANGED paid + +BankAccepts == sent > 0 /\ paid' = TRUE /\ UNCHANGED <> + +Done == sent = 2 /\ UNCHANGED <> + +Next == YouPressPay \/ BankAccepts \/ Done + +Spec == Init /\ [][Next]_<> + +NeverPaidTwice == ~(paid /\ sent > 1) +==== diff --git a/pstack/skills/statechart/scripts/test/corpus/UnchangedWarning/chart.mmd b/pstack/skills/statechart/scripts/test/corpus/UnchangedWarning/chart.mmd new file mode 100644 index 000000000..75ed53a6b --- /dev/null +++ b/pstack/skills/statechart/scripts/test/corpus/UnchangedWarning/chart.mmd @@ -0,0 +1,7 @@ +stateDiagram-v2 + s0: sent=0 paid=FALSE + s1: sent=1 paid=FALSE + s2: sent=2 paid=FALSE + [*] --> s0 + s0 --> s1: YouPressPay + s1 --> s2: YouPressPay diff --git a/pstack/skills/statechart/scripts/test/corpus/UnchangedWarning/graph.dot b/pstack/skills/statechart/scripts/test/corpus/UnchangedWarning/graph.dot new file mode 100644 index 000000000..3735b29e5 --- /dev/null +++ b/pstack/skills/statechart/scripts/test/corpus/UnchangedWarning/graph.dot @@ -0,0 +1,15 @@ +strict digraph DiskGraph { +nodesep=0.35; +subgraph cluster_graph { +color="white"; +-3952272340217912252 [label="/\\ sent = 0\n/\\ paid = FALSE",style = filled] +-3952272340217912252 -> 6766213544992975756 [label="YouPressPay",color="black",fontcolor="black"]; +6766213544992975756 [label="/\\ sent = 1\n/\\ paid = FALSE"]; +6766213544992975756 -> -4427539119762059655 [label="YouPressPay",color="black",fontcolor="black"]; +-4427539119762059655 [label="/\\ sent = 2\n/\\ paid = FALSE"]; +-4427539119762059655 -> -4427539119762059655 [label="Done",color="black",fontcolor="black"]; +{rank = same; -3952272340217912252;} +{rank = same; 6766213544992975756;} +{rank = same; -4427539119762059655;} +} +} \ No newline at end of file diff --git a/pstack/skills/statechart/scripts/test/corpus/UnchangedWarning/report.md b/pstack/skills/statechart/scripts/test/corpus/UnchangedWarning/report.md new file mode 100644 index 000000000..9e971a85b --- /dev/null +++ b/pstack/skills/statechart/scripts/test/corpus/UnchangedWarning/report.md @@ -0,0 +1,14 @@ +# UnchangedWarning + +TLC reached 3 states and 3 steps. The chart draws 3 states and 2 arrows. +The chart does not draw 1 steps that stay in one chart state. + +## TLC warnings +TLC printed this warning while it checked the rules. A rule can hold only because of the problem that the warning names. +``` +The variable paid was changed while it is specified as UNCHANGED at +line 9, col 62 to line 9, col 65 of module UnchangedWarning +``` + +## Rules that hold +NeverPaidTwice, NoDeadlock diff --git a/pstack/skills/statechart/scripts/test/corpus/UnchangedWarning/sany.out b/pstack/skills/statechart/scripts/test/corpus/UnchangedWarning/sany.out new file mode 100644 index 000000000..4738573b0 --- /dev/null +++ b/pstack/skills/statechart/scripts/test/corpus/UnchangedWarning/sany.out @@ -0,0 +1,2 @@ +UnchangedWarning10000--TLA+ BUILTINS--0FALSE020000--TLA+ BUILTINS--0TRUE040000--TLA+ BUILTINS--0=2565Formal_006Formal_1026716799UnchangedWarning2BankAccepts0166799UnchangedWarning219163999UnchangedWarning219162399UnchangedWarning1194161999UnchangedWarning1230232399UnchangedWarning00283999UnchangedWarning24283299UnchangedWarning213283199UnchangedWarning1231363999UnchangedWarning02446799UnchangedWarning267546799UnchangedWarning1125565999UnchangedWarning1230626599UnchangedWarning1231130000--TLA+ BUILTINS--2'11414Formal_00150000--TLA+ BUILTINS--0\lnot11616Formal_00190000--TLA+ BUILTINS--0\land2202120Formal_002761441111UnchangedWarning2Done09441111UnchangedWarning2199161111UnchangedWarning149121111UnchangedWarning123016161111UnchangedWarning0221441111UnchangedWarning26731441111UnchangedWarning112533361111UnchangedWarning123039421111UnchangedWarning123121Formal_10220000--TLA+ BUILTINS--0\lor2232423Formal_0024Formal_10154177136NaturalsNaturals1561621721761821881942002062122182242821421313UnchangedWarning2Next09421313UnchangedWarning2229341313UnchangedWarning2229191313UnchangedWarning225324341313UnchangedWarning226739421313UnchangedWarning22761561161414Naturals0Nat014161414Naturals0106157111515Naturals0a0158331515Naturals0b01621191515Naturals0+214191515Naturals010615151515Naturals015718181515Naturals0158157158163111717Naturals0a02911391515UnchangedWarning3Spec09391515UnchangedWarning3199121515UnchangedWarning123917391515UnchangedWarning36119391515UnchangedWarning211320231515UnchangedWarning228226391515UnchangedWarning112528311515UnchangedWarning123034371515UnchangedWarning1231164331717Naturals0b016514191717Naturals0n02981371717UnchangedWarning1NeverPaidTwice019371717UnchangedWarning11521361717UnchangedWarning11921241717UnchangedWarning123129361717UnchangedWarning119429321717UnchangedWarning123036361717UnchangedWarning011721331717Naturals0-214331717Naturals012625331717Naturals0425291717Naturals016225251717Naturals016429291717Naturals016533331717Naturals0163165163164173111818Naturalsa0174331818Naturalsb01761171818Naturals0*214171818Naturals02173174177111919Naturals0a0178331919Naturals0b01821191919Naturals0^214191919Naturals010615151919Naturals017718181919Naturals0178177178183112020Naturals0a0184332020Naturals0b01881192020Naturals0<215192020Naturals0415152020Naturals018319192020Naturals0184183184189112121Naturals0a0610000--TLA+ BUILTINS--3[]162190332121Naturals0b062Formal_001941192121Naturals0>215192121Naturals0415152121Naturals018919192121Naturals0190189190195112222Naturals0a0670000--TLA+ BUILTINS--2UNCHANGED168196882222Naturals0b068Formal_002001192222Naturals0\leq215192222Naturals0415152222Naturals019519192222Naturals0196195196201112323Naturals0a0202882323Naturals0b02061192323Naturals0\geq215192323Naturals0415152323Naturals020119192323Naturals0202201202207113333Naturals0a0208553333Naturals0b02121203333Naturals0%215203333Naturals010616163333Naturals020719193333Naturals0208207208213113434Naturals0a0214883434Naturals0b02181203434Naturals0\div215203434Naturals010616163434Naturals021319193434Naturals0214213214219113535Naturals0a0220663535Naturals0b02241203535Naturals0..215203535Naturals010616163535Naturals021919193535Naturals022021922022914118UnchangedWarningUnchangedWarning230231156162172176182188194200206212218224239253267276282291298230111433UnchangedWarning1sent03231172033UnchangedWarning1paid031060000--TLA+ BUILTINS--0$SetEnumerate-123913255UnchangedWarning1Init093255UnchangedWarning11991655UnchangedWarning1491255UnchangedWarning1230161655UnchangedWarning00213255UnchangedWarning14212455UnchangedWarning1231283255UnchangedWarning011130000--TLA+ BUILTINS--2$SquareAct2114115114Formal_00115Formal_1025316177UnchangedWarning2YouPressPay0166177UnchangedWarning219164377UnchangedWarning219162377UnchangedWarning1188161977UnchangedWarning1230232377UnchangedWarning02284377UnchangedWarning24283277UnchangedWarning213283177UnchangedWarning1230364377UnchangedWarning1162363977UnchangedWarning1230434377UnchangedWarning01486177UnchangedWarning267586177UnchangedWarning12311250000--TLA+ BUILTINS--0$Tuple-11260000--TLA+ BUILTINS--0$UnboundedChoose1127127Formal_00154229Semantic processing of module Naturals +Semantic processing of module UnchangedWarning diff --git a/pstack/skills/statechart/scripts/test/corpus/UnchangedWarning/verdict-1.out b/pstack/skills/statechart/scripts/test/corpus/UnchangedWarning/verdict-1.out new file mode 100644 index 000000000..bee82948f --- /dev/null +++ b/pstack/skills/statechart/scripts/test/corpus/UnchangedWarning/verdict-1.out @@ -0,0 +1,53 @@ +@!@!@STARTMSG 2262:0 @!@!@ +TLC2 Version 2.19 of 08 August 2024 (rev: 5a47802) +@!@!@ENDMSG 2262 @!@!@ +@!@!@STARTMSG 2401:3 @!@!@ +Please run the Java VM which executes TLC with a throughput optimized garbage collector by passing the "-XX:+UseParallelGC" property. +@!@!@ENDMSG 2401 @!@!@ +@!@!@STARTMSG 2187:0 @!@!@ +Running breadth-first search Model-Checking with fp 0 and seed -4267136552748306321 with 1 worker on 4 cores with 1986MB heap and 64MB offheap memory [pid: 2422224] (Linux 6.8.0-149-generic amd64, Eclipse Adoptium 21.0.13 x86_64, MSBDiskFPSet, DiskStateQueue). +@!@!@ENDMSG 2187 @!@!@ +@!@!@STARTMSG 2220:0 @!@!@ +Starting SANY... +@!@!@ENDMSG 2220 @!@!@ +Parsing file /root/projects/cursor-plugins/pstack/skills/statechart/scripts/test/corpus/UnchangedWarning/UnchangedWarning.tla +Parsing file /tmp/statechart-LTGrgW/statechart-APR1B4/tmp-verdict-1/Naturals.tla +Semantic processing of module Naturals +Semantic processing of module UnchangedWarning +@!@!@STARTMSG 2219:0 @!@!@ +SANY finished. +@!@!@ENDMSG 2219 @!@!@ +@!@!@STARTMSG 2185:0 @!@!@ +Starting... (2026-11-16 23:38:30) +@!@!@ENDMSG 2185 @!@!@ +@!@!@STARTMSG 2189:0 @!@!@ +Computing initial states... +@!@!@ENDMSG 2189 @!@!@ +@!@!@STARTMSG 2190:0 @!@!@ +Finished computing initial states: 1 distinct state generated at 2026-11-16 23:38:31. +@!@!@ENDMSG 2190 @!@!@ +@!@!@STARTMSG 2143:3 @!@!@ +The variable paid was changed while it is specified as UNCHANGED at +line 9, col 62 to line 9, col 65 of module UnchangedWarning +@!@!@ENDMSG 2143 @!@!@ +@!@!@STARTMSG 2193:0 @!@!@ +Model checking completed. No error has been found. + Estimates of the probability that TLC did not check all reachable states + because two distinct states had the same fingerprint: + calculated (optimistic): val = 1.6E-19 +@!@!@ENDMSG 2193 @!@!@ +@!@!@STARTMSG 2200:0 @!@!@ +Progress(3) at 2026-11-16 23:38:31: 4 states generated (90 s/min), 3 distinct states found (67 ds/min), 0 states left on queue. +@!@!@ENDMSG 2200 @!@!@ +@!@!@STARTMSG 2199:0 @!@!@ +4 states generated, 3 distinct states found, 0 states left on queue. +@!@!@ENDMSG 2199 @!@!@ +@!@!@STARTMSG 2194:0 @!@!@ +The depth of the complete state graph search is 3. +@!@!@ENDMSG 2194 @!@!@ +@!@!@STARTMSG 2268:0 @!@!@ +The average outdegree of the complete state graph is 1 (minimum is 0, the maximum 1 and the 95th percentile is 1). +@!@!@ENDMSG 2268 @!@!@ +@!@!@STARTMSG 2186:0 @!@!@ +Finished in 2709ms at (2026-11-16 23:38:31) +@!@!@ENDMSG 2186 @!@!@ diff --git a/pstack/skills/statechart/scripts/test/pipeline.test.ts b/pstack/skills/statechart/scripts/test/pipeline.test.ts index 81a5056a3..edec05833 100644 --- a/pstack/skills/statechart/scripts/test/pipeline.test.ts +++ b/pstack/skills/statechart/scripts/test/pipeline.test.ts @@ -164,6 +164,7 @@ const twoStates = (breaks: Rule[], property = "Settles"): CheckResult => ({ drawing: undefined, states: { distinct: 2, initial: 1, complete: true, cut: false }, messages: [{ code: EC.TLC_FINISHED, level: LEVEL.NONE, body: ["Finished in 394ms at (T)"] }], + warnings: [], }); const body = (files: Map>, name: string) => {