Skip to content

🧹 Remove dead script stubs and utility functions across packages#18846

Merged
dsyme merged 6 commits intomainfrom
dead15
Feb 28, 2026
Merged

🧹 Remove dead script stubs and utility functions across packages#18846
dsyme merged 6 commits intomainfrom
dead15

Conversation

@dsyme
Copy link
Contributor

@dsyme dsyme commented Feb 28, 2026

Summary

  • Removes unused get*Script() stub functions from js.go and replaces their call sites with inline empty strings ("")
  • Cleans up dead functions across parser, workflow, and 7 other packages
  • Adds a note in DEADCODE.md documenting a console_wasm.go pitfall

Deleted unreachable functions from utility packages:
- pkg/sliceutil: ContainsAny, ContainsIgnoreCase (+ all tests)
- pkg/logger: NewSlogLogger, Discard (+ tests for NewSlogLogger)
- pkg/fileutil: CalculateDirectorySize (+ test)
- pkg/repoutil: ParseGitHubURL (+ all tests)
- pkg/stringutil/identifiers: IsAgenticWorkflow, IsLockFile (+ tests)
- pkg/stringutil/pat_validation: IsFineGrainedPAT, IsClassicPAT, IsOAuthToken (+ tests)
- pkg/stringutil/stringutil: StripANSIEscapeCodes (+ tests)

Also replaces sliceutil.ContainsAny calls in docker_images_test.go
with inline strings.Contains expressions.

986 lines removed across 15 files.
- Delete EnsureLocalhostDomains from pkg/parser/mcp.go and its test
- Delete AddIfTrue from pkg/workflow/compiler_safe_outputs_config.go
- Delete HasUserCheckouts from pkg/workflow/checkout_manager.go
- Delete 14 dead methods from pkg/workflow/artifact_manager.go
  (SetCurrentJob, GetCurrentJob, RecordUpload, RecordDownload,
   computeNormalizedPaths, findCommonParent, ComputeDownloadPath,
   FindUploadedArtifact, ValidateDownload, matchesPattern,
   GetUploadsForJob, GetDownloadsForJob, ValidateAllDownloads, GetAllArtifacts)
- Delete artifact_manager test files (all tests tested deleted methods):
  artifact_manager_test.go, artifact_manager_integration_test.go,
  artifact_manager_workflows_integration_test.go

2216 lines removed across 9 files
Delete dead parser functions and their exclusive tests:

pkg/parser/include_processor.go:
- Delete ProcessIncludes

pkg/parser/include_expander.go:
- Delete ExpandIncludes, ProcessIncludesForEngines, ProcessIncludesForSafeOutputs

pkg/parser/schema_validation.go:
- Delete ValidateMainWorkflowFrontmatterWithSchema
- Delete ValidateIncludedFileFrontmatterWithSchema
- Delete ValidateMCPConfigWithSchema

pkg/parser/yaml_error.go:
- Delete ExtractYAMLError, extractFromGoccyFormat, extractFromStringParsing

Test cleanup (deleted whole files):
- schema_oneof_test.go
- schema_passthrough_validation_test.go
- schema_additional_properties_test.go
- frontmatter_syntax_errors_test.go
- schema_validation_test.go

Test cleanup (removed specific functions):
- frontmatter_includes_test.go: 5 functions for ProcessIncludes/ExpandIncludes
- schema_test.go: 3 functions for dead schema validators
- schema_utilities_test.go: 2 functions for dead validators
- yaml_error_test.go: 3 functions for ExtractYAMLError
- import_syntax_test.go: TestProcessIncludesWithNewSyntax
- frontmatter_benchmark_test.go: 2 benchmark functions

5129 lines removed across 15 files
Copilot AI review requested due to automatic review settings February 28, 2026 14:19
Copy link
Contributor

Copilot AI left a comment

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 removes dead/unused JavaScript “getter” stub functions from pkg/workflow/js.go and replaces their remaining call sites with inline empty script strings, consistent with the current “scripts provided at runtime” model.

Changes:

  • Deleted unused get*Script() stub functions that only returned "".
  • Replaced several Script: get*Script() assignments with Script: "".
  • Kept only the small set of remaining script stub getters still referenced elsewhere.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pkg/workflow/js.go Removes multiple unused script getter stubs; keeps a small remaining subset.
pkg/workflow/create_pr_review_comment.go Replaces script getter call with inline empty script.
pkg/workflow/create_discussion.go Replaces script getter call with inline empty script.
pkg/workflow/create_code_scanning_alert.go Replaces script getter call with inline empty script.
pkg/workflow/compiler_safe_outputs_specialized.go Replaces create-project script getter call with inline empty script.
pkg/workflow/add_comment.go Replaces script getter call with inline empty script.

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

Comment on lines 68 to +73
// All getter functions return empty strings since embedded scripts were removed

func getAddCommentScript() string { return "" }
func getAssignToAgentScript() string { return "" }
func getCreateCodeScanningAlertScript() string { return "" }
func getCreateDiscussionScript() string { return "" }
func getCreateIssueScript() string { return "" }

//nolint:unused // Only used in integration tests
func getCreatePRReviewCommentScript() string { return "" }
func getNoOpScript() string { return "" }
func getNotifyCommentErrorScript() string { return "" }
func getCreateProjectScript() string { return "" }
func getUploadAssetsScript() string { return "" }
func getAssignToAgentScript() string { return "" }
func getNoOpScript() string { return "" }
func getNotifyCommentErrorScript() string { return "" }
func getUploadAssetsScript() string { return "" }
Copy link

Copilot AI Feb 28, 2026

Choose a reason for hiding this comment

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

The comment All getter functions return empty strings... is now inaccurate/misleading: this file still has getters like GetLogParserScript returning a non-empty placeholder, and only a small subset of private get*Script() stubs remain below. Suggest rewording to something more precise (e.g., specifically about the remaining private get*Script() stubs) to avoid confusion for future maintainers.

See below for a potential fix:

// Private get*Script stubs return empty strings now that embedded scripts were removed.

func getAssignToAgentScript() string      { return "" }
func getNoOpScript() string               { return "" }
func getNotifyCommentErrorScript() string { return "" }
func getUploadAssetsScript() string       { return "" }

// Public Get* functions no longer return embedded script contents; most return empty
// strings or placeholders because scripts are provided at runtime instead.

Copilot uses AI. Check for mistakes.
@dsyme dsyme merged commit c8496db into main Feb 28, 2026
88 checks passed
@dsyme dsyme deleted the dead15 branch February 28, 2026 14:32
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.

2 participants