fix: stop storing JSON null in runtime_variants.default_model_definition#13009
Merged
Conversation
Runtime variants created through the create API stored a JSON null in the
NOT NULL default_model_definition column: the creator never set the
attribute and SQLAlchemy's JSON type serializes Python None as JSON null
rather than SQL NULL. Such rows load back as None and fail the required
node conversion with a 400 since the field became part of the v2 node.
- Seed an empty ModelDefinitionDraft ({} with exclude_unset) in
RuntimeVariantCreatorSpec.build_row()
- Backfill already-materialized JSON null rows to {} via a new data
migration (a0a28251f296)
- Fix scheduling_history component conftest: MagicMock(spec=ActionValidators)
rejects the rbac attribute (dataclass field without default), which broke
all tests once SchedulingHistoryProcessors started wiring
validators.rbac.scope; construct a real ActionValidators with mocked
RBACValidators instead
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
seedspirit
approved these changes
Jul 22, 2026
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
nullin the NOT NULLdefault_model_definitioncolumn: the creator never set the attribute, and SQLAlchemy's JSON type serializes PythonNoneas JSONnull(not SQLNULL), slipping past the constraint. Such rows load back asNoneand fail the v2 node conversion with a 400 once the field became required inRuntimeVariantNode(feat(BA-6942): expose runtime variant model defaults #12970). The creator now seeds an emptyModelDefinitionDraft(stored as{}, consistent with the exclude_unset write path from fix(install): point PACKAGE scaling_group at the app-proxy coordinator #12872), and a new data migration (a0a28251f296) backfills already-materialized JSONnullrows.MagicMock(spec=ActionValidators)rejects therbacattribute (a dataclass field without a default is not a class attribute), which broke all 12 tests at fixture setup onceSchedulingHistoryProcessorsstarted wiringvalidators.rbac.scope(feat(BA-6891): add kernel scheduling-history v2 DTOs and service actions #12869). Construct a realActionValidatorswith mockedRBACValidatorsinstead, following the existing artifact_revision conftest pattern.Test plan
tests/component/runtime_variant/test_runtime_variant_crud.py— previously 6/7 failing, now passestests/component/scheduling_history/test_scheduling_history.py— previously 12/12 setup errors, now passestests/unit/manager/api/adapters/test_runtime_variant_adapter.pypasses'null'::jsonbrow,alembic upgrade headconverts it to{}while leaving seeded variants untouched;downgrade -1/ re-upgraderound-trip OK🤖 Generated with Claude Code