feat(recoverable-job): add consistency_batch (runs all consistency check)

This commit is contained in:
Edouard Vanbelle
2026-07-29 01:38:44 +02:00
parent 782a5c99bd
commit 41d83b3053
5 changed files with 274 additions and 7 deletions
+30
View File
@@ -1304,6 +1304,36 @@ impl AppServiceFactory {
.register_recoverable_job(&core.job_registry, &job_store_provider_dyn)
.await;
// Third recoverable-run tenant. Iterates `storage.files`
// and reports parent-folder-trashed cascade misses,
// `missing_blob` (data-loss indicator — file references
// absent blob row), and `blob_size_mismatch` (denormalised
// size drift). One SQL round-trip loads folder + blob via
// two LEFT JOINs; per-row branches key off the join
// results.
let _ = Arc::new(
crate::infrastructure::services::files_consistency_service::FilesConsistencyCheck::new(
maintenance_pool.clone(),
),
)
.register_recoverable_job(&core.job_registry, &job_store_provider_dyn)
.await;
// "Run all consistency checks" coordinator. Plain JobHandler
// (not RecoverableJobHandler) — it dispatches, doesn't scan.
// MUST register AFTER every `*_consistency` tenant so the
// snapshot ordering in `GET /api/admin/jobs` shows children
// then wrapper; snapshot filtering happens at run time so
// late registration is fine. Weak<JobRegistry> internally
// breaks the Arc cycle.
let _ = Arc::new(
crate::infrastructure::services::consistency_batch_service::ConsistencyBatch::new(
&core.job_registry,
),
)
.register_job(&core.job_registry)
.await;
// 2. Repository services (requires PgPool for all metadata)
let repos = self.create_repository_services(&core, &pool);