You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Refactor: Combine functionality of Plan and Plan model #1728
The distinction between the bluesky type Plan and the api model PlanModel was created to ensure a seperation of concerns between the
plans that the context uses for running plans and the serializable
representation required for the rest api. However in practice this 'Plan'
is already as a model as the plan functions are stored with it. It does
not provide a useful distinction and adds an extra model that we don't
need.
We can instead unify to
class BlueapiPlan(BlueapiBaseModel):
"""
A plan that can be run
"""
name: str = Field(description="Referenceable name of the plan")
description: str | None = Field(
description="Description/docstring of the plan", default=None
)
model: type[BaseModel] = Field(
description="Validation model of the parameters for the plan"
)
def to_model(self) -> dict[str, Any]:
return {
"name": self.name,
"parameter_schema": self.model.model_json_schema(),
"description": self.description,
}
Where the to_model does the logic in the current PlanModel for
creating it's self from the current bluesky_type.Plan for rest.
There are pro's and cons to the naming of this class. I have gone with BlueapiPlan to make it distinct from both the raw plan and the model
for human readability reasons. This will help with unification with the
device refactor and we can change it later if it is contentious.
Acceptance Criteria
The PlanModel in model is removed and the logic for creating it is
stored with the plan in the context.
From discussions around trying to implement this, we should keep the Plan and PlanModel types separate. They serve different purposes and lets us separate the REST interface and client code from the internals of the server. Expanding the current Plan type still lets us improve the plan handling in the context.
Activity
tpoliaw commentedon Nov 9, 2026
From discussions around trying to implement this, we should keep the
PlanandPlanModeltypes separate. They serve different purposes and lets us separate the REST interface and client code from the internals of the server. Expanding the currentPlantype still lets us improve the plan handling in the context.