You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PR #111 (C1 PR-4) closed #83 by driving both lingering FPs to zero. Two labeled false negatives remain on the benchmark corpus and were intentionally accepted as out-of-scope:
batch FN at flask-mixed-providers/src/providers/anthropic_helper.py:11 — two calls to _client.messages.create(...) in two different module-level functions (summarize and summarize_with_style). The same SDK method is called repeatedly across functions in one module, which is genuinely batchable, but PR-3's (provider, enclosingFunction) bucketing now suppresses it.
unbatched_parallel FN at langchain-openai/src/libs/langchain-openai/src/tools/dalle.ts:242 — Promise.all over Array.from({length: this.n}).map(() => this.client.images.generate(...)) fans out n parallel image-generation requests with identical params. DALL-E accepts n directly in a single request, so this is provably wasteful — but the BOUNDED_REPLICATION guard from PR fix(detection): A3 + A5 — barrel re-exports + factory/DI/aliased clients (closes #75, #77) #110 (added to suppress legitimate Array.from({length:N}) patterns) currently silences this detection.
Why bundled
Both are recall-recovery problems where a previously-shipped guard (PR-3 bucketing, PR #110 BOUNDED_REPLICATION) is suppressing a real positive. Both need new structural signals beyond what the AST currently exposes. Design-first plan.
What to do — design sketch
For the batch FN (Python cross-function)
Add a secondary bucketing pass in src/scanner/python-waste-detector.tsdetectSequentialBatching: after the (providerKey, enclosingFunction) pass, run a (providerKey, methodChain) pass at module scope.
Suggestion: "X calls to {methodChain} across multiple functions in this module — consolidate into a single batched call."
Must NOT re-introduce the FPs that motivated PR-3 (calls across different SDKs / different methodChains).
For the unbatched_parallel FN
The current BOUNDED_REPLICATION guard suppresses ALL Array.from({length:N}) patterns. The DALL-E case is exactly this shape but IS wasteful.
Need a finer signal: the count expression is a runtime parameter (this.n, an arg) rather than a constant literal (Array.from({length: 4})).
This wave has historically re-introduced FPs (PR-3 → PR-4 was exactly that loop). Save for last when corpus expansion (#113) and CI gate (#119) are firmer.
Summary
PR #111 (C1 PR-4) closed #83 by driving both lingering FPs to zero. Two labeled false negatives remain on the benchmark corpus and were intentionally accepted as out-of-scope:
batchFN atflask-mixed-providers/src/providers/anthropic_helper.py:11— two calls to_client.messages.create(...)in two different module-level functions (summarizeandsummarize_with_style). The same SDK method is called repeatedly across functions in one module, which is genuinely batchable, but PR-3's(provider, enclosingFunction)bucketing now suppresses it.unbatched_parallelFN atlangchain-openai/src/libs/langchain-openai/src/tools/dalle.ts:242—Promise.alloverArray.from({length: this.n}).map(() => this.client.images.generate(...))fans outnparallel image-generation requests with identical params. DALL-E acceptsndirectly in a single request, so this is provably wasteful — but theBOUNDED_REPLICATIONguard from PR fix(detection): A3 + A5 — barrel re-exports + factory/DI/aliased clients (closes #75, #77) #110 (added to suppress legitimateArray.from({length:N})patterns) currently silences this detection.Why bundled
Both are recall-recovery problems where a previously-shipped guard (PR-3 bucketing, PR #110 BOUNDED_REPLICATION) is suppressing a real positive. Both need new structural signals beyond what the AST currently exposes. Design-first plan.
What to do — design sketch
For the batch FN (Python cross-function)
src/scanner/python-waste-detector.tsdetectSequentialBatching: after the(providerKey, enclosingFunction)pass, run a(providerKey, methodChain)pass at module scope.{methodChain}across multiple functions in this module — consolidate into a single batched call."For the unbatched_parallel FN
BOUNDED_REPLICATIONguard suppresses ALLArray.from({length:N})patterns. The DALL-E case is exactly this shape but IS wasteful.this.n, an arg) rather than a constant literal (Array.from({length: 4})).inlineParallelCapableflag exists (per [Detection] Narrow images.generate batchCapable to a separate inlineParallelCapable flag #116), the suppression should target ONLY that case, not all bounded replication.Acceptance criteria
npm run benchmarkshowsbatchrow at TP 1 / FP 0 / FN 0 (currently 0/0/1).npm run benchmarkshowsunbatched_parallelrow at TP 1 / FP 0 / FN 0 (currently 0/0/1).Depends on
inlineParallelCapableflag) — enables the cleanerunbatched_parallelfix.Risk hotspot
This wave has historically re-introduced FPs (PR-3 → PR-4 was exactly that loop). Save for last when corpus expansion (#113) and CI gate (#119) are firmer.