Skip to content

refactor(core,users): decouple core/users views from optional modules via registries and a users store#4467

Merged
PierreBrisorgueil merged 2 commits into
masterfrom
refactor/4461-decouple-core-users-modules
Jul 17, 2026
Merged

refactor(core,users): decouple core/users views from optional modules via registries and a users store#4467
PierreBrisorgueil merged 2 commits into
masterfrom
refactor/4461-decouple-core-users-modules

Conversation

@PierreBrisorgueil

Copy link
Copy Markdown
Collaborator

Summary

  • What changed: core.navigation.component.vue (nav drawer) and user.view.vue (account header) previously hard-imported optional billing/organizations components and stores directly. This introduces a shared component-registry seam (createComponentRegistry + useNavExtras / useUserHeaderActions), mirroring the existing useFooterExtras pattern: billing/organizations now self-register their nav compute-gauge / header org-switcher from invisible registrar components mounted at the app shell composition root (app.vue), and core/users just render whatever is registered — no compile-time dependency on the optional modules. Also adds users.store.js, since the users module previously had no store and user.view/user.profile.view called axios directly for profile/delete operations. Behavior is identical; this is a decoupling refactor. Also fixes a mount-order inversion found during pre-PR review: billingNavExtras (the registrar) now mounts above devkitNav (the consumer) in app.vue, matching the working legalFooterSectiondevkitFooter precedent, and adds reactive-after-mount test coverage for both registry seams.
  • Why: Core/users modules should not compile-time-depend on optional billing/organizations modules — this is the same decoupling seam already proven by useFooterExtras for the footer, applied to the nav drawer and the account header, plus giving users a proper store layer instead of view-level axios calls.
  • Related issues: Closes 🔧 Decouple core and users views from optional modules #4461

Scope

  • Modules impacted: core, users, billing, organizations, auth, app, lib/composables
  • Cross-module impact: yesbilling and organizations now register into shared lib/composables registries instead of being imported by core/users; core/users no longer import billing/organizations at all
  • Risk level: low — pure refactor, registries are additive, existing UI/behavior parity verified by full unit suite + build

Validation

  • npm run lint
  • npm run test:unit
  • npm run build
  • Manual checks done (if applicable) — 2510 unit tests green (148 files), including new reactive-toggle coverage for the mount-order fix (billing.navExtras meterMode flip post-mount, organizations.headerAction isLoggedIn flip post-mount)

Guardrails check

  • No secrets or credentials introduced (.env*, secrets/**, keys, tokens)
  • No risky rename/move of core stack paths
  • Changes remain merge-friendly for downstream projects
  • Tests added or updated when behavior changed

Notes for reviewers

  • Security considerations: none — no new endpoints, no auth/ability changes; users.store.js wraps existing profile/delete API calls with the same request shape.
  • Mergeability considerations: downstream projects that override core.navigation/user.view/app.vue will need /update-stack to pick up the new registry seam.
  • Follow-up tasks (optional): none

https://claude.ai/code/session_01WfNC8bt1TgL4AsiYgCEGup

… via registries + a users store

Core layout and the users account view reached directly into optional
feature modules (billing, organizations), and users had no store layer:

- users.store.js: new Pinia store owning profile update + account delete
  (mirrors admin/billing/organizations store shape). user.profile.view.vue
  now calls store actions instead of building axios calls inline.
- core.navigation.component.vue: replaced the hard billing nav-gauge
  import with the useNavExtras() registry seam (mirrors core.footer's
  useFooterExtras). billing.navExtras.component.vue registers the gauge,
  reactively gated on meterMode — same v-if behavior, now owned by billing.
- user.view.vue: replaced the hard organizations switcher + store import
  with the useUserHeaderActions() registry seam. organizations.headerAction
  .component.vue registers the switcher and owns the on-login
  fetchOrganizations() pre-load (now logged on failure instead of
  swallowed). Both registrars mount from app.vue, the existing composition
  root that already wires every optional module.
- createComponentRegistry.js: shared register/unregister factory backing
  both new seams, keeping the bookkeeping in one place.

Tests updated/added per touched module, including source-level checks that
core/users no longer statically import the optional modules.

Closes #4461

Claude-Session: https://claude.ai/code/session_01WfNC8bt1TgL4AsiYgCEGup
… reactive tests

app.vue mounted the useNavExtras consumer (devkitNav) before its registrar
(billingNavExtras), inverted vs the legalFooterSection→devkitFooter
precedent — causes a redundant re-render pass on first mount. Move
billingNavExtras above devkitNav so registration happens first (the
organizations.headerAction→user.view pair was already correctly ordered:
the registrar mounts in app.vue ahead of <router-view>).

Add reactive-after-mount tests for both registry seams: flipping meterMode
post-mount (billing.navExtras) and isLoggedIn false→true post-mount
(organizations.headerAction) — the runtime path the watch()/computed exist
for, previously only exercised via immediate-on-mount. Required wrapping
the auth-store mock in reactive() (a plain object mock isn't tracked by
Vue's reactivity) and tracking+unmounting wrappers in the organizations
suite to avoid cross-test watcher leakage once the mock became reactive.
@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@PierreBrisorgueil, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 29 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 97a98a40-51df-4f50-9609-411f20d0fb82

📥 Commits

Reviewing files that changed from the base of the PR and between ed35252 and 161e14b.

📒 Files selected for processing (17)
  • src/lib/composables/createComponentRegistry.js
  • src/lib/composables/tests/createComponentRegistry.unit.tests.js
  • src/lib/composables/useNavExtras.js
  • src/lib/composables/useUserHeaderActions.js
  • src/modules/app/app.vue
  • src/modules/billing/components/billing.navExtras.component.vue
  • src/modules/billing/tests/billing.navExtras.component.unit.tests.js
  • src/modules/core/components/core.navigation.component.vue
  • src/modules/core/tests/core.navigation.component.unit.tests.js
  • src/modules/organizations/components/organizations.headerAction.component.vue
  • src/modules/organizations/tests/organizations.headerAction.component.unit.tests.js
  • src/modules/users/stores/users.store.js
  • src/modules/users/tests/user.profile.view.unit.tests.js
  • src/modules/users/tests/user.view.unit.tests.js
  • src/modules/users/tests/users.store.unit.tests.js
  • src/modules/users/views/user.profile.view.vue
  • src/modules/users/views/user.view.vue
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/4461-decouple-core-users-modules

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Jul 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.57%. Comparing base (9cb370d) to head (161e14b).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #4467   +/-   ##
=======================================
  Coverage   99.57%   99.57%           
=======================================
  Files          35       36    +1     
  Lines        1398     1411   +13     
  Branches      439      439           
=======================================
+ Hits         1392     1405   +13     
  Misses          6        6           

☔ View full report in Codecov by Harness.
📢 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@PierreBrisorgueil
PierreBrisorgueil marked this pull request as ready for review July 17, 2026 00:52
@PierreBrisorgueil

Copy link
Copy Markdown
Collaborator Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
✅ Action performed

Full review finished.


Your plan includes PR reviews subject to rate limits. More reviews will be available in 29 minutes.

@PierreBrisorgueil
PierreBrisorgueil merged commit f03041b into master Jul 17, 2026
7 checks passed
@PierreBrisorgueil
PierreBrisorgueil deleted the refactor/4461-decouple-core-users-modules branch July 17, 2026 01:00
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.

🔧 Decouple core and users views from optional modules

1 participant