Skip to content

fix(scripts): repoint checks at the .adoc files that exist - #69

Merged
hyperpolymath merged 2 commits into
mainfrom
fix/repoint-scripts-at-adoc
Aug 26, 2026
Merged

fix(scripts): repoint checks at the .adoc files that exist#69
hyperpolymath merged 2 commits into
mainfrom
fix/repoint-scripts-at-adoc

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

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: ABI-FFI-README.md->ABI-FFI-README.adoc

Three failure modes were in play across the estate, all fixed by the same change:

shape effect
check "X.md exists" "[ -f X.md ]" hard fail — can never pass
[ -f X.md ] && ((doc_score++)) silently scores lower
if [ -f X.md ]; then …greps… fi silent skip — the block never runs, so the gate reports success by not checking

Labels are repointed too, so failure messages name the file 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 here were rewritten; anything without a twin was left for separate triage.

Found by an estate-wide sweep of 454 repos: 56 such checks across 18 repos. Same class as hyperpolymath/Axiom.jl#82.

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: ABI-FFI-README.md->ABI-FFI-README.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.
@coderabbitai

coderabbitai Bot commented Aug 26, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 1d7838d2-e4b5-47ec-85e4-b91dc05cae97

📥 Commits

Reviewing files that changed from the base of the PR and between 4699a51 and cffed46.

📒 Files selected for processing (1)
  • tests/validate_structure.sh

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.

📜 Recent review details
⏰ Context from checks skipped due to timeout. (1)
  • GitHub Check: Codacy Static Code Analysis
🧰 Additional context used
🪛 GitHub Check: SonarCloud Code Analysis
tests/validate_structure.sh

[failure] 38-38: Use '[[' instead of '[' for conditional tests. The '[[' construct is safer and more feature-rich.

See more on https://sonarcloud.io/project/issues?id=hyperpolymath_thejeffparadox&issues=AaA_CS2Ybsq2ePVCtiH_&open=AaA_CS2Ybsq2ePVCtiH_&pullRequest=69


[failure] 43-43: Use '[[' instead of '[' for conditional tests. The '[[' construct is safer and more feature-rich.

See more on https://sonarcloud.io/project/issues?id=hyperpolymath_thejeffparadox&issues=AaA_CS2Ybsq2ePVCtiIA&open=AaA_CS2Ybsq2ePVCtiIA&pullRequest=69


[failure] 53-53: Use '[[' instead of '[' for conditional tests. The '[[' construct is safer and more feature-rich.

See more on https://sonarcloud.io/project/issues?id=hyperpolymath_thejeffparadox&issues=AaA_CS2Ybsq2ePVCtiIC&open=AaA_CS2Ybsq2ePVCtiIC&pullRequest=69


[failure] 31-31: Use '[[' instead of '[' for conditional tests. The '[[' construct is safer and more feature-rich.

See more on https://sonarcloud.io/project/issues?id=hyperpolymath_thejeffparadox&issues=AaA_CS2Ybsq2ePVCtiH-&open=AaA_CS2Ybsq2ePVCtiH-&pullRequest=69


[failure] 48-48: Use '[[' instead of '[' for conditional tests. The '[[' construct is safer and more feature-rich.

See more on https://sonarcloud.io/project/issues?id=hyperpolymath_thejeffparadox&issues=AaA_CS2Ybsq2ePVCtiIB&open=AaA_CS2Ybsq2ePVCtiIB&pullRequest=69


[failure] 21-21: Use '[[' instead of '[' for conditional tests. The '[[' construct is safer and more feature-rich.

See more on https://sonarcloud.io/project/issues?id=hyperpolymath_thejeffparadox&issues=AaA_CS2Ybsq2ePVCtiH9&open=AaA_CS2Ybsq2ePVCtiH9&pullRequest=69


[failure] 58-58: Use '[[' instead of '[' for conditional tests. The '[[' construct is safer and more feature-rich.

See more on https://sonarcloud.io/project/issues?id=hyperpolymath_thejeffparadox&issues=AaA_CS2Ybsq2ePVCtiID&open=AaA_CS2Ybsq2ePVCtiID&pullRequest=69

🔇 Additional comments (1)
tests/validate_structure.sh (1)

16-62: LGTM!


📝 Walkthrough

Summary by CodeRabbit

  • Tests
    • Improved structural validation with clearer checks for required root files, directories and key files.
    • Updated validation to recognise the ABI/FFI documentation in its current AsciiDoc format.
    • Refined validation messages to reference the updated documentation filename, making validation results easier to understand.

Walkthrough

The structural validation script now uses explicit checks for required files, directories, and key files. It validates ABI-FFI-README.adoc and updates the related result messages.

Changes

Structure validation

Layer / File(s) Summary
Required structure checks
tests/validate_structure.sh
The script uses explicit if/else checks for required structure elements and validates ABI-FFI-README.adoc with updated pass and failure messages.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Merge Risk: ⚪ Minimal · up to cffed

This localized change repoints validation scripts to existing documentation files; no actionable merge-blocking risk remains beyond normal checks and review.

Poem

A rabbit checks each required place
The README wears its AsciiDoc face
Pass and fail messages agree
The structure check runs carefully
Neat files hop into line
Validation finishes fine

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: updating scripts to reference existing .adoc documentation files.
Description check ✅ Passed The description directly explains the .md to .adoc migration, the affected checks, and the scope of the script updates.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1 files.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codacy-production

codacy-production Bot commented Aug 26, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

AI Reviewer: first review requested successfully. AI can make mistakes. Always validate suggestions.

Run reviewer

TIP This summary will be updated as you push new changes.

@gitar-bot

gitar-bot Bot commented Aug 26, 2026

Copy link
Copy Markdown

Important

You are using the Gitar free plan. Upgrade to unlock code review, CI analysis, auto-apply, custom automations, and more.

Gitar

@codacy-production codacy-production Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull Request Overview

This PR is currently not up to standards due to a high-severity logic issue in the validation script. While the update to the .adoc file extension aligns with the documentation migration, the implementation in tests/validate_structure.sh uses a brittle [ condition ] && pass || fail pattern. This construct is unsafe as it does not guarantee standard if-then-else behavior; if the 'pass' command fails, the 'fail' branch will execute regardless of the condition's result. This flaw should be addressed to ensure reliable CI checks.

Test suggestions

  • Verify validate_structure.sh succeeds when ABI-FFI-README.adoc is present
  • Verify validate_structure.sh fails with an appropriate error message when ABI-FFI-README.adoc is missing
Prompt proposal for missing tests
Consider implementing these tests if applicable:
1. Verify `validate_structure.sh` succeeds when `ABI-FFI-README.adoc` is present
2. Verify `validate_structure.sh` fails with an appropriate error message when `ABI-FFI-README.adoc` is missing

TIP Improve review quality by adding custom instructions
TIP How was this review? Give us feedback

Comment thread tests/validate_structure.sh Outdated
[ -f LICENSE ] && pass "LICENSE present" || fail "LICENSE missing"
[ -f SECURITY.md ] && pass "SECURITY.md present" || fail "SECURITY.md missing"
[ -f ABI-FFI-README.md ] && pass "ABI-FFI-README.md present" || fail "ABI-FFI-README.md missing"
[ -f ABI-FFI-README.adoc ] && pass "ABI-FFI-README.adoc present" || fail "ABI-FFI-README.adoc missing"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔴 HIGH RISK

The construct [ condition ] && pass || fail is not a safe substitute for an if-then-else statement. If the pass function returns a non-zero exit status, the fail branch will be executed even if the file exists. Replace this with a standard if-block for better reliability. Try running the following prompt in your IDE agent: > Refactor line 19 in tests/validate_structure.sh to use a proper if-then-else statement instead of the &&/|| shorthand to resolve ShellCheck SC2015.

See Issue in Codacy

Comment thread tests/validate_structure.sh Outdated
[ -f LICENSE ] && pass "LICENSE present" || fail "LICENSE missing"
[ -f SECURITY.md ] && pass "SECURITY.md present" || fail "SECURITY.md missing"
[ -f ABI-FFI-README.md ] && pass "ABI-FFI-README.md present" || fail "ABI-FFI-README.md missing"
[ -f ABI-FFI-README.adoc ] && pass "ABI-FFI-README.adoc present" || fail "ABI-FFI-README.adoc missing"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 MEDIUM RISK

Suggestion: Automated verification is needed to confirm the script correctly handles both the presence and absence of the new .adoc files.

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 <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

@hyperpolymath
hyperpolymath merged commit 2385518 into main Aug 26, 2026
4 checks passed
@hyperpolymath
hyperpolymath deleted the fix/repoint-scripts-at-adoc branch August 26, 2026 17:08
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.

1 participant