Skip to content

Conversation

@afuno
Copy link
Member

@afuno afuno commented Jan 2, 2026

No description provided.

afuno added 5 commits January 3, 2026 00:11
- Removed the old `Usual::Extensions::Example1` and its associated spec to clean up unused extensions.
- Added new reusable service extensions under the `ApplicationService::Extensions` namespace:
  - `ApiAction::DSL`
  - `Authorization::DSL`
  - `ExternalApiRequest::DSL`
  - `Idempotent::DSL`
  - `PostCondition::DSL`
  - `Publishable::DSL`
  - `Rollbackable::DSL`
  - `StatusActive::DSL`
  - `Transactional::DSL`
- Reimplemented `Example1` under `Usual::Extensions` and `Wrong::Extensions` with these reusable extensions to improve code modularity and maintainability.
- Renamed output attribute from `result` to `total` or `value` across applicable services and corresponding specs for consistent terminology.
- Updated specs to properly validate the renamed attributes in both success and failure scenarios.
- Introduced additional checks for `meta` property in exceptions to enhance error details.
- Updated multiple specs to include `:aggregate_failures` for improved testing of multiple expectations within a single example.
- Simplified DSL method definitions by leveraging Ruby's shorthand syntax for keyword arguments.
- Adjusted `publish` and `post_condition!` methods for better readability and consistency.
- Refactored example definitions in `Publishable`, `ExternalApiRequest`, and `Rollbackable` extensions.
- Introduced consistent input and output validation using the `have_input` and `have_output` matchers.
- Added `:aggregate_failures` for enhanced testing of multiple expectations within a single example.
- Reorganized success and failure scenarios with clear validations and outputs in extensions.
- Improved readability by simplifying example definitions, standardizing output attributes, and aligning API requests with expected behavior.
- Deleted `it_behaves_like "failure result class"` from various specs, including `Idempotent`, `ApiAction`, `ExternalApiRequest`, `Transactional`, `PostCondition`, `Authorization`, `Rollbackable`, and `Publishable` extensions.
- Retained focused examples with `:aggregate_failures` for clearer and more concise test cases.
- Streamlined failure scenario definitions to improve readability and maintainability.
@afuno afuno added this to the v.2.17.0 milestone Jan 2, 2026
@afuno afuno self-assigned this Jan 2, 2026
@afuno afuno added the polish label Jan 2, 2026
afuno added 9 commits January 3, 2026 00:49
- Adjusted the order of `require_relative` statements in `Base` to ensure consistent and logical loading of extensions.
- Moved `StatusActive::DSL` to align with other DSL modules for better readability and structure.
- Simplified DSL implementations by removing unnecessary private methods where applicable.
- Renamed variables for clarity: replaced instance variables like `@_idempotency_was_cached` with local variables.
- Improved error handling with explicit nil checks for configuration (e.g., idempotency store, transaction class, and event bus).
- Consolidated logic in transactional, rollbackable, and external API request extensions for better readability.
- Removed redundant calls to auxiliary methods in DSL extensions such as `_check_status_active`, `_perform_rollback`, and `_verify_post_conditions`.
- Added `README.md` to provide detailed guidelines for creating and using service extensions under `ApplicationService`.
- Described common patterns (`Before`, `After`, `Around`, `On_failure`) and their use cases for extensibility.
- Provided examples of configuration storage and execution wrapping (`call!`).
- Highlighted best practices and recommendations for DSL design, error handling, and validations.
- Listed available extensions with their respective patterns and purposes.
- Added detailed explanations for the `error_class` parameter in the `external_api_request` extension, emphasizing the importance of using specific exception classes and avoiding broad ones like `StandardError`.
- Clarified the exception flow and logic for filtering and re-raising exceptions to preserve Servactory's behavior.
- Documented the `rollbackable` extension's behavior, highlighting its handling of `StandardError` and maintaining the exception flow.
- Updated the `README.md` to include these best practices and important notes for extension usage.
- Adjusted the `call!` method in `Idempotent::DSL` to disable additional RuboCop metrics (`Metrics/CyclomaticComplexity`, `Metrics/PerceivedComplexity`) for enhanced flexibility.
- Retained existing overrides for `Metrics/AbcSize` and `Metrics/MethodLength` to preserve functionality.
- Introduced `Example2` under `Usual::Extensions::Rollbackable`, implementing a rollback mechanism with a new `LikeARollbackTracker` class for tracking rollback calls.
- Added corresponding specs to validate input, output, and rollback behavior for `Example2`.
- Enhanced rollback logic in the `Rollbackable::DSL` to exclude `success!` exceptions from triggering the rollback flow.
- Adjusted `Authorization::DSL` and `StatusActive::DSL` to encapsulate conditional checks and improve maintainability.
- Updated examples and documentation to reflect changes in execution and error-handling patterns, emphasizing pre-execution and post-execution behaviors.
…hecks

- Updated `authorization` and `status_active` DSLs to use the `Before` pattern for pre-execution validation, ensuring side effects do not occur when checks fail.
- Refactored `user_authorized?` methods to accept `incoming_arguments` for flexibility during pre-checks.
- Adjusted specs to validate new pre-execution behavior for `authorization` and ensure service actions are not executed when unauthorized.
- Simplified validations by removing redundant input checks.
- Updated documentation to reflect pattern changes and highlight the proper use of pre-execution validation.
- Updated `call!` methods in `Authorization::DSL` and `StatusActive::DSL` to disable RuboCop's `Metrics/MethodLength` check.
- No functional changes were introduced, maintaining existing behaviors.
- Ensured code adheres to current complexity rules while improving maintainability.
- Deleted the `StatusActive::DSL` module as it is no longer needed.
- Cleaned up related code to improve maintainability and reduce complexity.
- Ensured no functional dependencies were affected by the removal.
@afuno afuno changed the title Introduce reusable service extensions for modularity dd service extensions for cross-cutting concerns Jan 3, 2026
@afuno afuno changed the title dd service extensions for cross-cutting concerns Add service extensions for cross-cutting concerns Jan 3, 2026
@afuno afuno changed the title Add service extensions for cross-cutting concerns Add example implementations of service extensions Jan 3, 2026
@afuno afuno marked this pull request as ready for review January 3, 2026 07:20
@afuno afuno merged commit 37a5395 into main Jan 3, 2026
37 checks passed
@afuno afuno deleted the feature/SRV-371/extensions2 branch January 3, 2026 07:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants