Skip to content

[Wheel] Migrate structured object storage to unified package - #3633

Merged
Aionw merged 4 commits into
mainfrom
codex/migrate-structured-object-storage
Oct 14, 2026
Merged

Aionw merged 4 commits into
mainfrom
codex/migrate-structured-object-storage

Conversation

@Aionw

@Aionw Aionw commented Aug 24, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Implements the structured-object storage increment of RFC #3534 Phase 2.

  • move mooncake.structured_object_store and its _fast_copy C source into python/mooncake as the sole tracked source;
  • move the directly owned structured-object and native-copy tests into python/tests/store;
  • compile _fast_copy from its canonical source through the root CMake/PEP 517 build;
  • stage both migrated sources only for the temporary legacy wheel builder that remains until Phase 5;
  • update source-test discovery, installation checks, CODEOWNERS, and label routing;
  • add source-layout, optional-dependency, wheel-manifest, no-dependency core-import, and installed structured-extra smoke coverage.

The public mooncake.structured_object_store and mooncake._fast_copy paths and behavior are unchanged. This PR does not migrate dataproto_catalog.py, rename native extensions, redesign Store APIs, or perform the release/backend cutover.

Overlap and conflict risk

After merging main, the rename-aware diff is 596 additions and 275 deletions (871 total), covered by RFC #3534. Of that, 484 additions and 264 deletions are ruff format on the two moved Python files; the migration itself is 112 additions and 11 deletions.

Closes no issue; contributes to #3534.

Module

  • Transfer Engine (mooncake-transfer-engine)
  • Mooncake Store (mooncake-store)
  • Reshard (mooncake-reshard)
  • Mooncake EP (mooncake-ep)
  • Mooncake PG (mooncake-pg)
  • Integration (mooncake-integration)
  • P2P Store (mooncake-p2p-store)
  • Python Wheel (mooncake-wheel)
  • Common (mooncake-common)
  • Mooncake RL (mooncake-rl)
  • CI/CD
  • Docs
  • Other

Type of Change

  • Bug fix
  • New feature
  • Refactor
  • Breaking change
  • Documentation update
  • Performance improvement
  • Other

How Has This Been Tested?

Original submission (before merging main on 2026-09-28; superseded by "After merging main" below). Since #3586 moved buffer_pool.py, python/ must come before mooncake-wheel/ on PYTHONPATH:

Test commands:

PYTHONPATH="$PWD/mooncake-wheel:$PWD/python" /tmp/mooncake-structured-source-49f2/bin/python -m pytest -q \
  python/tests/store/test_structured_object_store.py \
  python/tests/store/test_fast_copy.py

python -m pytest -q python/tests/packaging/test_project.py

CMAKE_BUILD_PARALLEL_LEVEL=128 python -m build --wheel
python -m twine check \
  dist/mooncake_transfer_engine-0.3.12.post1-cp310-cp310-linux_x86_64.whl

MOONCAKE_TEST_WHEEL="$PWD/dist/mooncake_transfer_engine-0.3.12.post1-cp310-cp310-linux_x86_64.whl" \
  python -m pytest -q python/tests/packaging/test_installed_wheel.py

/tmp/mooncake-structured-source-49f2/bin/python -m pytest -q \
  python/tests/store/test_fast_copy.py \
  python/tests/store/test_structured_object_store.py::test_typed_ragged_uses_direct_copy_payload_when_fast_copy_available \
  python/tests/store/test_structured_object_store.py::test_dataproto_helper_typed_ragged_fast_copy_put \
  python/tests/store/test_structured_object_store.py::test_dataproto_helper_typed_ragged_rejects_short_fast_copy

bash -n scripts/build_wheel.sh scripts/test_installation.sh
python -m py_compile \
  python/tests/packaging/test_project.py \
  python/tests/packaging/test_installed_wheel.py \
  mooncake-wheel/tests/conftest.py

git fetch origin main
pre-commit run --files $(git diff --name-only --diff-filter=ACMR origin/main...HEAD)

Test results:

  • Unit tests pass: 104 passed, 38 skipped in the source-tree run; 7 passed in the installed native fast-copy-focused run.
  • Integration tests pass: root wheel built successfully; twine check passed; isolated installed-wheel test passed. The no-dependency phase verified core import without NumPy/Pillow, then the structured extra was installed and both the canonical Python module and compiled _fast_copy helper were smoke-tested outside the repository.
  • Manual testing done: wheel manifest contains mooncake/structured_object_store.py and _fast_copy.cpython-310-x86_64-linux-gnu.so; _fast_copy.c and test_fast_copy.py are 100% renames, and the two formatted Python files are 95%/96% renames whose content equals ruff format of main's legacy copies.

Originally, ruff-format changes to the two moved Python files were reverted to keep the diff migration-only. Since #3567 added CI's changed-lines Python format check, which treats moved files as fully changed, both files are now formatted with ruff 0.6.9. The result is exactly ruff format applied to main's legacy copies, so it can be checked mechanically, and the PR-scoped pre-commit command now passes every hook.

After merging main (d9152a4, 2026-09-28):

