Fix SC2015 ambiguous shell pattern in generated firewall log copy step - #54747
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
PR Triage
|
|
Thanks for addressing the shellcheck SC2015 linting issue across all 275 workflows! 🚀 The fix is well-focused and correctly rewrites the ambiguous shell pattern from Here's what would help this PR cross the finish line:
Once test coverage is added, this PR should be ready for review! If you'd like to hand this to your coding agent:
|
PR TriageCategory: Draft. Mechanical shellcheck SC2015 fix across 276 generated lockfiles. Blocked mergeable state. Automated triage — run 32572524009
|
There was a problem hiding this comment.
Pull request overview
Replaces the ambiguous firewall-log copy shell chain with explicit conditionals so copy failures remain visible.
Changes:
- Updates the compiler-generated logs and audit copy commands.
- Regenerates all 275 affected workflow lock files.
Show a summary per file
| File | Description |
|---|---|
pkg/workflow/threat_detection_steps.go |
Generates explicit conditional copy commands. |
.github/workflows/*.lock.yml (275 files) |
Propagates the corrected generated step across affected workflows. |
Review details
- Files reviewed: 276/276 changed files
- Comments generated: 1
- Review effort level: Balanced
| fmt.Sprintf(" if [ -d %s ]; then mkdir -p %s/logs && cp -r %s/. %s/logs/; fi\n", proxyLogsDir, detectionFirewallLogsDir, proxyLogsDir, detectionFirewallLogsDir), | ||
| fmt.Sprintf(" if [ -d %s ]; then mkdir -p %s/audit && cp -r %s/. %s/audit/; fi\n", auditDir, detectionFirewallLogsDir, auditDir, detectionFirewallLogsDir), |
|
✅ PR Code Quality Reviewer completed the code quality review.
|
|
✅ Design Decision Gate 🏗️ completed the design decision gate check. No ADR enforcement needed: PR does not have the implementation label and has only 2 new lines of code in business logic directories (threshold: 100).
|
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅
|
|
✅ Test Quality Sentinel completed test quality analysis. No test files were added or modified in this PR. This PR contains only workflow lock file updates (.lock.yml). Test Quality Sentinel skipped.
|
|
✅ Ponytail Reviewer completed successfully! Warning Threat Detection Engine Failure — The analysis engine could not complete. This is a tooling failure, not a security finding. What happenedThe threat detection engine failed to produce results. Review the workflow run logs for details.
|
Comment MemoryNote This comment is managed by comment memory.It stores persistent context for this thread in the code block at the top of this comment.
|
There was a problem hiding this comment.
Verdict
No new blocking issues from this patch.
The only actionable gap I found is already covered by an existing review comment.
The compiler change from A && B && C || true to explicit if guards is directionally correct and the regenerated workflow output matches it. I did not find an additional correctness, performance, or maintainability problem in the changed lines beyond the already-raised test regression gap.
🔎 Code quality review by PR Code Quality Reviewer · gpt54 · 8.69 AIC · ⌖ 8.6 AIC · ⊞ 7K
Comment /review to run again
There was a problem hiding this comment.
Skills-Based Review 🧠
Applied /diagnosing-bugs — the SC2015 fix is correct and the root cause is properly addressed at the source.
📋 Summary
What's good
- ✅ Root-cause fix is in the generator (
threat_detection_steps.go), not just patched in individual workflows — all 275 regenerated.lock.ymlfiles are consistent mechanical output. - ✅ The rewrite from
A && B && C || truetoif [ -d X ]; then B && C; ficorrectly scopes the no-op to a missing directory only, while letting realmkdir/cpfailures propagate — exactly what SC2015 demands. - ✅ The two-line pattern (logs + audit) is handled symmetrically.
One open item
An existing review comment already requests a regression test asserting the generated script uses the if form and does not contain || true. That test would lock in the fix and prevent future regressions. Approving here because the production code is correct; the test gap is already tracked.
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · sonnet46 · 30.3 AIC · ⌖ 9.73 AIC · ⊞ 7.6K
Comment /matt to run again
There was a problem hiding this comment.
The SC2015 fix is correct and consistently applied across all lock files.
The old pattern [ -d dir ] && mkdir && cp || true had a subtle bug: the || true swallowed failures from mkdir and cp, not just the directory-existence test. The replacement if [ -d dir ]; then mkdir -p ... && cp -r ...; fi is semantically correct: skips when the directory is absent and correctly propagates errors from the copy/mkdir commands.
No other concerns.
🧵 Reviewed using Impeccable skills by Impeccable Skills Reviewer · sonnet46 · 26.1 AIC · ⌖ 8.96 AIC · ⊞ 6.2K
|
@copilot this PR still needs forward progress before maintainer review. Failed checks to address:
Please address the remaining failures, refresh the branch if needed, and use the
|
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Added regression assertions in b01f982 requiring explicit directory guards and rejecting |
|
@copilot resolve the merge conflicts on this branch. |
# Conflicts: # pkg/workflow/threat_detection_test.go Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Resolved and pushed in merge commit |
Static analysis flagged shellcheck SC2015 across 275 compiled workflows: the auto-generated "Copy detection firewall logs" step used
[ -d X ] && mkdir -p Y && cp -r X/. Y/ || true, where the trailing|| truecan silently swallow failures frommkdir -p/cp -r(not just a false-dtest), masking real log-copy errors.Compiler fix
pkg/workflow/threat_detection_steps.go, rewrote both generated lines fromA && B && C || trueto explicitif [ -d X ]; then B && C; fi, so a missing directory is a no-op while genuinemkdir/cpfailures are no longer suppressed.Regenerated workflows
make recompileto propagate the single source change into all 275 affected.lock.ymlfiles with firewall/threat-detection enabled.