Skip to content

fix: prevent double registration when a Page is in both registration_…#59

Merged
gin0115 merged 4 commits intomasterfrom
fix/issue-58-double-page-registration
May 1, 2026
Merged

fix: prevent double registration when a Page is in both registration_…#59
gin0115 merged 4 commits intomasterfrom
fix/issue-58-double-page-registration

Conversation

@gin0115
Copy link
Copy Markdown
Contributor

@gin0115 gin0115 commented May 1, 2026

…classes and a Group (issue #58)

Page_Dispatcher now tracks page classes claimed by an Abstract_Group via mark_group_claimed(). Page_Middleware marks every page on a Group during process(), and register_single_page / register_subpage short-circuit when the page class is claimed and the call is not driven by the Group itself.

Adds unit tests for the claim methods and the skip behaviour, and an application-level regression test covering primary, sub-page, full-group duplication, no-overlap backward compatibility, and the render-once symptom from the issue.

…classes and a Group (issue #58)

Page_Dispatcher now tracks page classes claimed by an Abstract_Group via
mark_group_claimed(). Page_Middleware marks every page on a Group during
process(), and register_single_page / register_subpage short-circuit when
the page class is claimed and the call is not driven by the Group itself.

Adds unit tests for the claim methods and the skip behaviour, and an
application-level regression test covering primary, sub-page, full-group
duplication, no-overlap backward compatibility, and the render-once
symptom from the issue.
@gin0115 gin0115 self-assigned this May 1, 2026
@gin0115 gin0115 added the bug Something isn't working label May 1, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 1, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.39%. Comparing base (6cbfee8) to head (13ae321).
⚠️ Report is 5 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master      #59      +/-   ##
============================================
+ Coverage     99.29%   99.39%   +0.10%     
- Complexity       96      119      +23     
============================================
  Files            12       13       +1     
  Lines           282      330      +48     
============================================
+ Hits            280      328      +48     
  Misses            2        2              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

gin0115 added 3 commits May 1, 2026 21:36
…ry + GROUPS_PROCESSED hook

Moves the page-claim storage out of Page_Dispatcher's private array into a
new Group_Page_Registry service that is registered as shared in
Admin_Menu::pre_boot. Page_Dispatcher resolves it lazily from the DI
container, so dispatcher and any downstream consumer see the same instance.

Page_Middleware no longer holds the claim helper itself; it delegates to
Page_Dispatcher::record_group_pages() during process(), and fires
Hooks::GROUPS_PROCESSED in tear_down() with the populated registry as
payload. Downstream modules (e.g. Settings_Page) subscribe in pre_register
to react to Group-declared pages and add their own DI rules — order-
independent, no priority coordination, no framework changes.

The skip-when-claimed behaviour from issue #58 is preserved unchanged;
only the storage location moves. Existing application regression tests
pass without modification.

Adds: Group_Page_Registry + tests, Hooks::GROUPS_PROCESSED + tests, hook
firing in Page_Middleware::tear_down + tests, application test for the
hook publishing the populated registry, docs/group.md hooks section,
README changelog entry for 2.1.1.
@gin0115 gin0115 merged commit 88b0b1e into master May 1, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Page double-registers when listed in both registration_classes and a Group's primary_page / $pages

1 participant