You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(statechart): resolve configured tools from caller - #1017
Configured relative TLC jar and Java paths stop working when statechart starts Java in its temporary snapshot directory. Resolve those paths from the caller before starting Java. Closes#973.
What changed
Resolve TLA2TOOLS and path-shaped JAVA values from the caller in both discovery paths.
Add CLI regressions and regenerate the Claude Code copy.
Scope
Preserve absolute paths, bare Java names on PATH, and temporary-directory isolation.
Leave tool installation and model checking unchanged.
Blast Radius
This affects statechart's configured tool discovery. Bare executable names still use PATH.
Verification
Two focused regressions pass and fail on unchanged main. Five real Java/TLC CLI scenarios pass, including three relative-path failures reproduced on main.
Plugin validation and the generated-tree check pass.
The full pstack run passed 362 of 369 tests. Four direct-TLC temporary-directory failures then passed on both main and this branch with an owned Java temp folder. Three existing signal tests that use ps also fail on main in the macOS sandbox. Hosted Linux CI remains pending.
Note
Low Risk
Narrow change to statechart tool path resolution; behavior for absolute paths and PATH-only Java names is preserved.
Overview
Fixes relative TLA2TOOLS and path-shaped JAVA env vars breaking when the statechart CLI runs Java in an isolated temp working directory.
findTlc in run.ts now resolves non-absolute tool paths against process.cwd() (the caller) via a fromCaller helper, while absolute paths and bare java on PATH are unchanged. Path-like JAVA values (absolute or containing / or \) are normalized the same way on both the explicit-TLA2TOOLS branch and the mise discovery branch, instead of passing through raw relative strings that would be interpreted from the temp cwd.
Adds tool-paths.test.ts with two CLI integration tests (fake Java/mise) that assert the expected jar classpath and that Java still runs outside the caller directory.
Reviewed by Cursor Bugbot for commit 15d26ab. Bugbot is set up for automated code reviews on this repo. Configure here.
Hey @Ehsan-hash, the run.ts change does what #973 asked, and on macOS the first of the two new tests fails for a reason unrelated to it: resolves relative TLC and Java paths from the caller with explicit TLA2TOOLS exits 91 from the fake Java with unexpected classpath: /private/var/folders/.../tools/tla2tools.jar. runCase builds root with mkdtempSync(path.join(os.tmpdir(), ...)), which on macOS is /var/folders/..., and passes path.join(root, "tools", "tla2tools.jar") as STATECHART_EXPECTED_CP; the CLI runs with cwd: root, Node reports process.cwd() with the symlink resolved (/private/var/...), so path.resolve(process.cwd(), value) produces a path that is correct but not string-equal to the expected one. The second case passes because its Java path is absolute and there is no relative jar. const root = fs.realpathSync(fs.mkdtempSync(...)) makes both cases pass here (126 of the existing cli.test.ts plus 2); that is the same /var -> /private/var class as #923 and #997. Merge-tree is clean against main (23ab063).
Thanks @deanrie, reproduced the /tmp to /private/tmp mismatch. Fixed in 15d26ab by canonicalizing the fixture root with fs.realpathSync, then regenerated the harness copy. Both new tests pass with canonical and symlinked temporary paths. The existing CLI checks pass with canonical temporary paths (125 selected tests; the three previously documented signal/ps cases remain host-limited). No production behavior changed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Configured relative TLC jar and Java paths stop working when statechart starts Java in its temporary snapshot directory. Resolve those paths from the caller before starting Java. Closes #973.
What changed
TLA2TOOLSand path-shapedJAVAvalues from the caller in both discovery paths.Scope
Blast Radius
This affects statechart's configured tool discovery. Bare executable names still use PATH.
Verification
psalso fail on main in the macOS sandbox. Hosted Linux CI remains pending.Note
Low Risk
Narrow change to statechart tool path resolution; behavior for absolute paths and PATH-only Java names is preserved.
Overview
Fixes relative
TLA2TOOLSand path-shapedJAVAenv vars breaking when the statechart CLI runs Java in an isolated temp working directory.findTlcinrun.tsnow resolves non-absolute tool paths againstprocess.cwd()(the caller) via afromCallerhelper, while absolute paths and barejavaon PATH are unchanged. Path-likeJAVAvalues (absolute or containing/or\) are normalized the same way on both the explicit-TLA2TOOLSbranch and the mise discovery branch, instead of passing through raw relative strings that would be interpreted from the tempcwd.Adds
tool-paths.test.tswith two CLI integration tests (fake Java/mise) that assert the expected jar classpath and that Java still runs outside the caller directory.Reviewed by Cursor Bugbot for commit 15d26ab. Bugbot is set up for automated code reviews on this repo. Configure here.