chore: migrate scenarios to Pydantic — 40 classes, -658 LOC — completes migration (AC-489, AC-481)#599
Merged
jayscambler merged 2 commits intomainfrom Apr 1, 2026
Merged
Conversation
…C-481) Converted 40 dataclasses across 13 scenario files from @DataClass to Pydantic BaseModel. Eliminates ~684 lines of to_dict/from_dict. Files: simulation.py, workflow.py, tool_fragility.py, negotiation.py, schema_evolution.py, operator_loop.py, investigation.py, coordination.py, artifact_editing.py, world_state.py, templates/__init__.py, custom/spec.py, custom/family_classifier.py NOT converted (ABC hierarchies): - SimulationInterface, WorkflowInterface, etc. (abstract classes) - WorldStateManager, WorldStateStore (plain classes) - ActionSpec, Action, ActionResult, ActionRecord, EnvironmentSpec (kept as @DataClass — used with dataclasses.replace/asdict) TDD: Extended test_serde_conventions.py with scenarios module enforcement. 14 files changed, 196 insertions, 854 deletions (-658 net)
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
Final Pydantic migration batch — converted 40 scenario data classes to BaseModel. -658 LOC net. This completes the bulk of the to_dict/from_dict elimination.
Changes
13 files, 40 classes:
simulation.pyworkflow.pytool_fragility.pynegotiation.pyschema_evolution.pyoperator_loop.pyinvestigation.pycoordination.pyartifact_editing.pyworld_state.pytemplates/__init__.pycustom/spec.pycustom/family_classifier.pyKept as @DataClass
Pydantic Migration Complete
Verification
ruff check src— all checks passedmypy src— zero errorspytest tests/— all tests pass (1 pre-existing flaky heartbeat test excluded)Issues
Completes AC-489 and AC-481 for all major modules.