Skip to content

Enhance icon caching and management for Docker containers - #147

Merged
mstrhakr merged 31 commits into
mainfrom
dev
Sep 4, 2026
Merged

Enhance icon caching and management for Docker containers#147
mstrhakr merged 31 commits into
mainfrom
dev

Conversation

@mstrhakr

@mstrhakr mstrhakr commented Sep 1, 2026

Copy link
Copy Markdown
Owner

This pull request delivers a beta release of Compose Manager Plus, introducing significant new features for stack management, improvements to icon caching, and robust identity enforcement for Docker Compose projects. It also includes several bug fixes, refactorings, and test enhancements to improve reliability and maintainability.

New features and enhancements:

Stack management improvements:

  • Added global and per-stack settings for "wait-for-healthy" and configurable timeout, allowing Compose Manager to wait for stacks to report healthy before marking startup as complete. These settings are surfaced in the settings page and respected during stack startup. [1] [2] [3] [4]
  • Introduced "follow-logs" functionality, enabling live log streaming during compose up by omitting the detach option.

Identity enforcement and security:

  • Mutating actions (like stack updates or deletions) are now blocked unless the stack's project identity is proven, with clear user-facing messages and fail-closed behavior for legacy projects. This is enforced in both manual and scheduled operations. [1] [2] [3] [4] [5] [6]

Icon caching and Docker Manager integration:

  • Enhanced icon caching: icons are always served from the plugin cache, with options to refresh and to repair Docker Manager icons. Data URIs are now passed directly to the browser, and cache writes are hardened and atomic. [1] [2] [3]
  • Improved icon cache management and test coverage for regression cases.

Bug fixes and refactoring:

UI and dashboard:

  • Improved Docker container visibility handling and identity chooser attribute escaping; restored main channel and provided clearer warnings for multi-stack identity errors.
  • Extracted dashboard JavaScript and hid Docker flash messages for a cleaner UI.

Chores and documentation:

  • Updated changelog, README, and plugin metadata to reflect the beta release and new dev branch pluginURL. [1] [2] [3]

For a full list of changes and details, see the beta release diff.

mstrhakr and others added 15 commits September 1, 2026 12:13
A failed refresh could truncate a previously good cache entry, and the
shared `<dest>.tmp` name let concurrent seeds race on the same path.

- Write the icon cache through a unique temp file and rename into place
- Use a per-destination unique temp file when seeding Docker Manager
- chmod 0644 before rename since tempnam() creates files as 0600

Refs #129
Seeding writes a persistent copy as well as the RAM one, so tests left
files behind and could become order-dependent.

Refs #129
Three separate refactors shared one bullet, breaking the one-change-per-
line format of the surrounding release notes.
fix(icon): serve icons from cache and repair Docker Manager icon cache
composeIconSrc/composeIconFallback lived in composeManagerMain.js, which is only
loaded on the Compose/Docker tab. On the Dashboard the stack render loop threw a
ReferenceError, so the tile stayed on 'Loading...' and compose containers were
never hidden from the Docker tile.

Move the icon helpers into composeIcons.js and load it from both the Compose page
and the dashboard tile. Also run container hiding before the render loop so a
render failure can no longer disable it.
IconCache.php?src=<data URI> puts the whole base64 payload in the query string,
which trips browser/nginx URL length limits and breaks the icon. Data URIs are
already inline, so proxying gains nothing; Docker Manager seeding for them still
happens server-side in Exec.php.
fix(dashboard): load icon helpers on Dashboard tile (#143)
Add ProjectIdentity resolver that compares folder-derived and legacy name-derived candidates against live compose project label ownership across containers, volumes, and networks.

Persist resolved runtime identity to project_name metadata and wire StackInfo to always use that centralized pinned identity for docker compose -p.

Fail closed on ambiguous or unprobeable identity and add explicit owner-choice support via StackInfo.
Enforce resolved project identity across compose action builders, single and multi-stack command launchers, manual and scheduled auto-update paths, and event/script consumers via compose_args.

Add read-only identity preview endpoint plus explicit identity selection endpoint for owner-driven conflict resolution.

Surface blocked stacks in list/UI with warning indicator and chooser modal when actions hit ambiguous identity.
…osed behavior

Add ProjectIdentity tests covering legacy name mismatch, running/stopped ownership, volume-only ownership, ambiguous dual ownership, no ownership, Docker probe failure, pinned reuse, owner choice, and logs-vs-mutation guard behavior.

Set deterministic default probe in test bootstrap so unit tests never depend on host Docker state.
Scope the fail-closed identity guard in echoComposeCommand() to mutating actions only. composeLogs stays read-only and continues opening ttyd even when identity is unresolved.
Handle identity error payloads that do not include per-stack candidates (e.g. multi-stack operations) with a simple warning dialog instead of opening the chooser with no options.
fix(migration): fail-closed legacy runtime project identity migration for imported stacks
Copilot AI lite review requested due to automatic review settings September 1, 2026 19:33

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

There are confirmed security/robustness issues in the new identity chooser HTML escaping and in atomic write logic that can spuriously fail due to chmod chaining, plus a potentially unintended update-channel switch in the plugin URL.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR strengthens Docker container icon handling (cache correctness, atomic writes, Docker Manager cache/metadata repair, shared JS helpers for dashboard + main UI) and adds a fail-closed legacy Compose project-identity migration mechanism that blocks mutating actions until identity is proven or explicitly pinned.

Changes:

  • Introduces shared composeIcons.js helpers and aligns Compose page + Dashboard tile icon resolution (including container-context seeding).
  • Hardens icon caching: verify PNG bytes, atomic cache writes, stricter cache serving behavior in IconCache.php, and Docker Manager icon/docker.json repair.
  • Adds ProjectIdentity resolution + UI affordances (warnings + chooser) and enforces fail-closed behavior across compose actions and auto-update paths, with new regression coverage.
File summaries
File Description
tests/unit/StackInfoTest.php Expands icon seeding/repair test coverage and consolidates cleanup.
tests/unit/ProjectIdentityTest.php Adds regression tests for legacy project-identity resolution and fail-closed behavior.
tests/bootstrap.php Adds test constants for Docker Manager icon paths and disables live Docker probing by default in tests.
source/compose.manager/README.md Marks plugin as “(Beta)”.
source/compose.manager/javascript/composeManagerMain.js Removes inline icon helpers (moved to composeIcons.js) and adds identity-warning UI + identity pinning flow.
source/compose.manager/javascript/composeIcons.js New shared icon helper module for Compose page + Dashboard tile.
source/compose.manager/include/Util.php Adds PNG verification/staleness helpers, atomic icon-cache writes, Docker Manager seeding + docker.json repair, and identity integration into StackInfo.
source/compose.manager/include/ProjectIdentity.php New identity resolver/pinner with Docker evidence probing and fail-closed unresolved state.
source/compose.manager/include/Helpers.php Blocks mutating compose actions when identity is unresolved; improves multi-action handling for blocked stacks.
source/compose.manager/include/Exec.php Seeds Docker Manager icons during icon resolution and adds endpoints for identity preview + pinning.
source/compose.manager/include/Defines.php Adds constants for Docker Manager icon locations and icon-label key.
source/compose.manager/include/ComposeManager.php Loads composeIcons.js on the Compose page.
source/compose.manager/include/ComposeList.php Adds identity warning indicators and row data attributes used by the chooser UI.
source/compose.manager/include/ComposeCommandBuilder.php Refuses mutating compose actions when identity is unresolved (logs allowed).
source/compose.manager/include/AutoUpdateRunner.php Skips scheduled auto-updates when identity is unresolved.
source/compose.manager/include/AutoUpdate.php Blocks manual auto-updates with 409 when identity is unresolved.
source/compose.manager/IconCache.php Serves strictly from cache (with refresh/staleness logic) and supports container-context repairs.
source/compose.manager/compose.manager.dashboard.page Loads composeIcons.js on dashboard tile and passes container name into icon proxying.
compose.manager.plg Points pluginURL to the dev branch and tidies changelog formatting.
Review details

Suppressed comments (1)

source/compose.manager/include/Util.php:467

  • Docker Manager icon seeding uses a copy/chmod/rename && chain, so a chmod failure prevents seeding even if the copy and rename would have worked. Consider making chmod best-effort (as in other atomic-write patterns) to avoid leaving Docker Manager with a corrupt/missing icon due to permission quirks.
            if (@copy($cachedPngPath, $tmp) && @chmod($tmp, 0644) && @rename($tmp, $dest)) {
                $seeded = true;
                composeLogger('Seeded Docker Manager icon cache', ['container' => $containerName, 'dest' => $dest], 'system', 'debug', 'icon-cache');
            } else {
                @unlink($tmp);
  • Files reviewed: 19/19 changed files
  • Comments generated: 4
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread source/compose.manager/javascript/composeManagerMain.js Outdated
Comment thread compose.manager.plg
Comment thread source/compose.manager/include/Util.php
Comment thread source/compose.manager/include/Util.php Outdated
@mstrhakr
mstrhakr requested a lite review from Copilot September 2, 2026 02:52

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

There are confirmed functional and security issues in the new follow-logs path (getopt option list and EXIT trap handling) and in the dashboard/detach endpoints where unescaped or unvalidated inputs can lead to injection or unsafe process signaling.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details
  • Files reviewed: 29/29 changed files
  • Comments generated: 4
  • Review effort level: Lite

Comment thread source/compose.manager/include/ComposeUtil.php
Comment thread source/compose.manager/javascript/composeDashboard.js Outdated
Comment thread source/compose.manager/scripts/compose.sh
Comment thread source/compose.manager/scripts/compose.sh Outdated
@mstrhakr
mstrhakr merged commit e6bb367 into main Sep 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Won't hide from Docker Dashboard tiles after update to 2026.08.31

2 participants