Save The Tree implementation and acceptance work in progress
Preserve production code, regression fixtures, audio assets and provenance, test infrastructure, and the original-completion plan and progress ledger. Final game and Windows acceptance remain pending; excluded local artifacts and native experiments are not part of this snapshot.
This commit is contained in:
@@ -25,6 +25,7 @@ func _run() -> void:
|
||||
_test_current_format_snapshot_validation()
|
||||
_test_save_package_migration_and_pre_migration_backup()
|
||||
_test_migration_failure_preserves_source()
|
||||
_test_migration_hold_precedes_ordinary_backup()
|
||||
if _failures == 0:
|
||||
print("PASS: %d checks" % _checks)
|
||||
else:
|
||||
@@ -582,3 +583,30 @@ func _expect(condition: bool, label: String) -> void:
|
||||
return
|
||||
_failures += 1
|
||||
push_error(" ✗ %s" % label)
|
||||
|
||||
func _test_migration_hold_precedes_ordinary_backup() -> void:
|
||||
for promoted: bool in [false, true]:
|
||||
for entry: String in ["load", "inspect"]:
|
||||
var slot := "user://saves/s6_migration_priority_%s_%s" % [str(promoted), entry]
|
||||
var candidate_slot := slot + "_candidate"
|
||||
SaveServiceType.delete_save(slot); SaveServiceType.delete_save(candidate_slot)
|
||||
var previous := _snapshot(90, &"previous_ordinary")
|
||||
var original := _snapshot(100, &"migration_original")
|
||||
var candidate := _snapshot(110, &"migration_candidate")
|
||||
_expect(SaveServiceType.save_snapshot(slot, previous)[&"ok"], "migration priority previous formal")
|
||||
_expect(SaveServiceType.save_snapshot(slot, original)[&"ok"], "migration priority real ordinary backup")
|
||||
_expect(SaveServiceType.save_snapshot(candidate_slot, candidate)[&"ok"], "migration priority verified candidate")
|
||||
var target := ProjectSettings.globalize_path(slot)
|
||||
_copy_fixture_tree(target, target + SaveServiceType.MIGRATION_BACKUP_SUFFIX)
|
||||
_expect(DirAccess.rename_absolute(target, target + ".migration.original") == OK, "migration source actually held")
|
||||
_copy_fixture_tree(ProjectSettings.globalize_path(candidate_slot), target if promoted else target + ".migration.tmp")
|
||||
var ordinary_world_before := FileAccess.get_file_as_bytes((target + ".bak").path_join(SaveServiceType.WORLD_FILE))
|
||||
var loaded: Dictionary = SaveServiceType.load_snapshot(slot) if entry == "load" else SaveServiceType.inspect_recovery_candidates(slot)
|
||||
_expect(loaded[&"ok"], "migration-owned recovery succeeds via " + entry)
|
||||
_expect(SaveServiceType.inspect_snapshot(slot).get(&"snapshot", {}) == candidate, "migration candidate outranks stale ordinary backup")
|
||||
_expect(FileAccess.get_file_as_bytes((target + ".bak").path_join(SaveServiceType.WORLD_FILE)) == ordinary_world_before, "migration recovery never moves ordinary backup")
|
||||
_expect(SaveServiceType.load_recovery_candidate(slot, &"backup").get(&"snapshot", {}) == previous, "ordinary backup whole snapshot unchanged")
|
||||
_expect(SaveServiceType.load_recovery_candidate(slot, &"pre_migration_backup").get(&"snapshot", {}) == original, "migration backup whole original unchanged")
|
||||
_expect(not DirAccess.dir_exists_absolute(target + ".migration.original") and not DirAccess.dir_exists_absolute(target + ".migration.tmp"), "verified migration clears only owned crash markers")
|
||||
_expect(SaveServiceType.load_snapshot(slot).get(&"snapshot", {}) == candidate, "repeated migrated load exact")
|
||||
SaveServiceType.delete_save(slot); SaveServiceType.delete_save(candidate_slot)
|
||||
|
||||
Reference in New Issue
Block a user