Guard cellular profile migration recovery
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 1m53s
Foundation / checks (client) (push) Successful in 13m29s
Foundation / checks (network) (push) Successful in 14m48s
Foundation / checks (tsan) (push) Successful in 8m19s
Foundation / checks (postgres) (push) Failing after 20m2s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (checks) (push) Canceled after 34m44s

This commit is contained in:
dingo
2026-10-11 11:58:15 -04:00
parent 290c9501cd
commit 6a99d31b6e
2 changed files with 21 additions and 13 deletions
+14 -13
View File
@@ -428,11 +428,12 @@ recover_cellular_checkpoint(Postgres& db, const FilesystemObjectStore& objects,
auto migration = load_cellular_profile_migration(db, key, lease, manifest->commit, timeout);
if (!migration)
return std::unexpected{RecoveryFailure{RecoveryError::store, migration.error()}};
if (!*migration || (*migration)->target_sequence != manifest->sequence ||
(*migration)->target_commit != manifest->commit ||
(*migration)->target_manifest_sha256 != *digest ||
(*migration)->target_payload_sha256 != manifest->payload_sha256 ||
(*migration)->target_sequence == 0)
const auto migration_record = migration->value_or(CellularProfileMigrationRecord{});
if (!*migration || migration_record.target_sequence != manifest->sequence ||
migration_record.target_commit != manifest->commit ||
migration_record.target_manifest_sha256 != *digest ||
migration_record.target_payload_sha256 != manifest->payload_sha256 ||
migration_record.target_sequence == 0)
return fail_with(RecoveryError::history);
auto predecessor = load_region_commit(db, key, manifest->sequence - 1, timeout);
if (!predecessor)
@@ -453,15 +454,15 @@ recover_cellular_checkpoint(Postgres& db, const FilesystemObjectStore& objects,
((source_manifest->cellular_versions == cellular_v1_versions) !=
(manifest->cellular_versions == cellular_v2_versions)) ||
source_manifest->end_tick != manifest->end_tick ||
(*migration)->source_sequence != source_manifest->sequence ||
(*migration)->source_commit != source_manifest->commit ||
(*migration)->source_manifest_sha256 != *source_manifest_digest ||
(*migration)->source_payload_sha256 != source_manifest->payload_sha256 ||
(*migration)->source_versions.size() != 36 ||
!std::ranges::equal((*migration)->source_versions,
migration_record.source_sequence != source_manifest->sequence ||
migration_record.source_commit != source_manifest->commit ||
migration_record.source_manifest_sha256 != *source_manifest_digest ||
migration_record.source_payload_sha256 != source_manifest->payload_sha256 ||
migration_record.source_versions.size() != 36 ||
!std::ranges::equal(migration_record.source_versions,
std::span{*source_manifest_bytes}.subspan(160, 36)) ||
(*migration)->target_versions.size() != 36 ||
!std::ranges::equal((*migration)->target_versions,
migration_record.target_versions.size() != 36 ||
!std::ranges::equal(migration_record.target_versions,
std::span{*target_manifest_bytes}.subspan(160, 36)))
return fail_with(RecoveryError::history);
auto source_bytes =