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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
//! The engine layer: what a workflow may call, how the engine is assembled
//! from stored rows, and how one channel's run is driven.
//!
//! F45: this file used to carry all three of those plus the glob matcher, the
//! rollout arithmetic and the lock accessors in one 468-line module. They are
//! now three:
//!
//! - [`handlers`] — the function-name vocabulary and the handler construction
//! behind Orion's own entries.
//! - [`loader`] — stored channels + workflows → the dataflow-rs workflow set,
//! with the per-channel quarantine.
//! - [`runner`] — running one channel, and the instrumented lock accessors.
//! - [`observer`] — always-on per-task timing, including the sync built-ins no
//! host can otherwise reach.
//!
//! Everything public is re-exported here, so `crate::engine::…` paths are
//! unchanged.
/// Where the engine records the **code** of each failed task, for workflows
/// that must branch on *why* a step failed (#280).
///
/// `metadata`, not `data` or `temp_data`, and that placement is the point:
/// `metadata` is stripped from the trace-read projection and never reaches the
/// sync response body, whereas `temp_data` would ride out through the
/// persisted trace's `result_json` and `data` would go straight to the caller.
///
/// The `_orion_` prefix follows the reserved namespace (`_orion_call_depth`,
/// `_orion_call_chain`) rather than the bare `metadata.errors` dataflow-rs
/// would otherwise default to — that name is both a plausible caller-supplied
/// key and outside the namespace Orion documents as its own.
///
/// **The prefix is a convention, not an enforced namespace.** A caller can put
/// `_orion_call_depth` in an envelope today and nothing strips it, so this key
/// is force-cleared at every ingress — see `build_request_metadata` and the
/// Kafka ingress builder — and reset on `channel_call`, where the child would
/// otherwise inherit and report the parent's failures as its own.
///
/// Records carry `{workflow_id, task_id, code, status}` and **never a
/// message**: see the note in `docs/src/reference/errors.md`.
pub const ERROR_CONTEXT_PATH: &str = "metadata._orion_errors";
/// The bare key under `metadata`, for the ingress stamping sites.
pub const ERROR_CONTEXT_KEY: &str = "_orion_errors";
/// Clear the engine-owned error records from a metadata object.
///
/// Lives beside the constant so a new ingress has one call to make rather than
/// a three-line idiom to copy — and so widening this to the whole `_orion_`
/// prefix later is a one-line change here instead of an audit of call sites.
/// The metadata key the `[vars]` config section is stamped under.
///
/// Platform-reserved, in the same sense as `channel` and `cookies`: an
/// operator declares the values and every ingress stamps them, overwriting
/// whatever the caller sent. Envelope mode merges caller-supplied `metadata`
/// wholesale, so without that a request could forge the topic prefix its own
/// run publishes to.
pub const VARS_KEY: &str = "vars";
/// Force `metadata.vars` to the instance's declared vars.
///
/// `None` — the instance declares no vars — *removes* the key rather than
/// writing an empty object. Both halves matter: the removal is what makes the
/// key unforgeable on an instance that declares nothing, and leaving the key
/// absent means a workflow reading `metadata.vars.x` sees the same missing
/// value whether the section is empty or the entry is.
///
/// Vars are stamped rather than held beside the message on purpose. They are
/// deployment configuration, so they *should* appear in the trace — an
/// operator asking "which topic did this run publish to?" is asking to see
/// them. That is the whole distinction between this and
/// [`secrets`], which the engine holds precisely so it
/// cannot record them.
///
/// A non-object `metadata` is replaced by an object rather than skipped when
/// there are vars to stamp. Every ingress builds metadata differently — the
/// HTTP route normalises the caller's value first, Kafka builds its own, and
/// the admin test endpoint's field defaults to `null` when the caller omits it
/// — so a helper that silently did nothing for `null` made "which ingress?"
/// decide whether `metadata.vars` exists. It reads as absent either way to a
/// caller who sent no metadata, and the workflow sees the same object it would
/// have seen through the data route.
pub use ;
pub use ;
pub use ;
pub use ;
pub use MetricsObserver;
pub use ;
pub use ;
pub use ResolvedSecrets;
pub use ;