Drive every phase in ``EMISSION_PHASES`` and return the full set of file writes the codegen would perform. No I/O side effects on disk — diagnostics print to stderr at the end.
(
schema: Dict[str, Any],
rules: Dict[str, Any],
mjxmacro: Dict[str, Any],
public_root: str,
private_root: str,
bind_h_path: str,
mjspec: Dict[str, Any] | None = None,
)
| 3913 | ) |
| 3914 | |
| 3915 | |
| 3916 | def _phase_bind_h(ctx: PhaseContext) -> None: |
| 3917 | bind_write = emit_bind_h_injection(ctx.rules, ctx.mjxmacro, ctx.bind_h_path) |
| 3918 | if bind_write: |
| 3919 | ctx.writes.append(bind_write) |
| 3920 | |
| 3921 | |
| 3922 | def _phase_schema_tests(ctx: PhaseContext) -> None: |
| 3923 | ctx.writes.append(emit_schema_for_tests(ctx.schema, ctx.rules)) |
| 3924 | |
| 3925 | |
| 3926 | # The 17 drift checks, _emit_drift_diagnostics, the hand-enum regexes, |
| 3927 | # _scan_hand_enums, _hand_enums_from_snapshot, _all_schema_attrs, |
| 3928 | # _collect_every_schema_attr, and _VALID_APPLY_MODES live in |
| 3929 | # _codegen_checks. The orchestrator re-exports them through the import |
| 3930 | # block at the top of this file. |
| 3931 | |
| 3932 | |
| 3933 | def _phase_diagnostics(ctx: PhaseContext) -> None: |
| 3934 | rules, schema, mjspec, mjxmacro = ctx.rules, ctx.schema, ctx.mjspec, ctx.mjxmacro |
| 3935 | _emit_drift_diagnostics(schema, rules, mjspec) |
| 3936 | _check_hand_enum_drift(schema, rules, mjspec, ctx.public_root) |
| 3937 | _check_type_shape_drift(schema, rules, mjspec) |
| 3938 | _check_new_attr_typing(schema, rules) |
| 3939 | _check_value_map_stale_mj_consts(rules, mjspec) |
| 3940 | _check_orphan_rule_entries(schema, rules) |