Skip to content

Parse Docker ps output with tab-separated fields#1227

Merged
GT-610 merged 3 commits into
mainfrom
fix/docker-ps-long-swarm-names
Jul 10, 2026
Merged

Parse Docker ps output with tab-separated fields#1227
GT-610 merged 3 commits into
mainfrom
fix/docker-ps-long-swarm-names

Conversation

@GT-610

@GT-610 GT-610 commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

#1226

Summary

  • Switch Docker ps output parsing to a tab-delimited format so long swarm names no longer break field alignment.
  • Add a clear FormatException when a row does not contain the expected four fields.
  • Extend tests to cover long swarm container names and malformed rows.

Testing

  • Added unit coverage for tab-separated Docker rows with long container names.
  • Added unit coverage for malformed row validation.
  • Not run (not requested).

Summary by CodeRabbit

Summary

  • Bug Fixes
    • Updated container listing parsing to align with tab-separated docker ps output.
    • Added clearer validation errors when rows are malformed.
    • Improved container refresh resilience by skipping only invalid rows instead of failing the entire update.
    • Adjusted docker ps command output to use status ({{.Status}}) and preserve image values correctly (including unusually long container names).
  • Tests
    • Expanded coverage for parsing edge cases and malformed-row failures.

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 89c95884-9837-44c4-a526-4a9166ebdbd8

📥 Commits

Reviewing files that changed from the base of the PR and between a2d882e and 9188144.

📒 Files selected for processing (1)
  • test/container_test.dart
🚧 Files skipped from review as they are similar to previous changes (1)
  • test/container_test.dart

📝 Walkthrough

Walkthrough

Docker container listing commands now emit tab-separated ID, status, name, and image fields. DockerPs.parse consumes this format, validates that rows contain at least four fields, preserves field values without trimming the image, and no longer depends on the removed miscellaneous regex import. Container refresh skips malformed rows individually, and tests cover tab-delimited output, long names, malformed rows, and the status template.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: Docker ps parsing now uses tab-separated fields.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/docker-ps-long-swarm-names

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@lib/data/model/container/ps.dart`:
- Around line 150-157: Update the Docker PS parsing flow around DockerPs.parse
and ContainerPs.fromRaw so malformed rows are handled independently: catch
FormatException for each raw line during the per-row mapping, skip or otherwise
discard invalid rows, and allow valid rows to continue parsing without setting
the overall parsePs operation to an error.

In `@lib/data/provider/container.dart`:
- Around line 490-491: Update the Docker command template in the
ContainerType.docker branch to use Docker’s human-readable {{.Status}} field
instead of {{.State}}, so ContainerStatus.fromDockerState() and DockerPs.parse()
receive values such as “Up 2 hours” and detect statuses correctly.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 7fad4b62-20a1-4520-96a2-9a65e1a482ad

📥 Commits

Reviewing files that changed from the base of the PR and between 17b429c and 3b22e00.

📒 Files selected for processing (3)
  • lib/data/model/container/ps.dart
  • lib/data/provider/container.dart
  • test/container_test.dart

Comment thread lib/data/model/container/ps.dart
Comment thread lib/data/provider/container.dart Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@test/container_test.dart`:
- Around line 61-65: Update the test for ContainerCmdType.ps.exec in the “docker
ps command uses human-readable status” case to assert the complete tab-delimited
--format string in the expected ID, Status, Names, and Image order, including
separators, rather than checking individual fields only.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 1816bbd5-2221-43a7-a168-34875fda926e

📥 Commits

Reviewing files that changed from the base of the PR and between 3b22e00 and a2d882e.

📒 Files selected for processing (2)
  • lib/data/provider/container.dart
  • test/container_test.dart

Comment thread test/container_test.dart Outdated
@GT-610
GT-610 merged commit 095dc7f into main Jul 10, 2026
5 checks passed
@GT-610
GT-610 deleted the fix/docker-ps-long-swarm-names branch July 10, 2026 04:07
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