Repository navigation
Description
The task path never emits entity.write_back.
Where it lives now
write_back_resolutions (dispatcher.rs:2175) is called from exactly one
place — drain_and_correct, the legacy in-process arm:
$ grep -rn "write_back" rust/crates/er-server/src --include='*.rs'
webhook.rs:111 "entity.write_back", # the catalog entry
dispatcher.rs:2152 write_back_resolutions(...) # the only call
dispatcher.rs:2175 async fn write_back_resolutions # the definition
dispatcher.rs:2185 pg::webhooks_for_delivery(..., "entity.write_back")
dispatcher.rs:2264 "entity.write_back",
Nothing under dags/ references it. So on the executor path — the only path a
job takes on a cluster, since deploy.yml lists every kind in DAG_KINDS — a
review resolution that changes a master queues no entity.write_back, and a
subscriber that integrated against O4 receives nothing.
Same family as #760 and as the run report (fixed in #756): Phase 3 moved the
pipeline into tasks and left control-plane side-effects behind in the arm that
was still running in tests.
Why it is not a small fix
write_back_resolutions needs BOTH halves:
- the lake — it opens a fresh session at the latest snapshot (the corrected
corpus is only readable after the pass commits) and calls
read::entity_detailper changed entity; - Postgres —
webhooks_for_deliveryto check for subscribers before paying
for that session, 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 — control_tasks_no_engine.rs enforces that by source scan. So
this is a decomposition, not a relocation.
Suggested shape
A pod task after assemble, whose output carries the payloads, feeding
settle_actions (already a control task taking apply_staged's receipt and
assemble's edge, and already the place Postgres writes for this pass happen):
- the labels it drives off are already on the wire —
StagedApplied.labelscarriesrec_a_key,rec_b_key,verdictand
decided_by, which is exactly what the current lookup uses; - the subscriber check should stay BEFORE the expensive read, as it is today;
- the
cause: "review_resolved"payload shape must not change — it is a
published webhook contract.
Driving it off the derived labels rather than the raw resolutions is worth
keeping: a dismissal yields no label and changes no master, so it correctly
writes nothing back.
Acceptance
pg_drain_dispatcher.rs already asserts this against the legacy arm —
it subscribes to entity.write_back before the drain precisely so that
"nothing to deliver" cannot be mistaken for "nothing delivered", then asserts
one master changed. Port that assertion onto the task path.
Blocks
The pg_drain_dispatcher.rs half of #645's test ports. The other seven files
do not touch write-back. Found while porting that file off the legacy arm; its
earlier assertions pass once #760 is fixed, and this is the one that remains.
Activity
test(pg): three correction-pass tests move onto the executor path
test(pg): the approval and entity-event tests move onto the executor …
test(pg): three correction-pass tests move onto the executor path
test(pg): the approval and entity-event tests move onto the executor …
refactor(server): delete ER_DISPATCH_IN_PROCESS and the spawn it gated
test(pg): three correction-pass tests move onto the executor path
test(pg): the approval and entity-event tests move onto the executor …
refactor(server): delete ER_DISPATCH_IN_PROCESS and the spawn it gated
test(pg): three correction-pass tests move onto the executor path
test(pg): the approval and entity-event tests move onto the executor …
test(pg): three correction-pass tests move onto the executor path
test(pg): the approval and entity-event tests move onto the executor …
refactor(dispatcher): delete the legacy in-process dispatch arm (#645)