fix(pi): bind native and prompt recovery to revisions

This commit is contained in:
SaladDay
2026-08-03 04:43:44 +00:00
parent c94983d5fa
commit 0b609158d7
10 changed files with 778 additions and 141 deletions
+44 -5
View File
@@ -620,6 +620,20 @@ impl ProxyService {
&self,
catalog_epoch: u64,
expected_native: Option<&crate::pi_config::document::PiProviderValuesSnapshot>,
) -> Result<Vec<String>, AppError> {
self.reconcile_pi_runtime_at_epoch_with_native_claim_precondition(
catalog_epoch,
expected_native,
None,
)
.await
}
pub(crate) async fn reconcile_pi_runtime_at_epoch_with_native_claim_precondition(
&self,
catalog_epoch: u64,
expected_native: Option<&crate::pi_config::document::PiProviderValuesSnapshot>,
expected_fingerprints: Option<&indexmap::IndexMap<String, String>>,
) -> Result<Vec<String>, AppError> {
#[cfg(test)]
if self.fail_next_pi_reconcile.swap(false, Ordering::AcqRel) {
@@ -631,10 +645,19 @@ impl ProxyService {
self.pi_runtime.close(catalog_epoch).await?;
if let Some(expected_native) = expected_native {
let models_path = crate::pi_config::native::get_pi_models_path()?;
crate::pi_config::document::verify_pi_provider_values(
&models_path,
&expected_native.values,
)?;
match expected_fingerprints {
Some(expected_fingerprints) => {
crate::pi_config::document::verify_pi_provider_preconditions(
&models_path,
&expected_native.values,
expected_fingerprints,
)?;
}
None => crate::pi_config::document::verify_pi_provider_values(
&models_path,
&expected_native.values,
)?,
}
}
return Ok(Vec::new());
}
@@ -660,6 +683,21 @@ impl ProxyService {
)?;
let models_path = crate::pi_config::native::get_pi_models_path()?;
let native_receipt = if build.projection_patch.is_empty() {
if let Some(expected_native) = expected_native {
match expected_fingerprints {
Some(expected_fingerprints) => {
crate::pi_config::document::verify_pi_provider_preconditions(
&models_path,
&expected_native.values,
expected_fingerprints,
)?;
}
None => crate::pi_config::document::verify_pi_provider_values(
&models_path,
&expected_native.values,
)?,
}
}
None
} else {
let expected = match expected_native {
@@ -690,9 +728,10 @@ impl ProxyService {
)?,
};
Some(
crate::pi_config::document::apply_pi_provider_patch_with_receipt(
crate::pi_config::document::apply_pi_provider_patch_with_receipt_and_fingerprints(
&models_path,
&expected,
expected_fingerprints,
&build.projection_patch,
)?,
)