cursus.validation.alignment.validators.registry_binding_validator¶
B3 — Registry-Binding Validator (FZ 31e1d3g3 Phase D, the reframed Level-4).
The old Level-4 step-type validators did SOURCE-LEVEL contract testing — inspect.getsource(
builder_class) substring scans + hasattr(builder_class, "_create_estimator") method-presence
checks — on the assumption that each step had a hand-written per-step builder whose Python source
embodied the contract. Against the shared TemplateStepBuilder shell (all 45 builders are
class XStepBuilder(TemplateStepBuilder): STEP_NAME = "X") those checks are meaningless: the source
is identical for every step, and hasattr(shell, "_create_estimator") is FALSE because the estimator
factory lives in TrainingHandler.make_compute, not the shell — so the old validators report EVERY
shell as FAILED (“Missing Training required method: _create_estimator”).
B3 replaces “does the builder SOURCE contain pattern X” with “can the step be REALIZED from its
.step.yaml + config” — the genuine residue the construction invariant can’t self-check:
- B3-1 HANDLER BINDS —
resolve_handler(sagemaker_step_type, patterns.step_assembly)yields aroutable construction handler (raises
NoBuilderErrorfor Base/Lambda/unknown). Calling it IS the binding check that replaces the source scan.- B3-2 BUILDER LOADABLE —
load_builder_class(step_name)returns a class that is a StepBuilderBase(the shell or the synthesized declarative shell), i.e. no orphan registry row.
- B3-3 CONFIG-FIELD COVERAGE — the resolved config class supplies every field the bound handler +
compute descriptor will read at build time. The required set is the handler’s declared
requires_config_fields(DATA — some reads use a runtime attr name, statically undecidable) UNION the descriptor-derived attrs (compute*_fieldnames with non-None values;contract.input_source_overridesvalues). A field absent from the config class = ERROR; a softjob_arguments[].sourceprovenance attr = WARNING. (Optional config fields that carry a default are NOT requirements — a missing value can’t breakgetattr.)
- class RegistryBindingValidator(workspace_dirs=None)[source]¶
Bases:
objectB3: validate that a step is realizable from its registry row +
.step.yaml+ config.Exposes
validate_builder_config_alignment(step_name)— the same method name/signature the deleted per-step-type validators exposed — solevel_validators.run_level_4_validationand the MCP/CLI consumers are byte-unchanged.