Repository navigation
[MemCache] test: require every ComponentData field to be classified by each split hook - #42518
Merged
ispobock merged 1 commit intoOct 7, 2026
Conversation
…t hook Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
alphabetc1
force-pushed
the
test/component-split-field-coverage
branch
from
October 6, 2026 00:56
628c3d1 to
27f3759
Compare
Collaborator
Author
|
/rerun-test -c |
Contributor
|
🚀 |
ispobock
approved these changes
Oct 7, 2026
2 tasks done
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.
Motivation
redistribute_on_node_splitis hand-written once per component, and the recurring bug is a field nobody remembered. SWA droppedhost_lock_refon a split (#38138), and FULL dropped the same field again until #38480 — in both cases a split moved half of a pinned host slice onto a new parent withhost_lock_ref == 0, so the next duplicate reclaim freed host pages an in-flight L3 write was still reading, and the object that landed in L3 mixed two nodes' KV.Nothing made that omission visible:
sanity_checkderives protected sizes from the refcounts, so a wrong refcount stays self-consistent. The three hooks drift independently, andComponentDatahas seven fields today.Modifications
A test that makes the decision explicit and machine-checked.
SPLIT_POLICYclassifies everyComponentDatafield for every component inCOMPONENT_REGISTRYas copy / divide / reset (plus the metadata boundary uuids, which migrate), and three checks enforce it:dataclasses.fields(ComponentData)must agree, and the table must cover every registered component — adding a field or a component without deciding what a split does with it fails here;Test-only, no product change. The hooks are driven directly with a mock tree core, so it is a CPU test (
base-a-test-cpu) that needs no fixture and no GPU.Not covered: the Rust core's split. It models per-(component × tier) state as a two-field
ValueState { value, lock_ref }— the host lock is the host slot'slock_ref— so the "N parallel fields, each hook remembers a subset" shape this guards against is specific to the PythonComponentData.Accuracy Tests
python -m pytest test/registered/unit/mem_cache/test_component_split_contract.py, withCUDA_VISIBLE_DEVICES=""to confirm it needs no GPU: 3 passed, 6 subtests passed, 8s.Three negative controls, each reverted afterwards and the suite re-run green:
new_parent.component_data[ct].host_lock_ref = child_cd.host_lock_reffrom FULL (i.e. revert [HiCache]: Fix host lock ownership across radix splits #38480's core line) →AssertionError: 0 != 2 : FULL.host_lock_ref must reach the parent;ComponentData→'brand_new_ownership_field' : FULL: ComponentData fields and the split policy disagree;metadata.pop("host_uuid")→'host_uuid' unexpectedly found ... : SWA: host_uuid must not stay on the child too.Checklist
🤖 Generated with Claude Code
CI States
Latest PR Test (Base): ❌ Run #37396584391
Latest PR Test (Extra): ❌ Run #37396583798
Latest PR Test (AMD ROCm 10): ❌ Run #37396585256