refactor: modularize schemas into schemas/runtime and schemas/graph #3038
+878
−1,280
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.
Description
Centralize schema definitions into dedicated subpackages (
schemas/runtime/andschemas/graph/) for better reusability, separation of concerns, and cleaner imports. This refactor creates a single source of truth for data shapes while keeping behavior in the original modules.Type of Change
Related Issues
Fixes #1568
Changes Made
New Schema Structure
schemas/runtime/- Runtime execution schemasdecision.py- Decision, DecisionType, Option, Outcome, DecisionEvaluationrun.py- Run, RunStatus, RunMetrics, RunSummary, Problemschemas/graph/- Graph definition schemasgoal.py- Goal, GoalStatus, SuccessCriterion, Constraintnode.py- NodeSpecedge.py- EdgeCondition, EdgeSpec, AsyncEntryPointSpec, GraphSpecplan.py- Plan, PlanStep, ActionSpec, ActionType, StepStatus, Judgment, and related typesKey Refactoring
graph/edge.pynow subclassesEdgeSpec/GraphSpecfrom schemas and adds behavior methods (should_traverse,validate,get_node, etc.)graph/goal.py,graph/node.py,graph/plan.pyre-export from schemas for backward compatibilityschemas/__init__.pyre-exports all types as a single entry pointruntime/,storage/,builder/, andtests/to useframework.schemasBenefits
from framework.graph.* import ...still workTesting
cd core && pytest tests/) - 438 tests passingruff check)ruff format --check)Checklist
Import Examples
Single entry point for all schemas
from framework.schemas import Decision, Run, Goal, Plan, GraphSpec
Domain-specific imports
from framework.schemas.runtime import Decision, RunStatus
from framework.schemas.graph import Goal, Plan, EdgeSpec
Backward compatible (still works)
from framework.graph.edge import EdgeSpec, GraphSpec
from framework.graph.goal import Goal
from framework.graph.plan import Plan