Skip to content

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

Merged
hyperpolymath merged 5 commits into
mainfrom
fix/find-exec-terminator
Sep 8, 2026
Merged

hyperpolymath merged 5 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
Contributor

Review Change StackReview Change Stack

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 92ec8710-7fd1-42f5-9df6-faa94226aa15

📥 Commits

Reviewing files that changed from the base of the PR and between 2b483e6 and 281af47.

📒 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. (2)
  • GitHub Check: rust-ci / Cargo audit (security)
  • GitHub Check: Burrower proof safety
🧰 Additional context used
📓 Path-based instructions (1)
SPDX: `MPL-2.0` on all new files.

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Files:

  • tests/e2e/template_instantiation_test.sh
🔇 Additional comments (1)
tests/e2e/template_instantiation_test.sh (1)

115-116: LGTM!

Also applies to: 142-142


📝 Summary

Summary by CodeRabbit

  • Bug Fixes
    • Fixed template instantiation checks so placeholder replacements are applied correctly to every matched file.
    • Improved the reliability of end-to-end template setup and validation, reducing failures caused by incomplete or incorrectly applied test configuration during template generation checks.

Walkthrough

The end-to-end template instantiation test exports its configuration variables and passes each matched file path to the placeholder replacement command.

Changes

Template instantiation testing

Layer / File(s) Summary
Fix placeholder replacement command
tests/e2e/template_instantiation_test.sh
The test exports configuration variables for the bash -c subshell. The find -exec command passes each matched file path through {} instead of $file.

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

Merge Risk: ⚪ Minimal · up to 281af

The template-instantiation test now passes each matched file to its replacement script and exposes the required configuration values to the child shell. No current merge-blocking risk is identified.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the defect, impact, and fix clearly, but it does not follow the repository template. It omits the required Summary, Changes, RSR Quality Checklist, Testing, and Screenshots se… Restructure the description using the repository template. Add the Summary, Changes, RSR Quality Checklist, Testing, and Screenshots sections. Record the test command and mark each applicable checklist item.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the test fix: it terminates the find -exec command and passes {} to correct the placeholder replacement step.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files.
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 explains the defect, impact, and fix clearly, but it does not follow the repository template. It omits the required Summary, Changes, RSR Quality Checklist, Testing, and Screenshots sections.

  • Fix all pre-merge checks with AI
✨ 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

A rabbit reads each line,
The patch grows clear beneath the moon,
Small changes hop in place,
Tests guard the garden path,
Reviews bloom before the dawn.

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

@gitar-bot

gitar-bot Bot commented Aug 26, 2026 •

Copy link
Copy Markdown

Gitar is working

Gitar

coderabbitai[bot]
coderabbitai Bot previously approved these changes Aug 26, 2026
@codacy-production

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.

@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

While this PR correctly identifies that the find -exec command was syntactically invalid and acting as a no-op, the proposed solution is still functionally broken. The test will likely continue to pass silently (as a no-op) because the variables required for placeholder replacement ($placeholder, $value) are not visible inside the single-quoted subshell environment.

Furthermore, the script still references an unassigned "$file" variable instead of the positional parameter $1 passed by find. To resolve this, variables must be either exported or passed as positional arguments to the subshell. There is also a missing test scenario to verify that the replacement actually occurred, which would have caught this logic error.

1 comment outside of the diff
tests/e2e/template_instantiation_test.sh

line 21 🟡 MEDIUM RISK
Multiple configuration variables (TEST_OWNER, TEST_FORGE, TEST_AUTHOR_EMAIL, etc.) are flagged as unused. Because they are used in a subshell (via find -exec), they must be exported to be visible in that environment. Use export for these variables at the start of the script.

Test suggestions

  • Verify that the find -exec command successfully executes for each matched file and passes the filename as the first argument to the subshell.
  • Ensure the template instantiation test fails if placeholders remain in the output files (verifying the test is no longer a no-op).
Prompt proposal for missing tests
Consider implementing these tests if applicable:
1. Ensure the template instantiation test fails if placeholders remain in the output files (verifying the test is no longer a no-op).

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

Comment thread tests/e2e/template_instantiation_test.sh
@hyperpolymath
hyperpolymath enabled auto-merge (squash) August 28, 2026 07:46
@hyperpolymath
hyperpolymath merged commit 3fd8bf0 into main Sep 8, 2026
50 checks passed
@hyperpolymath
hyperpolymath deleted the fix/find-exec-terminator branch September 8, 2026 06:07
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