Skip to content

Python tool for aircraft Doppler audio geolocation using historical ADS-B flight data (Source-available)

Update

Cinna Davis94c687f20d69
diff --git a/src/dopplergeist/automatic.py b/src/dopplergeist/automatic.py
index 19cd287..c6e73ed 100644
--- a/src/dopplergeist/automatic.py
+++ b/src/dopplergeist/automatic.py
@@ -127,14 +127,26 @@ def analyze(request, output_dir, config=None, progress=lambda *args, **kwargs: N
or spectral_options.keys() - spectral_keys):
return finish("failed", "invalid_configuration", "Spectral comparison accepts only work limits and spectral grid settings.")
if not resume:
- progress("intake", 0.05)
+ progress("intake", 0.05, message="Decoding audio.")
try:
- recording = intake_recording(request["audio_path"], output / "intake", time_window=request.get("time_window"))
+ recording = intake_recording(request["audio_path"], output / "intake", time_window=request.get("time_window"),
+ progress_callback=_throttled(lambda **details: progress(
+ "intake", *_decode_progress(0.05, 0.14, "Decoding audio", **details))))
except AudioIntakeError as exc:
return finish("failed", exc.code, str(exc))
state["recording"] = recording.metadata
- progress("discovery", 0.15, recording=recording.metadata)
- events = [validate_event(event) for event in discover_events(recording, output_dir=output / "discovery", settings=discovery_settings)]
+ progress("discovery", 0.15, message="Discovering acoustic events.", recording=recording.metadata)
+
+ def report_discovery_progress(phase, **details):
+ if phase == "decoding_high_rate":
+ fraction, message = _decode_progress(0.15, 0.24, "Discovery: decoding high-rate copy", **details)
+ else:
+ fraction, message = _DISCOVERY_PHASES.get(phase, (0.25, f"Discovery: {phase.replace('_', ' ')}."))
+ progress("discovery", fraction, message=message, recording=recording.metadata)
+
+ events = [validate_event(event) for event in discover_events(
+ recording, output_dir=output / "discovery", settings=discovery_settings,
+ progress_callback=_throttled(report_discovery_progress))]
_save_audio_checkpoint(output, request, config)
state["recording"] = recording.metadata
state["events"] = events
@@ -150,9 +162,10 @@ def analyze(request, output_dir, config=None, progress=lambda *args, **kwargs: N
progress("acquisition", 0.35, **running_state)
last_acquisition_report = 0.0
last_acquisition_phase = None
+ acquisition_fraction = 0.35
def report_acquisition_progress(**details):
- nonlocal last_acquisition_report, last_acquisition_phase
+ nonlocal last_acquisition_report, last_acquisition_phase, acquisition_fraction
now = time.monotonic()
phase = str(details.get("phase", "working")).replace("_", " ")
if phase == last_acquisition_phase and now - last_acquisition_report < 2.0:
@@ -174,7 +187,8 @@ def analyze(request, output_dir, config=None, progress=lambda *args, **kwargs: N
metrics.append(f"{value:,} {metric_label}")
if metrics:
message += f" ({', '.join(metrics)})"
- progress("acquisition", 0.35, message=message, **running_state)
+ acquisition_fraction = max(acquisition_fraction, _acquisition_fraction(details))
+ progress("acquisition", acquisition_fraction, message=message, **running_state)
last_acquisition_report, last_acquisition_phase = now, phase
def report_search_progress(fraction=0.0):
@@ -234,6 +248,60 @@ class MissingData(ValueError):
pass
+# Display-only progress bands. Fractions never affect scoring or rankings.
+_DISCOVERY_PHASES = {
+ "tracking_ridges": (0.25, "Discovery: tracking Doppler ridges across the recording."),
+ "grouping_proposals": (0.32, "Discovery: grouping harmonics into event proposals."),
+ "writing_plots": (0.33, "Discovery: writing diagnostic plots."),
+}
+# Acquisition spans 0.35-0.55: downloads with known byte totals move within
+# 0.35-0.45; later index-building phases have no row totals and use fixed steps.
+_ACQUISITION_PHASES = {
+ "decoding_archive": 0.45, "cached_flight_index": 0.45, "creating_flight_index": 0.46,
+ "staging_samples": 0.47, "creating_sample_lookup": 0.49, "building_segments": 0.50,
+ "preparing_tracks": 0.52, "compacting_flight_index": 0.53, "flight_index_ready": 0.54,
+}
+
+
+def _clock(seconds):
+ seconds = max(0, int(seconds))
+ hours, rest = divmod(seconds, 3600)
+ return f"{hours}:{rest // 60:02d}:{rest % 60:02d}" if hours else f"{rest // 60}:{rest % 60:02d}"
+
+
+def _decode_progress(low, high, label, decoded_s=0.0, duration_s=None, **_):
+ """Map decoded audio seconds into a display band; unknown durations stay at ``low``."""
+ if isinstance(duration_s, (int, float)) and math.isfinite(duration_s) and duration_s > 0:
+ share = min(1.0, max(0.0, decoded_s / duration_s))
+ return low + (high - low) * share, f"{label}: {_clock(decoded_s)} of {_clock(duration_s)} decoded."
+ return low, f"{label}: {_clock(decoded_s)} decoded."
+
+
+def _acquisition_fraction(details):
+ phase = details.get("phase")
+ if phase in _ACQUISITION_PHASES:
+ return _ACQUISITION_PHASES[phase]
+ done, total = details.get("bytes_done"), details.get("bytes_total")
+ if (isinstance(done, (int, float)) and isinstance(total, (int, float))
+ and math.isfinite(done) and math.isfinite(total) and total > 0):
+ return 0.35 + 0.10 * min(1.0, max(0.0, done / total))
+ return 0.35
+
+
+def _throttled(callback, interval_s=2.0):
+ """Forward phase changes immediately and repeated phases at most every ``interval_s``."""
+ last = {"time": None, "phase": object()}
+
+ def forward(**details):
+ now = time.monotonic()
+ phase = details.get("phase")
+ if phase == last["phase"] and last["time"] is not None and now - last["time"] < interval_s:
+ return
+ last["time"], last["phase"] = now, phase
+ callback(**details)
+ return forward
+
+
def _earliest_emission(lo, events, max_distance, c, filters):
"""Retain the complete CPA and refinement envelope of all proposals."""
original = lo - max_distance / 300 - 30
diff --git a/src/dopplergeist/cli.py b/src/dopplergeist/cli.py
index 0d9ff02..28fe2e9 100644
--- a/src/dopplergeist/cli.py
+++ b/src/dopplergeist/cli.py
@@ -266,7 +266,7 @@ def main():
if isinstance(progress,(int,float)) and math.isfinite(progress) else "")
stage_message=value.get("message")
activity_text=(f", {stage_message}"
- if value.get("stage") in {"acquisition", "search", "refinement", "decision"}
+ if value.get("stage") in {"intake", "discovery", "acquisition", "search", "refinement", "decision"}
and isinstance(stage_message,str) else "")
now=time.monotonic()
rate=""
diff --git a/src/dopplergeist/discovery.py b/src/dopplergeist/discovery.py
index cab763a..8bb4600 100644
--- a/src/dopplergeist/discovery.py
+++ b/src/dopplergeist/discovery.py
@@ -350,7 +350,9 @@ def _discover_baseline_events(recording, *, output_dir=None, settings=None, plot
return events
-def discover_events(recording, *, output_dir=None, settings=None, plot_summary=True, plot_event_details=False):
+def discover_events(recording, *, output_dir=None, settings=None, plot_summary=True, plot_event_details=False,
+ progress_callback=None):
+ """Discover acoustic proposals; ``progress_callback(phase=..., **counts)`` reports activity only."""
from .advanced_discovery import discover
from .intake import intake_recording
@@ -364,10 +366,18 @@ def discover_events(recording, *, output_dir=None, settings=None, plot_summary=T
output.mkdir(parents=True, exist_ok=True)
if (output / "discovery.json").exists():
raise FileExistsError("Discovery output exists; use a new output directory")
- auxiliary = intake_recording(recording.source_path, output / "intake_high", sample_rate_hz=24000)
+ def report(phase, **fields):
+ if progress_callback:
+ progress_callback(phase=phase, **fields)
+
+ auxiliary = intake_recording(
+ recording.source_path, output / "intake_high", sample_rate_hz=24000,
+ progress_callback=(lambda **fields: report("decoding_high_rate", **fields)) if progress_callback else None)
if auxiliary.metadata["source_sha256"] != recording.metadata["source_sha256"]:
raise ValueError("Audio source changed between intake and discovery")
+ report("tracking_ridges")
result = discover(recording, output, "ridge_dp_accel_broad_final_v25", aux_recording=auxiliary)
+ report("grouping_proposals")
tracks = {event["event_id"]: event for event in result["raw_events"]}
tracks.update({event["event_id"]: event for event in result["verified_tracks"]})
events, groups = [], []
@@ -390,6 +400,7 @@ def discover_events(recording, *, output_dir=None, settings=None, plot_summary=T
"fragment_links": baseline_diagnostics["fragment_links"],
"harmonic_ridges": [[points.tolist() for points in group] for group in groups],
"scope": "automatic acoustic proposals; aircraft identity unconfirmed"}, indent=2, allow_nan=False) + "\n")
+ report("writing_plots")
if plot_summary:
_plot_groups(groups, output / "discovery.png", recording.metadata["duration_s"], settings.max_gap_s)
if plot_event_details:
diff --git a/src/dopplergeist/intake.py b/src/dopplergeist/intake.py
index 2acac78..7c87d35 100644
--- a/src/dopplergeist/intake.py
+++ b/src/dopplergeist/intake.py
@@ -8,8 +8,10 @@ import hashlib
import json
import os
from pathlib import Path
+import math
import subprocess
import tempfile
+import time
import numpy as np
@@ -95,8 +97,17 @@ class IntakeRecording:
break
+def _container_duration_s(probe):
+ """Best-effort container duration for progress display; never a clock."""
+ try:
+ value = float(probe.get("format", {}).get("duration"))
+ except (TypeError, ValueError):
+ return None
+ return value if math.isfinite(value) and value > 0 else None
+
+
def intake_recording(source, output_dir, *, time_window=None, sample_rate_hz=4000,
- resample_filter_size=None):
+ resample_filter_size=None, progress_callback=None):
"""Decode mono f32 into a new cache without holding the whole input in RAM.
``time_window`` follows the shared RecordingTimeWindow contract and bounds
@@ -106,6 +117,9 @@ def intake_recording(source, output_dir, *, time_window=None, sample_rate_hz=400
historical matching. Existing cache files are never overwritten.
``resample_filter_size`` opts into the explicit swresample filter used by
experimental episode discovery; omission preserves the standard decoder.
+ ``progress_callback(decoded_s=..., duration_s=...)`` is optionally called
+ while decoding; ``duration_s`` is the container estimate or ``None``. It
+ reports activity only and does not affect the decoded samples.
"""
from .contracts import validate_recording, validate_request
@@ -141,6 +155,10 @@ def intake_recording(source, output_dir, *, time_window=None, sample_rate_hz=400
except OSError as exc:
raise AudioIntakeError("decoder_unavailable", "ffmpeg could not start; check executable and runtime dependencies") from exc
count, peak, remainder = 0, 0.0, b""
+ expected_s = _container_duration_s(probe)
+ last_report = time.monotonic()
+ if progress_callback:
+ progress_callback(decoded_s=0.0, duration_s=expected_s)
try:
while block := process.stdout.read(256 * 1024):
block = remainder + block
@@ -153,6 +171,9 @@ def intake_recording(source, output_dir, *, time_window=None, sample_rate_hz=400
count += len(values)
cache.write(block[:usable])
remainder = block[usable:]
+ if progress_callback and time.monotonic() - last_report >= 1.0:
+ progress_callback(decoded_s=count / sample_rate_hz, duration_s=expected_s)
+ last_report = time.monotonic()
code = process.wait()
if code in (126, 127):
raise AudioIntakeError("decoder_unavailable", "ffmpeg could not start; check runtime dependencies")
diff --git a/src/dopplergeist/jobs.py b/src/dopplergeist/jobs.py
index 16e5c95..89ec199 100644
--- a/src/dopplergeist/jobs.py
+++ b/src/dopplergeist/jobs.py
@@ -18,6 +18,9 @@ from .contracts import validate_request, validate_result
TERMINAL = {"needs_input", "succeeded", "inconclusive", "failed", "cancelled"}
PROGRESS_STALE_AFTER_S = 60.0
+# A live worker rewrites its last status at this interval, so only a dead or
+# stopped worker lets result.json age past PROGRESS_STALE_AFTER_S.
+HEARTBEAT_INTERVAL_S = 20.0
def write_json(path, value):
@@ -37,8 +40,14 @@ def status_for_display(job_dir, value=None, *, stale_after_s=PROGRESS_STALE_AFTE
shown = dict(read_json(path) if value is None else value)
shown["progress_stale"] = False
if shown.get("status") in {"queued", "running"}:
- age = max(0.0, time.time() - path.stat().st_mtime)
+ now = time.time()
+ age = max(0.0, now - path.stat().st_mtime)
shown["progress_age_seconds"] = age
+ try:
+ # request.json is written on submission and rewritten when analysis (re)starts.
+ shown["elapsed_seconds"] = max(0.0, now - (Path(job_dir) / "request.json").stat().st_mtime)
+ except OSError:
+ pass
shown["progress_stale"] = age > stale_after_s
if shown["progress_stale"]:
shown["progress"] = None
@@ -337,6 +346,47 @@ class JobManager:
self._lockfile.close()
+class _Heartbeat:
+ """Rewrite the latest running status while this worker process is alive.
+
+ Long steps without their own updates (audio decoding, ridge tracking,
+ index building) must not look like a dead job. The heartbeat rewrites
+ the exact last status, so it never invents progress; it stops before any
+ terminal result is written and dies with the worker process.
+ """
+
+ def __init__(self, directory, lock, latest, interval_s):
+ self.directory, self.lock, self.latest, self.interval_s = Path(directory), lock, latest, interval_s
+ self._stop = threading.Event()
+ self._thread = threading.Thread(target=self._run, name="progress-heartbeat", daemon=True)
+
+ def start(self):
+ self._thread.start()
+
+ def stop(self):
+ self._stop.set()
+ if self._thread.is_alive():
+ self._thread.join()
+
+ def beat(self):
+ """Rewrite the latest status if no update arrived within the interval."""
+ with self.lock:
+ if self._stop.is_set() or "value" not in self.latest or (self.directory / "cancel").exists():
+ return False
+ if time.monotonic() - self.latest["time"] < self.interval_s:
+ return False
+ try:
+ write_json(self.directory / "result.json", self.latest["value"])
+ except (OSError, TypeError, ValueError, RuntimeError):
+ return False
+ self.latest["time"] = time.monotonic()
+ return True
+
+ def _run(self):
+ while not self._stop.wait(min(5.0, self.interval_s)):
+ self.beat()
+
+
def execute(directory, parent_pid=None, resume=False):
# On Linux, an abruptly killed server must not leave an orphan analysis or
# decoder consuming resources and later overwriting an interrupted result.
@@ -353,15 +403,27 @@ def execute(directory, parent_pid=None, resume=False):
directory = Path(directory)
request = read_json(directory / "request.json")
config = read_json(directory / "operator.json")
+ os.utime(directory / "request.json", None)
+
+ lock = threading.Lock()
+ latest = {}
def progress(stage, fraction, **fields):
if (directory / "cancel").exists():
raise InterruptedError("Job cancelled")
- return result(directory, "running", stage=stage, progress=fraction, **fields)
+ with lock:
+ value = result(directory, "running", stage=stage, progress=fraction, **fields)
+ latest.update(value=value, time=time.monotonic())
+ return value
+ heartbeat = _Heartbeat(directory, lock, latest, HEARTBEAT_INTERVAL_S)
try:
- progress("intake", 0.02)
- final = analyze(request, directory, config, progress, resume=resume)
+ try:
+ progress("intake", 0.02, message="Starting analysis.")
+ heartbeat.start()
+ final = analyze(request, directory, config, progress, resume=resume)
+ finally:
+ heartbeat.stop()
if (directory / "cancel").exists():
result(directory, "cancelled", message="Cancelled by the user.", **_evidence(read_json(directory / "result.json")))
else:
diff --git a/src/dopplergeist/web/app.js b/src/dopplergeist/web/app.js
index 38b4a5f..ee52974 100644
--- a/src/dopplergeist/web/app.js
+++ b/src/dopplergeist/web/app.js
@@ -162,12 +162,35 @@ function coordinateCopyControl(lat, lon) {
return control;
}
+const STAGES = [
+ ['intake', 'Audio intake'], ['discovery', 'Event discovery'], ['acquisition', 'Flight data'],
+ ['search', 'Location search'], ['refinement', 'Refinement'], ['decision', 'Decision'],
+];
+
+function formatDuration(seconds) {
+ const total = Math.max(0, Math.floor(seconds));
+ const h = Math.floor(total / 3600), m = Math.floor((total % 3600) / 60), s = total % 60;
+ if (h) return `${h} h ${m} min`;
+ if (m) return `${m} min ${s} s`;
+ return `${s} s`;
+}
+
+function stageLabel(value) {
+ if (terminal.has(value.status)) return value.stage || '';
+ if (value.status === 'queued') return 'Waiting in queue';
+ const index = STAGES.findIndex(([name]) => name === value.stage);
+ const label = index < 0 ? (value.stage || '').replaceAll('_', ' ')
+ : `Step ${index + 1}/${STAGES.length}: ${STAGES[index][1]}`;
+ const elapsed = Number.isFinite(value.elapsed_seconds) ? ` � ${formatDuration(value.elapsed_seconds)} elapsed` : '';
+ return `${label}${elapsed}`;
+}
+
function render(value) {
renderedJob = value;
$('empty').hidden = true; $('job').hidden = false;
$('job-id').textContent = `JOB ${value.job_id}`;
$('status').textContent = value.status.replaceAll('_', ' ');
- $('stage').textContent = value.stage || '';
+ $('stage').textContent = stageLabel(value);
const progress = $('progress');
if (value.progress_stale) {
progress.removeAttribute('value');
@@ -179,7 +202,7 @@ function render(value) {
$('cancel').hidden = terminal.has(value.status);
$('resume').hidden = true;
const staleAge = Number.isFinite(value.progress_age_seconds)
- ? ` Last progress update was ${Math.floor(value.progress_age_seconds)} seconds ago.` : '';
+ ? ` Last progress update was ${formatDuration(value.progress_age_seconds)} ago; the worker may have stopped.` : '';
$('message').textContent = value.progress_stale
? `${value.message || 'The saved percentage is stale and hidden.'}${staleAge}`
: (value.message || 'Analysis is running. You can return to this job using its saved link.');
diff --git a/tests/test_progress_reporting.py b/tests/test_progress_reporting.py
new file mode 100644
index 0000000..8a02a9e
--- /dev/null
+++ b/tests/test_progress_reporting.py
@@ -0,0 +1,128 @@
+"""Progress display checks. These use no generated audio or flight data."""
+import os
+from pathlib import Path
+import threading
+import time
+
+import pytest
+
+from dopplergeist import automatic, jobs
+
+
+def _job(tmp_path):
+ directory = tmp_path / "0123456789abcdef0123456789abcdef"
+ directory.mkdir()
+ jobs.write_json(directory / "request.json", {})
+ jobs.write_json(directory / "operator.json", {})
+ return directory
+
+
+def _age(path, seconds):
+ then = time.time() - seconds
+ os.utime(path, (then, then))
+
+
+def test_dead_worker_turns_stale_and_elapsed_time_is_reported(tmp_path):
+ directory = _job(tmp_path)
+ jobs.result(directory, "running", stage="discovery", progress=0.2, message="Discovery: tracking.")
+ _age(directory / "request.json", 300)
+ fresh = jobs.status_for_display(directory)
+ assert fresh["progress_stale"] is False and fresh["progress"] == 0.2
+ assert fresh["elapsed_seconds"] >= 299
+ _age(directory / "result.json", 120)
+ stale = jobs.status_for_display(directory)
+ assert stale["progress_stale"] is True and stale["progress"] is None
+
+
+def test_heartbeat_rewrites_only_the_latest_status(tmp_path):
+ directory = _job(tmp_path)
+ lock, latest = threading.Lock(), {}
+ value = jobs.result(directory, "running", stage="discovery", progress=0.25, message="Discovery: tracking.")
+ latest.update(value=value, time=time.monotonic())
+ heartbeat = jobs._Heartbeat(directory, lock, latest, 30.0)
+ assert heartbeat.beat() is False # a recent update needs no heartbeat
+ latest["time"] -= 60
+ _age(directory / "result.json", 120)
+ assert heartbeat.beat() is True
+ shown = jobs.status_for_display(directory)
+ assert shown["progress_stale"] is False
+ assert {key: shown[key] for key in value} == value
+ latest["time"] -= 60
+ (directory / "cancel").touch()
+ assert heartbeat.beat() is False
+ (directory / "cancel").unlink()
+ heartbeat.stop()
+ assert heartbeat.beat() is False
+
+
+def test_worker_heartbeat_keeps_silent_step_fresh_and_never_overwrites_final(tmp_path, monkeypatch):
+ directory = _job(tmp_path)
+ monkeypatch.setattr(jobs, "HEARTBEAT_INTERVAL_S", 0.2)
+ observed = {}
+
+ def silent_step(request, output, config, progress, resume=False):
+ progress("discovery", 0.25, message="Discovery: tracking Doppler ridges across the recording.")
+ _age(output / "result.json", 120)
+ time.sleep(0.6) # a long call that reports nothing itself
+ observed["shown"] = jobs.status_for_display(output, stale_after_s=0.5)
+ return {"status": "inconclusive", "reason_code": "no_supported_events", "message": "none"}
+
+ monkeypatch.setattr(automatic, "analyze", silent_step)
+ jobs.execute(directory)
+ assert observed["shown"]["progress_stale"] is False
+ assert observed["shown"]["stage"] == "discovery" and observed["shown"]["progress"] == 0.25
+ time.sleep(0.5)
+ assert jobs.read_json(directory / "result.json")["status"] == "inconclusive"
+
+
+def test_acquisition_moves_within_its_band():
+ assert automatic._acquisition_fraction({"phase": "downloading", "bytes_done": 0, "bytes_total": 100}) == 0.35
+ assert automatic._acquisition_fraction({"phase": "downloading", "bytes_done": 50, "bytes_total": 100}) == pytest.approx(0.40)
+ assert automatic._acquisition_fraction({"phase": "downloading", "bytes_done": 7}) == 0.35
+ ordered = ["decoding_archive", "creating_flight_index", "staging_samples", "creating_sample_lookup",
+ "building_segments", "preparing_tracks", "compacting_flight_index", "flight_index_ready"]
+ fractions = [automatic._acquisition_fraction({"phase": phase}) for phase in ordered]
+ assert fractions == sorted(fractions) and 0.45 <= fractions[0] and fractions[-1] < 0.55
+
+
+def test_decode_progress_and_throttle():
+ fraction, message = automatic._decode_progress(0.05, 0.14, "Decoding audio", decoded_s=90, duration_s=180)
+ assert fraction == pytest.approx(0.095) and message == "Decoding audio: 1:30 of 3:00 decoded."
+ assert automatic._decode_progress(0.05, 0.14, "Decoding audio", decoded_s=4000)[0] == 0.05
+ calls = []
+ forward = automatic._throttled(lambda **details: calls.append(details), interval_s=60)
+ forward(phase="decoding_high_rate", decoded_s=1)
+ forward(phase="decoding_high_rate", decoded_s=2)
+ forward(phase="tracking_ridges")
+ assert [call.get("phase") for call in calls] == ["decoding_high_rate", "tracking_ridges"]
+
+
+REAL_RECORDING = os.environ.get("DOPPLERGEIST_REAL_RECORDING")
+
+
[email protected](not REAL_RECORDING, reason="set DOPPLERGEIST_REAL_RECORDING to a real recording")
+def test_intake_reports_decoding_progress_on_a_real_recording(tmp_path):
+ from dopplergeist.intake import intake_recording
+
+ reports = []
+ recording = intake_recording(Path(REAL_RECORDING), tmp_path / "intake",
+ progress_callback=lambda **details: reports.append(details))
+ assert reports[0]["decoded_s"] == 0
+ decoded = [report["decoded_s"] for report in reports]
+ assert decoded == sorted(decoded) and decoded[-1] <= recording.metadata["duration_s"]
+ assert reports[0]["duration_s"] == pytest.approx(recording.metadata["duration_s"], rel=0.02)
+
+
+def test_elapsed_time_starts_when_worker_starts(tmp_path, monkeypatch):
+ directory = _job(tmp_path)
+ _age(directory / "request.json", 300)
+ observed = {}
+
+ def silent_step(request, output, config, progress, resume=False):
+ progress("discovery", 0.1)
+ observed["elapsed"] = jobs.status_for_display(output)["elapsed_seconds"]
+ return {"status": "inconclusive", "reason_code": "no_supported_events", "message": "none"}
+
+ monkeypatch.setattr(automatic, "analyze", silent_step)
+ jobs.execute(directory)
+ assert observed["elapsed"] < 5
diff --git a/tests/test_service.py b/tests/test_service.py
index 367c72d..c2228c6 100644
--- a/tests/test_service.py
+++ b/tests/test_service.py
@@ -44,7 +44,8 @@ def test_upload_readback_cancel_and_original_preservation(tmp_path, monkeypatch)
code, job = request(url + "/api/jobs", b"encoded audio payload", {"schema_version": 1})
assert code == 202 and job["status"] == "queued"
job_id = job["job_id"]
- assert request(url + f"/api/jobs/{job_id}")[1] == job
+ status = request(url + f"/api/jobs/{job_id}")[1]
+ assert {key: status[key] for key in job} == job
assert request(url + f"/api/jobs/{job_id}/cancel", b"")[1]["status"] == "cancelled"
assert request(url + f"/api/jobs/{job_id}/artifacts/input.mp3")[1] == b"encoded audio payload"
items = request(url + f"/api/jobs/{job_id}/artifacts")[1]["artifacts"]