# Migrating from `legacy` Existing workflow and clone definitions use the `legacy` dialect: the behaviour of today's resolvers in the workflow manager and the dispatchers. This package does not implement `legacy` and does not change it. A workflow or clone opts in to `standard` per definition with `settings.placeholder_dialect: "standard"`; pipelines always use `standard`. ## What changes when a definition opts in (§11) | `legacy` | `standard` | | --- | --- | | A function is recognised only at the start of a string; trailing text is dropped (`"@{get_hour} o'clock"` gives `13`) | Functions resolve anywhere (`"13 o'clock"`) | | Quoted arguments are resolved again; `''` stays `''` | Quoted arguments are text; `''` is `'` | | `#/variables/`, `#/tasks//…` with `$.` selectors | `@{lookup, variables.}`, and `@{lookup, tasks..output.…}` once defined | | `{{…}}` in choice conditions and the SQL query task | Not part of `standard`; those tasks keep their own rules | | Unknown `@{…}` text is left as it is | Rejected when the definition is saved | | Time functions use the wall clock | Date functions take the time to compute from as their last argument (`@{get_hour, UTC, run.logical_at}`); without it, the current time | | Any field may hold a placeholder | Not `id`, `name`, `type`, `version` (by default) outside `settings` ([protected fields](concepts.md#protected-fields)) | | `get_secret` takes any key | Keys are restricted to the run's tenant | | Secrets resolved by the dispatcher, by a regex | Secrets resolved by the service, or by the dispatcher with `resolve(strict=False)` when the service cannot reach the vault | | `get_ssm_secret`, `new_uuid4` | Not available: use `get_secret` for secrets | ## Function output differences The time functions are reimplemented, not copied. At the same instant they give the same output as the workflow manager's builtins (a test compares them across DST changes, a year rollover, and a leap February), except: - `get_current_date` returns an ISO date string (`"2026-05-03"`), not a `date` object. - `get_previous_hour` subtracts one elapsed hour. On a DST change the legacy version subtracted wall time and could return an hour that does not exist. - `str_join` renders booleans as `true`/`false` (legacy: `True`/`False`). ## Checking a definition before it opts in Run `validate` on the definition for syntax and dialect problems, then a dry run of every task with the run context the workflow manager will build. Run it in a test or an offline script, not inside a running service. Secrets are stubbed: ```python from ds_common_placeholder_py_lib import Context, PlaceholderError, validate from ds_common_placeholder_py_lib.testing import fake_vault report = validate(definition) state = {"current": None, "outputs": {}} ctx = Context.from_values( { "tenant_id": tenant_id, "run": lambda: run_facts, "variables": definition["settings"].get("variables", {}), "job": definition, }, verbatim=["run", "execution", "tasks"], ) with fake_vault(default=b"dry-run"): # no real secrets in a dry run ctx.set("execution", lambda: state["current"]) ctx.set("tasks", lambda: state["outputs"]) for index, task in enumerate(definition["tasks"]): state["current"] = {"id": task["id"], "name": task["name"], "attempt_no": 1} try: ctx.resolve(["job", "tasks", index, "settings"]) except PlaceholderError as err: report.append(err) state["outputs"][task["id"]] = {"output": sample_output(task)} # what later tasks read for error in report: print(error.code.value, error.path, error.placeholder) ``` Text that is not a placeholder, such as `{{ POSTGRESQL_URI }}` or `#/variables/x`, passes validation as plain text. Replace it by hand: a `{{ … }}` connection string usually becomes a `get_secret` of a vault path. ## Date windows in workflows A `standard` date function written as in `legacy` (`@{get_start_date_last_month}`) computes from the current time, as `legacy` did. To compute the window for the time the run is *for*, not the time the task happens to run, pass it: `@{get_start_date_last_month, UTC, run.logical_at}`.