fix(argus-schedule): iterate .schedules[] envelope in list verb#325
Merged
Conversation
The daemon's GET /api/schedules returns {"schedules":[...]}, not a bare
array. The list verb only pretty-printed with `| jq` and left the agent to
guess `.[]`, which indexes the wrapper object and fails with "Cannot index
array with string". Make the list example iterate `.schedules[]` and
document the envelope explicitly.
Audited the other verbs against internal/api/schedules.go:
- create/update return a flat scheduleJSON object (.id/.next_run_at correct);
added a note confirming the shape.
- run returns {"task_id":"..."}; added a note to surface the task ID.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Address review findings on the list verb: - next_run_at is omitempty; without `// "pending"` jq prints a literal "null" for never-scheduled/disabled rows. Add the fallback. - Document that the jq emits 7 tab-separated columns with `id` as column 1, so the agent labels the table correctly instead of shifting columns. - Note that empty output means no schedules (exit 0) while a jq "Cannot iterate over null" error means the response was not the expected envelope — surface the body and stop. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The daemon's GET /api/schedules returns {"schedules":[...]}, not a bare array. The list verb only pretty-printed with
| jq, so the agent guessed.[]and hit "Cannot index array with string"..schedules[]; coalesce omitempty fields (next_run_at/last_run_at/last_error) so jq never prints a literal "null"; document the 7-column tab-separated output order (id first) and empty-vs-error handling..id/.next_run_atindex directly.task_id.Verb shapes verified against the daemon source internal/api/schedules.go.
Co-Authored-By: Claude noreply@anthropic.com