From 614378bb8dd8a8f97d9ef6eff36e2e007f2523f3 Mon Sep 17 00:00:00 2001 From: Brian Nguyen Date: Fri, 7 Aug 2026 04:05:30 -0700 Subject: [PATCH] [None][fix] Set in_mtp_draft_loop on the synthetic DSA metadata stub test_on_update_kv_lens_rebuilds_stale_map builds its metadata with object.__new__, bypassing __init__ where in_mtp_draft_loop is initialized. Since #16925 made on_update_kv_lens() read that flag, the test fails with AttributeError on every pre-merge run. Set the __init__ default on the stub. Signed-off-by: Brian Nguyen --- .../_torch/attention/sparse/dsa/test_req_idx_per_token.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/unittest/_torch/attention/sparse/dsa/test_req_idx_per_token.py b/tests/unittest/_torch/attention/sparse/dsa/test_req_idx_per_token.py index f4d2144bc151..58448da45733 100644 --- a/tests/unittest/_torch/attention/sparse/dsa/test_req_idx_per_token.py +++ b/tests/unittest/_torch/attention/sparse/dsa/test_req_idx_per_token.py @@ -75,6 +75,9 @@ def test_on_update_kv_lens_rebuilds_stale_map(): md = object.__new__(DSAtrtllmAttentionMetadata) md.kv_cache_manager = None md._num_generations = 0 + # __init__ (bypassed by object.__new__) defaults this to False; + # on_update_kv_lens() reads it since #16925. + md.in_mtp_draft_loop = False # Stub collaborators unrelated to the map rebuild (test_dsa_indexer.py style). md.kv_lens_cuda = torch.tensor([100, 200, 300], dtype=torch.int32, device=device) md._compute_kv_lens_row_reorder = Mock()