Skip to content

[dead-code] chore: remove dead functions — 1 function removed#39422

Open
github-actions[bot] wants to merge 1 commit into
mainfrom
dead-code/remove-buildArcDindChrootConfigInjectScript-e76453c4c3290198
Open

[dead-code] chore: remove dead functions — 1 function removed#39422
github-actions[bot] wants to merge 1 commit into
mainfrom
dead-code/remove-buildArcDindChrootConfigInjectScript-e76453c4c3290198

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Functions Removed

Function File
buildArcDindChrootConfigInjectScript pkg/workflow/awf_helpers.go

Tests Removed

  • TestArcDindChrootConfigInjection (pkg/workflow/awf_helpers_test.go)

Verification

  • go build ./...
  • go vet ./...
  • go vet -tags=integration ./...
  • make fmt

TestCompileWorkflow_PerformanceRegression fails on both main and this branch — pre-existing flaky test unrelated to this change.

https://github.com/github/gh-aw/actions/runs/27559409182

Generated by 🧹 Dead Code Removal Agent · ⌖ 15.1 AIC ·

  • expires on Jun 18, 2026, 8:37 AM UTC-08:00

The function was only used by its own test (TestArcDindChrootConfigInjection).
In production, the patch body is embedded directly inside BuildAWFCommand's
arcDindPrefixProbe if-block via buildArcDindChrootConfigPatchBody(), so the
standalone wrapper was never called from any main entrypoint.

Remove the function, its exclusive test, and clean up dangling references
in comments in awf_config.go and awf_helpers.go.

Detected by: deadcode ./cmd/... ./internal/tools/...
Run ID: 27559409182

Co-authored-by: Copilot <[email protected]>
@pelikhan pelikhan marked this pull request as ready for review June 16, 2026 14:08
Copilot AI review requested due to automatic review settings June 16, 2026 14:08
@github-actions

github-actions Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor Author

PR Code Quality Reviewer completed the code quality review.

@github-actions

github-actions Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor Author

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

@github-actions

github-actions Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor Author

Test Quality Sentinel completed test quality analysis.

@github-actions

github-actions Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor Author

Design Decision Gate 🏗️ completed the design decision gate check.

No ADR enforcement needed: PR #39422 does not have the implementation label and has only 1 new line of code in business logic directories (well below the 100-line threshold). Neither enforcement condition is met.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Removes a now-unused standalone ARC/DinD chroot config injection helper and its dedicated execution-based test, while keeping the inlined runtime patching behavior used by BuildAWFCommand.

Changes:

  • Removed buildArcDindChrootConfigInjectScript from pkg/workflow/awf_helpers.go.
  • Removed TestArcDindChrootConfigInjection (and now-unused imports) from pkg/workflow/awf_helpers_test.go.
  • Updated AWFConfigFile.Chroot field comment to reflect runtime injection without referencing the removed helper.
Show a summary per file
File Description
pkg/workflow/awf_helpers.go Deletes the standalone chroot injection helper; retains embedded patch body used in BuildAWFCommand.
pkg/workflow/awf_helpers_test.go Removes the Python-execution test and trims imports; leaves only string-based assertions for chroot injection presence.
pkg/workflow/awf_config.go Updates the Chroot field comment to remove the removed-function reference.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 3/3 changed files
  • Comments generated: 2

Comment on lines 956 to 958
// buildArcDindChrootConfigPatchBody returns the Python heredoc that patches the AWF
// config file with chroot.binariesSourcePath and chroot.identity.*. It is designed to be
// embedded inside a bash if-block that already guards on DOCKER_HOST=tcp://...
Comment on lines 1463 to 1465
// TestBuildAWFCommand_IncludesChrootInjectScript verifies that BuildAWFCommand
// includes the chroot injection script in the generated run step when the AWF
// version supports it.
@github-actions

Copy link
Copy Markdown
Contributor Author

🧪 Test Quality Sentinel Report

Test Quality Score: N/A — No New Tests

This PR removes dead code and its associated test (TestArcDindChrootConfigInjection). No new or modified test functions were added (0 additions, 130 deletions in test file).

📊 Metrics & Test Classification (0 tests analyzed)
Metric Value
New/modified tests analyzed 0
✅ Design tests (behavioral contracts) 0 (N/A%)
⚠️ Implementation tests (low value) 0 (N/A%)
Tests with error/edge cases 0 (N/A%)
Duplicate test clusters 0
Test inflation detected NO
🚨 Coding-guideline violations 0

Go: 0 (*_test.go); JavaScript: 0 (*.test.cjs, *.test.js). Other languages detected but not scored.

Changed test files: pkg/workflow/awf_helpers_test.go — 0 lines added, 130 lines deleted (removed TestArcDindChrootConfigInjection alongside the dead function buildArcDindChrootConfigInjectScript).

