Skip to content

fix(tests): terminate find -exec and pass {} — the placeholder step was a no-op - #84

Merged
hyperpolymath merged 2 commits into
mainfrom
fix/find-exec-terminator
Aug 26, 2026
Merged

fix(tests): terminate find -exec and pass {} — the placeholder step was a no-op#84
hyperpolymath merged 2 commits into
mainfrom
fix/find-exec-terminator

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

tests/e2e/template_instantiation_test.sh ran find … -exec bash -c '…' _ "\$file", which has two defects on one line:

  1. No ; or + terminator — the file does not parse (SC2067).
  2. "\$file" where {} belongs\$file is assigned only inside the -exec body, so in the outer scope it is unset. \$1 arrived empty, file="", and every grep/sed operated on an empty path.

The consequence is worse than a lint error. The placeholder-replacement step silently did nothing, then logged "All placeholder tokens replaced". A test whose entire purpose is to prove instantiation worked was passing without replacing a single token — a plausible cause of estate repos shipping with literal {{project}} still in their sources.

Corrected to ' _ {} \; so find passes each matched path.

Found by an estate-wide sweep of 5,111 scripts across 375 repos: this identical stale copy exists in 30 repositories. rsr-template-repo's own copy is already correct and restructured (371 lines vs the 268 here), so these are stale duplicates that never picked up the upstream fix.

…as a no-op

tests/e2e/template_instantiation_test.sh ran:

    find ... -exec bash -c '
        file="$1"
        ... grep/sed over $file ...
    ' _ "$file"

Two defects in that one line:

  1. No ';' or '+' terminator, so the file does not parse (SC2067).
  2. "$file" is passed where {} belongs. $file is assigned ONLY inside the
     -exec body, so in the outer scope it is UNSET — $1 arrived empty, file=""
     and every grep/sed operated on an empty path.

⚠ The consequence is worse than a lint error: the placeholder-replacement step
SILENTLY DID NOTHING, then logged "All placeholder tokens replaced". A test
whose whole purpose is to prove instantiation worked was passing without
replacing a single token. That is a plausible cause of estate repos shipping
with literal {{project}} tokens still in their sources.

Corrected to "' _ {} \;" so find passes each matched path.

Found by an estate-wide shellcheck sweep of 5,111 scripts across 375 repos:
this identical stale copy exists in 30 repositories. rsr-template-repo's own
copy is already correct and restructured (371 lines vs the 268 here), so these
are stale duplicates that never picked up the upstream fix.
@coderabbitai

coderabbitai Bot commented Aug 26, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

Next included review available in 42 minutes.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: d52782ef-ff14-461e-8a12-760d131272d5

📥 Commits

Reviewing files that changed from the base of the PR and between 2d824e2 and dcac9f7.

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

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: a1702ab5-3157-4b67-9d4c-881029300500

📥 Commits

Reviewing files that changed from the base of the PR and between c0917d1 and 2d824e2.

📒 Files selected for processing (1)
  • tests/e2e/template_instantiation_test.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. (13)
  • GitHub Check: rust-ci / Detect Cargo.toml
  • GitHub Check: Validate A2ML manifests
  • GitHub Check: Empty-linter (invisible characters)
  • GitHub Check: Validate K9 contracts
  • GitHub Check: Groove manifest check
  • GitHub Check: Validate eclexiaiser manifest
  • GitHub Check: Patch Bridge CVE triage
  • GitHub Check: Hypatia neurosymbolic scan
  • GitHub Check: panic-attack assail
  • GitHub Check: analyze (actions, none)
  • GitHub Check: analyze (rust, none)
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Gitar
🔇 Additional comments (1)
tests/e2e/template_instantiation_test.sh (1)

140-140: LGTM!


📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes
    • Fixed an issue with placeholder replacement during template instantiation, ensuring file paths are processed correctly.

Walkthrough

The end-to-end template test now passes each find-supplied file path to the embedded Bash command during placeholder replacement.

Changes

Template instantiation test

Layer / File(s) Summary
Pass the discovered file path
tests/e2e/template_instantiation_test.sh
The embedded Bash command now uses {} instead of the unused "$file" argument.

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

Merge Risk: ⚪ Minimal · up to 2d824

This localized test-script change fixes the find placeholder invocation without introducing a broader product or production behavior change; no actionable merge-blocking risk remains after normal checks and review.

Poem

A rabbit checks each template path
find sends the file along its path
Bash receives the name
Placeholders work the same
One tiny fix completes the task

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description clearly explains the defects and the intended fix, but it does not follow the repository template. It omits the required Summary, Changes, RSR Quality Checklist, Testing, and Screensho… Rewrite the description using the repository template. Add the Summary and Changes sections, complete the RSR Quality Checklist, describe the testing performed, and include screenshots or terminal output if applicable.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: fixing the test script's find -exec invocation and placeholder handling.
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: Description check

Explanation

The description clearly explains the defects and the intended fix, but it does not follow the repository template. It omits the required Summary, Changes, RSR Quality Checklist, Testing, and Screenshots sections.

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.

@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

Copy link
Copy Markdown
Contributor

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.

@codacy-production codacy-production Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

The PR correctly addresses a critical syntax error in the tests/e2e/template_instantiation_test.sh script. By terminating the find -exec command and properly passing the {} placeholder, it ensures that template files are actually processed rather than skipped. Codacy reports that the PR is up to standards with no new automated issues.

However, a cross-correlation of findings reveals a potential implementation gap. While the command syntax is fixed, several variables intended for template substitution (such as TEST_OWNER and TEST_FORGE) remain unused in the script. This suggests that the substitution logic may still be incomplete or relying on hardcoded values. Additionally, a minor performance optimization for the find command is recommended to handle multiple files more efficiently.

About this PR

  • There are several test configuration variables (e.g., TEST_OWNER, TEST_FORGE, TEST_AUTHOR_EMAIL) assigned at the start of the script that are never utilized. This suggests that the sed substitution logic within the find command might be incomplete or using hardcoded strings instead of these dynamic values. Please verify if these variables should be integrated into the file processing loop.
1 comment outside of the diff
tests/e2e/template_instantiation_test.sh

line 21-32 🟡 MEDIUM RISK
Several test configuration variables are assigned but never used. Verify if these should be incorporated into the replacement logic inside the find -exec loop. If they are redundant, they should be removed to simplify the script.

Test suggestions

  • Verify that the find command correctly identifies template files and passes their paths to the sed replacement logic.
  • Ensure the script does not produce SC2067 (missing terminator) linting errors.

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

Comment thread tests/e2e/template_instantiation_test.sh Outdated
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>
@hyperpolymath
hyperpolymath merged commit b1b50a7 into main Aug 26, 2026
15 of 19 checks passed
@hyperpolymath
hyperpolymath deleted the fix/find-exec-terminator branch August 26, 2026 17:53
@sonarqubecloud

Copy link
Copy Markdown

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