Who the dashboard is acting for, in the shape Lotus core expects.
Core accepts :context and :scope on every call that runs a query or
lists schema objects. :context reaches middleware and telemetry, :scope
reaches the visibility resolver and the cache key. The dashboard resolves
both at mount through Lotus.Web.Resolver and carries them as assigns;
this module turns those assigns into the option list core takes.
A nil context and a nil scope produce [], so an unscoped dashboard
calls core exactly as it did before an actor existed — same middleware
payloads, same cache keys.
Catching an actor that never arrived
A Phoenix.LiveComponent holds only what its parent passes, so a component
nobody handed the actor to calls core unscoped, and silently. Set
config :lotus_web, strict_actor: truein dev and test and opts/1 raises for assigns that carry no :context
key at all, which tells that mistake apart from a dashboard that has no actor
to give. Leave it off in production, where an unscoped call beats a crash.
Summary
Functions
Merge the actor options into an existing option list.
Build the :context / :scope options for a core call.
Resolve the actor for a user through the given resolver.
Types
Functions
Merge the actor options into an existing option list.
Options already present win, so a caller can override the actor for a single call.
Build the :context / :scope options for a core call.
Takes either the socket assigns or an explicit {context, scope} pair.
Keys whose value is nil are left out.
@spec resolve(module() | nil, Lotus.Web.Resolver.user()) :: {term(), term()}
Resolve the actor for a user through the given resolver.
Returns {context, scope}. Both are nil unless the resolver implements
Lotus.Web.Resolver.resolve_context/1 or
Lotus.Web.Resolver.resolve_scope/1.