8000 quint: run quint verify on the packaged apalache, never a download by bryan-minimal · Pull Request #1627 · gominimal/pkgs · GitHub
[go: up one dir, main page]

Skip to content

quint: run quint verify on the packaged apalache, never a download - #1627

Open
bryan-minimal wants to merge 1 commit into
mainfrom
quint-apalache
Open

bryan-minimal wants to merge 1 commit into
mainfrom
quint-apalache

Conversation

@bryan-minimal
Copy link
Copy Markdown
Member

This is the follow-up to #1611 (quint) and #1615 (apalache), which both merged today.

Problem. quint 0.33.1's quint verify looks for Apalache in ~/.quint/apalache-dist-<version>/apalache/. On first use it downloads apalache.tgz there from GitHub, unhashed. quint verify --backend tlc runs TLC from that jar with whatever java is on PATH. In a session with no network, verify fails.

Change

  • runtime_deps gains apalache, which installs /usr/lib/apalache/{bin/apalache-mc,lib/apalache.jar}. That is quint's expected layout, rooted at /usr/lib.
  • In build.sh, apalacheDistDir(version) returns /usr/lib for the pinned version only. An explicit --apalache-version for any other version keeps upstream's download, so quint never runs a different version than the one asked for.
  • TLC is spawned with /usr/lib/jvm/bin/java, the JDK apalache's launcher is already pinned to.
  • Guard: quint's DEFAULT_APALACHE_VERSION_TAG must equal apalache.attrs.upstream_version, which is forwarded as apalache_version. A bump of either package without the other fails the build.
  • Fail-closed checks after patching:
    • the pinned version resolves to /usr/lib, and another version doesn't;
    • no bare java spawn is left;
    • each patch site matches exactly once.

Tests. A new verify test runs both backends. On each backend a held invariant passes and a violated one fails. QUINT_HOME must stay empty, and no "Downloading Apalache" message may appear. The spec wraps at 5 so that TLC's state space is finite.

Checked locally:

  • Both arches evaluate.
  • build_args resolves to apalache_version = 0.62.4.
  • The patch logic, applied to the real 0.33.1 config.js and tlc.js, gives /usr/lib and upstream's path respectively, and both files pass node --check.

build-bot runs the real build and tests.

🤖 Generated with Claude Code

quint 0.33.1 looks for Apalache under ~/.quint/apalache-dist-<version> and
downloads apalache.tgz (unhashed) there on first use; `--backend tlc` runs
the jar's TLC with `java` from PATH.

- runtime_deps gains apalache (#1615), which installs
  /usr/lib/apalache/{bin/apalache-mc,lib/apalache.jar}.
- build.sh returns /usr/lib from apalacheDistDir() for the pinned version
  only (another --apalache-version keeps upstream's download), and spawns
  TLC with /usr/lib/jvm/bin/java.
- Guard: quint's DEFAULT_APALACHE_VERSION_TAG must equal apalache's
  upstream_version (forwarded as apalache_version), so a bump of either
  stops the build.
- New verify test: both backends, a held and a violated invariant, an
  empty QUINT_HOME, and no download message.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bryan-minimal
bryan-minimal requested a review from a team as a code owner November 21, 2026 17:17
@coderabbitai
coderabbitai Bot commented Nov 21, 2026
Copy link
Copy Markdown
Contributor

Warning

Review limit reached

  • Run on-demand review

This review includes 2 billable files and costs up to $0.50.

  • Ask an admin to make reviews automatic

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Or wait 28 minutes for your next included review.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 65 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 1db6b46 and dc12a8a.

Files selected for processing: 2

  • packages/quint/build.ncl
  • packages/quint/build.sh
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@norrietaylor norrietaylor left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Scope matches the title. Both files change only the Apalache lookup, the TLC java spawn, the version guard and one new test. Clobber not checked with git log, because the harness denied shell access after the first read. The diff removes only the NOT packaged comment that this PR makes obsolete. Correctness I read packages/quint/build.sh, packages/quint/build.ncl, packages/apalache/build.ncl and packages/apalache/build.sh in full. The /usr/lib redirect agrees with the layout that packages/apalache/build.sh installs. The version guard reads apalache.attrs.upstream_version, the same pattern as packages/chromedriver-bin/build.ncl:41. /usr/lib/jvm/bin/java is the path that the jdk packages install and that packages/apalache/build.sh:26 pins. The two findings are nits. Not checked: the upstream quint 0.33.1 config.js, tlc.js and apalache.js. The harness denied the npm download, so the patch sites, the Downloading Apalache text and the TLC output that the test greps for violation rest on the PR body. The new test does not set JVM_ARGS=-Xmx1g or TMPDIR, and both apalache tests do. I did not find why apalache sets them, so I did not file it. No build or test ran.

Comment thread packages/quint/build.sh
# the one apalache's launcher is pinned to.
tsig="(0, child_process_1.spawn)('java', ["
[ "$(grep -cF "$tsig" "$dist/tlc.js")" = 1 ] || { echo "tlc.js: the java spawn moved — re-check the patch" >&2; exit 1; }
sed -i "s|(0, child_process_1.spawn)('java', \[|(0, child_process_1.spawn)('/usr/lib/jvm/bin/java', [ // minimal: the packaged jdk|" "$dist/tlc.js"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit · The replacement puts a // comment directly after [ on the spawn line. The comment is safe only while upstream breaks the line after [. If a later quint puts the first argument on that line, the comment removes it and tlc.js does not parse. The guards at lines 102-103 only grep the file, so the build passes and only the verify test fails. config.js does not have this gap, because line 97 loads it with require. Drop the inline comment, or add node --check "$dist/tlc.js" after the patch. This is the only patch in the file that appends a comment in the middle of a statement. I did not read the upstream tlc.js, because the download was denied.

Comment thread packages/quint/build.ncl
fi
grep -qi 'violation' bad.log || { cat bad.log; exit 1; }
if grep -qi 'downloading apalache' ok.log bad.log; then echo "backend $b: quint tried to download Apalache" >&2; exit 1; fi
done
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit · The verify test does not show that --backend tlc runs the packaged JDK. The jdk is in the closure through apalache, so a java from PATH also passes. The check test in packages/apalache/build.ncl:120-124 puts a failing java first on PATH for this purpose. Add the same fakebin/java here to make the test fail when the spawn goes back to PATH. The build guards at build.sh:102-103 cover the patch today, so this is a nit.

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.

2 participants

0