PYTHONPATH=python:mooncake-wheel python -m pytest -q \
  python/tests/store/test_structured_object_store.py python/tests/store/test_fast_copy.py \
  mooncake-wheel/tests/test_partial_read.py mooncake-wheel/tests/test_dataproto_catalog.py \
  python/tests/packaging
PYTHONPATH=python python -m pytest -q \
  mooncake-wheel/tests/test_partial_read.py mooncake-wheel/tests/test_dataproto_catalog.py
pre-commit run --files $(git diff --name-only --diff-filter=ACMR origin/main...HEAD)
  • 180 passed, 42 skipped; the skips need Torch, the native mooncake.store, a built _fast_copy, or built wheels. With PYTHONPATH=python only, the legacy-tree tests pass (25 passed), the same as on main.
  • The merge's conflicts in .github/CODEOWNERS, .github/labeler.yml, scripts/build_wheel.sh, scripts/test_installation.sh, python/tests/packaging/test_installed_wheel.py, python/tests/packaging/test_project.py were resolved by keeping both sides.
  • Other merge adjustments: structured_object_store.py is removed from the legacy-module list in test_scikit_build_consumes_unified_python_sources; the installed-wheel structured smoke test installs the [structured] extra for the unified wheel and numpy/pillow directly for the legacy wheel, because main's installed-wheel test is now parametrized over both wheels and the legacy wheel declares no structured extra; and the per-file store / Tests label entries for python/tests/store/ are dropped because main's globs cover them.
  • Follow-up commits after the merge: ruff format on the two moved Python files (see above); mooncake-wheel/tests/conftest.py probes both source trees so legacy-only modules such as mooncake._partial_read stay importable from source; and the per-file CODEOWNERS entries for the two moved tests now sit after main's /python/tests/store/ @ykwd @stmatengss entry, so they still take effect and keep @zxpdemonio.
  • CI's changed-lines Python check (ruff check plus scripts/ci/check_changed_python_format.py, ruff 0.6.9) passes.
  • The new legacy-wheel branch of the structured smoke test was syntax-checked but not run.
  • The root PEP 517 wheel build, twine check, and installed-wheel smoke runs from the original submission were not repeated after the merge. CI does not run them either (it builds only the legacy scripts/build_wheel.sh wheel and runs scripts/test_installation.sh), so they still need a rerun.

Checklist

  • I have performed a self-review of my own code
  • I have formatted my code using ./scripts/code_format.sh (the staged C/C++ hook passed; _fast_copy.c is unchanged)
  • I have run pre-commit on the files changed in this PR and all hooks pass
  • I have updated the documentation (not applicable: public imports and behavior are unchanged)
  • I have added tests to prove my changes are effective
  • For changes >500 LOC: I have filed RFC issue [RFC]: Unify Mooncake's Python package, build, and release architecture #3534

AI Assistance Disclosure

  • No AI tools were used
  • AI tools were used (specified below)

OpenAI Codex assisted with the migration, overlap review, build and packaging updates, validation, diff review, and PR preparation. The human submitter remains responsible for reviewing every changed line and defending the change end to end.

Claude Code (Anthropic) merged main into this branch on 2026-09-28, resolved the conflicts, added follow-up commits for the ruff format of the two moved Python files, the mooncake-wheel/tests/conftest.py fallback, and the test CODEOWNERS entries, re-ran the focused tests listed under "After merging main", and updated this description.

Conflict resolutions:
- .github/CODEOWNERS: keep the structured_object_store.py and _fast_copy.c
  owners ahead of main's migrated python/ entries; drop the per-file
  python/tests/store/ entries now covered by main's /python/tests/store/.
- .github/labeler.yml: keep both sides; drop this branch's python/tests/store
  entries from the store and Tests labels (covered by main's
  python/tests/store/**/* and python/tests/**/* globs).
- scripts/build_wheel.sh: add structured_object_store.py and _fast_copy.c to
  main's multi-line MIGRATED_PYTHON_MODULES list.
- scripts/test_installation.sh: keep both the test_fast_copy.py copy and
  main's ssd_tests copy.
- python/tests/packaging/test_installed_wheel.py: fold the structured-object
  assertions into main's parametrized unified/legacy smoke test, reuse its
  installed_files set, and install numpy/pillow directly for the legacy
  wheel, which has no structured extra.
- python/tests/packaging/test_project.py: keep both sides; parse the
  multi-line MIGRATED_PYTHON_MODULES list like the sibling tests, and drop
  structured_object_store.py from the list of legacy-supplied modules.
…cy test fallback

The migrated files count as fully changed for the changed-lines ruff check, so format them with ruff 0.6.9 (the result equals ruff format of main's legacy-path copies). Let mooncake-wheel/tests/conftest.py extend mooncake.__path__ for both the unified source package and the legacy tree, so legacy-only helpers such as mooncake._partial_read stay importable from source.
main's /python/tests/store/ entry (#3586) would otherwise drop @zxpdemonio from the two migrated structured-object tests. Place the per-file entries after it so they take effect.

@zxpdemonio zxpdemonio left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@Aionw
Aionw merged commit d236a31 into main Oct 14, 2026
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants