Repository navigation
refactor(router): add dynamo-router-protocol, the wire vocabulary crate - #174
Closed
ishandhanani wants to merge 1 commit into
Closed
ishandhanani wants to merge 1 commit into
ishandhanani wants to merge 1 commit into
Conversation
Extract the identities and worker-facing vocabulary every router crate names into lib/router/protocol: worker and rank ids, partition, pool, owner, and domain identities, WorkerType, the residency vocabulary, the block-hash newtypes, worker load and metadata wire types, KV hint wire types, SessionContext, and AttemptId. lib/kv-router keeps pub use shims at every old path, so no other crate's imports change. AttemptId has no public constructor any more. AttemptIdMinter::mint is the only way to obtain one and yields fresh ids only; the slot tracker's RequestIndex holds the one minter. Tests use for_testing behind the testing feature, benches for_benchmark behind bench. ResidencyOwner's BLAKE3 compact_key is hashing, not wire, so it becomes the ResidencyOwnerKeyExt extension trait in dynamo_kv_router::protocols. The crate depends on exactly serde, serde_json, and thiserror. scripts/router_layering_check.sh enforces that by set equality, forbids behavior in the crate, and fails closed; it runs in pre-commit and, with --host, in the Rust CI job. scripts/router_move_diff.py shows the move is a move: 3,858 lines found, 45 new (minter, extension trait, one test), 9 dropped (the replaced constructor paths). Step 1 of the router split v2 plan. DYNO-170. Signed-off-by: Ishan Dhanani <ishandhanani@gmail.com>
ishandhanani
had a problem deploying
to
external_collaborator
November 2, 2026 13:53 — 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.
Router split v2, unit 01 of 17. Base: main.
Summary
dynamo-router-protocol(lib/router/protocol) is the identities and worker-facing vocabulary every router crate names: worker, rank, partition, pool, owner, and domain ids;WorkerType; the load and metadata wire; the KV hint wire;AttemptIdand the newAttemptIdMinter;SessionContext. Its dependency contract is exactly serde, serde_json, thiserror, and it carries no executable behavior; the new fail-closedscripts/router_layering_check.shenforces both. Rule applied: protocol is counterparty wire and identity only, so everything that computes stays with its producer (the hash functions stay in kv-router here,ResidencyOwner::compact_keybecomes theResidencyOwnerKeyExtextension trait) andAttemptId::newis replaced by a minter so a chosen id can no longer be forged outside the slot tracker. kv-router keepspub useshims at every old path, so no other crate's imports change. Replaces fork PR #111.What moves
7663c31682refactor(router): add dynamo-router-protocol, the wire vocabulary crate: theworker,identity,residency,block_hash,load,metadata,kv_hints,session,worker_type, andattemptmodules extracted fromlib/kv-routerwith shims at every old path. Move-diff (its body): 3,858 normalized lines found; 45 new (the minter, the extension trait,ResidencyOwnerKey::from_digest,is_missingmade public, one minter test); 9 dropped (the replacedAttemptId::newand inherentcompact_keypaths); per-file fractions protocols.rs 0.999, identity.rs 1.000, worker_type.rs 1.000, kv_hints.rs 1.000, scheduling/types.rs 0.996, request_maps.rs 0.981.Dependency edges
The layering gate is new in this unit (
scripts/router_layering_check.sh: per-crate rows checked by set equality fromcargo treeandcargo metadata, the workspace feature check, and--hostresolution ofdynamo-llm,dynamo-ext-proc,dynamo-mockeragainstprometheus axum hyper reqwest zmq).dynamo-router-protocol-> serde, serde_json, thiserror (no router crate;dynamo-runtime,dynamo-kv-router, tokio, anyhow, tracing, async-trait, derive_builder, prometheus, axum, hyper, reqwest, zmq forbidden in its tree;lib/router/protocol/srcgrepped fordyn,async,std::fs,anyhow,tracing,derive_builder, hiddenpub)Validation
Unit-level move-diff, run from the worktree at the unit head
7663c31682:python3 -I scripts/router_move_diff.py 464ff290fe 7663c31682 --from <6 paths> --to <7 paths>, the union of the replaced fork PRs'--from/--tolists filtered to the paths present at each end (full command in the artifact/tmp/rr-split/unit-prs/01-move-diff.txt).The 45 new and 9 dropped lines are the set the fork PR recorded:
AttemptIdMinter(struct,new,mint, the slot tracker'sattempt_idsfield, one minter test) replacingAttemptId::new; theResidencyOwnerKeyExtextension trait replacing the inherentcompact_key;ResidencyOwnerKey::from_digest;is_missingmade public; the rest are the braces of those items.New and dropped normalized lines (45 new, 9 dropped).
Chain v2, full mode, on the rebased stack head
ebd31cdf4d(every unit's commits are ancestors of it; the chain ran once on the head, not per unit), log/tmp/rr-split/srebase-validation.log: stage 1, the 13 router crates (clippy under default and all features,cargo test1,247 passed / 5 ignored, rustdoc with all features), 1 min 50 s; stage 2, kv-router (clippy, bench check, 229 tests including the prelude test), 1 min 20 s; stage 3, workspace clippy, 4 min 58 s; stage 4, hosts (dynamo-llmlib alone, its kv_router 492 / discovery 275 / pool_relay 261 tests, 13 host crates clippy, bindings clippy; the pre-existing kvbm-consolidator manifest failure is the one non-zero exit), 29 min 21 s; stage 5, gates (every kv-router feature alone and together, 6 public-API snapshots unchanged with kv-router at 918 items, layering gate 47 checks and--host66 checks with 0 failures, codeowners 7590/7590, fmt, 3 lockfiles--locked), 3 min 06 s; 40 min 35 s total, exit 0.Each replaced fork PR carried its own validation chain; see its body.
Tickets
Part of DYNO-170
Series
The 17 review units of the router split v2 stack on top of
main(464ff290fe), in order; each is stacked on the previous one and the last head is the stack headebd31cdf4d.protocol: add dynamo-router-protocol, the wire vocabulary cratekv-hashing: move the hash contract to dynamo-kv-hashingkv-events: add dynamo-kv-events for KV event types, the engine ZMQ codec, and the cursorzmq: add dynamo-zmq, the socket helperkv-indexer: add dynamo-kv-indexer in four slicesslot-tracker: move WorkerCapacity to protocol and add dynamo-slot-trackersession-affinity: add dynamo-session-affinityworker-selection: open the worker-selection stage and move it to lib/router/worker-selectionadmission: open the admission stage and move it to lib/router/admissionscheduler: move the scheduling kernel and the selection core to lib/router/schedulerkv-router-composition: thin kv-router to the composition crate with adapter features and plugins::preludehost-rewrite: point every host at the owning crates through stage host moduleskv-router-thins: import the owners inside kv-router and deprecate its shim pathsgate-v2: layering gate v2 and public-API snapshots in CIdynamo-error: move the error contract to dynamo-errorprotocol-cleanup: protocol cleanup: load, hints, residency, candidates, multimodal, and ActiveLoad to their ownersremove-shims: remove the deprecated shims and the kernel's foreign re-exportstrim-guardrails: plugins import through the prelude; public-API snapshots dropped; gate slimmed to edges; AGENTS.md trimmedprotocol-narrowing: RouterHintSourceMetadata to kv-indexer; WorkerAffinityTarget to session-affinityfold-zmq: dynamo-zmq folded back into kv-router behind its ZMQ features