From 5250a48cb7ac7e82d5a9604f45ed82a5055739df Mon Sep 17 00:00:00 2001 From: younes-io Date: Sat, 11 Jul 2026 15:28:41 +0200 Subject: [PATCH] fix(tla-check): support TLC 1.7.4 --- .claude-plugin/marketplace.json | 4 +- .github/workflows/skill-ci.yml | 33 +++ VERSION | 2 +- .../.claude-plugin/plugin.json | 2 +- .../tla-workbenches/.codex-plugin/plugin.json | 2 +- .../tla-workbenches/skills/tla-check/SKILL.md | 6 +- .../skills/tla-check/scripts/tlc_check.sh | 154 +++++++++++- .../tla-check/scripts/tlc_trace_summary.sh | 2 +- scripts/tests/tla_check_test.sh | 230 ++++++++++++++++++ skills/tla-check/SKILL.md | 6 +- skills/tla-check/scripts/tlc_check.sh | 154 +++++++++++- skills/tla-check/scripts/tlc_trace_summary.sh | 2 +- 12 files changed, 562 insertions(+), 35 deletions(-) create mode 100755 scripts/tests/tla_check_test.sh diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json index dea11aa..7e2403a 100644 --- a/.claude-plugin/marketplace.json +++ b/.claude-plugin/marketplace.json @@ -5,13 +5,13 @@ }, "metadata": { "description": "Portable TLA+ agent skills for Claude Code and other Agent Skills clients.", - "version": "0.1.6" + "version": "0.1.7" }, "plugins": [ { "name": "tla-workbenches", "description": "TLA+ skills for checking specs and writing proofs.", - "version": "0.1.6", + "version": "0.1.7", "author": { "name": "younes-io" }, diff --git a/.github/workflows/skill-ci.yml b/.github/workflows/skill-ci.yml index db03fa0..5cbc9f5 100644 --- a/.github/workflows/skill-ci.yml +++ b/.github/workflows/skill-ci.yml @@ -7,6 +7,39 @@ on: - main jobs: + tla-check: + name: TLC Script Tests + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Java + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 17 + + - name: Shell syntax checks + run: | + set -euo pipefail + bash -n scripts/tests/tla_check_test.sh + bash -n skills/tla-check/scripts/tlc_check.sh + bash -n skills/tla-check/scripts/tlc_trace_summary.sh + + - name: Run TLC behavioral tests + run: | + set -euo pipefail + jar_path="$RUNNER_TEMP/tla2tools.jar" + curl --fail --location --silent --show-error --retry 3 \ + https://github.com/tlaplus/tlaplus/releases/download/v1.7.4/tla2tools.jar \ + --output "$jar_path" + printf '%s %s\n' \ + '936a262061c914694dfd669a543be24573c45d5aa0ff20a8b96b23d01e050e88' \ + "$jar_path" | sha256sum --check + ./scripts/tests/tla_check_test.sh --jar "$jar_path" + tla-proof: name: TLA Proof Script Tests runs-on: ubuntu-latest diff --git a/VERSION b/VERSION index c946ee6..1180819 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.1.6 +0.1.7 diff --git a/plugins/tla-workbenches/.claude-plugin/plugin.json b/plugins/tla-workbenches/.claude-plugin/plugin.json index 869792a..7795ff5 100644 --- a/plugins/tla-workbenches/.claude-plugin/plugin.json +++ b/plugins/tla-workbenches/.claude-plugin/plugin.json @@ -1,6 +1,6 @@ { "name": "tla-workbenches", - "version": "0.1.6", + "version": "0.1.7", "description": "TLA+ skills for checking specs and writing proofs.", "author": { "name": "younes-io" diff --git a/plugins/tla-workbenches/.codex-plugin/plugin.json b/plugins/tla-workbenches/.codex-plugin/plugin.json index 1dc393e..5ecbc63 100644 --- a/plugins/tla-workbenches/.codex-plugin/plugin.json +++ b/plugins/tla-workbenches/.codex-plugin/plugin.json @@ -1,6 +1,6 @@ { "name": "tla-workbenches", - "version": "0.1.6", + "version": "0.1.7", "description": "TLA+ skills for checking specs and writing proofs.", "author": { "name": "younes-io", diff --git a/plugins/tla-workbenches/skills/tla-check/SKILL.md b/plugins/tla-workbenches/skills/tla-check/SKILL.md index 335a62e..c0357cd 100644 --- a/plugins/tla-workbenches/skills/tla-check/SKILL.md +++ b/plugins/tla-workbenches/skills/tla-check/SKILL.md @@ -9,7 +9,7 @@ description: "Write and iteratively refine executable TLA+ specs (.tla) and TLC - TLA+ spec(s): `*.tla` - TLC config(s): `*.cfg` -- TLC run artifacts: `.tla-check/runs//...` (logs, json trace if any) +- TLC run artifacts: `.tla-check/runs//...` (logs and a JSON trace when TLC reports a counterexample) ## Non-Negotiables (Honesty Rules) @@ -103,6 +103,8 @@ Run (from the `tla-check` skill directory): scripts/tlc_check.sh --spec path/to/Foo.tla --cfg path/to/Foo.cfg ``` +The runner uses TLC's stable `-tool` messages and converts counterexample states to JSON. This keeps it compatible with released TLA+ distributions without scraping presentation-oriented console text. + This writes a run directory under the spec folder: - `.tla-check/runs//summary.json` - `.tla-check/runs//tlc.stdout` @@ -124,7 +126,7 @@ If TLC passes: ## Resources ### scripts/ -- `scripts/tlc_check.sh`: run TLC with `-dumpTrace json`, capture logs, emit `summary.json` +- `scripts/tlc_check.sh`: run TLC in tool mode, capture logs, and emit `summary.json` - `scripts/tlc_trace_summary.sh`: summarize a `counterexample.json` into step-by-step diffs (optional helper) ### references/ diff --git a/plugins/tla-workbenches/skills/tla-check/scripts/tlc_check.sh b/plugins/tla-workbenches/skills/tla-check/scripts/tlc_check.sh index 2766177..5ad5abe 100755 --- a/plugins/tla-workbenches/skills/tla-check/scripts/tlc_check.sh +++ b/plugins/tla-workbenches/skills/tla-check/scripts/tlc_check.sh @@ -158,6 +158,133 @@ quote_cmd() { printf '%s\n' "$out" } +write_tool_trace() { + local input="$1" + local output="$2" + local tmp_output + local trace_filter + + tmp_output="$(mktemp "${output}.tmp.XXXXXX")" + trace_filter=' +def capture_value($capture; $name): + $capture.captures[] | select(.name == $name) | .string; + +def parse_vars: + [ + match( + "(?ms)^(?:/\\\\[[:space:]]+)?(?[A-Za-z_][A-Za-z0-9_]*)[[:space:]]*=[[:space:]]*(?.*?)(?=^(?:/\\\\[[:space:]]+)?[A-Za-z_][A-Za-z0-9_]*[[:space:]]*=|\\z)"; + "g" + ) + | { + "key": capture_value(.; "name"), + "value": (capture_value(.; "value") | sub("[[:space:]]+$"; "")) + } + ] | from_entries; + +[ + match( + "(?ms)@!@!@STARTMSG 2217:[0-9]+ @!@!@\\n(?.*?)@!@!@ENDMSG 2217 @!@!@"; + "g" + ) + | capture_value(.; "body") + | capture("(?s)^(?[0-9]+): <(?