fix: error nicely when a task is not found - #148
Conversation
|
📋 PR Summary Improves the Changes
|
There was a problem hiding this comment.
Note
Reviewed — No new blocking findings · 1 minor point
🔍 Full review · 4 files reviewed
🔵 Minor points
Not blocking, and no threads opened for these.
legacy/src/Service/Api.php:1844— When a task object in the API response lacks a 'name' key, getEnvironmentTasks keys it by the numeric list index ($task['name'] ?? $key), and TaskListCommand now renders that key as the Name column value. The previous list code produced an empty Name ($task['name'] ?? '') in that case, so name-less tasks now display a numeric index instead of blank.
Review details
- Commit: 212f5f8
- Model: claude-opus-4-8
- Panel: correctness · robustness · design
There was a problem hiding this comment.
Pull request overview
This PR improves the legacy PHP task:run command UX by proactively checking whether a task exists on the selected environment and emitting a clear, actionable error message instead of surfacing a low-level RequestException. It also centralizes task-list fetching in the legacy API service and adds integration coverage to prevent regressions.
Changes:
- Added
Api::getEnvironmentTasks()to fetch and return environment tasks keyed by name. - Updated
task:listandtask:runto use the shared task-fetching helper;task:runnow prints a friendly “task not found” / “no tasks” message and exits early. - Added integration tests covering list, run, missing-task, and no-tasks scenarios.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| legacy/src/Service/Api.php | Adds a reusable helper to fetch tasks for an environment and key them by task name. |
| legacy/src/Command/Task/TaskRunCommand.php | Checks task existence before attempting run; improves stderr messaging and avoids RequestException output. |
| legacy/src/Command/Task/TaskListCommand.php | Uses the new API helper and adjusts iteration to use task names as keys. |
| integration-tests/task_test.go | Adds integration tests validating task list/run behavior and improved “not found” messaging. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Instead of
RequestException