Compatibility and Review Matrix#
Energon has several independent compatibility surfaces. Review a change against each surface instead of using “API compatible” as a synonym for “non-breaking.”
Compatibility surfaces#
Surface |
Examples of a breaking change |
|---|---|
Public Python API |
Removing or renaming an exported class, parameter, return field, or import path. |
Prepared dataset config |
Changing required |
Recipe config |
Changing YAML names, defaults, nesting behavior, subset meaning, or split resolution. |
Checkpoint |
Changing saved classes, fields, wrapper topology, restore keys, or required buffer state. |
Iteration order |
Changing sharding, shuffle, RNG consumption, blend selection, skip advancement, or permutation. |
A change can belong to more than one row. For example, moving a shuffle stage may be both checkpoint and iteration-order breaking without changing a public signature.
Public versus internal API#
Names exported by the top-level megatron.energon package form the primary public Python API. Documented
extension modules, such as the dataset factory provider interface, are also supported extension points even
if every implementation class is not exported at the top level. Other package internals may change, but
their effect on configuration, checkpoints, and ordering still requires review.
The deprecation module supports compatibility aliases for moved modules and symbols through import hooks and module attribute lookup. When moving a supported name:
add and document the new location;
keep an old import mapping when compatibility is intended;
emit the standard deprecation warning;
test both the new and deprecated imports;
state the removal window in release notes;
mark the pull request if the old path is removed immediately.
MetadatasetV2 remains a compatibility alias for the recipe system. This does not imply support for
obsolete v1 configuration.
Reproducible iteration#
For a fixed supported configuration and seed, iteration order is an explicit compatibility surface. Important building blocks include:
WorkerRng, whose state is saved and whose discrete choice avoids depending on changing framework implementations;FeistelPermutation, which creates a memory-constant bijection and uses cycle walking for non-power-of-two ranges;worker-to-shard assignment;
the number and position of random calls in wrappers and user hooks.
Changing a Feistel round function, number of rounds, seeding, or cycle-walking behavior changes the permutation even if every sample still appears once. Treat such a change as iteration-order breaking. Checkpoints only store the permutation seed, so it also breaks restoring an epoch in progress.
Avoid incidental RNG calls in logging, validation, or skipped paths. A random decision that affects the stream must use saved worker state.
Checkpoint compatibility#
Adding a field to _savable_fields, changing wrapper child structure, or changing restore-key shape can
break exact restoration. Recipe migration may still be able to preserve matched leaf progress, but that
does not make the exact checkpoint format compatible.
If an intentional migration is possible, add it explicitly and test both old-state input and new-state round trips. Never silently assign state after an ambiguous leaf match.
Review and test matrix#
Use the rows relevant to the change:
Area changed |
Required focused tests |
Also inspect |
|---|---|---|
Wrapper state or topology |
Save/restore tests in |
|
Recipe nodes or identities |
|
nested splits, typed subsets, ambiguous matches |
Worker assignment or RNG |
current-batch-index tests in |
distributed rank, exact ordering |
Dataset factory or format |
resolver and format-specific tests; |
preparation, stale indexes, |
Prepared metadata |
preparation and format reader tests |
old metadata fixtures and explicit versioning |
Packing or blending |
packing, grouping, and blending tests |
mid-buffer restore, metrics, RNG |
Public imports |
API and deprecation import tests |
|
Documentation |
|
warnings, links, generated API pages |
After focused tests, run the full suite with just test. Run just check before review and use just fix
to apply the repository’s standard formatting.
Pull request annotations#
Call out each applicable class of breakage in the pull request description:
CHECKPOINT BREAKING CHANGEITERATION ORDER BREAKING CHANGEAPI BREAKING CHANGEDATASET CONFIG BREAKING CHANGERECIPE CONFIG BREAKING CHANGE
Explain the affected versions or configurations, whether a migration exists, and which tests demonstrate the new behavior. Checkpoint compatibility has its own versioning implications; the other breaking surfaces normally require a major release.
Reviewer questions#
A reviewer should be able to answer:
Which compatibility rows can this change affect?
Does construction config remain stable and serializable?
Can state be saved with input consumed but output still pending?
Does reset produce the same state as a new construction?
Are random calls, worker mapping, and sample indexes unchanged?
Are old imports and configuration accepted, migrated, or rejected clearly?
Does remote storage behave like local storage where promised?
Do tests assert order and state, rather than only comparing sample sets?