Skip to content

fix(argus-schedule): iterate .schedules[] envelope in list verb#325

Merged
drn merged 2 commits into
masterfrom
argus/2026-06-24-144102-fix-argus
Jun 24, 2026
Merged

fix(argus-schedule): iterate .schedules[] envelope in list verb#325
drn merged 2 commits into
masterfrom
argus/2026-06-24-144102-fix-argus

Conversation

@drn

@drn drn commented Jun 24, 2026

Copy link
Copy Markdown
Owner

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".

  • list: iterate .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.
  • create/update: note they return a flat schedule object, so .id/.next_run_at index directly.
  • run: note the response is enveloped under task_id.

Verb shapes verified against the daemon source internal/api/schedules.go.

Co-Authored-By: Claude noreply@anthropic.com

drn and others added 2 commits June 24, 2026 16:14
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>
@drn drn merged commit c7a6e95 into master Jun 24, 2026
@drn drn deleted the argus/2026-06-24-144102-fix-argus branch June 25, 2026 00:50
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.

1 participant