Skip to content

Commit 6963886

Browse files
fix(ci): make set-e safe counter increments + correct lean4→lean prover name (#40)
Two foundational CI/CD reds on main fixed at source: 1. `scripts/validate-correspondence.sh` — every counter `((var++))` returns exit-code 1 when `var=0` (the post-increment yields the pre-value, which is treated as a falsy arithmetic result). Combined with `set -euo pipefail` this caused the script to exit at the very first PASS line. Replaced all `((var++))` with `var=$((var + 1))` which always returns 0. Verified locally: now reports 18 PASS / 0 WARN / 0 FAIL / 100% confidence, replacing the previous instant exit-1 after a single PASS. 2. `scripts/validate-with-echidna.sh` — same `((var++))` bug AND it passed `--prover lean4` to the echidna CLI, which only accepts `--prover lean` (see `src/rust/provers/mod.rs:660-678` in hyperpolymath/echidna: matches on `"lean"` for `ProverKind::Lean`; `"lean4"` returns `"Unknown prover: lean4"`). Verified against echidna source — the four Lean 4 verify_file calls now route to the correct prover. Affected workflows that should now go green on main: - Correspondence Validation (`.github/workflows/validation.yml`) - ECHIDNA Validation (`.github/workflows/echidna-validation.yml`) Refs valence-shell audit 2026-06-01 (mirror of verisimdb #77-#83 shape). Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 56827ab commit 6963886

2 files changed

Lines changed: 28 additions & 28 deletions

File tree

scripts/validate-correspondence.sh

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -37,32 +37,32 @@ check_file_reference() {
3737
# Check Lean file exists
3838
if [ ! -f "$lean_file" ]; then
3939
echo -e "${RED}FAIL${NC} - Lean file not found: $lean_file"
40-
((fail_count++))
40+
fail_count=$((fail_count + 1))
4141
return 1
4242
fi
4343

4444
# Check Rust file exists
4545
if [ ! -f "$rust_file" ]; then
4646
echo -e "${RED}FAIL${NC} - Rust file not found: $rust_file"
47-
((fail_count++))
47+
fail_count=$((fail_count + 1))
4848
return 1
4949
fi
5050

5151
# Check correspondence doc mentions both
5252
if ! grep -q "$(basename "$lean_file")" "$CORRESPONDENCE_DOC" 2>/dev/null; then
5353
echo -e "${YELLOW}WARN${NC} - Lean file not documented in correspondence"
54-
((warn_count++))
54+
warn_count=$((warn_count + 1))
5555
return 0
5656
fi
5757

5858
if ! grep -q "$(basename "$rust_file")" "$CORRESPONDENCE_DOC" 2>/dev/null; then
5959
echo -e "${YELLOW}WARN${NC} - Rust file not documented in correspondence"
60-
((warn_count++))
60+
warn_count=$((warn_count + 1))
6161
return 0
6262
fi
6363

6464
echo -e "${GREEN}PASS${NC}"
65-
((pass_count++))
65+
pass_count=$((pass_count + 1))
6666
}
6767

6868
# Function to check property test coverage
@@ -74,15 +74,15 @@ check_property_test_coverage() {
7474

7575
if grep -q "$test_pattern" "$IMPL_DIR/tests/property_tests.rs" 2>/dev/null; then
7676
echo -e "${GREEN}PASS${NC}"
77-
((pass_count++))
77+
pass_count=$((pass_count + 1))
7878
return 0
7979
elif grep -q "$test_pattern" "$IMPL_DIR/tests/property_correspondence_tests.rs" 2>/dev/null; then
8080
echo -e "${GREEN}PASS${NC}"
81-
((pass_count++))
81+
pass_count=$((pass_count + 1))
8282
return 0
8383
else
8484
echo -e "${YELLOW}WARN${NC} - No property test found"
85-
((warn_count++))
85+
warn_count=$((warn_count + 1))
8686
return 0
8787
fi
8888
}
@@ -111,49 +111,49 @@ echo
111111
echo "4. Conditional Operations (Phase 6 M14)"
112112
if [ -f "$IMPL_DIR/src/test_command.rs" ]; then
113113
echo -e " test/[ implementation... ${GREEN}PASS${NC}"
114-
((pass_count++))
114+
pass_count=$((pass_count + 1))
115115
check_property_test_coverage "test -f" "prop_test_f_file_detection"
116116
check_property_test_coverage "test -d" "prop_test_d_directory_detection"
117117
else
118118
echo -e " test/[ implementation... ${RED}FAIL${NC}"
119-
((fail_count++))
119+
fail_count=$((fail_count + 1))
120120
fi
121121
echo
122122

123123
# Validate Logical Operators
124124
echo "5. Logical Operators (Phase 6 M14)"
125125
if grep -q "LogicalOp" "$IMPL_DIR/src/parser.rs" 2>/dev/null; then
126126
echo -e " &&/|| implementation... ${GREEN}PASS${NC}"
127-
((pass_count++))
127+
pass_count=$((pass_count + 1))
128128
check_property_test_coverage "logical AND" "prop_logical_and_short_circuit"
129129
check_property_test_coverage "logical OR" "prop_logical_or_short_circuit"
130130
else
131131
echo -e " &&/|| implementation... ${RED}FAIL${NC}"
132-
((fail_count++))
132+
fail_count=$((fail_count + 1))
133133
fi
134134
echo
135135

136136
# Validate Quote Processing
137137
echo "6. Quote Processing (Phase 6 M13)"
138138
if [ -f "$IMPL_DIR/src/quotes.rs" ]; then
139139
echo -e " Quote module... ${GREEN}PASS${NC}"
140-
((pass_count++))
140+
pass_count=$((pass_count + 1))
141141
check_property_test_coverage "quote processing" "prop_quote_prevents_glob"
142142
else
143143
echo -e " Quote module... ${RED}FAIL${NC}"
144-
((fail_count++))
144+
fail_count=$((fail_count + 1))
145145
fi
146146
echo
147147

148148
# Validate Glob Expansion
149149
echo "7. Glob Expansion (Phase 6 M12)"
150150
if [ -f "$IMPL_DIR/src/glob.rs" ]; then
151151
echo -e " Glob module... ${GREEN}PASS${NC}"
152-
((pass_count++))
152+
pass_count=$((pass_count + 1))
153153
check_property_test_coverage "glob expansion" "prop_glob_deterministic"
154154
else
155155
echo -e " Glob module... ${RED}FAIL${NC}"
156-
((fail_count++))
156+
fail_count=$((fail_count + 1))
157157
fi
158158
echo
159159

scripts/validate-with-echidna.sh

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -48,36 +48,36 @@ verify_file() {
4848

4949
if [ ! -f "$REPO_ROOT/$file" ]; then
5050
echo "[SKIP] $label — file not found: $file"
51-
((SKIPPED++))
51+
SKIPPED=$((SKIPPED + 1))
5252
return 0
5353
fi
5454

5555
echo -n "[....] $label"
5656
local output
5757
output=$("$ECHIDNA" verify "$REPO_ROOT/$file" --prover "$prover" --timeout 120 $VERBOSE $FORMAT_FLAG 2>&1) && {
5858
echo -e "\r[PASS] $label"
59-
((PASSED++))
59+
PASSED=$((PASSED + 1))
6060
} || {
6161
# Distinguish prover-not-found from actual verification failure
6262
if echo "$output" | grep -qi "not found\|not installed\|not available\|no such\|cannot find"; then
6363
echo -e "\r[SKIP] $label (prover '$prover' not available)"
64-
((SKIPPED++))
64+
SKIPPED=$((SKIPPED + 1))
6565
else
6666
echo -e "\r[FAIL] $label"
6767
if [ -n "$VERBOSE" ]; then
6868
echo " $output" | head -3
6969
fi
70-
((FAILED++))
70+
FAILED=$((FAILED + 1))
7171
fi
7272
}
7373
}
7474

7575
# ─── Step 1: Verify Lean 4 proofs (primary source of truth) ───
7676
echo "── Step 1: Lean 4 Proofs ──"
77-
verify_file "Lean 4: FilesystemModel" "proofs/lean4/FilesystemModel.lean" "lean4"
78-
verify_file "Lean 4: FileOperations" "proofs/lean4/FileOperations.lean" "lean4"
79-
verify_file "Lean 4: FilesystemComposition" "proofs/lean4/FilesystemComposition.lean" "lean4"
80-
verify_file "Lean 4: FilesystemEquivalence" "proofs/lean4/FilesystemEquivalence.lean" "lean4"
77+
verify_file "Lean 4: FilesystemModel" "proofs/lean4/FilesystemModel.lean" "lean"
78+
verify_file "Lean 4: FileOperations" "proofs/lean4/FileOperations.lean" "lean"
79+
verify_file "Lean 4: FilesystemComposition" "proofs/lean4/FilesystemComposition.lean" "lean"
80+
verify_file "Lean 4: FilesystemEquivalence" "proofs/lean4/FilesystemEquivalence.lean" "lean"
8181
echo ""
8282

8383
# ─── Step 2: Verify Coq proofs ───
@@ -123,19 +123,19 @@ echo "── Step 7: Rust Correspondence Tests ──"
123123
echo -n "[....] cargo test --test correspondence_tests"
124124
if (cd "$REPO_ROOT/impl/rust-cli" && cargo test --test correspondence_tests 2>/dev/null); then
125125
echo -e "\r[PASS] cargo test --test correspondence_tests (28 tests)"
126-
((PASSED++))
126+
PASSED=$((PASSED + 1))
127127
else
128128
echo -e "\r[FAIL] cargo test --test correspondence_tests"
129-
((FAILED++))
129+
FAILED=$((FAILED + 1))
130130
fi
131131

132132
echo -n "[....] cargo test --test property_tests"
133133
if (cd "$REPO_ROOT/impl/rust-cli" && cargo test --test property_tests 2>/dev/null); then
134134
echo -e "\r[PASS] cargo test --test property_tests (28 tests)"
135-
((PASSED++))
135+
PASSED=$((PASSED + 1))
136136
else
137137
echo -e "\r[FAIL] cargo test --test property_tests"
138-
((FAILED++))
138+
FAILED=$((FAILED + 1))
139139
fi
140140
echo ""
141141

0 commit comments

Comments
 (0)