Verdict

Check passed. No new tests introduced. Removal of TestArcDindChrootConfigInjection is a clean, expected companion to the dead-code removal of buildArcDindChrootConfigInjectScript.

🧪 Test quality analysis by Test Quality Sentinel · 118.4 AIC · ⌖ 18.8 AIC · ⊞ 25.4K ·

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Test Quality Sentinel: N/A (no new tests). This PR only removes a test (TestArcDindChrootConfigInjection) alongside its dead production function — 0% implementation tests (threshold: 30%). No coding-guideline violations detected.

@github-actions github-actions Bot mentioned this pull request Jun 16, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Skills-Based Review 🧠

Applied /zoom-out — clean dead-code removal with one noted coverage tradeoff, no blocking issues.

📋 Key Themes & Highlights

Key Themes

  • Coverage reduction: TestArcDindChrootConfigInjection was the only test that executed the Python chroot-injection script at runtime (6 DOCKER_HOST scenarios, JSON round-trip, dual-path writes). With its removal, buildArcDindChrootConfigPatchBody — still production code — has no runtime test coverage. This is an expected tradeoff for dead-code cleanup; flagged for team awareness.

Positive Highlights

  • ✅ Correct removal: buildArcDindChrootConfigInjectScript had zero production callers; it existed solely as a test-convenience wrapper.
  • ✅ Comment in awf_config.go updated cleanly to remove stale function reference.
  • buildArcDindChrootConfigPatchBody comment also cleaned up with no stale cross-reference.
  • ✅ Verified by go build, go vet, go vet -tags=integration, and make fmt.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · 127.1 AIC · ⌖ 14.7 AIC · ⊞ 27.9K

}
}

// TestBuildAWFCommand_IncludesChrootInjectScript verifies that BuildAWFCommand

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[/zoom-out] This function is now the sole test covering the ARC/DinD chroot injection path — but it verifies that the script is included in the generated command, not that the Python executes correctly at runtime.

💡 Coverage tradeoff worth noting

TestArcDindChrootConfigInjection (removed) was the only test that:

  • Actually ran the bash+Python script end-to-end
  • Exercised 6 DOCKER_HOST scenarios ((redacted) (redacted) empty, bare path...)
  • Verified JSON round-trip correctness (original fields preserved after patching)
  • Confirmed writes to both $RUNNER_TEMP/gh-aw/awf-config.json and awfArcDindChrootBinariesSourcePath

With its removal, the correctness of the Python in buildArcDindChrootConfigPatchBody (still production code) is no longer exercised by any unit or integration test. This is a deliberate tradeoff of the dead-code cleanup — just flagging it so the team knows the gap exists if the Python ever needs to change.

One lightweight option: a table-driven test on buildArcDindChrootConfigPatchBody that invokes python3 -c with a few controlled inputs could restore the most critical coverage without needing the removed wrapper.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dead code removal is mechanically correct — buildArcDindChrootConfigInjectScript has zero callers outside its own test, import cleanup is consistent, and comment updates are accurate.

One non-blocking coverage gap is worth tracking before the Python script is modified.

💡 Coverage regression: buildArcDindChrootConfigPatchBody() Python script is no longer executed by any test

TestArcDindChrootConfigInjection was the only test that actually ran the Python heredoc produced by buildArcDindChrootConfigPatchBody(). It covered:

  • The DOCKER_HOST regex guard (positive: (redacted) negative: (redacted) empty)
  • The JSON read-modify-write round-trip (all pre-existing config keys preserved)
  • The dual-write to both $RUNNER_TEMP/gh-aw/awf-config.json and awfArcDindChrootBinariesSourcePath/awf-config.json
  • identity.uid/gid population via id -u/id -g subprocesses

TestBuildAWFCommand_IncludesChrootInjectScript (still present) only does assert.Contains string checks on the rendered command text — it never invokes bash or Python. A Python syntax error, a wrong heredoc quoting, or a broken id subprocess call would ship silently.

Suggested follow-up (not blocking): add a direct execution test for buildArcDindChrootConfigPatchBody() similar to the removed test but targeting the body function directly, or restore the meaningful assertions from the removed test inside TestBuildAWFCommand_IncludesChrootInjectScript.

🔎 Code quality review by PR Code Quality Reviewer · 174.2 AIC · ⌖ 13.1 AIC · ⊞ 17.3K

@github-actions

Copy link
Copy Markdown
Contributor Author

Recheck mergeability after GitHub refreshes the PR.

Generated by 👨‍🍳 PR Sous Chef · 96.5 AIC · ⌖ 1.01 AIC · ⊞ 17.4K ·

@pelikhan

Copy link
Copy Markdown
Collaborator

@lpcox

@pelikhan

Copy link
Copy Markdown
Collaborator

@zarenner just fyi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants