Repository navigation
Conversation
docker ps already fetches {{.Status}} which includes health state:
'Up 2 hours (healthy)', 'Up 1 hour (unhealthy)'
but docker_ps() parsed parts[2] and discarded it silently. An AI agent
monitoring containers could not detect unhealthy services.
Changes:
- Extract format_docker_ps_line(parts) as pub(crate) pure function
so it can be unit-tested without spawning docker
- Include status in output between name and image
- Prefix unhealthy containers with [!] for immediate visibility
- Extract trim_image_registry() helper, eliminating duplication
with format_compose_ps() which had the same split('/').next_back()
- Add UNHEALTHY_PREFIX const to avoid magic string duplication
- Add 7 targeted tests covering healthy, unhealthy, exited,
restarting states and the None guard for malformed input
|
This pull request has been automatically marked as stale due to 90 days of inactivity. If this pull request is still relevant, please leave any comment (for example, "bump"), and we'll keep it open. Your contribution is very much appreciated — we're sorry we haven't been able to review it yet. |
|
Thanks for this. The docker ps line formatting was pulled into its own helper on develop as format_container_line_from_parts, shared with |
Problem
`rtk docker ps` fetches `{{.Status}}` which already includes health state when configured:
```
Up 2 hours (healthy)
Up 1 hour (unhealthy)
```
But `docker_ps()` parsed `parts[2]` (Status field) and discarded it completely. An AI agent monitoring containers had no way to identify unhealthy services.
Fix
Refactoring
Tests
7 new unit tests: