1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//! Python-parity `check_pipeline_run_qualification`.
//!
//! Reads the latest `pipeline_runs` row for `(dataset_id, pipeline_name)` and
//! returns a verdict the caller acts on:
//!
//! - `Proceed` — no previous row, or the latest is `INITIATED` or `ERRORED`.
//! - `AlreadyRunning(PipelineRun)` — latest is `STARTED`; caller should reject.
//! - `AlreadyCompleted(PipelineRun)` — latest is `COMPLETED`; caller should
//! short-circuit without re-running.
//!
//! Source of truth: [`check_pipeline_run_qualification.py`][py]. Locked
//! decision 3 ships this gate at the `cognify` and `memify` entry points;
//! ingestion is intentionally excluded.
//!
//! [py]: https://github.com/topoteretes/cognee/blob/main/cognee/modules/pipelines/layers/check_pipeline_run_qualification.py
use ;
use Uuid;
/// Verdict from a qualification check.
/// Rust mirror of Python's `check_pipeline_run_qualification`.
///
/// Reads the most recent `pipeline_runs` row for `(dataset_id,
/// pipeline_name)` via [`PipelineRunRepository::get_pipeline_run_by_dataset`]
/// (added in task 08-06) and maps it to a [`Qualification`].
///
/// `INITIATED` and `ERRORED` map to `Proceed` to match Python's behaviour
/// (see [Python source][py]); only `STARTED` rejects and only `COMPLETED`
/// short-circuits.
///
/// [py]: https://github.com/topoteretes/cognee/blob/main/cognee/modules/pipelines/layers/check_pipeline_run_qualification.py
pub async