From 8d8a8c9c19ea966c140d31240ace8ca7b6194f26 Mon Sep 17 00:00:00 2001 From: mvalentsev Date: Wed, 20 May 2026 03:43:33 +0500 Subject: [PATCH] fix(miner): polish per multi-agent review (#1455) Drop the dead ``cap disabled`` arm of the ``cap_desc`` ternary in the mine summary. The outer ``if files_skipped_chunk_cap > 0:`` only fires when ``process_file`` returned ``"chunk_cap"``, which itself is gated by ``effective_cap > 0``; the ``effective_chunk_cap == 0`` arm was unreachable. Inlined the single live form with a comment recording the invariant. Rephrase the comment at the pre-resolved-int handoff in ``_mine_impl``: the short-circuit lives in ``_resolve_max_chunks_per_file``'s ``override is not None`` branch, not a separately named ``in-resolver fast-path``. No behaviour change. Co-Authored-By: David Glidden --- mempalace/miner.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/mempalace/miner.py b/mempalace/miner.py index 072a396..274508e 100644 --- a/mempalace/miner.py +++ b/mempalace/miner.py @@ -1294,8 +1294,9 @@ def _mine_impl( chunk_overlap=cfg_chunk_overlap, min_chunk_size=cfg_min_chunk_size, # Pass the already-resolved int so ``process_file``'s - # in-resolver fast-path short-circuits; otherwise a - # malformed env var would emit its warning per file. + # ``override is not None`` branch skips the env re-read; + # otherwise a malformed env var would emit its warning + # per file. max_chunks_per_file=effective_chunk_cap, ) except KeyboardInterrupt: @@ -1351,9 +1352,11 @@ def _mine_impl( ) print(f" {residual_label}: {max(0, files_skipped - files_skipped_chunk_cap)}") if files_skipped_chunk_cap > 0: - cap_desc = f"cap {effective_chunk_cap}" if effective_chunk_cap > 0 else "cap disabled" + # ``effective_chunk_cap`` is necessarily > 0 here: ``process_file`` + # only emits the ``"chunk_cap"`` skip_reason when its own + # ``effective_cap > 0`` guard passes (see ``process_file``). print( - f" Files skipped (chunk {cap_desc}): {files_skipped_chunk_cap} " + f" Files skipped (chunk cap {effective_chunk_cap}): {files_skipped_chunk_cap} " f"(raise via --max-chunks-per-file or MEMPALACE_MAX_CHUNKS_PER_FILE; " f"set 0 to disable)" )