# Airflow compatibility ## Approach: look-alike API under the `schedr.airflow` namespace - schedr is **not** Airflow and does not depend on `apache-airflow`. - The Python API **copies Airflow's names, signatures and module layout** so existing DAG code needs as few changes as possible. **Behaviour underneath is entirely ours.** - Migrating a DAG = **changing its imports only**. Everything below the imports stays the same. ## Thin translating classes The Airflow layer consists of **thin classes that translate onto the native API**; they don't build the model themselves. **Principle: the Airflow layer can only use what the native API has.** No Airflow-only structures, rules or behaviours: everything a compatibility layer produces must be expressible in the native API **as it is**. Otherwise people would use the Airflow API just to get functionality they can't express in the native API, and the native API would stop being the primary one. - **Allowed:** different *syntax* for the same thing: Airflow's names, signatures and argument types, the `@dag` decorator, task IDs as strings, `default_args` dicts, combinations of native constructs (e.g. an extra `empty` task or dropped edges, which a native DAG could write by hand). - **Not allowed:** a model rule, task kind, edge type or run-time behaviour that the native API doesn't offer. An Airflow feature that needs one is either **added to the native API first** (then translated onto it) or is an **error** in the Airflow layer. - **The native API is never changed to accommodate Airflow**, only the other way round: an Airflow feature maps onto what the native API has (directly, or as a combination of native constructs), or it is an error. A native feature is added only for a native need. - Applies to every compatibility API, not only `schedr.airflow`. - Earlier decisions that didn't follow it were all reviewed and brought in line. - **Arguments with a native equivalent are translated**, including renamed ones and different types. Examples: | Airflow | Native | |---|---| | `DAG(dag_id=..., ...)` | `Dag("...", ...)` | | `schedule="0 3 * * *"` / `"@daily"` / `timedelta(...)` / `"@once"` / `None` | `trigger=Cron(...)` / `DAILY` / `Every(...)` / `Once(start_date)` / `None` | | `catchup=` | `catchup=` on the time trigger (`Cron(..., catchup=...)`) | | `start_date=` / `end_date=` | `start=` / `end=` on the time trigger (`Cron(..., start=...)`) | | `max_active_runs=` (default 16, Airflow's `max_active_runs_per_dag`) | `max_active_runs=` (set explicitly to 16 when not given, so migrated DAGs keep Airflow's default) | | `tags=`, `description=` | `tags=`, `description=` | | `max_active_tasks=` (default 16, `max_active_tasks_per_dag`) | `max_active_tasks=` (set explicitly to 16 when not given) | | `max_active_tis_per_dagrun=` / `max_active_tis_per_dag=` | `max_active_per_run=` / `max_active=` | | `default_args={...}` | `defaults=StepDefaults(...)` (keys translated the same way) | | `BashOperator(bash_command=...)` | `CommandOperator(command=...)` | | `PythonOperator(python_callable=f, op_args=..., op_kwargs=...)` | a `@task` wrapping `f` | | `execution_timeout=` | `timeout=` | - **Arguments without a native equivalent are filtered out**, with a **parse warning** listed with the DAG in the UI (not silently), except: - **Metadata** (`owner`, `doc`, `doc_md`, `doc_rst`, `doc_json`, `doc_yaml`, `owner_links`, `access_control`): kept as DAG/task metadata and shown in the UI, no warning. - **An error when set to a non-default value**, because dropping it would change what the DAG does or hide failures: `depends_on_past=True`, `wait_for_downstream=True`, `ignore_first_depends_on_past`, `sla`, `run_as_user`, `user_defined_macros`, `user_defined_filters`, `template_searchpath`, and **all callbacks** (below). Default values (`depends_on_past=False`, `on_failure_callback=None`, …) are accepted silently. - **Unknown arguments** (not Airflow arguments at all) are an error, as in Airflow. - **`email_on_failure=True` is translated** (it is data, not code): with `email=[...]` it becomes a hidden native **`EmailChannel`** named after the DAG, with those addresses, for the event `TASK_FAILED` (see Outcomes, failures and joins: DAG-defined email channels). If no email transport is configured, the master's DAG validation shows a **warning** on the DAG ("email_on_failure ignored: no email transport configured"). `email_on_retry=True` is translated the same way, with the event `TASK_RETRY`. - **Callbacks are a parse error** (`on_failure_callback`, `on_success_callback`, `on_retry_callback`, `on_execute_callback`, `on_skipped_callback`, DAG-level `on_*_callback`, `sla_miss_callback`): they are arbitrary code with nowhere sound to run (not on the master; not as a failure branch; in the task's own process they would miss timeouts, OOM kills and lost workers, and command/script tasks have no Python process). Message: "not supported: configure notifications with `notify=`". The migration tool reports them as a manual step. Possibly later: Airflow's ready-made notifier objects (`SlackNotifier`, `SmtpNotifier`) recognized and translated to channels. - **Internal builder API.** A **private builder API** of the `schedr` package (e.g. `schedr._model`) may be used where Airflow's *syntax* can't go through the public native API directly (e.g. the `@dag` decorator, task IDs given as strings), never to build behaviour the native API doesn't have (see the principle above). - **Last-line `.output`** (`BashOperator`, `@task.bash`, `SchedrScriptOperator`'s `LAST_LINE` mode): where a DAG uses it, the factory inserts a **hidden native Python task** that takes the whole `ProcessResult` and returns the last non-empty line of stdout (without the trailing newline); downstream tasks get its output. A native DAG could write the same by hand. - Exact even when stdout was truncated: truncation keeps the tail, and a task taking the whole `ProcessResult` gets the text and its flags, not an error. - Added only where `.output` is actually used; the UI shows the hidden task folded into the command task. - Cost: one extra Python process per such reference and a short delay before its consumer. - Not chosen: a `last_line` field in the native `ProcessResult` (the native API isn't changed for Airflow); translating `.output` to the whole stdout (a silent difference: trailing newline, multi-line output); an error (breaks the common "Bash produces a value, Python consumes it" pattern). - **`skip_on_exit_code`** (`BashOperator`, `@task.bash`, `SchedrScriptOperator`) is translated onto **outcomes**, so it needs nothing beyond the native API: - Default (`99`): the task gets `outcomes=AirflowCommandOutcome`, an ordinary `Outcome` enum internal to `schedr.airflow`: ```python class AirflowCommandOutcome(Outcome): SUCCESS = 0 SKIPPED = 99 ``` (A separate enum, not a subclass of `DefaultOutcome`: Python doesn't allow extending an enum that has members.) - Every outgoing edge becomes `.on(.SUCCESS)`. On a skip code the edges aren't taken, so the downstream tasks see a skipped upstream: `all_success` (`AllSucceeded`) skips them, `none_failed` (`NoneFailed` + start anchor) runs them, as in Airflow. - `skip_on_exit_code=None` (disabled): `DefaultOutcome`. - Another code or a list of codes: an enum **generated for that task**, `SUCCESS = 0` plus one member per code (`SKIPPED_100`, …; one exit code per member, as decided for outcomes). Edges are still `.on(SUCCESS)` only. - Only difference from Airflow: the task itself shows as *success, outcome `SKIPPED`*, not *skipped* (display only; the run's result is the same). - By the `.on(DefaultOutcome.SUCCESS)` rule in Task results and outcomes, it is a parse error on such a task; the translation writes the edges itself. - **Missing annotations** in Airflow-style callables are treated as `Any` (only the run-time output check applies), the same as an explicit `-> Any` in the native API. - One translation path means the **same semantics** for both APIs: whatever the native API checks (types, references, outputs) is checked for Airflow-style DAGs too. ## Branching, task groups and mapping All translated onto the native API (`@branch`, `group`, `.partial()` / `.expand()`). Where Airflow behaviour differs from the native API, see the principle in Thin translating classes; each case is described below. **Branching:** - **`@task.branch` / `BranchPythonOperator`: supported.** They return task ID strings (one, a list, or `None`), computed at run time, so they can't be checked at parse time; at run time an ID that isn't a **direct downstream** task fails the branch task. `None` skips all direct downstream tasks, as in Airflow: it is translated to the native `[]` (the empty subset). - **`ShortCircuitOperator` / `@task.short_circuit`: supported.** A falsy return value skips downstream tasks; a truthy one continues. `ignore_downstream_trigger_rules=True` (default): skip everything downstream; `False`: skip only direct downstream tasks and let trigger rules decide the rest. - **Translation:** a native Python task with outcomes: a truthy result gives `Continue(value)`, a falsy one `Stop(value)` (dataclasses carrying the returned value, so a pull of it still works); its direct downstream edges become `.on(Continue)`. - **`ignore_downstream_trigger_rules=False`:** exact. - **`ignore_downstream_trigger_rules=True`:** native skips spread only through trigger rules, so it is exact where they give the same result, and a **parse error** otherwise (naming the task; suggesting `ignore_downstream_trigger_rules=False` or changing that task's rule): | Downstream shape | Skip on `Stop` | Exact? | |---|---|---| | a chain or tree below the short-circuit | a task whose only upstream was skipped is skipped, under either rule | yes | | a join with an upstream **outside** the short-circuit's subtree, rule `all_success` (→ `AllSucceeded`) | any skipped upstream → skipped | yes | | such a join with `none_failed` / `none_failed_min_one_success` (→ `NoneFailed`) | runs if its other upstream succeeded (Airflow skips it) | no → parse error | | an `always` task downstream (edges dropped) | no longer downstream, so not skipped (Airflow skips it) | no → parse error | - Not chosen: emulating "skip regardless" for `none_failed` joins with hidden join tasks (not exact either: data edges count in the join's rule). - **Not supported:** `BranchExternalPythonOperator`, `BranchPythonVirtualenvOperator`, `BranchDayOfWeekOperator`, `BranchDateTimeOperator`, `@task.branch_external_python`, `@task.branch_virtualenv`. They don't exist in `schedr.airflow`; importing them is an import error naming them as unsupported. **Trigger rules:** - Translated onto the two model rules, `NoneFailed` and `AllSucceeded` (see Outcomes, failures and joins), or an error. - **Translation by a factory** (private builder API) that returns a model rule and may also **rewrite the task's incoming edges**, so some rules with no direct equivalent are emulated exactly. Both rewrites are combinations a native DAG could write by hand, so they follow the principle in Thin translating classes: - **Start anchor:** a hidden `empty` root task of the DAG, completed by the master when the run starts (it is never skipped or failed), added as one more upstream. With `NoneFailed`, the task then can't be skipped for "all upstream skipped". - **Dropped edges:** the task's incoming dependencies are removed from scheduling (kept for display only). | Airflow 3 rule | Airflow behaviour | Translated to | Exact? | |---|---|---|---| | `all_success` (default) | all upstream succeeded; any failed → `upstream_failed`; any skipped → skipped | `AllSucceeded` | yes | | `none_failed_min_one_success` | no failure and ≥1 success; all skipped → skipped | `NoneFailed` | yes | | `none_failed` | no failure; runs even if all upstream skipped | `NoneFailed` + start anchor | yes | | `always` | runs at any time, doesn't wait for upstream | dropped edges | yes; a data reference to an upstream output is an error (no edge, so no guaranteed output) | | `one_success` | as soon as one succeeded; none succeeded: all skipped → skipped, else `upstream_failed` | **error** | `AtLeastOneSuccess` rejected (see Outcomes, failures and joins); the message suggests `none_failed_min_one_success`, usually what was meant | | `all_failed`, `one_failed`, `one_done`, `all_done`, `all_done_min_one_success`, `none_skipped` | run, or keep waiting, when upstream tasks fail | **error** | not possible: no failure branches (see Outcomes, failures and joins). Exception: a **leaf** `all_done` task (cleanup) translates onto a resource (see Cleanup and resources (Airflow)) | | `all_skipped` | runs only if all upstream skipped | **error** | not possible: no rule turns a skip into a run | | `all_done_setup_success` | setup/teardown tasks | **error** as a trigger rule | `@teardown` tasks translate onto resources instead (see Cleanup and resources (Airflow)) | - **Why `AllSucceeded` exists:** `NoneFailed` runs a task when *some* upstream succeeded, so no combination of it with empty tasks and anchors expresses "skipped if *any* upstream was skipped". Translating `all_success` to `NoneFailed` with a check instead doesn't work either: `BashOperator`'s `skip_on_exit_code` defaults to 99, so almost every Bash task is skippable, and a warning or error on "join with a skippable upstream" would fire on the **default rule** in most DAGs. By the principle, the native API offers it too. - Consequence: alert/rollback tasks (`one_failed`) and `all_done` tasks that aren't leaves must be reworked when migrating (the migration tool reports them; notifications replace alert tasks). Failure-aware rules evaluated by the master were rejected (see Outcomes, failures and joins). Leaf `all_done` cleanup tasks and setup / teardown translate onto resources (see Cleanup and resources (Airflow)). **Task groups:** - **`TaskGroup` (context manager) and `@task_group`: supported.** `group_id.task_id` names, `prefix_group_id=False`, dependencies on a group (its roots and leaves, as in the native API: decision 56A), nested groups, per-group `default_args` (→ group `StepDefaults`); `tooltip`, `ui_color`, `ui_fgcolor` kept as metadata. - **Mapped task groups** (`@task_group(...).expand(...)`): **not supported for now** (an error). The native API has none either; if added later, in both APIs together. **Dynamic task mapping:** - **`.partial(...).expand(...)` over literals and upstream outputs: supported.** Several mapped arguments give the **cartesian product**, as in Airflow (same in the native API). - **`expand_kwargs`** (a list of dicts, one per instance): **supported, in both APIs**; pure data, evaluated by the master. - **`.zip()`: not now** (pure data; could be done by the master later). - **`.map(fn)`: not supported** (runs a Python function on the output; would need Python where there is none). - **Limit on mapped instances per task:** `[mapping] max_instances`, default 1024 (like Airflow's `max_map_length`); more instances fail the mapped task with a clear error. Applies to both APIs. - **Empty expansion in the Airflow layer: skipped**, as in Airflow (the native API: succeeds with `[]`, unchanged), so migrated DAGs keep their behaviour. - **Translation:** in front of a mapped task, the factory inserts a **hidden native Python task** that takes the mapped arguments and returns the outcome `Empty` or `NotEmpty` (`Empty` if any mapped argument is empty, as the cartesian product then is); the mapped task's edge becomes `.on(NotEmpty)`. On `Empty` the mapped task is skipped and its downstream tasks follow their rules (under `all_success` → `AllSucceeded`: skipped, as in Airflow). Mapping over a literal list uses the same hidden task (one mechanism). - Cost: one extra Python process per mapped task; the list counts against the hidden task's input cap. - Not chosen: changing the native rule (the native API isn't changed for Airflow); keeping "succeeds with `[]`" in the Airflow layer (a silent difference: downstream `all_success` tasks would run where Airflow skips them). ## Cleanup and resources (Airflow) Translated onto the native per-task cleanup and resources (see Cleanup and resources). - **`on_kill()`** exists only in custom operators, which aren't supported (see Scope): nothing to translate. - **Setup / teardown translate onto resources when possible**, the rest is a parse error: `@setup` → `@resource`; `@teardown` / `.as_teardown(setups=s)` → `@s.cleanup`, receiving the setup's output; the tasks between them → users. `all_done_setup_success` is covered by this. **Parse errors:** teardowns with tasks downstream of them, teardowns taking other data, a teardown for several setups. - **A leaf task with `all_done`** (the classic Airflow cleanup task) translates onto a `Resource` without setup code, named after the task: **users** = its **direct upstream tasks** (exactly what `all_done` waits for; it may run while other parts of the graph still run, as in Airflow); **cleanup** = the task itself (a Python callable → `@.cleanup`, a `BashOperator` → `CommandCleanup`), with the task's `retries`. **Parse errors:** the task has downstream tasks; it takes data (e.g. `XComArg`). An `xcom_pull` inside it fails at run time ("a cleanup has no upstream outputs"). - **Compared with Airflow's setup/teardown:** the same idea and the same "runs if the setup succeeded" rule, but users are explicit (not every task between setup and teardown in the graph), the cleanup is not a graph node (nothing can wait for it, it can't decide the run's result as a leaf), it receives only the setup's output, and there is one cleanup per resource (Airflow: a teardown may serve several setups). schedr has no "clear" (see Run result), so re-creating a resource for re-run tasks never arises. - **Differences in results:** a failed cleanup **fails the run** in schedr; Airflow by default doesn't fail the run when a teardown fails (`on_failure_fail_dagrun=False`). A successful `all_done` leaf can turn an Airflow run green after a failure; never in schedr (see Run result). ## Reference version: Airflow 3 Module paths mirror **Airflow 3** (the `airflow.sdk` Task SDK and the `standard` provider). Migration is a mechanical rewrite of the import prefix, `airflow.` → `schedr.airflow.`: | Airflow 3 | schedr | |-----------------------------------------------|------------------------------------------------------| | `airflow.sdk` | `schedr.airflow.sdk` | | `airflow.providers.standard.operators.bash` | `schedr.airflow.providers.standard.operators.bash` | | `airflow.providers.standard.operators.python` | `schedr.airflow.providers.standard.operators.python` | | `airflow.providers.standard.operators.empty` | `schedr.airflow.providers.standard.operators.empty` | Airflow 2 import paths (`airflow.operators.*`, `airflow.decorators`) are **not** mirrored. Example: ```python from datetime import datetime, timedelta from schedr.airflow.sdk import DAG, task from schedr.airflow.providers.standard.operators.bash import BashOperator from schedr.airflow.providers.standard.operators.empty import EmptyOperator with DAG( dag_id="example", schedule="0 3 * * *", start_date=datetime(2026, 1, 1), catchup=False, default_args={"retries": 2, "retry_delay": timedelta(minutes=5)}, tags=["demo"], ): start = EmptyOperator(task_id="start") extract = BashOperator(task_id="extract", bash_command="./extract.sh") @task def transform() -> None: ... start >> extract >> transform() ``` ## Scope **Tier 1 (DAG authoring):** | Area | Included | |----------------------|------------------------------------------------------------------------------| | `schedr.airflow.sdk` | `DAG` (context manager), `@dag`, `@task`, `@task.bash`, `chain`, `TriggerRule` | | `DAG` arguments | `dag_id`, `schedule` (cron, `@daily`-style presets, `@once`, `timedelta`, `None`), `start_date`, `end_date`, `catchup`, `default_args`, `tags`, `description`, `max_active_runs`, `max_active_tasks`, `params` | | Operators | `BashOperator`, `PythonOperator` (`python_callable`, `op_args`, `op_kwargs`), `EmptyOperator` | | Per-task arguments | `task_id`, `retries`, `retry_delay`, `execution_timeout`, `trigger_rule`, `max_active_tis_per_dagrun`, `max_active_tis_per_dag`, `email`, `email_on_failure`, `email_on_retry` | | Dependencies | `>>`, `<<`, `set_upstream` / `set_downstream`, `chain()`, lists on either side | **Also in scope (beyond Tier 1):** | Feature | Airflow API mirrored | Decided in | |---|---|---| | Branching | `@task.branch`, `BranchPythonOperator`, `ShortCircuitOperator`, `@task.short_circuit` | Branching, task groups and mapping | | Trigger rules | all Airflow 3 rules: translated or an error | Trigger rules | | Task groups | `TaskGroup` (context manager), `@task_group` | Branching, task groups and mapping | | Dynamic task mapping | `.partial(...)`, `.expand(...)`, `expand_kwargs` | Branching, task groups and mapping | | Setup / teardown | `@setup`, `@teardown`, `.as_teardown(setups=...)` | Cleanup and resources (Airflow) | | Triggering another DAG | `TriggerDagRunOperator` | Dependencies between DAGs | | Passing values between tasks | outputs, `ti.xcom_pull` (restricted, translated onto inputs) | Output serialization; `ti.xcom_pull` below | | Connections | `Connection` in **Airflow's JSON format**, stored in **secret storage** (Vault first) | Secret storage (Connections) | **Naming: "outputs", not "XCom".** XCom is Airflow's name for passing values between tasks. schedr's shared model and native API call them **outputs**: - A task produces **one output and one outcome** (see Task results and outcomes). There are no named outputs: Airflow's `multiple_outputs` maps onto references into parts of that one output (see Output serialization). - A downstream task takes an **output reference** as an input (`extract.output`, or a part of it: `output["rows"]`). - `.expand()` maps over an output; a branch task's output is the list of task IDs to follow. Airflow-specific names (`ti.xcom_pull`, `do_xcom_push`, …) appear only inside `schedr.airflow`, where they map onto outputs. **`ti.xcom_pull(...)`: translated onto inputs, restricted.** Supported because the migration promise (change only the imports) would otherwise break for many DAGs: pulling inside a `PythonOperator` callable is very common. By the principle in Thin translating classes it uses only native data flow: there is **no run-time fetch** (the native API never gets one). - **Which tasks:** Airflow passes context to a callable through parameters named `ti`, `**context` or `**kwargs`; the factory sees the callable's signature at parse time. Only such tasks get the input below; others get nothing extra. - **What they get:** the **outputs of all their upstream tasks** (ancestors in the graph) of the same DAG run, as an ordinary data input added behind the scenes (task ID → output; mapped tasks per map index). A native DAG could write the same by passing each output as an argument. - **How a pull is answered:** `ti.xcom_pull(task_ids=...)` is answered **by the runner, locally**, from that input; no call to the master while the task runs (the master needn't be reachable). Inputs travel as usual (inline in `AssignTask` up to 4 MB, in chunks above). - **Only from upstream tasks**: they are guaranteed finished, so the result is deterministic. Pulling from any other task is an error at run time ("`extract` is not upstream of `load`"; Airflow returns `None` or a value depending on timing). - Only the default key (`return_value`, i.e. the task's output); other keys, `dag_id=` of another DAG and `include_prior_dates=True` are errors; `map_indexes=` is supported. - **Cost:** the task receives every upstream output, even ones it never pulls; this counts against the task's **total-inputs cap** (64 MB). A task over the cap fails with a clear error suggesting the data-flow rewrite (`load(extract.output)`); the migration tool reports every `xcom_pull` with that suggestion. - Not chosen: a run-time fetch through the agent and the master (a mechanism the native API doesn't have); adding a run-time pull to the native API (gives up "data flow is the only way", which makes native DAGs checkable at parse time); an error (breaks migration of many DAGs); only direct upstream tasks (cheaper, but more DAGs need changes; possible later as an option); scanning the callable's source for literal `xcom_pull` calls (fails with computed task IDs, helpers or aliases). - **Priority:** after the core output mechanism (it is a compatibility layer on top of it). **Templating: no Jinja, by design. Replaced by t-strings.** schedr will not include Jinja. Airflow templates are replaced by Python template strings (t-strings, PEP 750) combined with placeholder objects: ```python from schedr.airflow.templates import ds, params, macros BashOperator(task_id="x", bash_command="echo {{ ds }} {{ params.region }}") # Airflow BashOperator(task_id="x", bash_command=t"echo {ds} {params.region}") # schedr ``` - Placeholders (`ds`, `params`, `macros`, task outputs, …) are lazy: an operation on them (`params.region`, `macros.ds_add(ds, 7)`) builds a small expression, not a value. Only operations schedr implements are allowed; anything else is an error when the DAG is parsed. - Templates are part of the **shared model**: stored in the DAG JSON as literal text plus typed references, e.g. `["echo ", {"ref": "ds"}, " ", {"ref": "params.region"}]`. Rust validates references at parse time and can render templates itself (e.g. Bash commands without starting Python). - Values from other tasks are referenced directly (`t"{extract.output}"`) instead of `ti.xcom_pull(...)`. - The native API uses the same placeholder mechanism. - **Secrets** have their own placeholder, resolved from secret storage on the worker (see Secret storage). - Requires Python 3.14+ (the whole package's minimum version, see Repository and tooling: Python). - **Any argument may contain a t-string.** Every operator and task argument is checked for t-strings and filled in at run time; there is no per-operator list of templated arguments (Airflow's `template_fields`). - **Nested values are filled in recursively**, all the way down: t-strings inside lists, tuples and dicts (e.g. `env={"RUN": t"{run_id}"}`, `op_kwargs={"day": t"{ds}"}`) are found and filled in at any depth. - Traversed: lists, tuples, dict values. **Dict keys: never**; a t-string used as a dict key is a parse error (rendered keys could collide, and there's no real use). - **Not traversed:** sets, dataclasses and any other custom objects. - A t-string found inside a container that isn't traversed is **an error when the DAG is parsed**, so it can't silently reach a task unfilled. The error message tells the author to convert the container explicitly, e.g. a set into a list, before passing it as an argument. - **Not needed for now:** template files (`.sh` / `.sql` files rendered as templates). - **Later (M5; deferred: not designed until the first version of schedr, M1–M4, works, see Roadmap):** the set of placeholders and macros (`ds`, `params`, `macros.ds_add`, …). Rule for that design (the principle in Thin translating classes): every Airflow placeholder must be **expressible with native placeholders** (e.g. `ds` as `dag_ctx.run.planned_for` formatted `%Y-%m-%d`); one without a native equivalent is an error in the Airflow layer, unless the native API gets it for a native reason. - Not planned: a restricted `"{{ ... }}"` string syntax as a fallback. - **No values in shell source** (decision 99, the user's, 2026-10-30: A, on Codex's second opinion; B53). A shell-string `command` (a `str` or a t-string, run by `/bin/sh`) takes **no placeholders**: a t-string with one is refused when the DAG file loads (also by the master's validation and by the agent before launch), with the two ways to write it instead in the message: an argument list, `command=["./notify.sh", out.report_url]` (no shell reads the values: a t-string element keeps its placeholders and format specs, `:%Y-%m-%d` included), or the value in `env=` read by the shell program, `command='./notify.sh "$URL" | tee log', env={"URL": out.report_url}`. `:raw` goes. Why: quoting each value and joining it into shell text is unsafe whatever the rule: an author's quotes around a placeholder broke it (B53), and Codex reproduced code execution from placeholders in comments, heredoc bodies and after a backslash, where no quoting rule applies. Not chosen: B refusing placeholders inside quotes only (comments, heredocs, backslashes stay open); C quoting by context (a shell parser in two languages, constructs still missed). The section below described the earlier design, quoted by default; it stays as the record of what was replaced. - **Safe substitution into shell commands (replaced by decision 99).** A t-string in a `command` inserts values into text run by a shell; unquoted, a value with spaces, `;` or `$(…)` would break the command or allow shell injection. - **Quoted by default.** In a string `command`, every interpolated value is **shell-quoted** (POSIX single-quote quoting, the same result as Python's `shlex.quote`), e.g. `t"./notify.sh {out.report_url}"` with `https://x/a b;rm -rf ~` renders as `./notify.sh 'https://x/a b;rm -rf ~'`. The agent (Rust) renders commands, so it does the quoting; tests check parity with `shlex.quote`. - **Explicit opt-out with the format spec:** `t"./run.sh {flags:raw}"` inserts the value unquoted (t-strings keep the format spec, so no extra API). Unknown format specs are a parse error. - **Format specs on references:** none; `raw` (shell commands only: elsewhere nothing is quoted); a `strftime` pattern (`:%Y-%m-%d`), only on a `datetime` / `date` / `Any` reference. Others are parse errors, and so are conversions (`!r`, `!s`) on references: they are rendered at run time, without Python. - **Plain Python values** interpolated in a t-string (known in the DAG body, e.g. `t"--region {region}"`) are formatted **at parse time** (any Python format spec and conversion); in a shell command they are shell-quoted too, unless `:raw`. `None`, containers, objects and nested t-strings are parse errors. - **Values as text** (references rendered by the agent and plain values formatted by the Python API at parse time, so a t-string mixing both is consistent): strings as they are; `int` / `float` / `bool` as Python's `str()` (`7`, `1.5`, `1.0`, `1e+20`, `True`); `datetime` and `date` in ISO 8601 (`2026-10-19T03:00:00+00:00`, `2026-10-19`; not `str()`'s space); `timedelta` as total seconds (`3600`, `1.5`; not `1:00:00`). A `strftime` spec formats a `datetime` in its own offset. A reference to a truncated `stdout` / `stderr` is a run-time error. - **Quoting parity:** the agent's quoting is tested against a shared fixture (`testdata/shell_quote.json`) that the Python tests check against `shlex.quote`, plus property tests (quoting always round-trips through the shell). - **Where t-strings go:** a `CommandOperator` command (a shell string), each element of an argument list, `env` values, and any task argument (also inside lists, tuples and dict values). A t-string task argument renders to a `str`, so its parameter must accept `str`. - **Argument-list commands, no shell:** `command=["./notify.sh", out.report_url]` runs the program directly, each element one argument: no injection possible, no quoting needed. Recommended in the documentation whenever pipes, redirects or other shell features aren't needed. Script arguments (`schedr.toml`, `ScriptOperator`) are always argument lists. - **Secrets in a command line are a parse error**: `secrets[...]` in a `command` (string or list), in the `args` of a script / `ScriptOperator`, or in the `command` / `args` of a cleanup or resource setup. A command line is readable by every user on the node (`ps`, `/proc//cmdline`, unless `/proc` is mounted with `hidepid`), including sidecars and monitoring agents, and ends up in tools' error messages, which masking doesn't cover. The error message points to the two ways below (see Secret storage). A tool that accepts a credential only as an argument still works, explicitly in the user's script (`--token "$(schedr task-ctx secret get 'ci/deploy#token')"`). - Not the main mechanism: passing every value through environment variables (`"$URL"` in the command); safe only if the user remembers the double quotes. Kept as the recommendation for secrets. - **Later in the project:** a migration tool (`schedr migrate`, built on `libcst`) that rewrites imports and converts Jinja templates to t-strings, flagging what it can't convert. It also **reports each `ti.xcom_pull` call** and suggests the data-flow rewrite (passing `extract.output` as an argument) without forcing it, so migrated DAGs work at once and can be modernized gradually. Sensors map onto `@sensor.poke` (see Sensors and triggers: what it adds elsewhere). Out of scope for now: Assets, callbacks, pools, hooks. (`pool=` is filtered out with a parse warning: dropping it doesn't hide failures; queues cover the need.) **Custom operators are not supported** (as in the native API, by the principle in Thin translating classes). A user class subclassing `BaseOperator` (or any `schedr.airflow` operator) is an import error naming the class: "custom operators are not supported: move `execute()` into a `@task` function or a `PythonOperator` callable". The migration tool reports each one as a manual step. Provider operators other than the `standard` provider (and schedr's own `providers.schedr`) don't exist in `schedr.airflow` either.