-
Notifications
You must be signed in to change notification settings - Fork 119
[WIP] Update compile command to show failed workflow IDs #14980
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Updates the compile command’s stderr summary so failed workflow IDs are listed immediately after the overall compilation summary line, before detailed per-workflow errors.
Changes:
- Print a “Failed workflows” section (with workflow IDs) right after the error summary line when compilation fails.
- Keep backward compatibility by still supporting
FailedWorkflowswhenFailureDetailsis absent. - Add unit tests to validate the updated output.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| pkg/cli/compile_helpers.go | Prints a dedicated “Failed workflows” list (and spacing) before detailed error messages. |
| pkg/cli/compile_summary_output_test.go | Adds tests capturing stderr to validate summary + failed workflow list output. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| r, w, _ := os.Pipe() | ||
| os.Stderr = w | ||
|
|
||
| // Call the function | ||
| printCompilationSummary(tt.stats) | ||
|
|
||
| // Restore stderr and capture output | ||
| w.Close() | ||
| os.Stderr = oldStderr | ||
|
|
||
| var buf bytes.Buffer | ||
| buf.ReadFrom(r) |
Copilot
AI
Feb 11, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test mutates the global os.Stderr, which can race with other tests (including tests in other packages) if they run in parallel. Prefer refactoring printCompilationSummary to write to an injected io.Writer (e.g., parameter or package-level writer) so tests can pass a bytes.Buffer without touching global process state; if keeping this approach, at minimum restore os.Stderr via t.Cleanup/defer, check the os.Pipe()/ReadFrom errors, and close r to avoid leaking FDs.
| r, w, _ := os.Pipe() | |
| os.Stderr = w | |
| // Call the function | |
| printCompilationSummary(tt.stats) | |
| // Restore stderr and capture output | |
| w.Close() | |
| os.Stderr = oldStderr | |
| var buf bytes.Buffer | |
| buf.ReadFrom(r) | |
| r, w, err := os.Pipe() | |
| if err != nil { | |
| t.Fatalf("failed to create pipe: %v", err) | |
| } | |
| os.Stderr = w | |
| t.Cleanup(func() { | |
| os.Stderr = oldStderr | |
| }) | |
| // Call the function | |
| printCompilationSummary(tt.stats) | |
| // Restore stderr and capture output | |
| os.Stderr = oldStderr | |
| if err := w.Close(); err != nil { | |
| t.Fatalf("failed to close write end of pipe: %v", err) | |
| } | |
| var buf bytes.Buffer | |
| if _, err := buf.ReadFrom(r); err != nil { | |
| t.Fatalf("failed to read from pipe: %v", err) | |
| } | |
| if err := r.Close(); err != nil { | |
| t.Fatalf("failed to close read end of pipe: %v", err) | |
| } |
| // Check for expected content | ||
| for _, expected := range tt.expectedInOutput { | ||
| if !strings.Contains(output, expected) { | ||
| t.Errorf("Expected output to contain %q, but it didn't.\nFull output:\n%s", expected, output) | ||
| } | ||
| } |
Copilot
AI
Feb 11, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new behavior is specifically about ordering (failed workflow list appearing immediately after the summary line and before detailed errors), but these assertions only check presence. Add ordering assertions (e.g., using strings.Index to ensure Compiled ... occurs before Failed workflows: and that occurs before the first detailed error message) so the test will fail if the output sections are reordered.
| fmt.Fprintln(os.Stderr, console.FormatErrorMessage("Failed workflows:")) | ||
| for _, workflow := range stats.FailedWorkflows { | ||
| fmt.Fprintf(os.Stderr, " - %s\n", workflow) | ||
| fmt.Fprintf(os.Stderr, " ✗ %s\n", workflow) |
Copilot
AI
Feb 11, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the FailedWorkflows fallback branch you print workflow as-is, but in the FailureDetails branch you print filepath.Base(failure.Path). For consistent output (and to better match the stated goal of listing workflow IDs), consider applying filepath.Base(workflow) here as well.
| fmt.Fprintf(os.Stderr, " ✗ %s\n", workflow) | |
| fmt.Fprintf(os.Stderr, " ✗ %s\n", filepath.Base(workflow)) |
Plan: Agent-Friendly Compile Error Summary
printCompilationSummaryto show failed workflow list immediately after summary lineSummary
Updated the compile command to provide an agent-friendly summary of failed workflows. When compilation errors occur, the output now shows:
✗ Compiled X workflow(s): Y error(s), Z warning(s)This makes it much easier for agents (and humans) to quickly identify which workflows failed before diving into the detailed error messages.
Changes Made
printCompilationSummary()inpkg/cli/compile_helpers.goto display failed workflow list immediately after the summary linepkg/cli/compile_summary_output_test.govalidating the new output formatFailedWorkflowsfield✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.