Introduce Error and Exception base abstractions#8
Merged
Conversation
**Details:** - Updated badge links and branch references to point to the `architecture/error-exception-base` branch. - Adjusted branch purpose and overview to describe the introduction of a **core error and exception abstraction layer**. - Added detailed sections explaining architectural goals, core concepts, and the FireHub-native error system. - Introduced related milestone, pull request, and repository metadata to enhance clarity on progress and objectives. - This update formalizes the foundation for structured error handling in the FireHub ecosystem and prepares it for future architectural expansions.
2 tasks
**Details:** - Added a `FireHubException` base class along with specialized subtypes (`DomainException`, `RuntimeException`, `ValidationException`, etc.) to establish a structured exception hierarchy for the FireHub ecosystem. - Introduced `Code` value object as a type-safe representation of error codes with invariant enforcement. - Implemented concrete exceptions such as `InvalidCodeValueException` to handle specific invariant violations. - Refactored `ValueObject` to incorporate stricter exception handling and validation mechanisms. - Updated existing `ValueObject` tests to use the new exception types and replaced generic exceptions with FireHub-native ones. - Added unit tests for: - `DomainException`, `RuntimeException`, `SecurityException`, and other exception subtypes. - `Code` value object validation and functionality. - Dummy exception stubs for base test scenarios. - Enhanced test coverage and enforced consistent exception handling, laying a foundation for robust error management in the framework.
**Details:** - Introduced a GitHub Actions workflow (`Codecov.yml`) to automate code coverage reporting on pull requests targeting `master`, `develop`, and versioned branches (`v*`). - Integrated reusable workflow from the central repository to streamline maintenance and enforce consistency. - Added `codecov.yaml` to configure coverage thresholds: - Set a project-wide target of 70%. - Defined higher coverage targets (80%) for `Exception` and `Type` modules to promote critical code robustness. - Utilized GitHub and Codecov tokens for secure authentication. This enhances the repository with automated coverage tracking, enforces quality targets, and ensures visibility into test reliability across critical components.
**Details:** - Enhanced `phpunit.xml` by adding `integration` and `smoke` test suites, expanding the testing scope beyond unit tests. - Updated the Codecov workflow (`Codecov.yml`) to monitor release branches with the pattern `release/v*` instead of `v*`, ensuring consistency with branching conventions. - These changes improve test organization and maintain alignment with the repository's versioning strategy.
**Details:** - Added `.gitkeep` files to `Core-Standard/tests/Smoke` and `Core-Standard/tests/Integration` directories to ensure the inclusion of empty directories in the repository. - These changes prepare the structure for future development of smoke and integration tests, aligning with the expanded testing strategy outlined in previous commits.
…cov workflow **Details:** - Deleted `smoke` and `integration` test suites from `phpunit.xml` as part of simplifying the test structure to focus solely on the `unit` suite. - Updated the Codecov workflow (`Codecov.yml`) to reflect this change by specifying the `suits` parameter as `["unit"]`. - Removed `.gitkeep` files from `tests/Integration` and `tests/Smoke` directories, as these test categories are no longer included. This cleanup streamlines test management and aligns testing and coverage workflows with the current project focus.
**Details:** - Corrected a typo in the `Codecov.yml` file, changing `suits` to `suites` under the Codecov configuration. - Ensures proper functionality and alignment with the expected configuration syntax.
Welcome to Codecov 🎉Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests. ℹ️ You can also turn on project coverage checks and project coverage reporting on Pull Request comment Thanks for integrating Codecov - We've got you covered ☂️ |
…se branch **Details:** - Added badges for PHPStan, PHPUnit, and Codecov workflows to the README file. - Linked the badges to their respective GitHub Actions workflows and Codecov report for the `architecture/error-exception-base` branch. - Enhances visibility into CI status and coverage metrics directly from the project documentation.
…bs with enhanced `ValueObject` exception handling tests **Details:** - Introduced `DummyVOInvalidGuardException` stub for validating value objects with guard clause testing. - Added `DummyNotFireHubException` to simulate custom exception scenarios in tests. - Extended `ValueObjectTest` with a test case for invalid guard clause validation, expecting `ValueObjectException`. - Updated `DummyStringVO` and `DummyIntVO` to include new FireHub-native exception types in their constructors. - These changes expand test coverage, ensure stricter validation, and align tests with the project's exception hierarchy structure.
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.
🧱 System Design / Architecture Pull Request
Related Issue
Closes Define Core Error & Exception Abstraction Layer #7
Description
What architectural decision is being implemented?
FireHub\Core\Error, defining two base classes:ErrorandExceptionas the foundational contract for all framework-level failures.What system boundary or rule is being defined?
\Error,\Exception, or generic\Throwabletypes.Error) and runtime/domain-level failures (Exception).Why is this architecture required?
What parts of Core / Runtime / Adapter / Capability are affected?
Architecture Overview
System Design
Introduces a foundational exception hierarchy for the FireHub Core layer. The architecture establishes a common base abstraction for all framework-defined exceptions and provides semantic categories for domain, runtime, and security concerns.
Design Decisions
Key architectural decisions made
Introduce
FireHubExceptionas the single root exception abstraction.Categorize exceptions by responsibility:
Allow specialized exceptions to extend semantic categories.
Integrate future support for strongly typed error codes through the
CodeValue Object.Why these decisions were chosen
Rejected alternatives
FireHubErrorhierarchy.System Boundaries
Included
Excluded
Implementation
Core Changes
Files / modules introduced or modified
FireHub\Core\Exception\FireHubExceptionFireHub\Core\Exception\DomainExceptionFireHub\Core\Exception\RuntimeExceptionFireHub\Core\Exception\SecurityExceptionFireHub\Core\Exception\Domain\ValidationExceptionFireHub\Core\Exception\Runtime\SystemExceptionFireHub\Core\Exception\Runtime\InvariantExceptionFireHub\Core\Exception\CodeContracts
ValueObjects
CodeExceptions
FireHubExceptionDomainExceptionRuntimeExceptionSecurityExceptionValidationExceptionSystemExceptionInvariantExceptionInterfaces
Dependencies
New dependencies introduced
Impact on existing packages
core-standard: Introduces foundational exception contracts.core-professional: May extend the hierarchy with advanced exception types.core-enterprise: May build enterprise-specific exception strategies on top of these contracts.Validation
Architecture Compliance
Build & Stability
Impact Analysis
Core Impact
Introduces the first standardized exception model for the FireHub ecosystem and establishes a stable contract for future framework extensions.
Runtime Impact
None immediately required. Runtime implementations may gradually migrate to the new exception hierarchy.
Future Extensions
Risks / Constraints
Risk Level
Potential Risks
Architecture lock-in
Low. The hierarchy remains intentionally small and extensible.
Breaking changes for downstream packages
Minimal. Existing implementations may continue using native PHP exceptions until migration is desired.
Over-abstraction risks
Mitigated by limiting the number of exception categories introduced in Core.
Documentation
Checklist
Notes
Technical Notes
This architecture intentionally relies on PHP's native
Errorhierarchy and introduces only framework-specific exception abstractions. Core remains responsible for contracts and categorization, while Runtime remains responsible for exception handling behavior.Future Work
Reviewer Guidance