Record original-alignment implementation and traceability checkpoint
Capture current source, content data, tests, asset licenses, and original-specification traceability. Original implementation remains incomplete. The accepted matching UI generation passed 154 suites and 12,253 checks, with eight rendered staff-contract screens reviewed. Latest native Windows and full-original acceptance remain outstanding.
This commit is contained in:
@@ -367,12 +367,27 @@ static func migrate_save(
|
||||
return _complete_timed_operation(result, &"save", started_at_us)
|
||||
|
||||
|
||||
## Domain migrations keep the package format version but still require the
|
||||
## same checksum-verified backup and atomic promotion as format migrations.
|
||||
## The caller validates domain invariants before supplying the candidate.
|
||||
static func replace_snapshot_with_backup(save_path: String, expected: Dictionary, candidate: Dictionary) -> Dictionary:
|
||||
if expected.is_empty() or candidate.is_empty():
|
||||
return _failure(&"MIGRATION_SNAPSHOT_REQUIRED", save_path)
|
||||
var validation := SimulationSnapshot.validate(candidate)
|
||||
if not validation[&"ok"]:
|
||||
return _failure(&"MIGRATION_INVALID_SNAPSHOT", ", ".join(validation[&"errors"]))
|
||||
var started := Time.get_ticks_usec()
|
||||
return _complete_timed_operation(_migrate_save_impl(save_path, null, FORMAT_VERSION, expected, candidate), &"save", started)
|
||||
|
||||
|
||||
static func _migrate_save_impl(
|
||||
save_path: String,
|
||||
registry: SaveMigrationRegistry,
|
||||
target_version: int
|
||||
target_version: int,
|
||||
expected_snapshot: Dictionary = {},
|
||||
replacement_snapshot: Dictionary = {}
|
||||
) -> Dictionary:
|
||||
if registry == null:
|
||||
if registry == null and replacement_snapshot.is_empty():
|
||||
return _failure(&"MIGRATION_REGISTRY_REQUIRED", save_path)
|
||||
var resolved := _resolve_safe_save_path(save_path)
|
||||
if not resolved[&"ok"]:
|
||||
@@ -410,7 +425,14 @@ static func _migrate_save_impl(
|
||||
var from_version := int(source[&"manifest"].get("format_version", -1))
|
||||
if target_version < from_version:
|
||||
return _failure(&"MIGRATION_DOWNGRADE_UNSUPPORTED", "%d -> %d" % [from_version, target_version])
|
||||
if target_version == from_version:
|
||||
if not replacement_snapshot.is_empty():
|
||||
if from_version != target_version:
|
||||
return _failure(&"FORMAT_MIGRATION_REQUIRED", save_path)
|
||||
if source[&"snapshot"] == replacement_snapshot:
|
||||
return {&"ok": true, &"code": &"ALREADY_CURRENT", &"backup_created": false, &"path": save_path}
|
||||
if source[&"snapshot"] != expected_snapshot:
|
||||
return _failure(&"MIGRATION_SOURCE_CHANGED", save_path)
|
||||
if target_version == from_version and replacement_snapshot.is_empty():
|
||||
var current_validation := SimulationSnapshot.validate(source[&"snapshot"])
|
||||
if target_version == FORMAT_VERSION and not current_validation[&"ok"]:
|
||||
return _failure(&"INVALID_SNAPSHOT", ", ".join(current_validation[&"errors"]))
|
||||
@@ -427,7 +449,12 @@ static func _migrate_save_impl(
|
||||
&"manifest": source[&"manifest"].duplicate(true),
|
||||
&"snapshot": source[&"snapshot"].duplicate(true),
|
||||
}
|
||||
var migrated := registry.migrate(payload, from_version, target_version)
|
||||
var migrated: Dictionary
|
||||
if replacement_snapshot.is_empty():
|
||||
migrated = registry.migrate(payload, from_version, target_version)
|
||||
else:
|
||||
payload[&"snapshot"] = replacement_snapshot.duplicate(true)
|
||||
migrated = {&"ok": true, &"data": payload, &"applied_migration_ids": [&"domain_snapshot_replacement"]}
|
||||
if not migrated[&"ok"]:
|
||||
return _with_context(migrated, {
|
||||
&"path": save_path,
|
||||
|
||||
Reference in New Issue
Block a user