Skip to content

fix(formal-verification): port upstream statechart CRLF, Windows cleanup and renderer fixes to chart - #18245

Merged
melodic-automation-lanes[bot] merged 2 commits into
mainfrom
work-resolve-issue/issue-18224-45069486868-1
Nov 22, 2026
Merged

melodic-automation-lanes[bot] merged 2 commits into
mainfrom
work-resolve-issue/issue-18224-45069486868-1

Conversation

@melodic-automation-lanes

@melodic-automation-lanes melodic-automation-lanes Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Closes #18224

Summary

Opened by the work-resolve-issue lane. The run's own summary:

Ports cursor/plugins#1292 and #1236 into formal-verification:chart's copied statechart scripts. TLC output is now split with splitLines, so CRLF line ends parse the same as LF. The /bin/sh process-group kill and cleanup are replaced by kill.ts (taskkill /t /f on Windows) and a Node janitor.ts. Both spawns hide their console window, the TLC JVM writes UTF-8, and childEnv sets TEMP and TMP. The Mermaid renderer's drawnEdges ends a parent's only way in at the parent and adds a start marker inside it. A spec SANY cannot read now reports SANY's own error lines. Adapt choices: TEMP and TMP go through childEnv, not inline as upstream does; the SANY rerun reads the staged spec, because our copy stages specs; and the upstream tests take our check(spec, cfg, tlc) signature and our STATECHART_RENDER_DEPS / TLA2TOOLS skips. Upstream code and tests were read at pin 0b46ec399d55f2829e88822998f53b84944837d3 (MIT).

Not verified

  • The chart skill's node suite (node --test --test-concurrency=4) was not run: this lane's Bash runs only the named wrappers, not node. The new and changed tests, and the hand-recomputed cli.test.ts expectations and Login/chart.mmd, are left to the PR's CI.
  • The #1236 render test (Pele 1.9.0) and SANY error tests skip unless STATECHART_RENDER_DEPS and TLA2TOOLS are set. Whether they pass needs a run with those set.
  • Native-Windows behaviour (taskkill, windowsHide, CRLF from a real Windows TLC) was not exercised on Windows; the CRLF path is covered by the replay tests only.
  • statechart.ts was written from a summary of upstream's version, since the fetcher would not quote it in full. The kill-only-while-running rule and the 'exited' signal to the janitor follow that summary and janitor.ts.
  • Reviewer notes left unchanged. (1) In record mode test/java.ts names the SANY rerun 'sany', so it overwrites the exporter's sany.out; no corpus case records a failing spec. (2) On Windows, rmSync right after taskkill has no retry, and the janitor's kill-after-exit window is small. Both match…
  • Tidy skipped: the change is 19 files, over the 10-file tidy cutoff, and it also touches docs/ beside plugins/formal-verification.
  • Untracked dotfiles at the checkout root (.bash_profile, .bashrc, .gitconfig, .idea, .mcp.json, .profile, .ripgreprc, .vscode, .zprofile, .zshrc) were not created by this run (they look like sandbox mount placeholders) and are not part of the change.

Fix

