Repository navigation
fix(dags): emit entity.write_back on the executor path, which never did (#770) - #775
Merged
Merged
Conversation
`write_back_resolutions` lived only in `dispatcher.rs` with one caller — `drain_and_correct`, the legacy in-process arm. Nothing under `dags/` referenced it. So on the executor path, which is the only path a job takes on a cluster, a review resolution that changed a master queued no `entity.write_back`, and a subscriber integrated against O4 received nothing. Third gap in one family, after the run report and the staged-action hand-off (#760): Phase 3 moved the pipeline into tasks and left the control-plane side-effects behind in the arm the tests were still exercising. It needed a decomposition rather than a move, because the old function wants both halves and §6.4 keeps them apart: a fresh lake session at the latest snapshot to resolve record keys and read entity detail, and Postgres to find subscribers and queue events. A pod can do the first and not the second; a control task can do the second and not the first, which `control_tasks_no_engine.rs` enforces by source scan. So `write_back_scan` (pod) publishes `WriteBackScanned` and `emit_write_back` (control) queues from it. **The branch is parallel to `settle_actions`, not upstream of it.** Putting the scan in between would make marking the actions applied depend on a webhook scan, so a reporting problem would leave them pending and RE-APPLY the corrections next pass — the opposite of the best-effort bargain O4 has always had. **Best-effort lives in the task bodies, not the graph.** `er_dag::settle` derives a job's outcome from its non-teardown leaves, so a task that failed here would fail a pass whose corrections are already applied and marked: destroying work in order to report on it. Both tasks swallow their own failures and return `Done`, logging every skip with its reason, because a write-back that silently does not happen is indistinguishable from a tenant whose endpoint is fine. Same bargain as the legacy arm; only the mechanism is new. One deliberate difference: the legacy half checked for subscribers BEFORE opening a session, to avoid paying for one nobody wanted. The scan's session is already open — being a pod task is what buys the lake read — and the subscriber list is Postgres, which a pod cannot reach. `emit_write_back` skips instead, so a tenant with no subscriber pays for the scan rather than a session. `pg_drain_dispatcher.rs` is ported off the legacy arm, which is what this unblocks and what proves it. The file subscribes to `entity.write_back` before the pass precisely so "nothing to deliver" cannot be mistaken for "nothing delivered". Observed failing with the branch removed, and the reproduction is the gap itself: zero write-backs and an empty delivery list. The port also gains the artefacts a correction pass resolves through `RunContext`, and its run-id assertion becomes the enqueued job id — on this path the run id IS the job id, so a test cannot choose it. `make check` green; the full 104-test er-server tier green against a real Postgres and DuckLake. Closes #770 Refs #645
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #770 · unblocks the last of #645's test ports
The gap
write_back_resolutionslived only indispatcher.rs, called from one place —drain_and_correct, the legacy in-process arm. Nothing underdags/referenced it. So on the executor path, which is the only path a job takes on a cluster, a review resolution that changed a master queued noentity.write_backand a subscriber integrated against O4 received nothing.Third gap in the same family, after the run report (#756) and the staged-action hand-off (#760): Phase 3 moved the pipeline into tasks and left control-plane side-effects behind in the arm the tests were still exercising.
Why it needed a decomposition rather than a move
The old function needs both halves, and §6.4 keeps them apart:
entity_of_record_keyper label, thenentity_detailper entity;webhooks_for_deliveryto find subscribers andwebhook::emitto queue each event.A pod can do the first and not the second; a control task can do the second and not the first, which
control_tasks_no_engine.rsenforces by source scan.So:
write_back_scan(pod) reads the corpus and publishesWriteBackScanned;emit_write_back(control) queues the events from it.The branch is parallel to
settle_actions, deliberatelyPutting the scan between
assembleandsettle_actionswould make marking the actions applied depend on a webhook scan — so a reporting problem would leave the actions pending and re-apply the corrections on the next pass. That is the opposite of the best-effort bargain O4 has always had.Best-effort is expressed in the task bodies, not the graph.
er_dag::settlederives the job's outcome from its non-teardown leaves, so a task that failed here would fail a pass whose corrections are already applied and marked — destroying work in order to report on it. Both new tasks therefore swallow their own failures and returnDone, logging every skip with its reason. That is exactly what the legacy arm did; only the mechanism is new.One deliberate difference: the legacy half checked for subscribers before opening a lake session, to avoid paying for one nobody wanted. The scan's session is already open — being a pod task is what buys the lake read — and the subscriber list is Postgres, which a pod cannot reach. So
emit_write_backskips instead, and a tenant with no subscriber pays for the scan rather than a session.Evidence
pg_drain_dispatcher.rsis ported off the legacy arm, which is what this unblocks. It subscribes toentity.write_backbefore the pass precisely so that "nothing to deliver" cannot be mistaken for "nothing delivered", then asserts one master changed, the cause, the run id, and that the master is the assembled golden record rather than an id.Observed failing with the branch removed — the pre-#770 graph — and the reproduction is the gap itself:
Two things the port had to change beyond the call, both the same as the other seven:
RunContext(ER_MODEL_PATH,ER_TF_PATH,ER_LEXICON_PATHand the version ids). It carried only the lake and the config, because the legacyrun_correctneeded only those.01DISPCORRECT….make checkgreen; full er-server tier green against a real Postgres and DuckLake.Note
dag_task_coverage.rs— which checks that every DAG node has a dispatch arm — is on the #645 branch and not yet onmain, so it could not vet the two new nodes here. Verified by hand instead:write_back_scanresolves to the pod table andemit_write_backto the control table, anddag_assembly.rsconfirms the graph still assembles.