Skip to content

fix(compose,agent): guard compose rewrites and agent prune, cover rollback-failed - #933

Merged
scttbnsn merged 4 commits into
dev/v1.7from
fix/v1.7-compose-agent-tests
Aug 29, 2026
Merged

scttbnsn merged 4 commits into
dev/v1.7from
fix/v1.7-compose-agent-tests

Conversation

@scttbnsn

Copy link
Copy Markdown
Contributor

Four findings from the rc.6 sweep. They're independent and each one is small, so they're on one branch.

The compose action picked which service to rewrite from the container's own com.docker.compose.service label and never compared the two images, so a container carrying a label for a service it isn't an instance of had that service's image: line rewritten to its own repository, and the operator's next docker compose up would run that image with the victim service's volumes and privileges. The one runtime-versus-compose comparison there was, reconciliationMode, compares full references, so it can't tell a tag drift from a different repository, and in its default warn mode it only logs. A repository mismatch now throws before anything is written, in every reconciliationMode including off, because a different repository doesn't mean the file has drifted, it means the container is not that service. Tag-only drift keeps its existing warn, block and off behaviour, and the Docker Hub aliases plus digest-pinned references still compare equal to the same repository.

The ownership gate that was added for agent ingestion lives in processAuthoritativeContainer, and all four callers prune before they ingest, so a foreign container id in a sync frame still reached pruneOldContainers unchecked. It couldn't delete or save a record on its own, since the prune only considers rows already owned by the reporting agent. What it could do is the #496 replacement match, which is keyed on agent::watcher::name with the agent forced to the reporting agent, so naming a container owned by another agent or by the controller turned the removal of one of the reporting agent's own rows into a replacement, retaining the update policy on the incoming record and skipping the Home Assistant discovery cleanup for the one going away. The prune now filters its input through the same rule the ingest gate uses.

