Skip to content

feat(dev:mode): add --clear-cache - #38

Merged
tyrsson merged 1 commit into
1.0.xfrom
feat/dev-mode-clear-cache
Sep 26, 2026
Merged

tyrsson merged 1 commit into
1.0.xfrom
feat/dev-mode-clear-cache

Conversation

@tyrsson

@tyrsson tyrsson commented Sep 26, 2026

Copy link
Copy Markdown
Member

What

dev:mode --clear-cache removes the aggregated configuration cache and changes nothing else.
Until now that meant toggling development mode off and on again, or reaching for the application's
own bin/clear-config-cache.php.

It is listed in the usage text beside the other actions, so it appears as a toggle in the menu too.

An addition, not parity

The reference has no cache-only action: it clears the cache as a side effect of enable/disable, and
the Mezzio skeleton ships a separate script for the standalone case. Recorded as row 13 in
docs/v1/dev-mode.md with the reason, so it does not read as an accidental divergence.

Three outcomes, reported distinctly

Case Output Exit
Cache removed Removed the config cache at "...". 0
No cache present There is no config cache to remove. 0
Present but unremovable Unable to remove the config cache. 1

The third matches the skeleton script, which also exits 1, and it is reachable: a directory at the
cache path satisfies file_exists() while defeating unlink(). Related, clearConfigCache() no
longer reports a removal that did not happen — it returned the path regardless of unlink()'s result.

error() stays as the single place the error markup is written; the metric was not worked around by
duplicating it.

Gates

Gate Result
mago fmt --check / lint / analyze / guard clean
PHPUnit 145 unit, 2 integration
Line coverage 100% (541/541 statements, 65/65 methods)
Infection MSI 100%, 0 escaped (397 mutants)

too-many-methods on DevelopmentModeCommand is suppressed with @mago-expect rather than
restructured: the class is the flag plumbing for five actions, and splitting it further would spread
that plumbing across more types than the separation is worth.

One escaped mutant was found by the gate and killed rather than ignored — dropping the success return
in clearCache() falls through to the "nothing to remove" branch, which also exits 0, so the test now
asserts that message's absence.

Dropping the aggregated config cache meant toggling development mode off
and on again, or reaching for the application's own clear-config-cache
script. The new action removes the cache and changes nothing else.

The reference has no cache-only action, so this is an addition beyond
parity and is recorded as one in docs/v1/dev-mode.md.

Three outcomes are reported separately: removed, nothing to remove, and
present but unremovable. The last exits 1, matching the skeleton script
the console replaces.

Signed-off-by: Joey Smith <jsmith@webinertia.net>
@tyrsson
tyrsson merged commit a557a26 into 1.0.x Sep 26, 2026
11 checks passed
@tyrsson
tyrsson deleted the feat/dev-mode-clear-cache branch September 26, 2026 16:00
@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!

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.

1 participant