Repository navigation
feat(dev:mode): match laminas-development-mode side effects - #36
Merged
Merged
Conversation
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 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
dev:modenow produces the same side effects aslaminas/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
Enableplacesconfig/autoload/development.local.phpfrom its.dist.distexistsDisableremovesconfig/autoload/development.local.phpsymlink(basename($source), $destination)onLinux/Unix/Darwin,copy()elsewhereauto-composerfollowsCOMPOSER_DEV_MODE--auto-composer:1enables,0disables, unset or empty does nothing, anything else exits 1The parity inventory
docs/v1/dev-mode.mdis new and is the substance of this PR: every behaviour of the reference, readfrom its own source (
Command,Help,Status,Enable,Disable,AutoComposer,ConfigDiscoveryTrait, both shipped.distfiles), one row each, and every row carrying adisposition — 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_optionscache fallback (a Mezzio application declaresconfig_cache_pathdirectly).Row 7 is the notable one. The reference's already-in-state branches return before removing the
cache — yet its own
Helpstates the cache is removed "both when disabling and enabling developmentmode". The console follows the documentation rather than the code path.
Also in this PR
Webware\Console\DevelopmentModeis extracted as the filesystem policy. The command had grown to314 lines and 13 methods and tripped
cyclomatic-complexityandtoo-many-methods; it is now theCLI surface only (10 methods), with the policy at 6. Every parity row is testable in isolation.
DevelopmentModeCommandFactoryand the DI wiring are unchanged — the command keeps itsconfig_cache_pathconstructor argument.docs/v1/development.mdcorrected: the dist file is linked, not copied, and documents--auto-composer.Gates
mago fmt --checkmago lintmago analyzemago guardTwo 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 linein 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 asmenuandconsole-menu. Thereference's
development-enable/development-disable/development-statusscripts and itspost-install-cmd/post-update-cmdauto-enable are not reproduced, so development mode isalways an explicit choice.
--auto-composerstays available for parity; nothing wires it up.Recorded in
docs/v1/dev-mode.mdso 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 inertthere until it does. That one is a real gap, not a decision.
Closes #35