Skip to content

feat(docker): add compact filter for docker compose up#2991

Open
DimMarr wants to merge 1 commit into
rtk-ai:developfrom
DimMarr:feat/docker-compose-up
Open

feat(docker): add compact filter for docker compose up#2991
DimMarr wants to merge 1 commit into
rtk-ai:developfrom
DimMarr:feat/docker-compose-up

Conversation

@DimMarr

@DimMarr DimMarr commented Jul 14, 2026

Copy link
Copy Markdown

Summary

docker compose up was previously always skipped by the rewrite hook (see the #336 tests in src/discover/registry.rs) since no compact filter existed for it yet — it silently bypassed rtk entirely instead of being tracked.

This adds a compact summary for detached runs (-d/--detach): entities are grouped by their final status instead of repeating a line per status transition (e.g. Created -> Starting -> Started, or Running -> Waiting -> Healthy for entities with healthchecks).

Foreground up (no -d) streams logs indefinitely, so instead of being skipped outright it now passes through untouched (tracked but unfiltered) — consistent with how other long-running/interactive cases are handled elsewhere in container.rs.

  • src/cmds/cloud/container.rs: format_compose_up (filter) + run_compose_up (detached vs. foreground dispatch)
  • src/main.rs: new ComposeCommands::Up variant, wired into the Docker match arm
  • src/discover/rules.rs: rewrite pattern extended to include compose up
  • src/discover/registry.rs: updated the two #336 tests that asserted up was skipped (now asserts it rewrites, for both the detached and foreground forms); down/config remain correctly skipped since they still have no filter
  • tests/fixtures/docker_compose_up_raw.txt: real fixture captured from a live docker compose up -d run (4 services, one with a healthcheck, plus a real orphan-container warning line)

Test plan

  • cargo fmt --all --check passes
  • cargo clippy --all-targets — no issues
  • cargo test — all tests pass except one pre-existing, unrelated failure (git_checkout_dirty_tree_error_keeps_file_list, caused by a French-localized git error message on my system; reproduces identically on unmodified develop)
  • New tests: real-fixture savings check (>=60%, actual 61%), status-dedup across transitions, fresh-creation edge case (network Created vs. container Started), empty/whitespace input, no-warning case
  • Manually verified end-to-end against a real running docker compose project (4 containers, one with a healthcheck, one orphan-container warning):
    $ rtk docker compose up -d
    [compose] up: 4 services
      Running: datalake-rustfs-1, datalake-backend-1, datalake-frontend-1
      Healthy: datalake-postgres-1
    [warn] orphan containers — run with --remove-orphans
    
  • rtk rewrite "docker compose up -d postgres redis"rtk docker compose up -d postgres redis; rtk rewrite "docker compose down" still correctly skipped (unchanged, out of scope for this PR)

Compose up was previously always skipped by the rewrite hook (rtk-ai#336)
since no filter existed for it, so it silently bypassed rtk instead of
being tracked. Add a compact summary for detached runs (-d/--detach),
grouping containers/networks by their final status instead of
repeating a line per status transition (Created -> Starting -> Started,
or Running -> Waiting -> Healthy for entities with healthchecks).

Foreground `up` (no -d) still streams logs indefinitely, so it now
passes through untouched rather than being skipped outright — it's
tracked but unfiltered, consistent with other passthrough paths.

Verified end-to-end against a real docker compose project (4
containers, one with a healthcheck plus an orphan-container warning):
61% token savings on that fixture.
@CLAassistant

CLAassistant commented Jul 14, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

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.

2 participants