Skip to content

Stabilize stack lifecycle, improve update accuracy, and expand E2E safety coverage - #139

Open
mstrhakr wants to merge 38 commits into
mainfrom
dev
Open

Stabilize stack lifecycle, improve update accuracy, and expand E2E safety coverage#139
mstrhakr wants to merge 38 commits into
mainfrom
dev

Conversation

@mstrhakr

Copy link
Copy Markdown
Owner

Summary

This PR merges dev into main with a reliability-focused update across stack operations, update detection, settings UX, and test coverage.

The goal is to reduce stale or false states, make automation safer, clarify operator controls, and increase confidence through broader regression coverage.

Changes

1. Stack lifecycle reliability

  • Hardened compose command execution and exit-code propagation.
  • Improved stack delete/update flows to reduce stale UI/runtime state.
  • Centralized menu visibility and related page-state handling.

2. Update detection and runtime behavior

  • Improved auto-update digest/change detection to avoid false “no update” results.
  • Added running-container guard behavior so automated updates align with manual expectations.
  • Added plugin-local update checking logic for better update accuracy.
  • Improved compose info publishing/WebSocket handling for hidden tabs and reduced nchan pressure.
  • Tightened stack refresh behavior to avoid stale post-update status after manual operations.

3. Settings page modernization

  • Reorganized settings sections and help text for clearer operator intent.
  • Added change counting/global actions for settings management.
  • Expanded auto-check options with mode selection and custom interval support.

4. Test strategy expansion

  • Added Playwright E2E coverage for smoke and mutation-safe lifecycle flows.
  • Added new operation-flow helpers/specs and supporting docs/scripts.
  • Reworked unit test coverage to target current behavior and reduce brittle legacy assertions.

Bug Fixes

Scope

  • 34 commits from dev not in main
  • 48 files changed
  • +5088 / -2189

Validation

  • Updated unit coverage around compose execution and stack behavior.
  • Added Playwright E2E coverage for isolated lifecycle and read-only smoke flows.
  • Updated supporting docs/scripts for E2E use and setup.

…Test

- Simplified IconTest by consolidating setup and teardown processes, removing unnecessary comments, and streamlining icon file handling.
- Removed SettingsBackupTest, SettingsPageTest, and StackInfoSourceTest as they were deemed unnecessary.
- Introduced ComposeListEndpointTest to validate the rendering of Docker Compose stacks and ensure proper handling of empty states.
- Created package.json and package-lock.json for e2e tests with Playwright dependencies.
- Added Playwright configuration file (playwright.config.ts) for test setup.
- Implemented script to create storage state for authentication (create-storage-state.mjs).
- Developed comprehensive end-to-end tests for Compose Manager lifecycle and read-only checks.
- Included TypeScript configuration for test files.
Copilot AI lite review requested due to automatic review settings August 18, 2026 16:41

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.

Pull request overview

This PR merges dev into main and focuses on improving Compose Manager reliability across stack lifecycle operations, update detection accuracy, UI column/layout behavior, and expanding automated coverage (unit + Playwright E2E).

Changes:

  • Stabilizes stack operations by propagating real compose exit codes, hardening stack deletion, and refreshing/purging related caches.
  • Improves update detection correctness (including plugin-local update checking and auto-update digest comparison + “only recreate when running” guard).
  • Adds server-driven column layout bootstrapping and expands E2E testing utilities/specs plus supporting docs/scripts.

Reviewed changes

Copilot reviewed 49 out of 51 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tests/unit/StackInfoTest.php Updates stack-creation expectations around always creating override templates.
tests/unit/StackInfoSourceTest.php Removes brittle source-string assertions.
tests/unit/SettingsPageTest.php Removes settings-page source assertions.
tests/unit/SettingsBackupTest.php Removes extensive settings backup/restore markup assertions.
tests/unit/IconTest.php Reworks endpoint-level icon tests to assert headers/bytes from real include.
tests/unit/ExecActionsTest.php Adds deleteStack traversal rejection coverage + stronger folder deletion assertion.
tests/unit/ComposeUtilTest.php Updates expectations for ttyd viewer URL behavior.
tests/unit/ComposeManagerMainSourceTest.php Removes wide set of source-level regression checks for main page + JS.
tests/unit/ComposeListHtmlTest.php Removes source-level HTML structure tests for ComposeList markup.
tests/unit/ComposeListEndpointTest.php Adds endpoint-level ComposeList rendering tests (default/empty state).
tests/unit/compose.bats Adds bats checks for compose.sh exit propagation + autoupdate digest/running guards.
tests/unit/AutoupdateRunnerTest.php Updates mocks/config to align with ttyd-only output routing.
tests/e2e/tsconfig.json Adds strict TS config for Playwright E2E suite.
tests/e2e/tests/helpers/composeE2eHelpers.ts Adds shared helpers for CSRF/form posts and lifecycle waits/cleanup.
tests/e2e/tests/compose-ui-operation-flows.spec.ts Adds bg/fg UI flow tests capturing ComposeUtil POST payloads.
tests/e2e/tests/compose-readonly.spec.ts Adds guarded read-only smoke checks that abort on POST writes.
tests/e2e/tests/compose-isolated-lifecycle.spec.ts Adds opt-in mutation-safe isolated lifecycle and settings round-trip tests.
tests/e2e/scripts/create-storage-state.mjs Adds headless storage-state generator for environments without headed login.
tests/e2e/README.md Documents E2E safety model, setup, and mutation opt-in.
tests/e2e/playwright.config.ts Introduces Playwright config (workers=1, baseURL/storageState env-driven).
tests/e2e/package.json Adds Playwright/TypeScript devDependencies and scripts.
tests/e2e/package-lock.json Locks Playwright/TS dependency graph for reproducible installs.
tests/e2e/.gitignore Ignores node_modules, reports, results, and auth state artifacts.
tests/e2e/.auth/.gitkeep Keeps auth directory present without committing secrets/state.
tests/bootstrap.php Adds COMPOSE_SKIP_TTYD_EXEC for test mode and removes OUTPUTSTYLE defaults.
source/compose.manager/sheets/ComboButton.css Updates comments and supports hide-col-* column visibility rules.
source/compose.manager/scripts/header_menu_visibility.sh Adds reusable header-menu visibility resolver script.
source/compose.manager/scripts/compose.sh Adds explicit operation exit-code propagation for mutating commands.
source/compose.manager/scripts/compose_autoupdate.sh Fixes digest comparison (config --images + .Id) and skips up -d when not running.
source/compose.manager/README.md Updates plugin branding text to “(Beta)”.
source/compose.manager/nchan/compose_info Fixes #130 by filtering docker stats to compose IDs and coalescing publishes.
source/compose.manager/javascript/composeColumnCustomizer.js Uses server bootstrap for column model/layout; reapply on list refresh.
source/compose.manager/include/Util.php Adds guarded stack-folder deletion helper and notification helper; ensures override template creation.
source/compose.manager/include/UpdateCheck.php Adds plugin-local update checker using platform-specific image config digests.
source/compose.manager/include/Helpers.php Simplifies compose command routing to ttyd (removes legacy compose.sh query URLs).
source/compose.manager/include/Exec.php Centralizes column layout IO, adds compose_info publisher ensure, improves deleteStack + cache purge.
source/compose.manager/include/ComposeManager.php Server-renders table headers/order + CSS vars from saved column layout bootstrap.
source/compose.manager/include/ComposeList.php Server-renders stack rows in saved column order and adds structured row-failure payloads.
source/compose.manager/include/ColumnLayout.php Introduces shared column defaults/normalization/width fraction model for server + client.
source/compose.manager/default.cfg Removes OUTPUTSTYLE default.
source/compose.manager/Compose.page Uses header_menu_visibility.sh to decide header menu visibility.
source/compose.manager/compose.manager.page Uses header_menu_visibility.sh for the complementary menu condition.
README.md Updates feature list to reflect ttyd-only terminal and new column customizer/layout model.
playwright.sh Adds a deploy+run helper for Playwright E2E with auth-state generation support.
phpunit.xml Removes HTML coverage output config (keeps clover/text).
phpstan.neon Adjusts ignore patterns for new external symbol usage and runtime method_exists checks.
docs/testing.md Documents Playwright E2E setup/run flow and fixes code-fence formatting.
compose.manager.plg Updates pluginURL entity (branch reference changed in this PR).
.github/workflows/sync-plugin-url.yml Adjusts sed escaping to correctly update pluginURL entity line.
Files not reviewed (1)
  • tests/e2e/package-lock.json: Generated file

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

Comment on lines +243 to +257
$targetReal = realpath($targetPath);
$meta['targetReal'] = $targetReal;
if ($targetReal === false || !Path::isAllowedPath($targetReal, [$composeRootReal]) || $targetReal === $composeRootReal) {
$errorMessage = 'Invalid stack path resolved for deletion.';
return false;
}

if (is_link($targetPath)) {
if (!@unlink($targetPath) && file_exists($targetPath)) {
$errorMessage = 'Failed to remove stack symlink.';
return false;
}
$appendRemovedPath($targetPath . ' [symlink]');
return true;
}
Comment on lines +216 to +220
$args = [];
foreach (explode(',', $m[1]) as $arg) {
$kv = explode('=', $arg);
$args[$kv[0]] = trim($kv[1] ?? '', "\" \r\n");
}
Comment thread compose.manager.plg
<!ENTITY packagefile "&packageName;.txz">
<!ENTITY github "mstrhakr/compose_plugin">
<!ENTITY pluginURL "https://raw.githubusercontent.com/&github;/main/&name;.plg">
<!ENTITY pluginURL "https://raw.githubusercontent.com/&github;/dev/&name;.plg">
$header = ['Accept: ' . $accept];
$basicUserPwd = null;

// Bearer challenge → fetch a token scoped to repository:<repo>:pull.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

2 participants