20260731 完善verification-only 回放 (#118/#137)

This commit is contained in:
2026-07-31 23:04:16 +08:00
parent f7f80fe684
commit f6a2d3a593
12 changed files with 1398 additions and 71 deletions

View File

@@ -3426,6 +3426,45 @@ fn runner_when_repo_sync_fails_uses_current_instance_vcir_and_keeps_children_emp
.any(|w| w.message.contains("repo sync failed")),
"expected warning about repo sync failure"
);
// Verification-only replays have the frozen repository bytes available,
// so a fresh read would succeed and never naturally enter the fallback
// branch. A contract-selected URI must therefore select the same VCIR
// projection without attempting fresh manifest/object validation.
let mut forced_policy = policy.clone();
forced_policy
.verification_forced_vcir_reuse_manifest_uris
.insert(manifest_rsync_uri.clone());
let forced_runner = Rpkiv1PublicationPointRunner {
store: &store,
policy: &forced_policy,
http_fetcher: &NeverHttpFetcher,
rsync_fetcher: &LocalDirRsyncFetcher::new(&fixture_dir),
validation_time,
timing: None,
download_log: None,
replay_archive_index: None,
replay_delta_index: None,
rrdp_dedup: false,
rrdp_repo_cache: Mutex::new(HashMap::new()),
rsync_dedup: false,
rsync_repo_cache: Mutex::new(HashMap::new()),
current_repo_index: None,
repo_sync_runtime: None,
parallel_phase2_config: None,
parallel_roa_worker_pool: None,
ccr_accumulator: None,
persist_vcir: true,
enable_roa_validation_cache: false,
enable_child_certificate_validation_cache: false,
publication_point_cache_observe_only: false,
enable_publication_point_validation_cache: false,
};
let forced = forced_runner
.run_publication_point(&handle)
.expect("contract-selected fallback should reuse current-instance VCIR");
assert_eq!(forced.source, PublicationPointSource::VcirCurrentInstance);
assert!(forced.discovered_children.is_empty());
}
#[test]
@@ -4807,17 +4846,18 @@ fn build_publication_point_audit_from_vcir_restores_reject_reason_with_legacy_fa
assert!(audit.objects.iter().any(|entry| {
entry.rsync_uri == "rsync://example.test/repo/issuer/rejected-with-reason.roa"
&& matches!(entry.result, AuditObjectResult::Error)
&& entry.detail.as_deref()
== Some("EE certificate path validation failed: test")
&& entry.detail.as_deref() == Some("EE certificate path validation failed: test")
}));
assert!(audit.objects.iter().any(|entry| {
entry.rsync_uri == "rsync://example.test/repo/issuer/rejected-legacy.roa"
&& matches!(entry.result, AuditObjectResult::Error)
&& entry.detail.as_deref() == Some(CACHED_REJECT_REASON_NOT_RECORDED)
}));
assert!(audit.objects.iter().all(|entry| {
!matches!(entry.result, AuditObjectResult::Ok) || entry.detail.is_none()
}));
assert!(
audit.objects.iter().all(|entry| {
!matches!(entry.result, AuditObjectResult::Ok) || entry.detail.is_none()
})
);
}
#[test]
@@ -4897,8 +4937,7 @@ fn build_publication_point_audit_from_pp_cache_projection_restores_reject_reason
assert!(audit.objects.iter().any(|entry| {
entry.rsync_uri == "rsync://example.test/repo/issuer/rejected-with-reason.roa"
&& matches!(entry.result, AuditObjectResult::Error)
&& entry.detail.as_deref()
== Some("EE certificate path validation failed: test")
&& entry.detail.as_deref() == Some("EE certificate path validation failed: test")
}));
assert!(audit.objects.iter().any(|entry| {
entry.rsync_uri == "rsync://example.test/repo/issuer/rejected-legacy.roa"