# code-delivery DAG roots, code delivery, versions, change detection, ID conflicts. Generated by `make records` from the decisions whose `topic` (or `also`) is this one; edit the decisions, not this page. ## Current ### What is parsed - **A DAG is held while its file fails to import** (D72): Non-transient file errors hold every DAG of that file, including InvalidDag, InvalidPath and ParseResultTooLarge; these rejections are not retried. Held DAGs create no runs, reject manual triggers and leave queued runs waiting; running runs continue, and missed fire times follow catchup after repair. ParseTimeout and RunnerDied hold nothing; transiently failed files retry indefinitely, starting after 30 s and doubling to 10 min, preferring another worker. Holds and their file-level reasons appear in the API, UI, CLI, metrics and logs. - **Each parsed file records its worker and parse time** (D93): Each parse_files row records the worker_id and parsed_at for that file. A retry records its own worker and time. - **Only Python files mentioning schedr are parsed** (D305): Python files containing the exact bytes `schedr` are parsed; other files are shipped and hashed but skipped. Unreadable files are parsed to report the error; `schedr dags check` follows the same rule and reports skipped files. - **DAG files use ordinary Python imports in separate processes** (D326): Each parsed file has its own process and ordinary module name; tasks import it the same way. Python import behavior applies, and dots in file or folder names are refused. - **A DAG belongs to the module running its with block** (D329): The module running a DAG’s with block owns it, including when a helper function builds it. An imported module owns its own DAG, and the file must mention schedr. ### Roots and the scan - **Parse jobs and tasks run from a read-only copy of the hashed code** (D102): The agent copies scanned root files into its data directory and hashes the copied bytes. Parse jobs and tasks import from the read-only copy; unused older copies are removed and bytecode is not used. - **Standalone takes --dag-path and --script-path** (D488): `schedr standalone` takes `--dag-path PATH` and `--script-path PATH`, each repeatable and taking `.`; given, a list replaces `SCHEDR_DAG_PATH` / `SCHEDR_SCRIPT_PATH` and the file's `[dags] path` / `[scripts] path`, as other options override. A root given as `.` is named after the folder it is, as any other path; the lists keep their rules (decision 299). Only the standalone role takes them. Not chosen: `--cwd- dag-path` / `--cwd-script-path` (`.` says it), adding to the lists, a fixed name for `.`, the worker role too. ### Conflicts - **A DAG conflict remains while the remaining file fails to import** (D107): When the stored version belongs to the removed file, a conflict remains until the remaining file imports. The master logs a warning; a stored version belonging to the remaining file is kept. ### Versions - **A worker's move to new code or a revert makes that hash newest** (D113): A worker’s move to an unseen hash or one recorded before the hash it left makes that hash newest; moving to a later- recorded hash is catching up. Compare with the worker’s previous report, including across reconnects. An unseen hash is newest on first report; a revert while the master was down is not detected as a switch. - **A DAG root’s version includes the other roots on its path** (D327): Other DAG roots’ content hashes fold into a root’s reported hash, so any root edit reparses the others. Workers serving a root must agree on the DAG roots on its path. A lone root keeps its plain hash. ### When a file fails - **Reject DAG IDs that are dot or dot-dot** (D127): DAG IDs cannot be `.` or `..`. A file defining either ID receives an import error explaining why. ### Imports - **Ambiguous import names fail only files that use them** (D328): A top-level name duplicated across roots or colliding with a standard, installed or preloaded library fails the conflicting file and root files importing it, with an explanation. Checks occur at compile time, including inside functions, independently of process start method. Other files and tasks continue; library imports receive the library. ### Local checks - **DAG checks use the shipped copy filtered by .schedrignore** (D330): dags check reads the same filtered copy as dags test and workers. Files excluded by .schedrignore are unavailable for imports. - **A named file inside a DAG root keeps that root** (D331): Checking a named file or folder within a configured root retains its module path and other roots. A named file that a worker does not receive is an error. ### From other topics - Parse results stream one file per message (D62, `protocol`; built M4.1e) - Import errors show failed files of current parses (D66, `ui-cli`; built M4.2c) - Import errors have their own page (D67, `ui-cli`; built M4.2c) - Parse warnings stay in dags check (D68, `ui-cli`; built M4.2c) - Retry a resumed worker's failed follow-up each round (D109, `workers`; built M4.3e) - Testing one DAG file parses that file alone (D117, `testing-dags`; built M4.3e) - Connection values contain secrets and plain values (D180, `connections`; built M4.7a) - Connection values are limited to 1 MiB (D181, `connections`; built M4.7a) - An imported file keeps connections when its DAG is invalid (D182, `connections`; built M4.7a) - A moved cleanup runs the new worker’s current code (D245, `cleanup`; built M4.8b2) - The agent reads and checks schedr.toml (D293, `scripts`; built M4.9b) - A changed script declaration re-parses its DAGs (D294, `scripts`; built M4.9b) - A missing script root is a parse import error (D295, `scripts`; built M4.9b) - A DAG root's hash includes its used script roots (D301, `scripts`; built M4.9b) - Workers withdraw DAG roots when required script roots are missing (D303, `scripts`; built M4.9b) - The master sends workers each DAG root's script roots (D304, `scripts`; built M4.9b) - A watcher host serves one interpreter and code set (D320, `wait-steps`; built M4.11a2) - DAG parse concurrency defaults to four files (D332, `configuration`; built M4.11L) - Worker pass_env reaches parsing and the fork server (D333, `workers`; built M4.11L) - A poke moves to new code only when it can continue (D335, `wait-steps`; built M4.11a2) ## Replaced - D103 (superseded by D327): A DAG root imports only from itself and installed packages ## Where in code - `crates/schedr-agent/src/agent.rs` (D102, D117, D293, D305, D335) - `crates/schedr-agent/src/agent.rs::fitted_file` (D62) - `crates/schedr-agent/src/agent.rs::fold_hash` (D301, D327) - `crates/schedr-agent/src/agent.rs::moved_cleanup` (D245) - `crates/schedr-agent/src/agent.rs::report_changes` (D294, D303) - `crates/schedr-agent/src/agent.rs::set_uses` (D294, D304) - `crates/schedr-agent/src/attempt.rs` (D293, D335) - `crates/schedr-agent/src/env.rs::task_environment` (D333) - `crates/schedr-agent/src/fork.rs::pass_env` (D333) - `crates/schedr-agent/src/jobs.rs` (D294, D304) - `crates/schedr-agent/src/jobs.rs::lookup` (D295) - `crates/schedr-agent/src/jobs.rs::read_root` (D293) - `crates/schedr-agent/src/parse.rs` (D304, D326) - `crates/schedr-agent/src/parse.rs::ScriptDeclaration` (D293) - `crates/schedr-agent/src/parse.rs::available_parallelism` (D332) - `crates/schedr-agent/src/scan.rs::DAG_FILE_MARK` (D305) - `crates/schedr-agent/src/scan.rs::capture` (D102) - `crates/schedr-agent/src/scan.rs::mentions_schedr` (D305) - `crates/schedr-agent/src/watchers.rs::WatcherHosts` (D320) - `crates/schedr-agent/src/watchers.rs::begin_move` (D335) - `crates/schedr-api/src/routes.rs` (D72) - `crates/schedr-api/src/routes.rs::list_import_errors` (D66) - `crates/schedr-api/src/views.rs` (D72) - `crates/schedr-api/src/views.rs::ImportErrorView` (D66) - `crates/schedr-config/src/config.rs` (D303) - `crates/schedr-config/src/config.rs::parse_concurrency` (D332) - `crates/schedr-config/src/roots.rs::only` (D117) - `crates/schedr-config/src/sources.rs::OverrideValue` (D488) - `crates/schedr-db/migrations/postgres/0001_initial.sql` (D66, D72) - `crates/schedr-db/src/dags.rs::parsed_at` (D93) - `crates/schedr-db/src/runs.rs::Held` (D72) - `crates/schedr-master/src/core.rs::DEFAULT_SCRIPT_ROOT_GRACE` (D303) - `crates/schedr-master/src/core.rs::root_uses` (D304) - `crates/schedr-master/src/discovery.rs` (D93) - `crates/schedr-master/src/discovery.rs::record_switch` (D113) - `crates/schedr-master/src/dispatch.rs::resume` (D109) - `crates/schedr-master/src/validate.rs::MAX_CONNECTION_SIZE` (D181) - `crates/schedr-model/src/connection.rs::MAX_CONNECTION_SIZE` (D181) - `crates/schedr-model/src/ids.rs::DotSegment` (D127) - `crates/schedr-model/src/runner.rs::PARSE_RESULT_TOO_LARGE_EXCEPTION` (D62) - `crates/schedr-model/src/runner.rs::ScriptDeclaration` (D295) - `crates/schedr-model/src/runner.rs::WatchersRequest` (D320) - `crates/schedr-proto/proto/schedr/protocol/v1/master.proto` (D301) - `crates/schedr-proto/proto/schedr/protocol/v1/master.proto::RootUses` (D304) - `crates/schedr-ui/src/imports.rs::list` (D67) - `crates/schedr/src/cli.rs::root_path` (D488) - `crates/schedr/src/local.rs` (D305, D326) - `crates/schedr/src/local.rs::check_path` (D331) - `crates/schedr/src/local.rs::check_root` (D330) - `python/schedr/_build.py` (D180) - `python/schedr/connections.py::MAX_CONNECTION_SIZE` (D181) - `python/schedr/connections.py::defined_values` (D180) - `python/schedr/connections.py::take_connections` (D180) - `python/schedr/dag.py::_locate_in_module` (D329) - `python/schedr/runner/parse.py` (D326, D328) - `python/schedr/runner/sources.py::NameGuard` (D328) - `python/schedr/runner/watchers.py` (D320) ## Open None. Details and edge cases, with the reasons; read them before changing this: - JOURNAL.md: D488 - archive/PROJECT.md: Code versions and change detection, DAG ID conflicts, DAG code delivery, Web UI and CLI