Repository navigation
v0.9.0
Theme: ADR 0005's state-location foundation, delivered end to end. #756 ships all four steps — the state.backend config surface + factory, a working GCS backend, a working S3 backend, and the operator/migration docs — so run state, history, and the DLQ survive an ephemeral CI runner and are shareable across a team, with generation/ETag-preconditioned writes closing the same concurrent-writer failure class as #919 for drt's own state. Write-path semantics grew three ways: first-class run_id/sync_run_id correlation plus opt-in metadata_columns bookkeeping (#762), declarative computed_fields (#763), and REST API body_mode: batch (#770). CI/testing depth: state:modified selection against a prior manifest baseline (#772, ADR 0006) and zero-credential sync.unit_tests (#780). Security: secret provider URIs for AWS/GCP Secret Manager and Vault (#782). drt serve gained a real delivery contract — coalescing instead of dropping concurrent triggers, 202 + poll instead of holding the request open, pluggable auth (#854). Two data-loss bugs closed, both with the same reconcile-against-fresh-state pattern: concurrent GCS watermark writers silently clobbering each other (#919) and drt retry silently dropping dead letters appended by a concurrent drt run (#955) — local (non-object-store) cross-process safety for both stores is tracked separately as #963. The CLI/MCP parity gap that let --limit/--fail-fast/--vars ship without their MCP-tool equivalents for three releases is now a CI gate (#871), and all 11 gaps it found are closed (#870). Also: scope-aware SQL diff closing the last #694-part-2 memory-win gap (#890). No breaking changes — drop-in upgrade from v0.8.5.
Added
-
REST API batch request bodies (#770):
body_mode: batchsends the engine's already-sync.batch_size-bounded record chunk in one HTTP request, or further splits it withmax_records_per_request, replacing one-request-per-row activation against bulk endpoints without creating a second batching authority in the destination layer.batch_templaterenders withrows=<post-mapping records>and the existingtojson_safefilter handles the whole list; rate limiting is charged once per outer request, so the configured RPS now buys N records of throughput in batch mode, while retry still wraps the complete request atomically. Non-2xx responses fail the whole request chunk by default; optional dottederror_pathmaps an exactly length-matched, index-aligned JSON list wherenullmeans success and non-null entries become row errors (message priorityerror→message→error_message). A malformed mapping logs a warning and safely fails the whole sub-chunk rather than partially pairing the wrong records, and globalRowError.batch_indexoffsets remain correct across multiple sub-chunks for DLQ handoff.on_error: failstops after the first sub-chunk containing any failure; empty batches perform no rendering, limiter acquisition, or network I/O. Defaultbody_mode: recordis unchanged. Docs:docs/connectors/rest-api.md. -
State-aware selection — run only the syncs this PR changed (#772): CI no longer has to choose between running every sync and running nothing when a PR changes project configuration.
drt run --select state:modified --state ci-baseline/manifest.json --dry-run --diffcompares the current project with a priordrt docs generate --format jsonartifact; the same--stateflag andstate:modified/state:newselectors work ondrt build,drt test, anddrt validate. Manifest schema v3 addssyncs[].config_hash, and one shared resolver carries the resulting diff through selection without inventing a second state format. The hash covers sync-file content (plus referenced local model SQL), not resolved configuration: secrets referenced through environment variables structurally cannot enter it, while an environment-variable-only change is deliberately invisible — the same accepted blind spot dbt documents. A missing, unreadable, or malformed baseline warns and treats every current sync as new/modified, so the first CI run works rather than failing closed; a pre-v3 manifest instead exits clearly because it cannot contain comparable hashes. See ADR 0006. -
sync.computed_fields— declarative derived columns (#763): drt could rename a column (field_mappings) and obscure one (mask), but not derive one. The workarounds were to push destination-specific formatting into a shared dbt mart — one mart per destination, which is mart sprawl — or to use the REST destination'sbody_template, which the other 33 structured destinations do not have. Nowcomputed_fields: {name: "<jinja>"}derives payload-shaped columns at the engine seam, so every destination gets them:full_name: "{{ row.first }} {{ row.last }}",phone_e164: "+81{{ row.phone | replace('-', '') }}",source_system: "drt-${ENV}". Same Jinja environment, filters andStrictUndefinedstrictness asbody_template— one templating story. A single-expression template keeps the value's Python type ({{ row.n * 1000 }}reaches a BIGINT column as5000, not"5000"), while anything with surrounding text renders as a string; Jinja's ownnative_concatis deliberately not used, because itliteral_evals the result and would turn a column holding the string"123"into the integer123while leaving"01"alone — the same config behaving differently row by row, decided by the data. Ordering:computed_fields→field_mappings→mask. Templates therefore read source column names, matching howcursor_fieldandlookupsalready read, and the rename and mask apply to what they produced.⚠️ This is not the order sketched in the issue (computed_fields→mask→field_mappings), which would have inverted the shipped meaning of every existingmask:key — they reference post-rename names today, so a mask configured against the destination-facing name would have silently stopped matching and let PII through. A computed field can never read another computed field: every template is evaluated against the record as it arrived, so results do not depend on YAML key order — the same guaranteefield_mappingsmakes, and the reason chaining was rejected rather than overlooked. Writing an existing column name is allowed and replaces it in place, for normalisation (phone→ E.164) without inventing a second name. Template syntax is validated at config load — a malformed template stopsdrt validateinstead of surfacing on the first row of a production run — while a missing column stays a run-time error governed byon_error:skipdrops the row with aRowError(never half-derived: fields are assigned only once all of them succeeded),failraises and names the field, since a template failure is nearly always one config defect affecting every row alike and reporting it once beats reporting N skipped rows and zero synced. Error handling deliberately catches every exception a template can raise, not just the missing-column one —{{ row.a / row.b }}over a zero raisesZeroDivisionErrorstraight out of Jinja, and catching narrowly would let it abort a run that had explicitly asked to skip bad rows.⚠️ One inherited Jinja behaviour to know: a NULL passed through a filter renders as the literal string"None"({{ row.phone | replace('-', '') }}over a null phone), because Jinja stringifies before filtering; a bare{{ row.phone }}correctly stays null. This is shared withbody_templateand is not special-cased — write{{ row.phone or '' | replace('-', '') }}. Prior art: dlt'sadd_map, Census / Hightouch computed mapper fields; aggregations and cross-row logic remain out of scope (that is SQL's job). -
state:project config block (#756, step 1 of 4): builds on #900's prior pure-interface extraction (StateStore/HistoryStore/DlqBackendProtocols + back-compat aliases, no call-site changes, paired with a set-equality test against each local implementation's public API so a Protocol can't silently stop covering a method — caught a near-miss whereStateStore.reset()had arrived nine days after the Protocol's method list was written). This step adds a newdrt_project.ymlstate.backendfield (localonly for now — this is groundwork, not a new capability) and a sharedbuild_state_bundle()factory replacing 24 directStateManager/HistoryManager/DlqStoreconstructions across the CLI/MCP/docs surfaces. Behaviourally a no-op — every call site still gets the same local file-backed stores it did before — but it's what makes a remote (GCS/S3) backend a config change instead of a rewrite in the follow-up PRs this stack sets up. The bundle is cached per project directory rather than constructed fresh per call:drt run --threads N's existing per-instance locking only stays meaningful once every thread shares the same store instance, which matters more once that instance is a network client rather than a local file handle. -
state.backend: gcs(#756, step 2 of 4): the first working remote backend —state.json/history/DLQ each become one GCS object per sync (or one for state), read-modify-written under a generation precondition rather than last-write-wins, closing the same failure class as #919 (a lost update between two writers that finish together) for drt's own state rather than just watermarks. Reads are pinned by a versioned blob reference rather thanif_generation_matchon download — the two are not equivalent: a competing writer landing between the metadata check and the download raises404on a versioned read but412on anif_generation_matchdownload, and conflating the two would let a genuinely-present object's read be mistaken for "never existed", producing a wrong create-only write. Retries use jittered exponential backoff (up to 8 attempts — higher than a single watermark's 5, sincestate.jsonis shared by every--threads Nworker rather than by two independent writers) and raiseStateContentionErroron exhaustion for state (silent loss is exactly the bug class this closes) while history/DLQ stay best-effort, matching local's existing swallow-and-log posture. Remote history is additionally capped byhistory.max_entries(default 500) on top ofretention_days, bounding the object a conditional write reads and rewrites — a documented behaviour difference from local, which keeps everything inside the retention window with no count cap. The DLQ observer now buffers failed batches and flushes once per sync instead of writing on every failed batch, which also reduces local DLQ file writes. Newobject_store_smokepytest marker (realfake-gcs-serverviatestcontainers, every PR, no secrets — same posture #941 established for Postgres/MySQL) opens with a mandatory canary asserting the emulator actually enforces both preconditions before any concurrency test runs, so a permissive emulator fails loudly instead of reporting false-green results. -
state.backend: s3(#756, step 3 of 4): the same object-store primitive against Amazon S3, using ETag preconditions in place of GCS's generations. S3 has no equivalent of a generation-addressed read, so a stale snapshot surfaces as a412on the pinnedGetObject(or404on a concurrent delete) rather than the versioned-read404GCS gets almost for free — the read path retries explicitly rather than relying on a single primitive doing the work.PutObjectusesIfNoneMatch: "*"for create-only andIfMatch: <etag>for update-if-unchanged; an S3-compatible endpoint that can't honour a conditional header (e.g.501) fails loudly rather than silently falling back to an unconditional write. Credential resolution matchesS3Destination's existing shape exactly (aws_access_key_id_env/aws_secret_access_key_env/aws_session_token_env,region,endpoint_url) so state storage doesn't introduce a second AWS auth vocabulary.boto3floor bumped to>=1.35.69— the version that added conditional-write support toPutObject. Sameobject_store_smokemarker as the GCS leg, now covering both backends via LocalStack's S3 service, with its own three-part canary (create-only, stale-IfMatch-on-write, stale-IfMatch-on-read all independently verified enforced before any concurrency assertion runs). -
Remote state operations and migration guide (#756, step 4 of 4): documents GCS/S3 setup, authentication and scoped IAM, the shipped object layout and contention behavior, bidirectional migration from
.drt/, and the independence of project state from per-sync watermark storage. The sync-history, DLQ, CI/CD, and LLM API references now point operators to the durable backend where local-only wording previously implied.drt/was the only location. -
First-class
run_id+sync_run_idcorrelation (#762, part 1 of 2): everydrt runprocess now generates arun_id(one per process, threaded through every sync it executes), and everyrun_sync()call — including library callers that never pass one at all — generates its ownsync_run_id. Both flow throughSyncResult,HistoryEntry,DeadLetter,--output json, OTel span attributes, and failure/degraded alert context, all for free:_run_sync_bodystamps both ids onto itstotal_resultobject immediately after construction, before any observer or alert dispatcher ever sees it, so noSyncObserverProtocol signature change was needed. Deliberately not reconciled with #768's query-taggingnew_run_id()(a short lowercase-hex id sized to fit SQL comments and warehouse label length limits) — forcing a full UUID4 through that path risked corrupting the exact budget it exists to respect. Plainuuid.uuid4(), not the issue's proposeduuid7: none of the six correlation surfaces above sort by id, anduuid7isn't in the stdlib on any supported Python (3.10–3.13). One documented gap: ifrun_sync()raises before ever returning aSyncResult, the CLI's--output jsonerror entry for that one failure has no object to readsync_run_idfrom (the history entry and failure alert written inside the samefinallyblock, before the re-raise, still get it correctly). -
sync.metadata_columns— opt-in engine-injected bookkeeping columns (#762, part 2 of 2): drt wrote destination rows byte-for-byte from the source, with no marker of when a row synced, which run produced it, or which sync owns it — debugging a stale-looking CRM row meant cross-referencing local.drt/historyfiles a CI runner throws away between runs. Nowmetadata_columns: {synced_at: _drt_synced_at, run_id: _drt_run_id, sync_name: _drt_sync_name}adds any subset of the three as plain dict enrichment at the engine seam, so every destination that takes alist[dict]gets them — SQL, SaaS, and file/blob alike — not just the REST destination. Prior art: dlt's_dlt_load_id+_dlt_id, dbt'sinvocation_id.synced_at/run_idare computed once perrun_sync()call and shared by every row it writes (matching a load-id's "one per load" semantics), not recomputed per-record or per-batch;run_idisnullfor library callers that don't pass one torun_sync(), the same nullability part 1'sSyncResult.run_idalready has. Ordering: last of every transform, applied aftermask— unlikecomputed_fields(which runs first): the column names here are already destination-facing (chosen directly in config, not derived from a source column) and the values are engine bookkeeping, not source data, so there's nothing forfield_mappingsto rename ormaskto obscure. This also means acomputed_fieldstemplate can never observe a metadata column, since it doesn't exist yet whencomputed_fieldsruns. Requires the target column to already exist on the destination — this is dict enrichment, not DDL; a destination without that column fails the write normally, governed byon_error. A record that lands in the DLQ carries its metadata columns from the original failed attempt:drt retryresends the stored record verbatim, so a successfully-retried row's_drt_synced_at/_drt_run_idtrace back to when it first failed, not the retry — deliberate, not a gap. Docs:docs/guides/metadata-columns.md. -
sync.unit_tests— fixture rows in, expected payload out, zero credentials (#780): oncemask,field_mappings, and destination lookups could all touch a record before it ships, the only feedback loop for "does this mapping do what I think" wasdrt run --dry-runagainst a real warehouse — slow, and unavailable to a contributor without cloud credentials or to CI on a pull request.unit_tests:runsgivenfixture rows through the real engine transform chain (computed_fields→field_mappings→mask→metadata_columns, via aFakeSourceand a capturing destination) and compares the result againstexpect— no network call, no credential, no destination connection.expectis a subset match per row — only the keys a test declares are checked, so a sync's source columns growing later doesn't break every existing unit test — but row count is still checked exactly, since a transform that drops or duplicates a row is exactly what a unit test exists to catch.drt test --unit,--output json,--select,--fail-fast; wired intodrt buildand thedrt_run_testMCP tool. Not supported yet: a sync whose destination haslookups:configured — lookups resolve against the real destination and there is no fake for that — reported as a failed test rather than a crash; mutually exclusive with--dry-runand--store-failures, which are destination-connected concepts unit tests don't have.alertsare stripped before the sync runs (a shallowmodel_copy, the caller's own config object untouched) — otherwise a test deliberately exercising a failure path would fire real Slack/webhook alerts from insiderun_sync()'s ownfinallyblock, since alert dispatch there is not observer-mediated. Prior art: dbt unit tests (1.8+), Census/Hightouch mapper previews with sample records. Docs:docs/guides/sync-unit-tests.md. -
Secret provider URIs — resolve credentials from AWS/GCP Secret Manager or Vault (#782): production reverse ETL concentrates write credentials to CRMs, ad platforms, and warehouses — exactly the secrets an org keeps in a managed store with rotation policies attached, while the default path (export into an env var in every runner) duplicates secret-distribution logic per orchestrator and breaks rotation the moment it's exported. Any
*_envfield in a profile or destination config can now be ascheme://...URI instead of a plain env var name:aws-sm://<secret-id-or-arn>#<key>([aws-secrets]extra),gcp-sm://projects/<project>/secrets/<secret>/versions/<version>#<key>([gcp-secrets], GCP always names a version explicitly —latestis a real resolvable alias, not an implicit default), andvault://<mount>/data/<path>#<key>([vault];#<key>is required here, unlike AWS/GCP, since a KV v2 payload is always a field map with no "the secret is just one string" case to fall back to). Resolution chain: explicit YAML value → OS environment variable →.drt/secrets.toml→ provider URI, tried in that order, so a provider URI is automatically inert wherever a real env var orsecrets.tomlkey already resolves. A resolved value is cached by full URI with a 300s default TTL (DRT_SECRET_CACHE_TTL_SECONDS, read on every lookup, so changing it takes effect without a restart; a non-positive value disables caching entirely) — this is what letsdrt serve, a long-lived process that re-enters credential resolution on every triggered sync, pick up a rotated secret within one TTL window instead of holding the value it resolved at process start indefinitely (#929, caught and fixed before this shipped in any release). The Vault leg goes one step further for a related reason:hvac.Client()capturesVAULT_TOKENonce at construction and never refreshes it, and Vault tokens are conventionally short-TTL, so the Vault client is rebuilt on every fetch rather than cached — avoiding every fetch failing outright once the token expires, in favour of the value-cache's own bounded staleness. Not secret writing or rotation management (drt only reads), not local-file encryption (.drt/secrets.tomlis a separate, unrelated mechanism), not OAuth token brokering, and not yet a third-party plugin surface (the provider registry is structured for one, but nothing installs today). Docs:docs/guides/secret-provider-uris.md.
Changed
-
Template rendering compiles once instead of per record (#763):
render_templatebuilt a fresh JinjaEnvironmentand re-parsed the template on every call, and all five of its callers — HubSpot, Klaviyo, Mixpanel, Zendesk, Linear — call it per record. Two module-level environments and an LRU cache of compiled templates replace that. Behaviour is unchanged, including the exception surface; Jinja templates are safe to render concurrently, which matters becausedrt run --threads Nnow renders through one shared cache. -
Scope-aware SQL diff for tracked+scoped mirror, closing the gap #694 part 2 left open (#890):
strategy: tracked+scopecomposed together still pulled the whole per-sync tracked-key state table into Python before filtering by scope in memory — #694 part 2's server-sideNOT EXISTSdiff landed, but the scope narrowing came after it, in Python. On real Postgres 16 with 500 scopes × 200 keys (100,000 tracked rows), a run touching one scope and dropping 5 of its keys returned 99,805 rows to Python before this change; 5 after — roughly 20,000× fewer rows crossing the wire, and faster too (44.4ms → 6.6ms, best of 3). Fixed identically across all four SQL destinations that implement tracked+scoped mirror — Postgres/MySQL, Snowflake, ClickHouse, Databricks — each dialect's own diff query now applies the scope filter server-side instead of after the fact. Rows written before scope tracking existed (scope_spec/scope_keystillNULL, un-backfilled) correctly fall through to the existing Python-side filter, unchanged from today's behaviour — verified with a mixed backfilled/un-backfilled table rather than assumed. -
Internal —
drt_run_teststopped re-implementing the test loop (#851, PR #927 by @Muawiya-contact): the MCP tool ran its own copy of connect → build query → execute → check → severity → error handling, the same loopexecute_tests_for_synchas run fordrt testanddrt buildsince #777. Two implementations of one rule is precisely what #400 was, and #836 had to add MCP-side severity tests to pin behaviour a comment was otherwise holding in place.run_test()is now selection plus the JSON envelope: it picks the syncs and delegates per sync, so a change to severity semantics — or to anything else in the loop — reaches the MCP tool by construction rather than by remembering to. The returned shape is unchanged field-for-field, includingstatus/results[].sync/tests[]/skipped/reason, and every existing test passes unmodified. Two arguments carry the difference in surface:json_mode=True+quiet=True, because the shared function prints a test header and a line per test for the CLI and MCP speaks over stdio; and (at the time)store_failures=False, because #779's samples are written to.drt/test_failures/and MCP exposed no way to read one back — #870 below turns that into a real opt-in parameter once the returnedpathitself answers the objection. One user-visible edge: the skipped-syncreasonindrt test --output jsongains the trailing worddestinations("tests not supported for rest_api destinations"), matching the wording the same command has always printed, the wordingdrt_run_testhas always returned, and the wordingdrt build'stests_skipped_reasoninherits. -
The drift audit now checks that CLI options reach their MCP tool (#871, PR #877 by @Pawansingh3889):
scripts/check_drift.shaudited connectors and MCP tool existence, so adding a connector was caught and adding a flag was not. That is why the v0.8.0 wave —--limit,--fail-fast,--failed,--vars,--threads— shipped without MCP parity and went unnoticed for three releases (#870). The release checklist already asked for this by hand (drt-release-check.md, Phase 0 item 12), and it was manually ticked and silently passed each time; asking a human to enumerate "new CLI capabilities" from memory across a thirty-PR release is exactly the task that degrades. New check 9 does the enumeration instead, viascripts/check_cli_mcp_parity.py: it walks the Typer command tree, reads each MCP tool's signature, and reports any behaviour-changing option with no corresponding parameter. Presentation flags (--output,--verbose,--quiet,--log-format,--format) and selection flags (--select,--exclude) are structurally excluded with the reason recorded, and renames are declared rather than guessed (--diff→compute_diff,--sync→sync_name, and--no-state→include_state, an inverted alias). A command that is neither mapped to a tool nor explicitly listed as deliberately unmapped is itself reported — so a new command forces a decision instead of being silently skipped, which is #870's failure mode one level up. The 11 gaps it found are recorded — and, as of #870 directly below, cleared — inscripts/drift_baseline.txt; two of them —test --dry-runandtest --store-failures-limit— were found by the check rather than by the hand audit.⚠️ The check refuses to report success if introspection breaks. Typer 0.27 vendors its own Click, soTyperOptiondoes not subclass the installedclick.Option; the obviousisinstancefilter matches nothing, every command enumerates zero options, and a parity check written that way passes forever while the gap it exists to catch grows. Options are therefore identified by duck-typing onparam_type_name, and a canary assertion exits 2 rather than 0 if known-present options stop enumerating. For the same reason the script imports noclickat all — Typer vendors it, so standalone Click is absent from a core install and importing it would work locally and fail in CI. The drift workflow gained a Python setup + corepip install -e .step (checks 1–8 are pure bash), anddrt/cli/**,drt/mcp/tools/**were added to itspaths:filter — without those a new flag would only have been caught by the weekly cron, reintroducing the lag this fixes. Trigger design is unchanged: the audit stays post-merge + weekly and never comments on contributor PRs. -
MCP parity closed:
--limit/--varsondrt_run_sync,--dry-run/--fail-fast/--store-failures[-limit]ondrt_run_test,--check-connection/--strictondrt_validate(#870): all 11 gapsscripts/check_cli_mcp_parity.py(#871) found are now closed or recorded as deliberate.drt_run_syncgainslimit(→extract_limit, same mirror/replace rejection as the CLI — a sample would delete or replace real rows) andvars(already a parsed dict, not the CLI's'k: v, k2: v2'string — resolved through the samevars:block <DRT_VAR_*< caller precedence viaproject_vars(), reused rather than reimplemented).drt_run_testgainsdry_run,fail_fast,store_failures, andstore_failures_limit— the multi-sync--fail-fastloop moved out ofdrt testinto a new sharedrun_test_suite()(same one-implementation principle #851 above already applied to the per-test loop, applied one level up to the per-sync loop, and to theunit=Truepath too viarun_unit_test_suite()once review caughtfail_fastsilently not reaching it there) so every surface schedules syncs identically.store_failuresreverses #851's earlier "MCP can't read a sample back" reasoning: the returnedfailures_stored.pathis a filesystem path under the project directory, and an MCP client with its own file access (the common case — an agent driving drt via MCP usually also has Read/Bash on the same checkout) can open it directly; MCP itself still doesn't read the file, it just stops pretending the path is useless.drt_validate— previously four lines returning onlyvalid/errors, with no secret scan at all — now also runs the hardcoded-secret scan and reportswarningsper sync (including for syncs that failed schema validation, matching the CLI), gainsstrict(promotes those warnings toerrors, matchingdrt validate --strict) andcheck_connection(adds aconnection_testsdict via the same_run_connection_testthe CLI uses, keyed by sync name).run:--threads/--fail-fast/--failedare deliberately excluded, not implemented:drt_run_syncruns exactly one sync per call, and all three are multi-sync scheduling/selection concepts — parallelism across syncs, stopping remaining scheduled syncs, and a status-based selector with the same grammarSELECTION_OPTIONSalready excludes--select/--excludeunder ("an agent filters viadrt_get_status()and callsdrt_run_syncper name"). Recorded inCOMMAND_EXCLUSIONS["run"]with each reason rather than left as baseline debt, since extending a single-sync tool with a second scheduling authority would contradict the selection precedent already shipped.scripts/drift_baseline.txt'scli-mcp:section is now empty. -
drt servegets a real delivery contract (#854, ADR 0004 Tier 3, PR #902 by @Pawansingh3889): at webhook cadence the old endpoint had three defects that compounded — a second trigger was answered423 Lockedand dropped (the sender believed it delivered; nothing ran — silent event loss, not backpressure), the sync ran synchronously inside the request handler (any sender with a delivery timeout recorded a failure for a sync that succeeded, then retried it), and the lock was global across every sync, so unrelated syncs queued behind each other. All three are replaced by one explicit promise, documented in the endpoint docs as a contract rather than an implementation detail: a trigger accepted with202will run — different syncs run concurrently, and same-sync triggers coalesce to depth 1 (while a sync runs, the first new trigger creates one pending run; further triggers get the same run id with"coalesced": true, a flag that means "your trigger did not start a run of its own", covering both the trigger that creates the pending run and every one that joins it). Coalescing rather than a deeper queue is deliberate: drt syncs are watermark-driven, so one pending run picks up everything that accumulated — a queue of N would do the same work as a queue of 1. That reasoning holds because triggers are parameterless; if a trigger ever selects rows, the coalescing decision must be revisited. Dry-run and real triggers coalesce separately — a real trigger is never folded into a dry preview.⚠️ Two behaviour changes:423is gone (a concurrent trigger now coalesces instead of dropping), andPOST /sync/<name>now returns202+ a run id immediately instead of holding the request open — pollGET /runs/<id>for the outcome, or pass?wait=truefor the old synchronous200/207semantics (await=truerequest against a busy sync coalesces and blocks until the pending run completes). Run ids are in-memory, valid for the lifetime of thedrt serveprocess — deliberately not persisted, because durable run ids are #762's decision to make; when that lands, only the id's durability changes, not this contract. Auth became pluggable (--auth none|bearer|hmac;autokeeps the historical default of bearer-if-token-set): the bearer comparison now usessecrets.compare_digest(it was==), and new HMAC-SHA256 body-signature verification covers GitHub (sha256=<hex>, default headerX-Hub-Signature-256), Shopify (base64,--hmac-header X-Shopify-Hmac-Sha256) and bare-hex senders. Stripe's timestamped scheme and Pub/Sub's OIDC JWT are not covered — OIDC is a filed follow-up (#903 — it needs a JWT dependency decision), and until it lands Pub/Sub push still needs a verifying proxy. Auth coversGET /runs/<id>, not just thePOST: that endpoint returns the fullSyncResultand any error text, and while the run id is a uuid4 it rides in the URL path, so it reaches every reverse-proxy access log in front of drt. Leaving it as an implicit capability URL would have made the read path quietly weaker than the write path, in the one change whose stated purpose is making the contract explicit.GET /healthstays open so load-balancer probes need no credential. UnderhmacaGEThas no body to sign, so its signature is over the empty body: a constant per secret rather than a per-request signature, documented in the guide together with theopensslone-liner that computes it and with when to preferbearerfor the polling path. One correctness fix underneath:run_drt_sync()gained an optionalstate_managerparam and the server passes a shared state store, sinceLocalStateManager's thread-safety is an instance lock and the previous per-request instances would have raced load-modify-save onstate.jsonthe moment different syncs ran concurrently. That param is typed as theStateStoreProtocol (#756) rather than the concrete local class, sodrt serveis not the one caller structurally unable to take a remote state backend when those land. Request bodies are capped at 1 MiB (413); the run registry keeps the last 1000 finished runs, evicted byfinished_atrather than by membership of a fixed set of state strings, so a status the runner's result contract grows later cannot leave a run permanently un-evictable. Docs:docs/guides/using-webhook-trigger.md(the contract, status-code table, per-scheme auth setup),docs/llm/CONTEXT.md.
Fixed
-
drt retrysilently dropped dead letters appended by a concurrentdrt run(#955).replay_dead_letters()read the DLQ once at the top, decided what to keep/drop against that snapshot, and wrote the result back at the end withDlqBackend.replace()— an unconditional whole-queue overwrite. A dead letter a concurrentdrt runappended between that read and that write was never seen by the snapshot and was silently lost on the overwrite. Same failure class as #919 (concurrent writers, a stale snapshot committed as truth), caught three days after that fix shipped.DeadLettergains a stableid(assigned once at creation, preserved bydrt retryacross attempts — a retried-and-failed-again entry keeps its identity; onlyattempts/timestamp/error_messagechange) and both backends gainDlqBackend.reconcile(remove_ids=..., updates=...), which re-reads current state itself and touches only the named entries — anything the caller never saw (a concurrent append, or an entry beyond--limit) survives untouched.replay_dead_letters()now calls this instead ofreplace();--limit's previously-explicituntouchedbookkeeping is now implicit, since reconcile only ever names what it actually processed.ObjectStoreDlqBackend.reconcile()is genuinely cross-process-safe — the same generation/ETag preconditioningappend()already used forces a retry against fresh state on a losing race, exhausting attempts raises rather than silently committing stale content.LocalDlqStore.reconcile()is not — it has no OS-level file lock (only a process-localthreading.Lock, the same limitation its class docstring already documented), so a genuinely separatedrt runprocess racing the read/write window still loses that append exactly asreplace()did; what this fix does close for local is reconciling by identity from a fresh read rather than a stale in-memory snapshot, which matters the moment real file locking lands (a wholesale-overwrite operation could never be made cross-process-safe regardless of locking). Real local cross-process safety is filed separately as #963, coveringLocalStateManager/LocalHistoryManagertoo, not just this class.--clearstill usesreplace([])— a full discard racing a concurrent append can still lose that append on either backend, which is the documented "records are unrecoverable" contract, not a gap this fix left open. A retried entry'ssync_run_idnow correctly carries over from the original failure (previously reset tonullon every retry — a byproduct fix, since the reconstructedDeadLetterobject needed rebuilding here regardless), matching #762's stated correlation-id semantics: a successfully-retried row traces back to when it first failed, not the retry. Entries written beforeidexisted decode via a content-hash of their own JSONL line rather than a fresh random id per read —replay_dead_letters()reads the queue twice per invocation (once to decide what to retry, again insidereconcile()), and a random per-read id would make every legacy entry's remove/update silently never match, leaving it stuck in the queue and risking a duplicate resend on the next retry (caught in review). -
Concurrent GCS watermark writers silently discarded each other's updates (#919, PR #935 by @Pawansingh3889).
GCSWatermarkStorage.save()loaded the whole watermarks blob, set one key on the resulting dict, and uploaded the whole blob back with no precondition. Two writes that overlapped therefore both read the same base object and the later upload won outright, dropping the other sync's watermark with no error anywhere. That sync then re-read from a stale cursor on its next run and re-processed rows it had already synced, which is silent duplicate work against any destination that is not naturally idempotent.delete()had the same shape. Both now use the standard optimistic concurrency loop: read the object's generation, apply the change, and upload withif_generation_match, so a write that lost its race fails with a 412 and is retried against freshly read state instead of overwriting it. The download is pinned to the generation just read, so the bytes and the precondition token cannot come from different versions of the object, and a first write to a bucket with no object yet assertsif_generation_match=0("only if still absent"). That read is itself two round trips, so it sits inside the retry boundary rather than before it: a competing writer landing between thereload()and the pinned download fails the download's own precondition, and because the object still exists that is a 412 rather than the 404 the read guards against. Caught at the same boundary as a lost upload, it costs one attempt and re-reads, instead of escapingsave()/delete()as an unhandledPreconditionFailed, which is the one outcomeWatermarkContentionErrorexists to avoid. Retries are bounded at 5 and exhausting them raisesWatermarkContentionErrorrather than returning quietly, since a write that gives up in silence is the same failure this fixes.get()is unchanged, being a plain read with nothing to be conditional about.BigQueryWatermarkStoragewas never affected: itssave()is aMERGE, which the SQL engine already applies atomically per row.⚠️ The write path now needsgoogle-api-core(already a transitive dependency of the[gcs]extra) for its precondition exception types, resolved through the same lazy import the GCS client uses so a core install is unaffected. Found while reviewing ADR 0005, whose write-amplification note describes this same read-modify-write shape, so the approach here is a precedent for the remote state backend in #756. -
Databricks mirror DELETE on a composite
upsert_key(#908). Also shipped in 0.8.5.