[store]feat: support python hash seed#2969
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a mechanism to derive the root digest of a hash profile from a Python hash seed using SHA256, replacing the manual configuration of root_digest in HashProfileConfig. It introduces a new ResolvedHashProfile structure, updates configuration parsing and validation logic, and adapts the event manager and tests to support this seed-based resolution. The review feedback highlights a potential maintenance issue in ParseHashProfileConfig, where the logic for identifying which field caused a validation error duplicates the validation rules from ValidateProfileSelectors, and suggests returning a structured error instead.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| if (std::string error = prefixindex::ResolveHashProfile(source, profile); | ||
| !error.empty()) { | ||
| const char* field = "python_hash_seed"; | ||
| if (source.strategy != "vllm_v1") { | ||
| field = "strategy"; | ||
| } else if (source.algorithm != "sha256_cbor") { | ||
| field = "algorithm"; | ||
| } else if (source.index_projection != "low64_be") { | ||
| field = "index_projection"; | ||
| } | ||
| HttpJsonError(resp, "invalid_value", error, field); | ||
| return false; | ||
| } |
There was a problem hiding this comment.
This logic for determining the field that caused the error is a bit fragile as it duplicates the validation logic from prefixindex::ValidateProfileSelectors. If the supported profiles change in ValidateProfileSelectors, this code will also need to be updated to report the correct field in case of an error. This could lead to maintenance issues in the future.
A more robust approach could be for ResolveHashProfile to return a structured error indicating the problematic field. Barring that, you might consider reporting the error on the hash_profile object as a whole to avoid this duplication and potential for getting out of sync.
Description
This change makes
python_hash_seedthe source of truth for Conductor hashprofiles. Clients no longer calculate and submit
root_digest; Conductorvalidates the seed and derives the digest internally.
HashProfileConfigfrom the internalResolvedHashProfile.randomor ASCII decimal seeds in the range0..4294967295.SHA-256 over its canonical CBOR text encoding.
python_hash_seedin static configuration and/register, withstrict validation for missing, malformed, mistyped, legacy, or unknown fields.
python_hash_seedand the derivedroot_digestfrom/servicesand
/global_view.unchanged when profiles are forged or conflicting.
event lifecycle, concurrency, and event-ingestion coverage.
Related issue: N/A
Module
Type of Change
How Has This Been Tested?
Test commands:
cd mooncake-conductor ./build/tests/conductor_test git diff --check HEAD^ HEADTest results:
All 137 tests from 30 test suites passed. The commit diff contains no
whitespace errors.
Checklist
AI Assistance Disclosure
Codex was used to inspect commit c973c8c, review its test coverage, and
draft the PR title and description. The human submitter must review and
understand all code changes before opening the PR.