List every photo's open Enhance jobs for a jobs manager

GET /enhance/jobs without a path now answers the jobs manager (FVR #99):
every photo's queued / running / unavailable jobs, plus ready / failed /
expired ones touched in the last 3 days, newest first, discarded and
approved hidden, at most 100. DB only; the poller keeps rows current.
An optional status=a,b filter applies to both forms.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Cameron CordesandClaude Opus 5.5 committed 2026-11-01 22:14:27 -05:00
1 parent f121457c43
commit 37a2386458
5 files changed
+156 -8

No files matched your search

+50
View File
@@ -914,6 +914,56 @@ async fn discard_hides_the_job_from_the_photo_list_only() {
assert_eq!(st, 404);
}
#[actix_rt::test]
async fn jobs_without_a_path_list_every_photos_open_jobs() {
let fx = fx().await;
const OTHER: &str = "2009_200/other.JPG";
fx.put(PHOTO, b"photo");
fx.put(OTHER, b"other photo");
let submit = |path: &'static str| {
let fx = &fx;
async move {
let (_, j, _) = call(
fx,
"POST",
"/enhance",
Some(json!({"path": path, "template": "restore"})),
)
.await;
j["id"].as_str().unwrap().to_string()
}
};
let a = submit(PHOTO).await;
let b = submit(OTHER).await;
let c = submit(OTHER).await;
call(&fx, "POST", &format!("/enhance/jobs/{a}/discard"), None).await;
let ids = |v: &Value| -> Vec<String> {
v["jobs"]
.as_array()
.unwrap()
.iter()
.map(|j| j["id"].as_str().unwrap().to_string())
.collect()
};
let (st, all, _) = call(&fx, "GET", "/enhance/jobs", None).await;
assert_eq!(st, 200);
assert_eq!(
ids(&all),
[c.clone(), b.clone()],
"across photos, newest first, discarded hidden"
);
assert_eq!(all["jobs"][0]["path"], OTHER, "each job names its photo");
let (_, none, _) = call(&fx, "GET", "/enhance/jobs?status=ready,failed", None).await;
assert!(
ids(&none).is_empty(),
"status filter keeps only those statuses"
);
let (_, queued, _) = call(&fx, "GET", "/enhance/jobs?status=queued,%20running", None).await;
assert_eq!(ids(&queued).len(), 2);
}
#[actix_rt::test]
async fn unreachable_active_jobs_become_unavailable_after_the_grace_period() {
// Submit against the mock, then point nothing at it: use a service whose