Skip to content

feat(dev:mode): match laminas-development-mode side effects - #36

Merged
tyrsson merged 2 commits into
1.0.xfrom
feat/dev-mode-parity
Sep 26, 2026
Merged

tyrsson merged 2 commits into
1.0.xfrom
feat/dev-mode-parity

Conversation

@tyrsson

@tyrsson tyrsson commented Sep 26, 2026 •

Copy link
Copy Markdown
Member

What

dev:mode now produces the same side effects as laminas/laminas-development-mode. Presentation
— wording, flag interface, exit codes — stays the console's own, because those are not what a
migration depends on.

The gaps this closes

Reference behaviour Was Now
1 Enable places config/autoload/development.local.php from its .dist never touched placed when the .dist exists
2 Disable removes config/autoload/development.local.php never touched removed when present
3 Enable runs symlink(basename($source), $destination) on Linux/Unix/Darwin, copy() elsewhere always copied links where symlinks are trusted, copies elsewhere
4 auto-composer follows COMPOSER_DEV_MODE absent --auto-composer: 1 enables, 0 disables, unset or empty does nothing, anything else exits 1

The parity inventory

docs/v1/dev-mode.md is new and is the substance of this PR: every behaviour of the reference, read
from its own source (Command, Help, Status, Enable, Disable, AutoComposer,
ConfigDiscoveryTrait, both shipped .dist files), one row each, and every row carrying a
disposition
— replicate, diverge with a reason, or out-of-scope with a reason. Reading the reference
only far enough to answer the immediate question is precisely how three of those four gaps were
missed the first time.

Rows that deliberately differ, each with its reason recorded: the no-action exit code (0 here, so an
empty submit from the menu is not a red failure), STDERR routing, prose, flag-versus-subcommand
grammar, and the MVC module_listener_options cache fallback (a Mezzio application declares
config_cache_path directly).

Row 7 is the notable one. The reference's already-in-state branches return before removing the
cache — yet its own Help states the cache is removed "both when disabling and enabling development
mode". The console follows the documentation rather than the code path.

Also in this PR

  • Webware\Console\DevelopmentMode is extracted as the filesystem policy. The command had grown to
    314 lines and 13 methods and tripped cyclomatic-complexity and too-many-methods; it is now the
    CLI surface only (10 methods), with the policy at 6. Every parity row is testable in isolation.
  • DevelopmentModeCommandFactory and the DI wiring are unchanged — the command keeps its
    config_cache_path constructor argument.
  • docs/v1/development.md corrected: the dist file is linked, not copied, and documents
    --auto-composer.

Gates

Gate Result
mago fmt --check clean
mago lint no issues
mago analyze no issues
mago guard no issues
PHPUnit unit 143 tests, 283 assertions
PHPUnit integration 2 tests, 6 assertions
Line coverage 100% (530/530 statements, 63/63 methods)
Infection MSI 100%, 0 escaped (382 mutants)

Two escaped mutants were found by the gate and killed rather than ignored: an internal-only
configCache() whose visibility change nothing noticed (inlined away), and the blank separator line
in the usage output (now asserted).

Composer script wiring - deliberately not replicated

The only Composer script a console application needs is the one that starts the menu
("menu": "webware menu"), which this package already exposes as menu and console-menu. The
reference's development-enable / development-disable / development-status scripts and its
post-install-cmd / post-update-cmd auto-enable are not reproduced, so development mode is
always an explicit choice. --auto-composer stays available for parity; nothing wires it up.

Recorded in docs/v1/dev-mode.md so the absence reads as a decision rather than an oversight.

The application ships no config/autoload/development.local.php.dist, so rows 1 and 2 are inert
there until it does. That one is a real gap, not a decision.

Closes #35

The command reproduced only part of the reference, so a migrating
application saw different side effects from enable and disable.

Enabling now places the optional
config/autoload/development.local.php from its dist, and links the
dist files instead of copying them wherever symlinks are trusted;
disabling removes both. COMPOSER_DEV_MODE is honoured through a new
--auto-composer flag.

The filesystem policy moves into Webware\Console\DevelopmentMode, so
the command is only the CLI surface and each behaviour is testable on
its own. Wording, flags and exit codes stay ours - only the side
effects are parity. docs/v1/dev-mode.md inventories every behaviour of
the reference beside its disposition.

Closes #35

Signed-off-by: Joey Smith <jsmith@webinertia.net>
@codecov

codecov Bot commented Sep 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

The reference wires development-enable/disable/status plus post-install-cmd
and post-update-cmd auto-enable. None of that is reproduced: the only
Composer script a console application needs is the one that starts the
menu, which this package already exposes.

Signed-off-by: Joey Smith <jsmith@webinertia.net>
@tyrsson
tyrsson merged commit ceb4c87 into 1.0.x Sep 26, 2026
12 checks passed
@tyrsson
tyrsson deleted the feat/dev-mode-parity branch September 26, 2026 07:12
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.

dev:mode diverges from laminas-development-mode: local overrides, link-vs-copy, auto-composer

1 participant