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
Draft
refactor(BA-6630): move scheduler value types to the data layer to cut sokovan↔repositories cycles#12438fregataa wants to merge 4 commits into
fregataa wants to merge 4 commits into
Conversation
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>
…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>
e5d40a4 to
9d9bc02
Compare
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.
Summary
Removes the cross-layer import cycle between
manager/sokovanandmanager/repositories/schedulerby relocating shared value types (data) out of the logic layers intodata/, and moving the logic that lived on those data types into its callers.Three focused commits:
data/session/creation—ImageInfo,ContainerUserInfo,ScalingGroupNetworkInfo,DeploymentContext(+ itsUserContext/ContainerUserContext/ImageContext/ResolvedPresetValueshelpers). The sokovan scheduling-controller rule modules now depend ondata/, notrepositories/.sokovan.datapackage →data.sokovan— sorepositories/schedulerno longer imports thesokovanpackage for its value objects. To keepdata/free of upward imports,SessionAllocation.from_agent_selections(which referenced the selector-layerAgentSelection) was dropped and its logic moved into its only caller,SessionProvisioner._build_session_allocation.repositories/scheduler → sokovanback-edges — relocatedAgentInfoandHandlerSessionData/HandlerKernelDataintodata/sokovan, and movedAgentInfo.from_meta_and_occupancyinto 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-@dataclassstyle consistent with the existingdata/sokovanpackage.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_shareandrepositories/resource_usage_historystill importsokovan.scheduler.fair_shareresult types (4 TYPE_CHECKING edges) — same pattern, separate change.Test plan
pants fmt/fix/lint(incl. visibility) passpants check(mypy, full) passespants test(CI)Resolves BA-6630