Repository navigation
refactor(exception): gather the six failures into one Exception bucket - #7
Merged
Merged
Conversation
All six failures now live in CommonDoc\Aggregate\Exception and end with the Exception suffix, matching the owner rule that every exception carries the suffix and lives in the Exception directory. Moved and renamed, bodies unchanged: - src/Config/InvalidSiteConfig.php -> src/Exception/InvalidSiteConfigException.php - src/Output/MissingCname.php -> src/Exception/MissingCnameException.php - src/Render/UnaddressableDocument.php -> src/Exception/UnaddressableDocumentException.php - src/Source/GitFailure.php -> src/Exception/GitFailureException.php - src/Source/MissingDocDirectory.php -> src/Exception/MissingDocDirectoryException.php - src/Source/SourceUnavailable.php -> src/Exception/SourceUnavailableException.php Every import, @throws docblock, throw statement, catch clause and test moves with them. ReasonCode enum cases keep their names: they are reason vocabulary, not classes. The dedicated tests moved to test/unit/Exception under CommonDocTest\Aggregate\Exception. No behaviour change. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
The exception rename rewrote three throw lines that had no test behind them, so they entered the patch as uncovered lines. Cover each one and assert the message, because the class name inside the message is what the rename changed. - SiteConfigReaderTest: a configuration file that cannot be read, and a configuration file whose contents are not a JSON object. - GitCommandTest: a working directory that does not exist, which makes the process impossible to start and therefore emits the "could not be run" diagnostic rather than the non-zero-exit one. Reached through a real process start attempt because GitCommand constructs its own Symfony Process; the existing suite already drives real subprocesses this way. Unit suite 360 tests / 747 assertions (was 357 / 736). Integration unchanged at 1 / 1. All four mago gates clean, baselines untouched. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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 moved
The six inherited exception classes now live in one bucket at the package root,
CommonDoc\Aggregate\Exception, and each name ends with theExceptionsuffix. This is a moveand a rename only: same
final class ... extends RuntimeException, same readonly properties, sameprivate constructors, same named constructors, same reason codes, same messages.
src/Config/InvalidSiteConfig.phpsrc/Exception/InvalidSiteConfigException.phpsrc/Output/MissingCname.phpsrc/Exception/MissingCnameException.phpsrc/Render/UnaddressableDocument.phpsrc/Exception/UnaddressableDocumentException.phpsrc/Source/GitFailure.phpsrc/Exception/GitFailureException.phpsrc/Source/MissingDocDirectory.phpsrc/Exception/MissingDocDirectoryException.phpsrc/Source/SourceUnavailable.phpsrc/Exception/SourceUnavailableException.phpEvery import,
@throwsdocblock,throwstatement andcatchclause moved with them. The fourdedicated tests moved to
test/unit/Exceptionunder theCommonDocTest\Aggregate\Exceptionnamespace, and each test file was renamed to match its class.
src/Build/ReasonCode.phpis deliberately unchanged. Its cases (InvalidSiteConfig,MissingCname,MissingDocDirectory,SourceUnavailable) are reason vocabulary recorded in thereport, not class references.
Reference-line edits in three shared files
src/Build/SiteBuild.php,src/Console/BuildCommand.phpandtest/unit/BuildCommandTest.phpcarry reference-only edits, because the code does not compile otherwise: two imports, one
@throwsline, one
catchtype, and the matching test references. Behaviour is unchanged, including theexit-2 blocked path in
BuildCommand.Gates
Run once on the final tree. All clean, with no new baseline entries and no suppressions:
mago lint --ignore-baseline: no issues foundmago format --check: all files already formatted (core.autocrlf is false, so this is meaningful)mago analyze: no issues foundmago guard: no issues foundBoth counts are identical to the pre-change baseline recorded on the parent commit, so the move
changed nothing observable.
The rule this satisfies
The guard rule requiring the
Exceptionsuffix and theExceptiondirectory now exists inwebware/webware-toolsas of1.0.0-rc.12, merged in PR #78 at commit7bad0a74c9d4b743a12c1a50f33973e6533ca17c. That is whymago guardis green here rather thansilent about these classes.
Overlap with PR #6
This branch and
tyrsson-discovery-of-projects(PR #6) both editsrc/Build/SiteBuild.php,src/Console/BuildCommand.phpandtest/unit/BuildCommandTest.php. Whichever lands second needs arebase; the overlap is known and is being sequenced on the owner side.
src/Discovery/is nottouched by this branch at all.
Naming proof
A grep over the package finds no
class,interface,traitorenumdeclaration ending inExceptionoutsidesrc/Exception/, and every class insidesrc/Exception/carries the suffix. Acase-sensitive grep for the six old bare class identifiers returns only the four
ReasonCodeenumcases.