Skip to content

Commit 6c75fb6

Browse files
[dead-code] chore: remove dead functions — 5 functions removed (#58996)
1 parent dbc0ceb commit 6c75fb6

4 files changed

Lines changed: 10 additions & 34 deletions

File tree

pkg/cli/add_command_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,7 @@ on:
616616
# Worker
617617
`), 0o644))
618618

619-
compileDispatchWorkflowDependencies(context.Background(), mainPath, false, true, "", false, nil)
619+
compileDispatchWorkflowDependenciesWithActionRef(context.Background(), mainPath, false, true, "", "", false, nil)
620620

621621
lockPath := filepath.Join(workflowsDir, "worker.lock.yml")
622622
_, err := os.Stat(lockPath)
@@ -651,7 +651,7 @@ safe-outputs:
651651
// Write an intentionally broken worker file (no frontmatter — compile will fail).
652652
require.NoError(t, os.WriteFile(workerPath, []byte(`not valid workflow content`), 0o644))
653653

654-
err := compileCallWorkflowDependencies(context.Background(), mainPath, false, true, "", false, nil)
654+
err := compileCallWorkflowDependenciesWithActionRef(context.Background(), mainPath, false, true, "", "", false, nil)
655655
require.Error(t, err, "worker compilation failure should propagate as an error")
656656
require.ErrorContains(t, err, "worker", "error should mention the worker name")
657657
}
@@ -690,13 +690,13 @@ on:
690690
require.NoError(t, os.WriteFile(lockPath, []byte("# stale lock"), 0o644))
691691

692692
// Without force: stale lock is preserved.
693-
err := compileCallWorkflowDependencies(context.Background(), mainPath, false, true, "", false, nil)
693+
err := compileCallWorkflowDependenciesWithActionRef(context.Background(), mainPath, false, true, "", "", false, nil)
694694
require.NoError(t, err)
695695
content, _ := os.ReadFile(lockPath)
696696
assert.Equal(t, "# stale lock", string(content), "without force, stale lock should not be recompiled")
697697

698698
// With force: stale lock gets recompiled.
699-
err = compileCallWorkflowDependencies(context.Background(), mainPath, false, true, "", true, nil)
699+
err = compileCallWorkflowDependenciesWithActionRef(context.Background(), mainPath, false, true, "", "", true, nil)
700700
require.NoError(t, err)
701701
recompiled, _ := os.ReadFile(lockPath)
702702
assert.NotEqual(t, "# stale lock", string(recompiled), "with force, stale lock should be recompiled")

pkg/cli/add_workflow_compilation.go

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020
var addWorkflowCompilationLog = logger.New("cli:add_workflow_compilation")
2121

2222
// compileWorkflow compiles a workflow file without refreshing stop time.
23-
// This is a convenience wrapper around compileWorkflowWithRefresh.
23+
// This is a convenience wrapper around compileWorkflowWithActionRef.
2424
func compileWorkflow(ctx context.Context, filePath string, verbose bool, quiet bool, engineOverride string) error {
2525
return compileWorkflowWithActionRef(ctx, filePath, verbose, quiet, engineOverride, "")
2626
}
@@ -29,12 +29,6 @@ func compileWorkflowWithActionRef(ctx context.Context, filePath string, verbose
2929
return compileWorkflowWithRefreshAndActionRef(ctx, filePath, verbose, quiet, engineOverride, actionRef, false, false)
3030
}
3131

32-
// compileWorkflowWithRefresh compiles a workflow file with optional stop time refresh.
33-
// This function handles the compilation process and ensures .gitattributes is updated.
34-
func compileWorkflowWithRefresh(ctx context.Context, filePath string, verbose bool, quiet bool, engineOverride string, refreshStopTime bool, approve bool) error {
35-
return compileWorkflowWithRefreshAndActionRef(ctx, filePath, verbose, quiet, engineOverride, "", refreshStopTime, approve)
36-
}
37-
3832
func compileWorkflowWithRefreshAndActionRef(ctx context.Context, filePath string, verbose bool, quiet bool, engineOverride, actionRef string, refreshStopTime bool, approve bool) error {
3933
addWorkflowCompilationLog.Printf("Compiling workflow: file=%s, refresh_stop_time=%v, engine=%s, approve=%v", filePath, refreshStopTime, engineOverride, approve)
4034

@@ -68,12 +62,6 @@ func compileWorkflowWithRefreshAndActionRef(ctx context.Context, filePath string
6862
return nil
6963
}
7064

71-
// compileWorkflowWithTracking compiles a workflow and tracks generated files.
72-
// This is a convenience wrapper around compileWorkflowWithTrackingAndRefresh.
73-
func compileWorkflowWithTracking(ctx context.Context, filePath string, verbose bool, quiet bool, engineOverride string, tracker *FileTracker) error {
74-
return compileWorkflowWithTrackingAndActionRef(ctx, filePath, verbose, quiet, engineOverride, "", tracker)
75-
}
76-
7765
func compileWorkflowWithTrackingAndActionRef(ctx context.Context, filePath string, verbose bool, quiet bool, engineOverride, actionRef string, tracker *FileTracker) error {
7866
return compileWorkflowWithTrackingAndRefreshAndActionRef(ctx, filePath, verbose, quiet, engineOverride, actionRef, tracker, false)
7967
}
@@ -149,21 +137,13 @@ type compileDepsOptions struct {
149137
tracker *FileTracker
150138
}
151139

152-
// compileDispatchWorkflowDependencies compiles any dispatch-workflow .md dependencies of
153-
// workflowFile that are present locally but lack a corresponding .lock.yml. This must be
154-
// called before compiling the main workflow, because the dispatch-workflow validator
155-
// requires every referenced .md workflow to have an up-to-date .lock.yml.
156-
func compileDispatchWorkflowDependencies(ctx context.Context, workflowFile string, verbose, quiet bool, engineOverride string, force bool, tracker *FileTracker) {
157-
compileDispatchWorkflowDependenciesWithActionRef(ctx, workflowFile, verbose, quiet, engineOverride, "", force, tracker)
158-
}
159-
160140
func compileDispatchWorkflowDependenciesWithActionRef(ctx context.Context, workflowFile string, verbose, quiet bool, engineOverride, actionRef string, force bool, tracker *FileTracker) {
161141
compileSafeOutputsWorkflowDependencies(ctx, workflowFile, "dispatch-workflow dependency", dispatchWorkflowNamesForCompilation, compileDepsOptions{
162142
verbose: verbose, quiet: quiet, engineOverride: engineOverride, actionRef: actionRef, force: force, propagateErrors: false, tracker: tracker,
163143
})
164144
}
165145

166-
// compileCallWorkflowDependencies compiles any call-workflow .md worker dependencies of
146+
// compileCallWorkflowDependenciesWithActionRef compiles any call-workflow .md worker dependencies of
167147
// workflowFile that are present locally but lack a corresponding .lock.yml. This must be
168148
// called before compiling the main workflow, because the call-workflow validator requires
169149
// every referenced .md worker to have an up-to-date .lock.yml.
@@ -172,10 +152,6 @@ func compileDispatchWorkflowDependenciesWithActionRef(ctx context.Context, workf
172152
// the dynamic tool-generation path maps every worker .md to a .lock.yml reference, so a
173153
// worker whose lock cannot be produced would leave the orchestrator referencing a file that
174154
// does not exist.
175-
func compileCallWorkflowDependencies(ctx context.Context, workflowFile string, verbose, quiet bool, engineOverride string, force bool, tracker *FileTracker) error {
176-
return compileCallWorkflowDependenciesWithActionRef(ctx, workflowFile, verbose, quiet, engineOverride, "", force, tracker)
177-
}
178-
179155
func compileCallWorkflowDependenciesWithActionRef(ctx context.Context, workflowFile string, verbose, quiet bool, engineOverride, actionRef string, force bool, tracker *FileTracker) error {
180156
return compileSafeOutputsWorkflowDependencies(ctx, workflowFile, "call-workflow worker", callWorkflowNamesForCompilation, compileDepsOptions{
181157
verbose: verbose, quiet: quiet, engineOverride: engineOverride, actionRef: actionRef, force: force, propagateErrors: true, tracker: tracker,

pkg/cli/file_tracker_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ This uses reaction.
298298
tracker := NewFileTracker()
299299

300300
// Compile the workflow with tracking
301-
if err := compileWorkflowWithTracking(context.Background(), workflowFileWithReaction, false, false, "", tracker); err != nil {
301+
if err := compileWorkflowWithTrackingAndActionRef(context.Background(), workflowFileWithReaction, false, false, "", "", tracker); err != nil {
302302
t.Fatalf("Failed to compile workflow: %v", err)
303303
}
304304

@@ -340,7 +340,7 @@ This does NOT use ai-reaction.
340340
// (Note: Since reaction is now inline, this removal step is no longer needed)
341341

342342
// Compile the workflow with tracking
343-
if err := compileWorkflowWithTracking(context.Background(), workflowFileWithoutReaction, false, false, "", tracker2); err != nil {
343+
if err := compileWorkflowWithTrackingAndActionRef(context.Background(), workflowFileWithoutReaction, false, false, "", "", tracker2); err != nil {
344344
t.Fatalf("Failed to compile workflow: %v", err)
345345
}
346346

pkg/cli/update_command_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,7 +1006,7 @@ This is a test workflow.
10061006

10071007
// Test with refreshStopTime=false (should preserve existing stop time if lock exists)
10081008
t.Run("compileWorkflowWithRefresh false", func(t *testing.T) {
1009-
err := compileWorkflowWithRefresh(context.Background(), workflowFile, false, false, "", false, false)
1009+
err := compileWorkflowWithRefreshAndActionRef(context.Background(), workflowFile, false, false, "", "", false, false)
10101010
if err != nil {
10111011
t.Logf("Compilation failed (expected in test environment): %v", err)
10121012
// In a test environment without full setup, compilation may fail,
@@ -1016,7 +1016,7 @@ This is a test workflow.
10161016

10171017
// Test with refreshStopTime=true (should regenerate stop time)
10181018
t.Run("compileWorkflowWithRefresh true", func(t *testing.T) {
1019-
err := compileWorkflowWithRefresh(context.Background(), workflowFile, false, false, "", true, false)
1019+
err := compileWorkflowWithRefreshAndActionRef(context.Background(), workflowFile, false, false, "", "", true, false)
10201020
if err != nil {
10211021
t.Logf("Compilation failed (expected in test environment): %v", err)
10221022
// In a test environment without full setup, compilation may fail,

0 commit comments

Comments
 (0)