Skip to content

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

Open
hyperpolymath wants to merge 1 commit into
mainfrom
fix/find-exec-terminator
Open

fix(tests): terminate find -exec and pass {} — the placeholder step was a no-op#47
hyperpolymath wants to merge 1 commit 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: e54a94ff-c69e-4a34-8e8c-7f4c81d291aa

📥 Commits

Reviewing files that changed from the base of the PR and between e78f9e7 and 52fb8d2.

📒 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. (12)
  • GitHub Check: governance / Code quality + docs
  • GitHub Check: governance / Licence consistency
  • GitHub Check: governance / Security policy checks
  • GitHub Check: governance / Trusted-base reduction policy
  • GitHub Check: governance / Language / package anti-pattern policy
  • GitHub Check: governance / Check Workflow Staleness
  • GitHub Check: governance / Workflow security linter
  • GitHub Check: governance / Guix primary / Nix fallback policy
  • GitHub Check: governance / Well-Known (RFC 9116 + RSR)
  • GitHub Check: Hypatia Neurosymbolic Analysis
  • GitHub Check: analyze (actions, none)
  • GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (1)
tests/e2e/template_instantiation_test.sh (1)

140-140: LGTM!


📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes
    • Fixed template instantiation so placeholder replacement consistently processes each matching file path.

Walkthrough

The end-to-end template test now passes each matched path from find directly to the placeholder replacement command.

Changes

Template instantiation test

Layer / File(s) Summary
Matched path replacement
tests/e2e/template_instantiation_test.sh
The bulk replacement command now uses find’s {} argument for each matched file path.

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

Merge Risk: ⚪ Minimal · up to 52fb8

This is a localized test-script correction with no actionable merge-blocking risk remaining after normal checks and review.

Poem

A rabbit checked the paths with care
Each matched file was sent in there
The placeholders now align
The test runs on a clearer line
Hop, hop, the shell is fine

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the defect, impact, and correction, but it does not use the required template sections. It omits the Summary, Changes, RSR Quality Checklist, Testing, and Screenshots sections… Rewrite the description using the repository template. Include the required Summary and Changes sections, complete the RSR Quality Checklist, and document the tests run. Add Screenshots output if applicable.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main fix: it terminates the find -exec command and passes {} to replace the placeholder step input.
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 explains the defect, impact, and correction, but it does not use the required template sections. It omits the 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.

  • 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.

@sonarqubecloud

Copy link
Copy Markdown

@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

@github-actions

Copy link
Copy Markdown

🔍 Hypatia Security Scan

Findings: 36 issues detected

Severity Count
🔴 Critical 6
🟠 High 25
🟡 Medium 5

⚠️ Action Required: Critical security issues found!

View findings
[
  {
    "reason": "Issue in push-email-notify.yml",
    "type": "missing_timeout_minutes",
    "file": "push-email-notify.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Code scanning (Hypatia): hypatia/structural_drift/SD004 -- Hypatia structural_drift: SD004 -- 11 day(s) old [STALE]",
    "type": "CSA001",
    "file": ".machine_readable/6a2/PLAYBOOK.a2ml",
    "action": "escalate",
    "rule_module": "code_scanning_alerts",
    "severity": "high"
  },
  {
    "reason": "Code scanning (Hypatia): hypatia/structural_drift/SD004 -- Hypatia structural_drift: SD004 -- 11 day(s) old [STALE]",
    "type": "CSA001",
    "file": ".machine_readable/6a2/NEUROSYM.a2ml",
    "action": "escalate",
    "rule_module": "code_scanning_alerts",
    "severity": "high"
  },
  {
    "reason": "Code scanning (Hypatia): hypatia/structural_drift/SD004 -- Hypatia structural_drift: SD004 -- 11 day(s) old [STALE]",
    "type": "CSA001",
    "file": ".machine_readable/6a2/AGENTIC.a2ml",
    "action": "escalate",
    "rule_module": "code_scanning_alerts",
    "severity": "high"
  },
  {
    "reason": "Code scanning (Hypatia): hypatia/structural_drift/SD004 -- Hypatia structural_drift: SD004 -- 11 day(s) old [STALE]",
    "type": "CSA001",
    "file": ".machine_readable/6a2/ECOSYSTEM.a2ml",
    "action": "escalate",
    "rule_module": "code_scanning_alerts",
    "severity": "high"
  },
  {
    "reason": "Code scanning (Hypatia): hypatia/structural_drift/SD004 -- Hypatia structural_drift: SD004 -- 11 day(s) old [STALE]",
    "type": "CSA001",
    "file": ".machine_readable/6a2/META.a2ml",
    "action": "escalate",
    "rule_module": "code_scanning_alerts",
    "severity": "high"
  },
  {
    "reason": "Code scanning (Hypatia): hypatia/structural_drift/SD004 -- Hypatia structural_drift: SD004 -- 11 day(s) old [STALE]",
    "type": "CSA001",
    "file": ".machine_readable/6a2/STATE.a2ml",
    "action": "escalate",
    "rule_module": "code_scanning_alerts",
    "severity": "high"
  },
  {
    "reason": "Code scanning (Scorecard): TokenPermissionsID -- Token-Permissions -- 35 day(s) old [STALE]",
    "type": "CSA001",
    "file": ".github/workflows/scorecard.yml",
    "action": "escalate",
    "rule_module": "code_scanning_alerts",
    "severity": "high"
  },
  {
    "reason": "Code scanning (Scorecard): BranchProtectionID -- Branch-Protection -- 62 day(s) old [STALE]",
    "type": "CSA001",
    "file": "no file associated with this alert",
    "action": "escalate",
    "rule_module": "code_scanning_alerts",
    "severity": "high"
  },
  {
    "reason": "Code scanning (Hypatia): hypatia/workflow_audit/missing_timeout_minutes -- Hypatia workflow_audit: missing_timeout_minutes -- 62 day(s) old [STALE]",
    "type": "CSA001",
    "file": "push-email-notify.yml",
    "action": "update",
    "rule_module": "code_scanning_alerts",
    "severity": "medium"
  }
]

Powered by Hypatia Neurosymbolic CI/CD Intelligence

@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 and attempts to fix a no-op in the E2E template instantiation tests, the current implementation remains non-functional. Although the 'find -exec' syntax is now properly terminated, the variables within the 'bash -c' subshell are not correctly expanded or passed. Specifically, variables like $placeholder and $value are treated as literal strings in the subshell, and the file path passed via '{}' is not assigned to the variable used in the 'sed' command. These issues must be resolved for the test to correctly verify placeholder replacement.

Test suggestions

  • Verify that placeholders (e.g., {{project}}) are actually replaced in the target files during E2E instantiation

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.

🔴 HIGH RISK

The subshell script references variables ($file, $placeholder, $value) that are not expanded by the parent shell because of the single-quote wrapping. Additionally, although {} is now passed to the subshell, it maps to $1 and is never assigned to the $file variable used in the sed command on line 137. Try running the following prompt in your coding agent: > Update the find -exec command to pass $placeholder and $value as arguments to the subshell, and modify the internal script to use these arguments (e.g., by assigning file="$1" at the start).

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