Repository navigation
refactor(router): resolve KV transfer sources before worker selection ranks them - #125
Closed
ishandhanani wants to merge 1 commit into
Closed
ishandhanani wants to merge 1 commit into
ishandhanani wants to merge 1 commit into
Conversation
ishandhanani
had a problem deploying
to
external_collaborator
October 30, 2026 21:40 — with
GitHub Actions
Failure
… ranks them The transfer-source summary that credits a candidate worker for the KV prefix it could fetch read two things the worker-selection stage must not see: each worker's config (through WorkerConfigLike::kv_transfer_keys) and the indexer's residency routing snapshot (through KvTransferCandidates.routing_snapshot). Split the step in two. The router resolves first: kv_hints::resolve_transfer_sources walks the request's candidates with today's skips (sources no longer than every target's local prefix or longer than the retained chain, worker ranks that publish no source endpoint, cache owners missing from the snapshot, the attached worker's topology for an owner that publishes none) and yields ResolvedTransferSource records: who holds the prefix, how long it is, the hashed hint worker type, the attached worker, and the topology labels. KvTransferSourceSummary::new takes those records and the scope and ranks them exactly as before; source_for is unchanged. Worker keys move the same way. WorkerKvTransferKeys keeps its data, target(), and a from_parts constructor over already-hashed labels, with worker_type() and topology() accessors; deriving the keys from a config becomes the WorkerKvTransferKeysExt extension trait beside WorkerConfigLike, and WorkerKvTransferKeysCache moves next to it. KvTransferCandidateSource moves to dynamo_router_protocol::kv_hints as shared vocabulary; the indexer and kv-router re-export it at the old paths. The label hashing (label_key, topology_keys) stays with the indexer, which builds the snapshot keys; the router calls it for worker keys. Step 5d-2 of the router split v2 plan (worker-selection boundary). DYNO-177. Signed-off-by: Ishan Dhanani <ishandhanani@gmail.com>
ishandhanani
force-pushed
the
idhanani/dyn-177-kv-hint-keys
branch
from
November 2, 2026 13:30
6ed46e6 to
2903076
Compare
ishandhanani
had a problem deploying
to
external_collaborator
November 2, 2026 13:30 — with
GitHub Actions
Failure
Owner
Author
|
Landed upstream as ai-dynamo#18055 (squash commit 79692cf on main, 2026-11-11). Closing this fork review unit. |
This branch had an error being deployed
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.
Step 5d-2 (DYNO-177), stacked on #124. Third boundary change for
dynamo-worker-selection; behavior-preserving. Plan:split-v2/inventory-worker-selection.md.Summary
KvTransferSourceSummary::new(candidates, workers, scope)read each worker's config (WorkerConfigLike::kv_transfer_keys) and the indexer'sResidencyRoutingSnapshot(throughKvTransferCandidates.routing_snapshot). The selection stage must see neither, so the step splits:kv_hints::resolve_transfer_sources(candidates, workers, &scope)(router side) walks the candidates with the same skips the summary applied (prefix no longer than every target's local prefix or longer than the retained chain; worker ranks without a source endpoint; cache owners missing from the snapshot; an owner without topology inherits its attached worker's) and yieldsResolvedTransferSource { source, prefix_blocks, worker_type, attachment, topology }.KvTransferSourceSummary::new(sources, scope)ranks the resolved records exactly as before (by_typewhen any target takes any island,by_islandfor covered labels);source_foris unchanged.KvTransferScopegainsmin_local_prefix_blocks()andneeds_islands()for the resolver.WorkerKvTransferKeyskeeps its data andtarget(), gainsfrom_partsover already-hashed labels plusworker_type()/topology()accessors;WorkerKvTransferKeys::new(&impl WorkerConfigLike)becomesWorkerKvTransferKeysExt::ofbesideWorkerConfigLikeinkv_hints.rs, andWorkerKvTransferKeysCachemoves there (same path).WorkerConfigLike::kv_transfer_keys's default calls the extension.KvTransferCandidateSourcemoves todynamo_router_protocol::kv_hints(shared vocabulary: the indexer produces it, selection consumes it);dynamo_kv_indexer::kv_hintsanddynamo_kv_router::kv_hintsre-export it.label_key/topology_keys/CacheOwnerKvTransferKeysstay with the indexer, which builds the snapshot keys; the router calls them for worker keys.Cost: the resolver copies each source's topology labels (a few pairs) into the record; the summary previously borrowed them. Everything else is the same single pass.
Validation
cargo check --all-targetson kv-router, builtin, mocker, ext-proc, bench, lib/llm: clean.cargo test -p dynamo-router-protocol -p dynamo-kv-indexer --all-features: protocol 10 passed; kv-indexer 597 passed, 2 ignored.cargo test -p dynamo-kv-router --features standalone-selection,standalone-slot-tracker,metrics,testing: 590 lib + 2 + 7 passed, 2 ignored.cargo test -p dynamo-custom-policy-builtin: all targets pass (56 + 5 + 1 + 3 + 20 + 3 + 4).-D warnings: protocol, kv-indexer, kv-router, builtin (--all-features --all-targets); mocker, ext-proc, bench (--tests): clean.scripts/router_layering_check.sh: 20 checks, 0 failures (protocol direct deps unchanged; the behavior grep accepts the plain-data enum).scripts/router_move_diff.py 435715c223 WORKTREEover the seven touched files: 5,671 common / 88 new / 33 dropped: theResolvedTransferSourcerecord, the resolver, the summary's new signature and loop over records,from_partsand the three accessors, the extension trait and the cache's call, and the call-site spelling.