Deep review and refactor#5198
Draft
IvanIvanoff wants to merge 3 commits into
Draft
Conversation
Replace direct cross-module access from the web/transport layer with
thin context-module facades, following the Phoenix context pattern.
Resolvers and LiveViews now talk to a single domain entry point per
concern instead of reaching into 3–5 sibling modules.
Changes
* Sanbase.AI.ContentCandidates
- Drop raw Repo/Ecto.Query usage from ai_description_live.ex
- Replace 13 inline queries with 6 context calls
(list/4, pending_ids/2, count/2, override_descriptions/2,
search_users/1, get_user/1)
* Sanbase.Insights
- New facade hiding Insight.Post, PostImage, ImageUrl,
PopularAuthor, Category, Tag
- insight_resolver.ex shrunk from 312 to 141 LOC, now thin
transport
- Moves resolve_post_images and rate-limited create_post into
the context
* Sanbase.Billing hides Stripe
- 8 new wrappers: refresh_subscription_payment_intent,
list_payments, retrieve_coupon, upcoming_invoice,
default_payment_instrument, update_default_payment_instrument,
delete_default_payment_instrument, create_setup_intent,
san_credit_balance
- Move transform_payments and choose_default_card into Billing
- billing_resolver.ex: drop alias Sanbase.StripeApi; all
StripeApi callsites routed through Billing
* Sanbase.MetricRegistry facade
- New module re-exporting Registry, Sync, ChangeSuggestion,
Category, UIMetadata, MetricVersions surface area
- metric_display_order_resolver.ex migrated to the facade
- Admin LiveView migration intentionally deferred to a
follow-up sweep
* Sanbase.Changelog + Webinars rename
- New Sanbase.Changelog unifies MetricVersions and
ProjectVersions changelog reads
- changelog_resolver.ex routes both metric and asset
changelogs through the facade
- Rename Sanbase.Webinar -> Sanbase.Webinars.Webinar across
webinar.ex, registration.ex, generic_admin/webinar.ex,
webinar_resolver.ex, test/support/factory/factory.ex
The MetricRegistry façade shipped 27 delegates but only 4 have a consumer (metric_display_order_resolver); drop the 23 unused ones so the façade reflects its actual call sites. Likewise remove the unused Insights.pulse?/1 delegate — pulse_text/1 calls Post.pulse?/1 directly and nothing else references it. Behavior-preserving: no call site referenced the removed functions (verified by grep + a full test run across the touched facades). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
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.
Changes
Add context modules / facades
Refactor (thin the web layer onto the facades)
linked_user.
Rename / move
Cleanup