eat: implement strict migration import version compatibility policy#358
Open
Abidoyesimze wants to merge 19 commits intoRemitwise-Org:mainfrom
Open
eat: implement strict migration import version compatibility policy#358Abidoyesimze wants to merge 19 commits intoRemitwise-Org:mainfrom
Abidoyesimze wants to merge 19 commits intoRemitwise-Org:mainfrom
Conversation
…ls")) for wasm builds
…ce_split testutils feature
…or flow validation
Contributor
|
@Abidoyesimze Please resolve the conflicts |
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
Introduces an explicit allow/deny policy for data migration imports with deterministic behavior across forward, backward, and unsupported schema versions. Ensures imports fail closed by default and surface precise error classes.
Motivation
Prevent accidental acceptance of unreviewed schema versions
Provide deterministic, auditable import decisions
Make emergency version blocks possible without code changes to logic
What’s changed
Added explicit policy and evaluator in data_migration/src/lib.rs:
Constants: SCHEMA_VERSION, MIN_SUPPORTED_VERSION, ALLOWED_IMPORT_VERSIONS, DENIED_IMPORT_VERSIONS
Enum: VersionCompatibility (Allowed, DeniedByPolicy, UnsupportedLegacy, UnsupportedFuture)
Functions:
evaluate_version_compatibility(version: u32) -> VersionCompatibility
check_version_compatibility(version: u32) -> Result<(), MigrationError>
Import flow validates version before checksum for fast, deterministic failures
Added/expanded unit tests covering policy edges and behavior
Documented policy and security rationale in README.md (Data Migration Import Version Policy section)
Policy decision order
Current policy values
MIN_SUPPORTED_VERSION = 1
SCHEMA_VERSION = 1
ALLOWED_IMPORT_VERSIONS = [1]
DENIED_IMPORT_VERSIONS = []
Security considerations
Default-deny for unknown in-range versions
Deny-list precedence enables emergency blocks
Deterministic error classes improve monitoring and incident response
Version checks run before checksum to short-circuit unsupported snapshots
Testing
Unit tests: cargo test -p data_migration
11 tests, all passing
Covers checksum round-trip, JSON/binary import, CSV import for goals, forward/backward rejections, deny precedence, and error message stability
Documentation
Updated README.md with the import policy, decision order, current constants, and security notes.
Backward compatibility
No breaking changes to external contract APIs. Import behavior is now explicitly defined and fail-closed for non-allowed versions.
closes #320