[4/6] refactor(pg): row-based enqueue target, needs view and settle hand-off (no behaviour change)
Stacked on #482, merge in order. Stack: 4/6, splitting #479.
Summary
Groundwork for the job-scoped promotion in #5 and #6. No behaviour change intended: promotion still runs the shared sweep over the loaded graph. The only new code that nothing calls yet is NeedsView's loader.
What changed
on_job_enqueuedtakes a row-basedEnqueueTargetinstead of aRunGraph(control/pg/dispatch.rs,lifecycle.rs). Callers that hold a graph build the target from the node;lifecycle.rsbuilds it from the job's own row, so enqueueing no longer needs a graph in hand.dependency_decision,hydrate_needs_contextand the needs context builders read the jobs a dependent names through aNeedsSourceinstead of a wholeRunRecord.NeedsViewloads exactly the rows one job's needs reach (matched by id or matrix base, following the matched rows' own needs transitively) with one recursive query (control/pg/needs.rs).refresh_remaining_needsreturns the blocked dependents with no needs outstanding instead of abool, and the settle outcome carries them (and the cohorts a freedmax-parallelslot can feed) by id to onepromote_after_settlestep, the single place the completion paths promote from. Existingrefresh_remaining_needstests assert the returned ids.- Docs: step 8 and step 11 of the settle flow in
internal/settle-redesign.md.
Not included
Job-scoped admission (#5) and dependent and waiter promotion (#6) use these pieces.
Test plan
On this PR's tip, against a disposable Postgres 17 (max_connections=2000, PRELOOP_PG_WRITERS=3 PRELOOP_PG_READERS=3, PRELOOP_TEST_POSTGRES_URL set):
cargo fmt --all --check: cleancargo clippy --workspace --all-targets -- -D warnings: cleancargo test --locked -p preloop-runner-server --lib -- control::: 351 passed, 0 failed, 0skipping:lines (same count as #3: the refactor adds no tests)
just test-ci and the local engine CI run were not run on this PR's tip: the laptop engine's runner pool does not advertise the preloop-cpane label that ci.yml requires, so jobs fail at enqueue. The checks on this PR are the first full CI run for these commits.
Stack
- #480
fix(pg): max-parallel stall, cohort waiter retry, nested-caller fold, non-terminal guard - #481
fix(pg): deferred reusable callers - #482
refactor(pg): remove the in-memory completion path - #483
refactor(pg): row-based enqueue target, needs view, settle hand-off (no behaviour change) - #484
perf(control/pg): max-parallel admission over rows - #485
perf(control/pg): dependents and job waiters over rows
Each PR's base is the previous PR's branch, so each shows only its own diff. Supersedes #479 (closed).