Skip to content

[RFC 0005] JSON Schema Versioning and Migration #405

Description

@andrewherren
  • Define a current schema-version constant in both R and Python; keep them in sync (cross-platform fixtures guard agreement). schema_version = 1 is added to output in WS1.
  • Reader rules in each language: v == current parse; v < current run the ladder then parse; v > current hard error (upgrade message); v absent → legacy (v0).
  • Parser augmentation: default every optional field reliably. This handles additive within-version drift (no rung needed) and is what keeps rungs rare — forward-compatibility rests here, not on the ladder.
  • Migration rungs (per-language, pure JSON→JSON): only for non-additive changes (rename / remove / re-type / structural-convention). At 0.5.0 the ladder is exactly one rung, v0 -> v1.
  • v0 sub-classifier: keep/extend the existing R + Python field-presence heuristic (inferStochtreeJsonVersion / _infer_stochtree_version); normalize legacy brackets to a single legacy_format_id.
  • Explicit supported floor: reject "unknown" / too-old legacy with a clear message (no best-effort parse).
  • migrate_v0_to_v1 (platform-aware, in each language): infer source platform from structural fingerprints (preprocessor_metadata+no covariate_preprocessor ⇒ R; covariate_preprocessor ⇒ Python; rfx_unique_group_ids corroborates R; documented fallback); augment missing legacy fields; apply renames/removals; compute cross_platform_portable. Leaves native covariate_preprocessor in place (renamed, not restructured).
  • Every rung ≥ v1 is platform-agnostic and operates on the unified format.
  • Forest container: independent internal version (handled by existing C++ ForestContainer serde), decoupled from envelope schema_version.
  • Nested recursion: migration recurses into BCF bart_propensity_model.
  • infer_stochtree_version / infer_stochtree_platform helpers (already R/Python today; keep).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions