From 124d0cd88f73485c0212d6687da43ae297dcf3ff Mon Sep 17 00:00:00 2001 From: "Jonathan D.A. Jewell" <6759885+hyperpolymath@users.noreply.github.com> Date: Wed, 26 Aug 2026 16:53:09 +0100 Subject: [PATCH 1/3] fix(scripts): repoint checks at the .adoc files that exist The .md -> .adoc documentation migration moved these files but never updated the scripts that READ them, so every check naming a .md has been operating on a file that no longer exists. Repointed: SECURITY.md->SECURITY.adoc Three failure modes were in play across the estate, all fixed by the same change: * hard fail - 'check "X.md exists" "[ -f X.md ]"' can never pass * wrong score - '[ -f X.md ] && ((doc_score++))' silently scores lower * SILENT SKIP - 'if [ -f X.md ]; then ...greps... fi' skips the whole block, so the checks inside never run and the gate reports success by not checking at all Human-readable labels are repointed too, so failure messages name the file that is actually inspected. Where a script did 'git add ... X.md', that is fixed as well - it would have failed at release time. Only tokens whose .adoc twin exists in this repository were rewritten; anything without a twin was left untouched for separate triage. Found by an estate-wide sweep of 454 repos: 56 such checks across 18 repos. Same defect class as hyperpolymath/Axiom.jl#82. --- tests/validate_structure.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/validate_structure.sh b/tests/validate_structure.sh index 5654a1b..d4c0c86 100755 --- a/tests/validate_structure.sh +++ b/tests/validate_structure.sh @@ -15,7 +15,7 @@ cd "$REPO_ROOT" # Required root files [ -f README.adoc ] && pass "README.adoc present" || fail "README.adoc missing" [ -f LICENSE ] && pass "LICENSE present" || fail "LICENSE missing" -[ -f SECURITY.md ] && pass "SECURITY.md present" || fail "SECURITY.md missing" +[ -f SECURITY.adoc ] && pass "SECURITY.adoc present" || fail "SECURITY.adoc missing" [ -f Justfile ] && pass "Justfile present" || fail "Justfile missing" [ -f rebar.config ] && pass "rebar.config present" || fail "rebar.config missing" From d58c3c6434adc6aad92f4235ba8efcac6b0b2bca Mon Sep 17 00:00:00 2001 From: "Jonathan D.A. Jewell" <6759885+hyperpolymath@users.noreply.github.com> Date: Wed, 26 Aug 2026 17:15:34 +0100 Subject: [PATCH 2/3] Update tests/validate_structure.sh Co-authored-by: codacy-production[bot] <61871480+codacy-production[bot]@users.noreply.github.com> Signed-off-by: Jonathan D.A. Jewell <6759885+hyperpolymath@users.noreply.github.com> --- tests/validate_structure.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/validate_structure.sh b/tests/validate_structure.sh index d4c0c86..8d283cc 100755 --- a/tests/validate_structure.sh +++ b/tests/validate_structure.sh @@ -15,7 +15,7 @@ cd "$REPO_ROOT" # Required root files [ -f README.adoc ] && pass "README.adoc present" || fail "README.adoc missing" [ -f LICENSE ] && pass "LICENSE present" || fail "LICENSE missing" -[ -f SECURITY.adoc ] && pass "SECURITY.adoc present" || fail "SECURITY.adoc missing" +if [ -f SECURITY.adoc ]; then pass "SECURITY.adoc present"; else fail "SECURITY.adoc missing"; fi [ -f Justfile ] && pass "Justfile present" || fail "Justfile missing" [ -f rebar.config ] && pass "rebar.config present" || fail "rebar.config missing" From a8e06d66a75dffdbe0ceaa32ba7520c03f867c60 Mon Sep 17 00:00:00 2001 From: "Jonathan D.A. Jewell" <6759885+hyperpolymath@users.noreply.github.com> Date: Wed, 26 Aug 2026 18:05:28 +0100 Subject: [PATCH 3/3] fix(scripts): repair unsafe control flow flagged by Codacy Two defect classes, both verified empirically rather than inferred. 1. '[ cond ] && pass || fail' is NOT if/then/else. If the 'pass' branch returns non-zero, the 'fail' branch ALSO runs -- even though the condition was true. Demonstrated: pass() { echo ran; return 1; } [ -n yes ] && pass || fail -> BOTH pass() and fail() execute Rewritten as explicit if/then/else. 2. '((var++))' dies under 'set -e' when the counter is 0. Post-increment returns the OLD value as its exit status, so the first increment of a zero counter exits 1 and 'set -e' terminates the script. Demonstrated: set -e; score=0; ((score++)); echo reached -> script DIES before 'reached'; works fine from 1 onward That is precisely the first-document case a compliance script hits on every run. Rewritten as 'var=$((var + 1))'. Both classes are the same underlying trap as the duplicate-branch bug already fixed on asdf-tool-plugins#70 and developer-ecosystem#191: shell shorthand that reads like control flow but is not. Co-Authored-By: Claude Opus 5 --- tests/validate_structure.sh | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/tests/validate_structure.sh b/tests/validate_structure.sh index 8d283cc..a1042ea 100755 --- a/tests/validate_structure.sh +++ b/tests/validate_structure.sh @@ -13,15 +13,39 @@ REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" cd "$REPO_ROOT" # Required root files -[ -f README.adoc ] && pass "README.adoc present" || fail "README.adoc missing" -[ -f LICENSE ] && pass "LICENSE present" || fail "LICENSE missing" +if [ -f README.adoc ]; then + pass "README.adoc present" +else + fail "README.adoc missing" +fi +if [ -f LICENSE ]; then + pass "LICENSE present" +else + fail "LICENSE missing" +fi if [ -f SECURITY.adoc ]; then pass "SECURITY.adoc present"; else fail "SECURITY.adoc missing"; fi -[ -f Justfile ] && pass "Justfile present" || fail "Justfile missing" -[ -f rebar.config ] && pass "rebar.config present" || fail "rebar.config missing" +if [ -f Justfile ]; then + pass "Justfile present" +else + fail "Justfile missing" +fi +if [ -f rebar.config ]; then + pass "rebar.config present" +else + fail "rebar.config missing" +fi # Required directories -[ -d src ] && pass "src/ directory present" || fail "src/ directory missing" -[ -d test ] && pass "test/ directory present" || fail "test/ directory missing" +if [ -d src ]; then + pass "src/ directory present" +else + fail "src/ directory missing" +fi +if [ -d test ]; then + pass "test/ directory present" +else + fail "test/ directory missing" +fi # GitHub workflows — require at least 3 WORKFLOW_COUNT=0