Repository navigation
fix(data-gen): reuse shared KV hashing for Mooncake IDs - #10095
Conversation
|
👋 Hi RitwijParmar! Thank you for contributing to ai-dynamo/dynamo. Just a reminder: The 🚀 |
WalkthroughToken-block hash ID generation in the data-gen crate migrates from local in-module hashing to the Dynamo KV hashing library. A new fallible ChangesDynamo KV hashing migration
🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@lib/data-gen/src/mooncake.rs`:
- Around line 397-432: Add round-trip wire-format tests that verify
alias-to-canonical field name conversion for Mooncake: create one test that
deserializes a Mooncake wire-format input using aliased field names into Request
(use Request::builder() shape to know expected fields), then reserialize and
assert the output uses the canonical field names and matches the canonical
serialization; add a second test that does the same for canonical input to
ensure identity round-trip. Use the library's (de)serialization helpers
(serde_json::from_str/to_string or the crate's helpers) and also assert that
relevant derived values (e.g., Request::sequence_hashes(...) and
RollingHashIdMapper behavior) remain the same after the round trip.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 9509f49f-c6c0-4979-8505-162a7b63e667
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (3)
lib/data-gen/Cargo.tomllib/data-gen/src/lib.rslib/data-gen/src/mooncake.rs
Signed-off-by: Ritwij Aryan Parmar <[email protected]>
|
I added follow-up coverage in 3e944cd for the Mooncake wire format that this PR touches. The new tests cover both upstream alias input ( Validated locally: |
Signed-off-by: Ritwij Aryan Parmar <[email protected]>
|
Small update: I amended the follow-up commit with DCO sign-off and force-pushed it as d56c339. The code/test content is the same; this is just to clear the DCO check. |
Signed-off-by: Ritwij Aryan Parmar <[email protected]>
Signed-off-by: Ritwij Aryan Parmar <[email protected]>
Signed-off-by: Ritwij Aryan Parmar <[email protected]>
|
Fixed the partial-block capacity issue in |
|
/ok to test 2d49173 |
PeaBrane
left a comment
There was a problem hiding this comment.
One suggestion on keeping partial-block hashing aligned with the existing rolling hash contract.
Signed-off-by: Ritwij Aryan Parmar <[email protected]>
PeaBrane
left a comment
There was a problem hiding this comment.
One performance suggestion to avoid the additional full-prompt clone introduced by the shared hashing path.
Signed-off-by: Ritwij Aryan Parmar <[email protected]>
Signed-off-by: Ritwij Aryan Parmar <[email protected]>
Signed-off-by: Ritwij Aryan Parmar <[email protected]>
|
Thanks, good catch. I ran I also rechecked the relevant local commands before pushing:
Will watch the rerun from here. |
|
/ok to test cb89db2 |
Signed-off-by: Ritwij Aryan Parmar <[email protected]>
Head branch was pushed to by a user without write access
|
I checked the new failure from The test subscribes to the shared trace bus and was accepting the first I pushed
I also tried the exact |
|
/ok to test d85fdaf |
PeaBrane
left a comment
There was a problem hiding this comment.
The requested hashing-contract, dependency-boundary, and consuming-path changes are addressed. Pre-merge Rust tests and clippy are green.
) Signed-off-by: Ritwij Aryan Parmar <[email protected]> Signed-off-by: shenls <[email protected]>
Part of #8997.
This removes one small source of hash-contract drift from
dynamo-data-gen:RollingHashIdMapper::hash_token_blocksno longer reimplements its own local block + parent-chain hashing. It now derives sequence-aware hashes throughdynamo-kv-hashing::Request::sequence_hashesand only keeps the existing data-gen responsibility of compacting stable sequence hashes into Mooncakehash_ids.What changed:
dynamo-data-gendepends ondynamo-kv-hashinginstead ofbytemuck+dynamo-tokenshash_token_blocksnow uses the shared KV-hashing contract before compacting IDstry_hash_token_blocksso invalid block sizes can be surfaced without panickingRequest::sequence_hashesOne behavior note: trailing partial token blocks are no longer assigned Mooncake IDs by the token helper, matching
dynamo-kv-hashing's current complete-block-only contract. This is intentional here, but I called it out because it changes the old local helper's behavior.Checks run locally:
cargo test -p dynamo-data-gencargo test -p dynamo-kv-hashingcargo fmt --check --package dynamo-data-gencargo clippy -p dynamo-kv-hashing -p dynamo-data-gen --all-targets -- -D warningsgit diff --checkI also tried the nearby consumer test:
cargo test -p dynamo-bench agent_trace --test agent_traceThat did not reach the test phase locally because
etcd-client's build script requiresprotoc, which is not installed in this local environment.AI disclosure: I used AI assistance while editing and reviewing this patch, then ran the checks above locally.
Summary by CodeRabbit
New Features
Tests