sanitizeLogParam stripped control characters before it looked for ANSI sequences, which deletes the escape byte the ANSI pattern needs, so the pattern could never match and hello\x1b[31m world came out as hello[31m world. It isn't an injection hole, the escape byte was always removed and a terminal can't act on the remainder, but the module's own contract said it removed ANSI sequences and it didn't, the residue is in every log line, audit detail and close reason carrying user or registry text, and the test asserting the behaviour had the residue written into its expected value. ANSI now goes first and the pattern covers the whole CSI grammar rather than just the colour sequences, so a cursor or clear-screen sequence doesn't leave [2J behind either. The scanner-asset error path had grown its own local copy of the regex to work around this, with a comment explaining the ordering problem, and that copy is gone.

getComposeRollbackTerminalPatch turns a rollback-failed compose outcome into {status: failed, phase: rollback-failed}, but the branch sat under a v8 ignore claiming it was integration-covered through compose recovery, and nothing drove that status through runContainerUpdateLifecycle. A regression mapping it to rolled-back, or letting it fall through to the duplicate-update expired reclassification, would have shipped at 100% coverage. Seven new lifecycle cases cover both statuses plus the blank-reason, absent-lastError, unrecognized-status, no-container-id, no-persistence-dependency and watcher-only-identity paths, which retires seven of that file's thirteen ignore blocks.

Tests cover all four: new compose resolution and mapping cases, agent prune ownership cases, the corrected ANSI expectations, and the seven lifecycle cases. Full pre-push gate passed locally (lint, 100% coverage, build, workflow and script tests, zizmor).

@vercel

vercel Bot commented Aug 29, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
drydock-website Ready Ready Preview Aug 29, 2026 5:47pm

@coderabbitai

coderabbitai Bot commented Aug 29, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 15 minutes.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 367dfe8c-31fe-4b24-9c3f-d1647f136c47

📥 Commits

Reviewing files that changed from the base of the PR and between beac71e and 6fa3c6f.

⛔ Files ignored due to path filters (1)
  • CHANGELOG.md is excluded by !CHANGELOG.md
📒 Files selected for processing (10)
  • app/agent/AgentClient.test.ts
  • app/agent/AgentClient.ts
  • app/log/sanitize.test.ts
  • app/log/sanitize.ts
  • app/security/assets.ts
  • app/triggers/providers/docker/Docker.test.ts
  • app/triggers/providers/docker/Docker.ts
  • app/triggers/providers/dockercompose/Dockercompose.compose-resolution-and-init.test.ts
  • app/triggers/providers/dockercompose/Dockercompose.map-and-process-compose.test.ts
  • app/triggers/providers/dockercompose/Dockercompose.ts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@codecov

codecov Bot commented Aug 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@biggest-littlest biggest-littlest left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Read all four fixes against the code, the compose repository guard and the prune ownership filter are the right shape and CI is green.

@ALARGECOMPANY ALARGECOMPANY left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ANSI ordering fix and the new lifecycle cases look right, nothing else in the diff surprised me.

@scttbnsn
scttbnsn merged commit 9bab251 into dev/v1.7 Aug 29, 2026
33 of 35 checks passed
@scttbnsn
scttbnsn deleted the fix/v1.7-compose-agent-tests branch August 29, 2026 18:08
scttbnsn added a commit that referenced this pull request Aug 30, 2026
* fix(compose,agent): guard compose rewrites and agent prune, cover rollback-failed (#933)

* fix(compose): refuse to rewrite a service whose image repository differs

* fix(agent): keep foreign container ids out of the agent prune

* test(triggers): cover the rollback-failed lifecycle branch

* fix(log): strip ANSI escapes before control characters

* fix(auth): stop persisting sessions for header-authenticated requests (#935)

* docs(readme): refresh the competitor comparison and roadmap table for 2026-08 (#936)

* docs(readme): refresh the competitor comparison for 2026-08

The comparison table was dated March 2026 and ran against WUD, Diun and two
archived projects, so Arcane, Komodo and Dockhand, the tools users actually
weigh drydock against now, appeared nowhere in it. It is two tables now,
update managers and management platforms, so neither has to carry nine
columns. Every cell traces to the 2026-08-29 competitive audit.

Corrections that audit forced: WUD ships threshold filtering and has 17
notification providers and 12 registries rather than 16 and 13; Diun's semver
and Home Assistant support are partial, and it does have Prometheus metrics;
Watchtower's Shoutrrr count is about 20. Drydock's own rows now carry the two
it loses, RBAC and a real pending-approval queue, instead of only the ones it
wins. A note under the first table records Watchtower's December 2025
archival, its November 2023 last release, and the unofficial community fork
still shipping.

Seventeen rows across the site's comparison surfaces disagreed with the audit
and are fixed with it, including two that undersold somebody: the Dozzle page
still called drydock's resource monitoring planned when it shipped in v1.5.0,
and the homepage teaser denied Portainer a distributed agent architecture.

The roadmap table moves scoped rotatable API keys from v2.0+ to v1.8.0, where
the SQLite store migration gives them the persisted key table they need, and
lists the per-update approval queue alongside them.

Four cells were deliberately left as they were. The audit's "Webhooks
(in/out)" row is broader than this table's "Webhook API for CI/CD", and its
"Multi-host / agent architecture" and "Compose-file-based updates" rows are
narrower than the labels here, so reading any of them straight across would
have asserted more than the audit measured. Dockhand's registry count is
shown as partial rather than a number because the audit gives two different
ones, 4 in the feature matrix and 2 in its summary.

All seven READMEs carry the same table, and the URL multiset they share is
unchanged.

* docs(readme): drop the shipped maturity indicator from the v1.7 roadmap row

The image maturity indicator shipped in v1.4.2 and v1.5.0, so listing it as
v1.7.0 scope reads as though it is still coming. Removed from the roadmap row
in all seven READMEs, with the translated tables re-padded so the column
widths are unchanged.

* fix(v1.7): address forward-port review findings (#938)

* fix(updates): serialize self-update with active lifecycles (#942)

* fix(updates): serialize self-update with active lifecycles

* fix(updates): release self-update gate after rollback

* fix(web): reconcile WUD trigger comparison copy

* perf(store): index containers by id

* test(playwright): stabilize mobile and update mode checks

* fix(updates): identify the active self-update container

* fix(updates): serialize helper-managed lifecycles

* fix(updates): bound Docker image pulls

* fix(config): cap Docker pull deadline

* fix(updates): resolve self identity from Docker

* fix(updates): release finalized helper lifecycles

* fix(updates): harden lifecycle identity and handoffs

* fix(updates): harden helper lifecycle completion

* fix(updates): bind helpers to the local Docker runtime

* fix(updates): harden helper reconciliation

* fix(watchers): isolate socket clients from ambient TLS

* fix(compose): resolve images before reconciliation

* fix(compose): honor env quoting and self lease errors

* fix(compose): consume poisoned multiline entries

* fix(compose): consume multiline environment duplicates

* fix(compose): handle escaped quote parity

* fix(updates): keep helper deadlines internal

* test(playwright): drain routes before fixture teardown

This branch was successfully deployed

1 active deployment
Preview – drydock-website — 6fa3c6f1 Deployed Aug 29, 2026 by vercel[bot]
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.

3 participants