Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .agents/skills/bff-session-lifecycle/model/check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,14 @@ JAR="$(mise where http:tla2tools)/tla2tools.jar"
OUT="${TMPDIR:-/tmp}/bff-session-lifecycle"
rm -rf "$OUT" && mkdir -p "$OUT"
failed=0
# The state files of TLC can take many GB. Delete them after each run and when the script stops. The logs stay.
trap 'rm -rf "$OUT"/*.meta' EXIT
trap 'exit 130' INT TERM HUP

tlc() { # tlc NAME CFG
mise exec -- java -XX:+UseParallelGC -jar "$JAR" -workers auto -metadir "$OUT/$1.meta" \
BffSession.tla -config "$2" >"$OUT/$1.out" 2>&1 || true
rm -rf "${OUT:?}/$1.meta"
}

# check CFG FINDING...: the rules of CFG without the findings must hold, and each finding must break.
Expand Down
5 changes: 4 additions & 1 deletion .agents/skills/membership-lifecycle/check.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh
# Model-checks the membership lifecycle with TLC: MC.cfg (safety, widest bounds), Live.cfg (liveness), Chart.cfg
# (the small model that /statechart draws), Managers.cfg (the paths of UM-4 with no invites). Exits 1 when a rule breaks. TLC writes its files to a temp folder.
# (the small model that /statechart draws), Managers.cfg (the paths of UM-4 with no invites). Exits 1 when a rule breaks. TLC writes its files to a temp folder. The script deletes the state files of TLC after each run and when it stops, keeps the logs of a failed config, and deletes the folder when all configs pass.
# Usage: .agents/skills/membership-lifecycle/check.sh [CONFIG ...]
set -eu
model=$(cd "$(dirname "$0")/model" && pwd)
Expand All @@ -10,11 +10,14 @@ jar="$(mise where http:tla2tools)/tla2tools.jar"
[ -f "$jar" ] || jar=$(find "$(mise where http:tla2tools)" -name 'tla2tools*.jar' | head -1)
out=$(mktemp -d "${TMPDIR:-/tmp}/membership-lifecycle.XXXXXX")
status=0
trap 'find "$out" -mindepth 1 -maxdepth 1 -type d -exec rm -rf {} +; [ "$status" -ne 0 ] || rm -rf "$out"' EXIT
trap 'status=1; exit 130' INT TERM HUP
for cfg in "${@:-MC.cfg Live.cfg Managers.cfg Chart.cfg}"; do
for c in $cfg; do
log="$out/${c%.cfg}.out"
mise exec -- java -XX:+UseParallelGC -cp "$jar" tlc2.TLC -workers auto -metadir "$out/${c%.cfg}" \
-config "$c" MC.tla >"$log" 2>&1 || true
rm -rf "${out:?}/${c%.cfg}"
if grep -q "Model checking completed. No error has been found." "$log"; then
echo "PASS $c: $(grep 'distinct states found' "$log" | tail -1)"
else
Expand Down
9 changes: 7 additions & 2 deletions .agents/skills/object-storage-lifecycle/check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ mise trust --quiet . >/dev/null
mise install --quiet >/dev/null
jar="$(mise where http:tla2tools)/tla2tools.jar"
java="$(mise which java)"
out=$(mktemp -d)
out=$(mktemp -d "${TMPDIR:-/tmp}/object-storage-lifecycle.XXXXXX")
status=0
# The state files of TLC can take many GB. Delete them after each run and when the script stops. Keep the logs of a
# changed config, and delete the folder when each config gives its expected result.
trap 'rm -rf "$out"/*/states-*; [ "$status" -ne 0 ] || rm -rf "$out"' EXIT
trap 'status=1; exit 130' INT TERM HUP

expected() {
case $1 in
Expand Down Expand Up @@ -40,6 +45,7 @@ result() {
log="$dir/run-$run.out"
"$java" -XX:+UseParallelGC -cp "$jar" tlc2.TLC -workers auto -metadir "$dir/states-$run" \
-config "$dir/run.cfg" ObjectStorage.tla >"$log" 2>&1 || echo "TLC exit code $?" >>"$log"
rm -rf "$dir/states-$run"
sed -n 's/.* \([0-9,]*\) distinct states found.*/\1/p' "$log" | tail -1 >"$dir/states"
new=$(broken "$log")
if [ -z "$new" ]; then
Expand All @@ -56,7 +62,6 @@ result() {
}

configs=${*:-"ObjectStorage Liveness Chart LateCommit GraceNone GraceLimit SoftDeletedNames DeletedTenantOrphan"}
status=0
for cfg in $configs; do
want=$(expected "$cfg")
mkdir -p "$out/$cfg"
Expand Down
Loading