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
+52 -5
View File
@@ -90,13 +90,17 @@ jsonpath "$..interval_ms" count == 3
# Every entry carries a `running` bool — same aggregate primitive.
# Count matches the registered-tenant count: 4 Part 1 periodics
# (trash_cleanup, storage_reconcile, dedup_gc, grant_cleanup) + 2
# Part 2 recoverables (drives_consistency, folders_consistency —
# wrapped by RecoverableAdapter so they appear here alongside the
# periodics). Bump when a new tenant registers.
jsonpath "$..running" count == 6
# (trash_cleanup, storage_reconcile, dedup_gc, grant_cleanup) + 3
# Part 2 recoverables (drives_consistency, folders_consistency,
# files_consistency — wrapped by RecoverableAdapter so they appear
# here alongside the periodics) + 1 coordinator (consistency_batch
# — a plain JobHandler that dispatches every registered
# `*_consistency`). Bump when a new tenant registers.
jsonpath "$..running" count == 8
jsonpath "$[*].name" contains "drives_consistency"
jsonpath "$[*].name" contains "folders_consistency"
jsonpath "$[*].name" contains "files_consistency"
jsonpath "$[*].name" contains "consistency_batch"
# ─────────────────────────────────────────────────────────────
@@ -151,6 +155,49 @@ jsonpath "$.outcome.outcome" == "ok"
jsonpath "$.outcome.count" exists
# ─────────────────────────────────────────────────────────────
# Step 4b2 — Trigger `files_consistency`. Third Part 2 recoverable
# tenant. Iterates `storage.files` and self-joins folder
# + blob. Same envelope shape as the earlier consistency
# tenants.
# ─────────────────────────────────────────────────────────────
POST {{base_url}}/api/admin/jobs/files_consistency/trigger
Authorization: Bearer {{admin_token}}
HTTP 200
[Asserts]
jsonpath "$.ok" == true
jsonpath "$.outcome.outcome" == "ok"
jsonpath "$.outcome.count" exists
# ─────────────────────────────────────────────────────────────
# Step 4c — Trigger `consistency_batch`. Coordinator (plain
# JobHandler) — snapshots the registry, filters names
# ending `_consistency`, sequentially triggers each.
# `outcome.count` = number of children dispatched (3 as
# of Slice 6: drives + folders + files). `extra.per_check`
# carries a per-child outcome map. Batch itself always
# returns ok — child failures live inside per_check.
# `?deep=true` propagates as `extra.deep`.
# ─────────────────────────────────────────────────────────────
POST {{base_url}}/api/admin/jobs/consistency_batch/trigger?deep=true
Authorization: Bearer {{admin_token}}
HTTP 200
[Asserts]
jsonpath "$.ok" == true
jsonpath "$.outcome.outcome" == "ok"
jsonpath "$.outcome.count" == 3
jsonpath "$.outcome.extra.deep" == true
jsonpath "$.outcome.extra.ok" == 3
jsonpath "$.outcome.extra.err" == 0
# per_check is keyed by child job name.
jsonpath "$.outcome.extra.per_check.drives_consistency.outcome" == "ok"
jsonpath "$.outcome.extra.per_check.folders_consistency.outcome" == "ok"
jsonpath "$.outcome.extra.per_check.files_consistency.outcome" == "ok"
# ─────────────────────────────────────────────────────────────
# Step 5 — Trigger a job that doesn't exist. 404 anti-enum on
# `JobRegistry::trigger` returning `None`.