Skip to content

Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.

fix(assembler): worker inlet must dedupe on internal job status

Sidwebworks32473ec96581
diff --git a/apps/assembler/src/jobs.rs b/apps/assembler/src/jobs.rs
index eac301507b..e380a9a10a 100644
--- a/apps/assembler/src/jobs.rs
+++ b/apps/assembler/src/jobs.rs
@@ -140,13 +140,24 @@ impl JobStore {
}
}
- /// The internal status of an active job (pending/running/uploading), for the
- /// create handler's idempotency attach. None if unknown or terminal.
+ /// The EXTERNAL status of an active job (queued/running), for the create
+ /// handler's idempotency-attach 202 response. None if unknown or terminal.
pub async fn existing_active(&self, id: &str) -> Option<String> {
+ self.internal_active(id)
+ .await
+ .map(|s| external_status(&s).to_string())
+ }
+
+ /// The INTERNAL status of an active job (pending/running/uploading). The
+ /// worker inlet dedupes deliveries on these exact names — the external
+ /// mapping folds pending->queued and uploading->running, which would make
+ /// the worker's pending/uploading branches unreachable (every Lambda job
+ /// no-op'd forever).
+ pub async fn internal_active(&self, id: &str) -> Option<String> {
self.read(id)
.await
.filter(|j| matches!(j.status.as_str(), "pending" | "running" | "uploading"))
- .map(|j| external_status(&j.status).to_string())
+ .map(|j| j.status)
}
pub async fn set_pending(
diff --git a/apps/assembler/src/main.rs b/apps/assembler/src/main.rs
index 07b2b92369..4b1d690f64 100644
--- a/apps/assembler/src/main.rs
+++ b/apps/assembler/src/main.rs
@@ -396,7 +396,7 @@ async fn worker_events(
}
let urls = run::upload_urls(&spec);
- match state.jobs.existing_active(&job_id).await.as_deref() {
+ match state.jobs.internal_active(&job_id).await.as_deref() {
Some("pending") => {
if let Err(m) = run::spawn_from_spec(&state, &job_id, &action, &spec) {
state.jobs.set_error(&job_id, "invalid_input", m.clone()).await;