Skip to content

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

Open
hyperpolymath wants to merge 3 commits into
mainfrom
fix/find-exec-terminator
Open

fix(tests): terminate find -exec and pass {} — the placeholder step was a no-op#94
hyperpolymath wants to merge 3 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

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: d9448e06-00d4-4221-a91a-e1e2ad96496f

📥 Commits

Reviewing files that changed from the base of the PR and between c1eb8f7 and 9cb83f9.

📒 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. (37)
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: governance / Guix packaging policy (Nix retired)
  • GitHub Check: scan / rust-secrets
  • GitHub Check: governance / Exemption ratchet
  • GitHub Check: governance / Trusted-base reduction policy
  • GitHub Check: governance / Licence consistency
  • GitHub Check: scan / gitleaks
  • GitHub Check: scan / shell-secrets
  • GitHub Check: governance / Debt ratchet
  • GitHub Check: governance / Well-Known (RFC 9116 + RSR)
  • GitHub Check: governance / Workflow security linter
  • GitHub Check: governance / Security policy checks
  • GitHub Check: governance / Check Workflow Staleness
  • GitHub Check: governance / Code quality + docs
  • GitHub Check: governance / Language / package anti-pattern policy
  • GitHub Check: governance / Allowlist Preflight
  • GitHub Check: scan / Hypatia Neurosymbolic Analysis
  • GitHub Check: lint
  • GitHub Check: Validate eclexiaiser manifest
  • GitHub Check: Hypatia neurosymbolic scan
  • GitHub Check: Empty-linter (invisible characters)
  • GitHub Check: Validate K9 contracts
  • GitHub Check: docs
  • GitHub Check: Validate A2ML manifests
  • GitHub Check: panic-attack assail
  • GitHub Check: analyze (actions, none)
  • GitHub Check: Runtime Policy
  • GitHub Check: check
  • GitHub Check: Groove manifest check
  • GitHub Check: E2E (coordination repo — nothing to exercise)
  • GitHub Check: Patch Bridge CVE triage
  • GitHub Check: openssf-compliance
  • GitHub Check: check
  • GitHub Check: boundary
  • GitHub Check: antipattern-check
  • GitHub Check: lint-workflows
  • GitHub Check: sync
🔇 Additional comments (2)
tests/e2e/template_instantiation_test.sh (2)

115-116: LGTM!


142-142: LGTM!


📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes
    • Fixed template setup so placeholder replacement runs correctly across all matched files during automated installation.

Walkthrough

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

Changes

Template instantiation test

Layer / File(s) Summary
Matched file path substitution
tests/e2e/template_instantiation_test.sh
The test exports configuration variables for the bash -c subshell. The find -exec command now uses {} for each matched file path instead of "$file".

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

Merge Risk: ⚪ Minimal · up to 9cb83

This change makes the template-instantiation test correctly process matched files and replace placeholders; no actionable merge-blocking risk remains after normal checks and review.

Poem

A rabbit exports values with care
Each matched path goes everywhere
Curly braces guide the way
Shell variables remain in play
Templates hop through tests today

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description clearly explains the defect, its impact, and the correction. However, it does not follow the repository template and omits the required Changes, RSR Quality Checklist, Testing, and Scr… Add all template sections. List the key changes under Changes, complete the RSR Quality Checklist, state the test command and result under Testing, and add terminal output or state that Screenshots are not applicable.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the test fix and the corrected find -exec argument handling. It is concise and directly related to the main change.
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 clearly explains the defect, its impact, and the correction. However, it does not follow the repository template and omits the required 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

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

This PR successfully identifies and addresses a syntax error in the find -exec command that rendered the template instantiation tests a no-op. While the fix correctly terminates the command and passes the file placeholder, it is currently insufficient for the logic to function as intended.

Codacy analysis indicates the PR is up to standards; however, findings suggest that the configuration variables (e.g., TEST_OWNER, TEST_AUTHOR_EMAIL) are not being exported to the subshell, meaning the sed replacements will likely use empty strings. Additionally, the repository is maintaining a significantly stale version of this test script compared to the authoritative upstream source, which may lead to further technical debt.

About this PR

  • The file tests/e2e/template_instantiation_test.sh is a stale copy (268 lines) compared to the authoritative version in the template-repo (371 lines). While this fix corrects an immediate defect, the repository remains divergent from the upstream source. Consider syncing with the upstream version to ensure all latest test logic and improvements are included.

Test suggestions

  • Verify that template placeholders (e.g., {{project}}) are successfully replaced with actual values in the instantiated output files.

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

fi
done
' _ "$file"
' _ {} \;

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: The fix to the find command ensures the subshell executes, but the placeholder replacement may still fail for two reasons:

  1. Variable Scoping: The variables like TEST_OWNER and TEST_AUTHOR_EMAIL are local to this script. To make them visible to the sh -c subshell, they must be exported.
  2. Positional Parameters: Ensure the script inside sh -c assigns $1 (which receives the {} filename) to the file variable used in the replacement logic.

Try running the following prompt in your IDE agent:

Export the configuration variables (TEST_OWNER, TEST_FORGE, TEST_AUTHOR_EMAIL, TEST_DESCRIPTION, TEST_PRIMARY_LANGUAGE) and ensure the find -exec subshell script maps the positional parameter $1 to the variable file used in the sed commands.

See Issue in Codacy
See Issue in Codacy
See Issue in Codacy
See Issue in Codacy
See Issue in Codacy

@hyperpolymath
hyperpolymath enabled auto-merge (squash) August 28, 2026 07:46
@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