Paths are under plugins/formal-verification/skills/chart/scripts/ unless given in full.

  • frontends/dot.ts: adds splitLines, which drops a trailing CR and splits on CRLF or LF; linesOf uses it.
  • run.ts: fileLines and outputLines split with splitLines. Drops killGroup. Adds windowsHide to the TLC spawn and -Dstdout.encoding=UTF-8 / -Dstderr.encoding=UTF-8 to the JVM. Adds firstLines, SANY_ERRORS and sanyErrors. A failed SANY XML export reruns tla2sany.SANY on the staged spec and reports its error block, else the export's tail.
  • kill.ts: new; kills a process group with process.kill(-pid) on POSIX or taskkill /t /f on Windows.
  • janitor.ts: new Node janitor, replacing the /bin/sh one. Once stdin closes it kills the worker group (if the worker was still running, or always off Windows) and removes the stage and temp folders.
  • statechart.ts: spawns janitor.ts under the same runtime instead of /bin/sh. Writes 'exited' to the janitor when the worker exits. Kills the worker group only while the worker runs, or always off Windows. Sets windowsHide on both spawns.
  • stage.ts: childEnv also sets TEMP and TMP to the fresh home folder.
  • backends/mermaid.ts: adds the exported drawnEdges (#1236). When every way into a parent comes from one source, the arrows end at the parent and a [*] marker inside the block leads on to each child. mermaidLines draws from it.
  • test/corpus/Login/chart.mmd: regenerated by hand for the renderer change: s0 --> s1 replaces s0 --> s2, and [*] --> s2 is added inside 'Trying to sign in'. This is the same edit upstream made to its copy of this chart.
  • test/drawn.ts: new; upstream's drawn() helper, which also reads [*] arrows inside parent blocks.
  • test/cli.test.ts: uses drawn.ts. Recomputes the expected arrows of the five parent-state drawn() cases for drawnEdges. Adds the corpus replay with Windows line ends (asTlcPrintsOnWindows). Adds a SANY-error case that needs no jar: a replayed sany.out with Java frames and a SANY errors block must give exit 2 and stderr with only SANY's line-and-column block, so the rerun and SANY_ERRORS are tested in every CI run.
  • test/chart.test.ts: adds the two #1236 parent-arrow tests.
  • test/labels.ts: expected() builds edges from drawnEdges, including each parent's start edges.
  • test/render.test.ts: adds pathPoints and the Pele 1.9.0 test that an arrow into a parent stays out of its title bar, with the file's existing skip.
  • test/corpus.test.ts: adds the three #1236 SANY error tests (unknown name, parse error, twelve unknown names), skipped without TLA2TOOLS like their neighbours.
  • test/messages.test.ts: adds the CRLF verdict and plain-text test from #1292.
  • test/guard.test.ts: the childEnv test also asserts TEMP and TMP.
  • plugins/formal-verification/skills/chart/SKILL.md: adds the native-Windows run line from #1292's SKILL.md (node --disable-warning=ExperimentalWarning .../statechart.ts). It names no Node versions; it points at the launcher's start gate, which owns the range.
  • docs/upstream/cursor-pstack.md: the statechart row records both fixes as taken by #18224, and the intro no longer says the renderer fix is missing.
  • .changes/formal-verification/work-resolve-issue-issue-18224-45069486868-1-c1375c7f.md: patch fragment for formal-verification.

Verification

The runner ran each check from the base copy against a819fec:

  • scripts/check-changelog-fragments.sh --check: passed
  • scripts/check-changed-skills.sh --merge-base: passed

The run reports:

  • read https: //patch-diff.githubusercontent.com/raw/cursor/plugins/pull /1292.diff: #1292 adds kill.ts and janitor.ts, a splitLines helper used wherever run.ts splits output, windowsHide and UTF-8 JVM flags, TEMP/TMP, CRLF tests in cli.test.ts and messages.test.ts, and a native-Windows line in…
  • read https: //raw.githubusercontent.com/cursor/plugins/0b46ec399d55f2829e88822998f53b84944837d3/pstack/skills/statechart/scripts/kill.ts: full kill.ts, ported as is
  • read https: //raw.githubusercontent.com/cursor/plugins/0b46ec399d55f2829e88822998f53b84944837d3/pstack/skills/statechart/scripts/janitor.ts: full janitor.ts, ported as is
  • read https: //raw.githubusercontent.com/cursor/plugins/0b46ec399d55f2829e88822998f53b84944837d3/pstack/skills/statechart/scripts/statechart.ts: imports killGroup from kill.ts; sets TMPDIR/TEMP/TMP; kills the worker group only when it is still running or the platform requires it (summary only, so…
  • read https: //raw.githubusercontent.com/cursor/plugins/0b46ec399d55f2829e88822998f53b84944837d3/pstack/skills/statechart/scripts/frontends/dot.ts: splitLines and linesOf definitions
  • read https: //raw.githubusercontent.com/cursor/plugins/0b46ec399d55f2829e88822998f53b84944837d3/pstack/skills/statechart/scripts/run.ts: splitLines at four sites, windowsHide on spawn, the -Dstdout/-Dstderr.encoding flags, SANY_ERRORS, firstLines, sanyErrors, stopOf, and the SANY rerun block
  • read https: //patch-diff.githubusercontent.com/raw/cursor/plugins/pull /1236.diff: truncated by the fetcher, so the per-file list came from the next read
  • read https: //api.github.com/repos/cursor/plugins/pulls/1236/files?per_page=100: #1236's statechart files are backends/mermaid.ts, run.ts, test/chart.test.ts, cli.test.ts, corpus.test.ts, corpus/Login/chart.mmd, drawn.ts (new), labels.ts and render.test.ts, plus what each change does
  • read https: //raw.githubusercontent.com/cursor/plugins/0b46ec399d55f2829e88822998f53b84944837d3/pstack/skills/statechart/scripts/backends/mermaid.ts: full file; Edge, within, wayIn, drawnEdges and the mermaidLines changes taken
  • read https: //raw.githubusercontent.com/cursor/plugins/0b46ec399d55f2829e88822998f53b84944837d3/pstack/skills/statechart/scripts/test/drawn.ts: full drawn() helper
  • read https: //raw.githubusercontent.com/cursor/plugins/0b46ec399d55f2829e88822998f53b84944837d3/pstack/skills/statechart/scripts/test/labels.ts: imports and expected() with drawnEdges
  • read https: //raw.githubusercontent.com/cursor/plugins/0b46ec399d55f2829e88822998f53b84944837d3/pstack/skills/statechart/scripts/test/chart.test.ts: the two parent-arrow tests
  • read https: //raw.githubusercontent.com/cursor/plugins/0b46ec399d55f2829e88822998f53b84944837d3/pstack/skills/statechart/scripts/test/corpus.test.ts: the three SANY error tests and writeSpec
  • read https: //raw.githubusercontent.com/cursor/plugins/0b46ec399d55f2829e88822998f53b84944837d3/pstack/skills/statechart/scripts/test/render.test.ts: pathPoints and the title-bar test
  • read https: //raw.githubusercontent.com/cursor/plugins/0b46ec399d55f2829e88822998f53b84944837d3/pstack/skills/statechart/scripts/test/messages.test.ts: the Windows line ends test
  • read https: //raw.githubusercontent.com/cursor/plugins/0b46ec399d55f2829e88822998f53b84944837d3/pstack/skills/statechart/scripts/test/cli.test.ts: asTlcPrintsOnWindows and the corpus replay loop with Windows line ends
  • read https: //raw.githubusercontent.com/cursor/plugins/0b46ec399d55f2829e88822998f53b84944837d3/pstack/skills/statechart/SKILL.md: on native Windows, run node --disable-warning=ExperimentalWarning <skill dir>/scripts/statechart.ts under Node 22.18 to 22.x or 23.6 or later
  • Grep for split("\n") under scripts/ outside tests: only run.ts tail() and stopOf/firstLines (which split text plainText already rebuilt from split lines), messages.ts messageState (message bodies already split), and dot.ts parseState's split("\n/\ ") on a decoded label. No split of raw TLC output…
  • Grep for /bin/sh under scripts/: only the statechart launcher (a #!/bin/sh shell script, not a spawn) and test files; no script spawns /bin/sh
  • Grep for nested parent blocks in corpus chart.mmd files: only Login has a parent state, so it is the only committed corpus chart the renderer change touches
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/45069486868

Left out: the items under Not verified.

Related

#18224

Lane-Activity: work-resolve-issue/resolve-issue
@github-actions

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-refine/fix-docs

Run 45072688254, attempt 1

Field Value
Model rung 0
Leg handoff
Run job success
Activity step success
Commits pushed none (read lane)
Run 45072688254

Failed GitHub API calls

No failed call recorded by the run job's scripts.

@github-actions

github-actions Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

claude-security-review reviewed 1fbd0fb9432047b88135b39c3eeb11dc7093bea4: read 3 of 3 changed file(s); 0 finding(s), 0 as inline comments.

Security review (incremental, blocking only): no security issues found

I read the whole change in all 3 files listed in .claude-lane/incremental-files.txt, from a819fec to 1fbd0fb, in .claude-lane/incremental.diff. This lane already reviewed an earlier head, so this review reports only CRITICAL and IMPORTANT findings. It found none.

What I checked:

  • plugins/formal-verification/skills/chart/SKILL.md: the native-Windows run line no longer lists Node versions. It now points to the start gate in scripts/statechart. No rule is removed or weakened. The command it gives is the same fixed node --disable-warning=ExperimentalWarning "${CLAUDE_PLUGIN_ROOT}/.../statechart.ts" call, and it brings in no new input.
  • plugins/formal-verification/skills/chart/scripts/test/cli.test.ts: adds one test. It writes a fixed sany.exit and sany.out into a copied corpus case, then checks that the result is exit 2, that stderr holds only SANY's line-and-column error block, and that no files are written. It is test-only, with no secrets, network calls or new spawn paths.
  • .changes/formal-verification/...c1375c7f.md: a one-sentence change to the changelog text, with nothing to execute.
  • Trust controls and manifests: this push changes no trust control, workflow, hold path, plugin.json or marketplace.json.
  • Embedded text: the PR description holds no instructions aimed at this lane.
  • Cost: none. The only spend is one more test case in the PR's CI.
  • Prior findings: this lane's earlier summary reported 0 findings, so there is nothing to repeat.

critical-findings: 0

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

claude-review: 2 inline finding(s) on a819fec8bd8ea0df63807a0e15b26b9abe294176; the summary is in this lane's pull request comment.

claude-lane: claude-review

@github-actions

github-actions Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

claude-review reviewed 1fbd0fb9432047b88135b39c3eeb11dc7093bea4: read 3 of 3 changed file(s); 0 finding(s), 0 as inline comments.

Code review (incremental, blocking only): changes since a819fec

This lane already reviewed an earlier head, so this pass reports only blocking findings. I read the full incremental change in all three files. I found no blocking issues.

  • cli.test.ts, new SANY-error case. This addresses the earlier finding that no CI run tested the SANY rerun.
    • The test reaches the rerun without a jar. I traced it through test/java.ts:9-10. Neither the export run nor the rerun passes -config, so in replay both are named sany and both read the test's sany.out and sany.exit (java.ts:55-63).
    • The expected stderr matches the code. sanyErrors (run.ts:227-232) cuts the output at *** Errors:. firstLines then trims it. The thrown message uses the caller's specFile, the same one the existing ENOENT test asserts at cli.test.ts:840.
    • It fails when it should. If SANY_ERRORS broke, or the rerun were dropped, the output would fall back to tail(xml). That keeps the at tla2sany. frames, so both the exact-match assert and the doesNotMatch assert would fail.
  • SKILL.md. The native-Windows line no longer lists Node versions. It links the launcher's start gate in scripts/statechart, as the earlier finding suggested. The relative link target is the launcher next to run.ts.
  • Changelog fragment. It adds one sentence about the run line deferring to the launcher's Node version gate. That matches the SKILL.md change, and bump: patch is unchanged.

Earlier findings.

  • The thread about the SANY rerun having no CI test is resolved with no lines changed since, and the new test addresses it.
  • The thread about SKILL.md restating the Node version range is resolved with no lines changed since, and the edit addresses it.

I re-raised neither.

Other inputs.

  • I ran nothing. That the new test passes in CI is the author's claim and unverified.
  • Loosened checks: the incremental change only adds a stricter test, so it loosens no check. Loosened checks would be marked: fail (default; the prompt carried no loosened_check_verdict: line); patterns: 0. The prompt had no loosened_check_decision_record: line, so I did not check the citation requirement.
  • No plugin manifest changed.
  • I found no embedded instructions in the PR context, the settled threads or the prior findings.

Spend. No hold. The added test is one more replay run in the existing suite, using CI minutes only.

Verifier dropped 0 of 0 candidates.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Unattended merge: native auto-merge leaves this pull request unarmed at head a819fec8bd8ea0df63807a0e15b26b9abe294176. No person needs to act: a lane clears this reason, and the next scheduled run judges it again.

pr-merge's gate refuses its verifier verdict (verify:missing)

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The unattended merge path is about to arm native auto-merge at head a819fec8bd8ea0df63807a0e15b26b9abe294176, the head its arming checks judged. The arm fails if the head moves first.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Merge-Risk: max=HIGH demote=true head=a819fec8bd8ea0df63807a0e15b26b9abe294176 rubric=10.8.2 rater=claude-opus-5-5 checker=claude-opus-5-5

@github-actions

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-unblock/address-feedback

Run 45073860024, attempt 1

Field Value
Model rung 0
Leg handoff
Run job success
Activity step success
Commits pushed none (read lane)
Run 45073860024

Failed GitHub API calls

No failed call recorded by the run job's scripts.

Lane-Activity: pr-unblock/address-feedback
Lane-Thread: PRRT_kwDOTCGFQM66ogvG
Lane-Thread: PRRT_kwDOTCGFQM66ogvH
@github-actions

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-unblock/apply-feedback-patch

Run 45073860024, attempt 1

Field Value
Model rung 0
Leg base
Run job success
Activity step success
Commits pushed 1fbd0fb
Run 45073860024

Failed GitHub API calls

No failed call recorded by the run job's scripts.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

pr-unblock / address-feedback finished round 1 of max 4 on 1fbd0fb.

@github-actions

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-unblock/publish-feedback

Run 45073860024, attempt 1

Field Value
Model rung 0
Leg base
Run job success
Activity step success
Commits pushed none recorded
Run 45073860024

Failed GitHub API calls

No failed call recorded by the run job's scripts.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The unattended merge path is about to arm native auto-merge at head 1fbd0fb9432047b88135b39c3eeb11dc7093bea4, the head its arming checks judged. The arm fails if the head moves first.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Merge-Risk: max=HIGH demote=true head=1fbd0fb9432047b88135b39c3eeb11dc7093bea4 rubric=10.8.2 rater=claude-opus-5-5 checker=claude-opus-5-5

@melodic-automation-lanes
melodic-automation-lanes Bot added this pull request to the merge queue Nov 22, 2026
Merged via the queue into main with commit 5a6a58d Nov 22, 2026
100 of 102 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-18224-45069486868-1 branch November 22, 2026 22:36
@github-actions

Copy link
Copy Markdown
Contributor

Post-merge mutation testing

Killed 0, survived 4, timeout 0, no coverage 3, invalid 0, not run 0.
Covered-code score 0%; mutation score 0%.

File Killed Survived Timeout No coverage Invalid Not run
plugins/formal-verification/skills/chart/scripts/backends/mermaid.ts 0 0 0 3 0 0
plugins/formal-verification/skills/chart/scripts/frontends/dot.ts 0 1 0 0 0 0
plugins/formal-verification/skills/chart/scripts/kill.ts 0 1 0 0 0 0
plugins/formal-verification/skills/chart/scripts/run.ts 0 2 0 0 0 0

Surviving mutants

Location Operator Disposition Cause
plugins/formal-verification/skills/chart/scripts/frontends/dot.ts:39 other unclassified none
plugins/formal-verification/skills/chart/scripts/run.ts:231 ROR unclassified none
plugins/formal-verification/skills/chart/scripts/run.ts:333 SBR unclassified none
plugins/formal-verification/skills/chart/scripts/kill.ts:12 UOI unclassified none

The run's summary has the full report.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The post-merge check verified merge commit 5a6a58df1f4b995631459a10f23f2dc8b158aa17; later checks count it verified from this comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(formal-verification): port upstream statechart CRLF, Windows cleanup and renderer fixes to chart

0 participants