Skip to content

refactor(BA-6630): move scheduler value types to the data layer to cut sokovan↔repositories cycles#12438

Draft
fregataa wants to merge 4 commits into
mainfrom
refactor/BA-6630-session-creation-types
Draft

refactor(BA-6630): move scheduler value types to the data layer to cut sokovan↔repositories cycles#12438
fregataa wants to merge 4 commits into
mainfrom
refactor/BA-6630-session-creation-types

Conversation

@fregataa

Copy link
Copy Markdown
Member

Summary

Removes the cross-layer import cycle between manager/sokovan and manager/repositories/scheduler by relocating shared value types (data) out of the logic layers into data/, and moving the logic that lived on those data types into its callers.

Three focused commits:

  1. session-creation types → data/session/creationImageInfo, ContainerUserInfo, ScalingGroupNetworkInfo, DeploymentContext (+ its UserContext/ContainerUserContext/ImageContext/ResolvedPresetValues helpers). The sokovan scheduling-controller rule modules now depend on data/, not repositories/.
  2. sokovan.data package → data.sokovan — so repositories/scheduler no longer imports the sokovan package for its value objects. To keep data/ free of upward imports, SessionAllocation.from_agent_selections (which referenced the selector-layer AgentSelection) was dropped and its logic moved into its only caller, SessionProvisioner._build_session_allocation.
  3. remaining repositories/scheduler → sokovan back-edges — relocated AgentInfo and HandlerSessionData/HandlerKernelData into data/sokovan, and moved AgentInfo.from_meta_and_occupancy into its only caller, SessionProvisioner._build_agent_info.

Net result: repositories/scheduler → sokovan (logic) import edges = 0. Data flows downward only; the moved data types keep their plain-@dataclass style consistent with the existing data/sokovan package.

Principle applied throughout: data modules hold types only — no logic. Factory methods that referenced upper layers were moved to their (single) callers.

Out of scope (follow-up)

repositories/fair_share and repositories/resource_usage_history still import sokovan.scheduler.fair_share result types (4 TYPE_CHECKING edges) — same pattern, separate change.

Test plan

  • pants fmt / fix / lint (incl. visibility) pass
  • pants check (mypy, full) passes
  • pants test (CI)

Resolves BA-6630

fregataa and others added 2 commits June 27, 2026 00:54
Move ImageInfo, ContainerUserInfo, ScalingGroupNetworkInfo and
DeploymentContext (with its UserContext/ContainerUserContext/ImageContext/
ResolvedPresetValues helpers) from repositories/scheduler/types/session_creation
to data/session/creation, so the sokovan scheduling-controller rule modules
depend on data/ instead of repositories/ and leave the cross-layer import cycle.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Relocate sokovan/data/ to data/sokovan/ so repositories/scheduler stops
importing the sokovan package for its value objects (the cross-layer
back-edge). To keep data/ free of upward imports, drop the
SessionAllocation.from_agent_selections factory (which referenced the
selector-layer AgentSelection type) and move that logic into its only
caller, SessionProvisioner._build_session_allocation.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added the size:L 100~500 LoC label Jun 26, 2026
fregataa added a commit that referenced this pull request Jun 26, 2026
@github-actions github-actions Bot added the comp:manager Related to Manager component label Jun 26, 2026
fregataa and others added 2 commits June 27, 2026 05:34
…a layer

Cut the remaining repositories/scheduler -> sokovan back-edges by relocating
AgentInfo and HandlerSessionData/HandlerKernelData into data/sokovan, and move
the AgentInfo.from_meta_and_occupancy factory into its only caller,
SessionProvisioner._build_agent_info.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@fregataa fregataa force-pushed the refactor/BA-6630-session-creation-types branch from e5d40a4 to 9d9bc02 Compare June 26, 2026 20:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp:manager Related to Manager component size:L 100~500 LoC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant