Skip to content

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

Merged
hyperpolymath merged 5 commits into
mainfrom
fix/find-exec-terminator
Sep 12, 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

Review Change StackReview Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Free

Run ID: f2d61ab1-5558-48f2-9fcd-1c2f4ffc2b06

📥 Commits

Reviewing files that changed from the base of the PR and between 592960b and c6083cc.

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

📝 Summary

Summary by CodeRabbit

  • Tests
    • Improved end-to-end validation for template instantiation.
    • Configuration values are now passed consistently during test execution.
    • Discovered files are processed using the correct paths, improving reliability and reducing false test failures.

Walkthrough

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

Changes

Template instantiation test

Layer / File(s) Summary
Replacement command execution
tests/e2e/template_instantiation_test.sh
The test exports configuration variables for child processes. The find -exec command uses {} to pass each matched pathname.

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


Note

🎁 Summarized by CodeRabbit Free

The PR author is not assigned a seat. If you are a newly provisioned user and your organization has automatic seat assignment enabled, open a new pull request to trigger seat assignment. Otherwise, ask an organization administrator to assign a seat through the team management page at https://app.coderabbit.ai/settings/team-management.

I am a rabbit beside the test,
The variables hop where children quest.
Each found path now joins the run,
Placeholders change, and checks are done.
I twitch my nose: the command is sound.

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

@gitar-bot

This comment has been minimized.

@hyperpolymath
hyperpolymath enabled auto-merge (squash) August 28, 2026 07:47
@hyperpolymath
hyperpolymath merged commit a8dcf63 into main Sep 12, 2026
2 of 17 checks passed
@hyperpolymath
hyperpolymath deleted the fix/find-exec-terminator branch September 12, 2026 17:13
@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