Skip to content

tech-debt: 重复的 BatchedEngine 实现 (engine/batched/ vs engines/batched.py) 需合并 #422

Description

@dahai80

现状

竞品审计报告 (fusion-mlx_vs_*.md) 一致指出存在两套 BatchedEngine 实现:

  • fusion_mlx/engine/batched/__init__.py (357 行) — class BatchedEngine(BaseEngine),独立实现,含 _mtp_dispatch.py
  • fusion_mlx/engines/batched.py (1157 行) — class BatchedEngine(BaseEngine)生产实现(server.py + engine_pool.py 用这个)

证据

$ grep -rln 'engines.batched' fusion_mlx/   # 生产导入者
fusion_mlx/server.py
fusion_mlx/pool/engine_pool.py
fusion_mlx/pool/engine/dflash.py

$ grep -rln 'engine.batched' fusion_mlx/    # 生产代码零导入者
# (空)

$ grep -rln 'engine.batched' tests/         # 仅测试依赖
tests/unit/test_no_mllm_flag.py
tests/unit/test_embeddings_timeout_admission.py
tests/unit/test_batching.py
tests/unit/test_disconnect_guard_aborts_scheduler.py
tests/unit/test_batched_engine_output_router.py
# ... 20+ 测试文件

风险

engine/batched/ 子包在生产代码中零导入者,但被 20+ 测试文件直接 import。两套实现分叉,维护时易改错一份,是架构冗余的典型信号(见三份竞品报告的「关键差距与风险」章节)。

复杂度

不能简单删除 engine/batched/ —— 20+ 测试依赖它,且这些测试多数在 debt_modules.txt 隔离名单内(已知失败)。清理需:

  1. 确认 engine/batched/ 是否为旧入口/shim(engine/__init__.pyfrom . import batched
  2. 决定单一权威实现(生产用 engines/batched.py
  3. 将依赖 engine.batched 的测试迁移到 engines.batched,或确认这些测试本身已是死测试随隔离名单清理

来源

竞品深度对比报告 (~/fusion/audit/fusion-mlx_vs_*.md) 行动项。本 issue 仅记录技术债,不在 GGUF 桥 PR 中一并处理(风险不对等)。

Co-Authored-By: Claude Fable 5 noreply@anthropic.com

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions