Skip to content

Fix Docker load warnings and enhance editor modal behavior - #150

Open
mstrhakr wants to merge 7 commits into
mainfrom
dev
Open

Fix Docker load warnings and enhance editor modal behavior#150
mstrhakr wants to merge 7 commits into
mainfrom
dev

Conversation

@mstrhakr

@mstrhakr mstrhakr commented Sep 6, 2026

Copy link
Copy Markdown
Owner

This pull request introduces several improvements and fixes to the Compose Manager, focusing on enhanced user experience, improved error logging, and more robust handling of Docker Compose project discovery. The main changes include a new advanced editor modal option, improved WebSocket error logging, better Compose file resolution from .env files, and a safer approach to handling project directories in the shell script. Unit tests were also added to ensure correct behavior.

User Experience Improvements

  • Added a new advanced option in the settings UI (compose.manager.settings.page) allowing users to prevent the editor modal from closing when clicking outside it, reducing accidental interruptions during editing. The setting is available in the UI, persisted in config, and respected by the JavaScript modal logic. [1] [2] [3]
  • Closes Option to disable closing the editor by clicking outside the modal #126

Error Handling and Logging

Docker Compose Project Discovery

  • Enhanced Compose file resolution in Util.php to support discovering the compose file via the COMPOSE_FILE variable in .env files, including support for custom envpath metadata. This makes Compose project detection more robust and flexible.
  • Fixes [Bug]: cant start complex project (akvorado) #149

Shell Script Robustness

Testing

  • Added a unit test to verify that Compose projects are properly loaded when the compose file is only declared in a .env file.

Copilot AI lite review requested due to automatic review settings September 6, 2026 00:13

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

Util.php’s new envpath resolution for COMPOSE_FILE discovery is inconsistent with existing envpath semantics (stack-dir metadata + absolute-only), which can break discovery for indirect stacks with a configured envpath.

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

Pull request overview

This PR improves Compose Manager’s UX and stack discovery by adding an editor-modal behavior toggle, reducing/noising-down Docker load warnings while improving error detail, and making Compose project discovery more robust when the compose file is specified via .env (COMPOSE_FILE), plus a compose wrapper script change to better match “run from project dir” semantics.

Changes:

  • Add an “advanced” setting to prevent the editor modal from closing when clicking outside the modal, and wire it into the modal overlay click handler.
  • Improve Docker load WebSocket error/reconnect logging structure (and log level), to reduce warnings and capture more useful fields.
  • Enhance compose file discovery in PHP to fall back to COMPOSE_FILE in the resolved env file; adjust compose wrapper to cd into the project directory for default discovery; add a unit test covering .env-only compose file declaration.
File summaries
File Description
tests/unit/StackInfoTest.php Adds coverage to ensure stacks load when compose file is declared only via .env COMPOSE_FILE.
source/compose.manager/scripts/compose.sh Switches from --project-directory to cd into workdir to align Compose discovery with validated CLI behavior.
source/compose.manager/javascript/composeManagerMain.js Adds modal “don’t close on outside click” behavior gated by config; improves dockerload WebSocket error logging payload.
source/compose.manager/include/Util.php Adds compose-file discovery via COMPOSE_FILE in resolved env file and adds envpath-based env resolution helper.
source/compose.manager/default.cfg Introduces default value for the new editor modal behavior setting.
source/compose.manager/compose.manager.settings.page Adds UI checkbox to configure/persist the new editor modal behavior setting.
Review details
  • Files reviewed: 6/6 changed files
  • Comments generated: 1
  • 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/include/Util.php Outdated
Comment on lines +2306 to +2310
$stackDir = rtrim($path, '/');
$envPathMetadata = $stackDir . '/envpath';
if (is_file($envPathMetadata)) {
$raw = @file_get_contents($envPathMetadata);
$candidate = $raw === false ? '' : trim($raw);
mstrhakr and others added 4 commits September 5, 2026 20:40
…tack envpath metadata resolution

For indirect stacks, metadata files (including envpath) live in the stack directory
($this->path), but getComposeFilePath() was called with the indirect path
($this->composeSource). This prevented envpath discovery for indirect stacks.

Changes:
- Add optional $stackPath parameter to getComposeFilePath()
- Update resolveProjectEnvFilePath() to accept both compose path and stack path
- Pass $this->path as stack path when resolving compose file
- Look for envpath metadata in stack directory regardless of indirect path

This ensures indirect stacks with envpath metadata can properly discover compose files
via COMPOSE_FILE variable, matching the behavior of direct stacks.
Update getExplicitEnvFilePath() to handle relative paths in envpath metadata,
matching the behavior of resolveProjectEnvFilePath().

Previously, relative envpath values (e.g., 'config/.env') would not be resolved
correctly when used in compose commands. Now both absolute and relative paths
are supported, with relative paths resolved against the stack directory.

This ensures consistency between compose file discovery and env-file argument
construction for stacks with relative envpath metadata.
Add two new test cases to verify indirect stacks can properly discover compose
files via envpath metadata:

1. testIndirectStackLoadsWhenComposeFileViaEnvpath: Tests indirect stack with
   absolute envpath pointing to a .env file that declares COMPOSE_FILE

2. testIndirectStackLoadsWhenComposeFileViaRelativeEnvpath: Tests indirect stack
   with relative envpath (resolved relative to stack directory) pointing to a
   .env file that declares COMPOSE_FILE

Also normalize returned paths in resolveComposeFileFromEnvFile() using realpath()
to ensure consistent path representation across different resolution paths.

These tests verify the fixes in the previous commits work correctly for indirect
stacks with custom envpath metadata.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

2 participants