chore(optimizations): remove legacy pflash and spark Python packages

Merged
GR
1d ago
+83-2029

Why

PFlash v2 and Luce Spark both run in-process in C++ inside luce_server. The standalone Python packages in optimizations/pflash/ (DflashClient, bench_niah_cpp.py, niah_gen.py) and optimizations/spark/ (_daemon.py, calibrate.py, bench.py, train_pregate.py) were legacy test_dflash stdin wrappers with zero callers in server/ or harness/, yet pflash was still installed into every uv workspace, Docker image, and pytest run.

Change

  • Remove legacy Python packages: Delete optimizations/pflash/{pflash,tests,pyproject.toml} and optimizations/spark/{spark,pyproject.toml} while keeping each directory's README.md, RESULTS.md, and media.
  • Unwire pflash from workspace, Docker, and CI: Remove pflash from pyproject.toml (dependencies, ruff exclude, pytest testpaths, uv workspace members/sources), regenerate uv.lock (removes only pflash v0.3.0; luce and torch still supply transformers and setuptools), drop COPY optimizations/pflash layers from Dockerfile and Dockerfile.rocm, and update .github/workflows/ci.yml, .github/ci/test_ci_plan.py, CONTRIBUTING.md, variables.md, and server/test/python/test_full_compress_cache.py.
  • Document optimization ownership: Add optimizations/README.md mapping each subdirectory to its runtime owner in server/src/ (and noting megakernel/ as the only compiled subproject here).
  • Align surviving docs with luce_server: Update optimizations/pflash/README.md (direct download of published Qwen3.5-0.8B-BF16.gguf and DFlash config.json, seg-scoring-head.gguf + --pflash on, aggregate region admission rules, --fa-window vs LUCE_FA_WINDOW, test_dflash --daemon stdin/stream-fd protocol, supported backends exposing pflash_gives_candidate_scores(), citation URL), optimizations/spark/README.md (--spark-vram target semantics, first-boot history bootstrap, citation URL), and label historical script references in server/RESULTS.md, optimizations/spark/RESULTS.md, and server/docs/laguna_integration_plan.md.
  • Unblock CUDA Docker build (GCC 11): Add #include <cstddef> and use std::size_t in contiguous_block_run (server/src/common/concurrency/paged_kv_pool.h), fixing the pre-existing main GCC 11 compile failure in Docker prebuilds / cuda12.
  • Unchanged: optimizations/megakernel/, optimizations/image_gen/, optimizations/kvflash/, optimizations/paged_attention/, and server runtime behavior.

Measured / Tested

  • uv lock --check --offline: passed (85 packages; uv.lock diff removes only pflash v0.3.0).
  • ruff check: passed.
  • pytest .github/ci/: 122 passed (including test_ci_plan.py, test_docs_paths.py, test_check_commit_messages.py).
  • Relative Markdown link check across all 8 modified/added .md files: 0 broken links.
  • test_paged_kv_pool (g++ -std=c++17): 18 passed, plus standalone syntax check on paged_kv_pool.h.
  • CI on prior head: Docker prebuilds / rocm, uv workspace, Build megakernel, Commit messages, CodeQL, GPU tests (DGX GB10), and Build Windows (ROCm HIP) all passed.
  • End-to-end model run skipped: the only C++ edit is adding #include <cstddef> / std::size_t to paged_kv_pool.h, with no runtime behavior change.

Review

  • Fixed all 13 verified findings from Sol 6.2 (high) and cubic-dev-ai: replaced missing convert_hf_to_gguf.py with published Qwen3.5-0.8B-BF16.gguf, added DFlash config.json download, fixed seg-scoring-head.gguf path and --pflash on, corrected aggregate region admission (active tool outputs only aggregate within the current turn), fixed test_dflash --daemon launch/command/--stream-fd protocol, separated --fa-window (luce_server) from LUCE_FA_WINDOW (test_dflash / entrypoint), updated supported PFlash backends (pflash_gives_candidate_scores(), adding inkling2 and excluding laguna), fixed Spark --spark-vram / history bootstrap wording, updated CONTRIBUTING.md and optimizations/README.md ownership links, fixed 404 citation URLs, and labeled historical scripts in server/RESULTS.md, optimizations/spark/RESULTS.md, and server/docs/laguna_integration_plan.md.
  • Also included the GCC 11 #include <cstddef> fix in server/src/common/concurrency/paged_kv_pool.h to unblock Docker prebuilds / cuda12.

Cleanup

  • tidy (Standard + Deslop): verified all hunks, lockfile diff, and relative links; no extra code or slop found.
  • prune-tests / test-audit: deleted optimizations/pflash/tests/test_dflash_client.py with DflashClient; audited .github/ci/test_ci_plan.py and server/test/python/test_full_compress_cache.py — all remaining tests enforce live contracts (0 deletions).

Limits

  • Waiting for the re-triggered Docker prebuilds / cuda12 run to confirm the full CUDA image build and runtime uv sync pass end to end.