Skip to content

Comments

Ensure correct positioning of hook extensions relative to core modules#9

Merged
afuno merged 13 commits intomainfrom
feature/SRV-467/hooks
Feb 15, 2026
Merged

Ensure correct positioning of hook extensions relative to core modules#9
afuno merged 13 commits intomainfrom
feature/SRV-467/hooks

Conversation

@afuno
Copy link
Member

@afuno afuno commented Feb 15, 2026

No description provided.

- Enhance `HookApplier` with three distinct modes: no hooks, entries in ancestors, and interleaved entries with hooks.
- Add `include_hooks_only` and `entries_in_ancestors?` methods for better inheritance handling.
- Reverse hook iteration to enforce correct method resolution order.
- Adjust DSL generator to call `included` directly for entry extensions.
- Introduce `entries_in_ancestors?`, `include_entries_with_hooks`, and `include_hooks_only` as private methods.
- Enhance `HookApplier` class with additional handling for entries and hooks.
- Mark methods as private to encapsulate internal logic.
…leaving

- Update `DSL::Generator` spec to verify deferred entry inclusion for base class and interleaved inclusion with hooks for child classes.
- Add tests for multi-level inheritance, ensuring hooks propagate correctly to descendants.
- Enhance `HookApplier` spec with comprehensive scenarios for hook positioning (before and after) relative to entries, multi-hook applications, and deferred execution.
- Introduce edge case tests for existing entries in ancestors and private methods like `entries_in_ancestors?`.
- Remove "(deferred)", "(interleave)", and similar labels from test titles for clarity and uniformity.
- Reorder and group related tests in `DSL::Generator` spec to improve readability.
- Replace "parent_class" with "base_class" in `inheritance isolation` tests to align with consistent terminology.
- Remove unused `entries_in_ancestors?` tests from `HookApplier` spec to streamline focus on public behavior.
@afuno afuno added this to the v0.x milestone Feb 15, 2026
@afuno afuno self-assigned this Feb 15, 2026
@afuno afuno added the feature label Feb 15, 2026
- Introduce deferred inclusion workflow, triggering `included` callback for entry extensions without immediately appending features to ancestors.
- Document idempotency requirement for `self.included` callbacks in entry extensions.
- Ensure proper interleaving of module inclusion and hooks by deferring actual module insertion until processed by Applier.
- Update `HookApplier` to manage deferred entry inclusion with hooks, ensuring correct method resolution order (MRO).
- Refactor `entries_in_ancestors?` to check for all entries instead of any, enabling precise handling of partially included entries.
- Improve documentation for hook inclusion logic and state-based operational modes.
- Enhance method idempotency to allow seamless reprocessing of included entries and hooks.
- Enhance `DSL::Generator` spec with new test cases for hooks and entries in multi-level inheritance scenarios.
  - Add tests for propagating hooks through all ancestor levels.
  - Verify inheritance isolation for grandchild classes without explicit hooks.
- Update `HookApplier` spec with expanded scenarios for before and after hooks.
  - Cover cases for individual hooks, combined hooks (both before and after), and duplication prevention in ancestors.
- Ensure improved coverage for hook inclusion and inheritance behaviors across the specs.
- Simplify and unify naming in `DSL::Generator` and `HookApplier` specs, replacing redundant and inconsistent variable names (e.g., renaming `before_ext` to `before_extension`).
- Restructure tests in `DSL::Generator` spec for clarity:
  - Group scenarios by hook levels (one level, every level, no hooks).
  - Rename test contexts for consistency (e.g., "multi-level with hooks at every level").
- Enhance `HookApplier` tests to ensure proper MRO (method resolution order) with hooks relative to entries:
  - Add scenarios for combined hooks, multi-hook order, and hook isolation.
- Ensure hooks and entries propagate correctly across classes and descendants.
- Improve readability and maintainability of test cases through better grouping and naming.
- Correct typo in variable name: `before_extensionension` → `before_extension`.
- Update expectations and hook addition logic to align with the corrected name.
- Ensure accurate naming improves readability and reduces potential confusion in the spec.
- Add detailed explanation about deferred `Module#include` behavior and interleaving with hooks in child classes.
- Specify the contract for idempotent `self.included` implementation in entry extensions.
- Improve documentation for lifecycle stages of entry inclusion across the class hierarchy.
- Extend `DSL::Generator` spec with tests to validate hook positioning relative to entries in grandchild classes.
- Verify `before_hook` maintains correct ordering relative to entries across inherited modules.
- Confirm `after_hook` appears above inherited entries in method resolution order (MRO).
- Include explanatory comments on Ruby's `Module#include` limitations and their impact on MRO behavior.
- Update test descriptions in `DSL::Generator` spec to improve accuracy and readability.
- Replace ambiguous terms like "defers entries" with clearer phrasing (e.g., "does not include entries").
- Consolidate overlapping test cases by grouping related assertions, simplifying structure.
- Ensure test titles align with multi-level inheritance and hook propagation logic.
@afuno afuno marked this pull request as ready for review February 15, 2026 15:44
- Remove `grandchild` variable from multi-level inheritance tests to reduce redundancy.
- Update tests to dynamically create grandchild classes within assertions.
- Simplify test expectations for MRO validation with improved clarity and consistency.
- Ensure alignment with prior improvements to the `DSL::Generator` spec.
@afuno afuno merged commit 96574b0 into main Feb 15, 2026
35 checks passed
@afuno afuno deleted the feature/SRV-467/hooks branch February 15, 2026 15:51
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.

1 participant