Skip to content

feat(wave4): recover unbatched_parallel FN; defer Python batch FN (#117) - #132

Merged
AndresL230 merged 13 commits into
mainfrom
feat/wave4-recall-recovery
Jun 5, 2026
Merged

feat(wave4): recover unbatched_parallel FN; defer Python batch FN (#117)#132
AndresL230 merged 13 commits into
mainfrom
feat/wave4-recall-recovery

Conversation

@AndresL230

@AndresL230 AndresL230 commented May 30, 2026

Copy link
Copy Markdown
Contributor

Summary

Wave 4 recall-recovery (#117) targeted the two C1 false negatives intentionally deferred by PR #111. One of two recovered.

Closes #117 — its remaining scope (the deferred Python batch FN below) is now tracked in #134.

  • DALL-E unbatched_parallel FN — recovered. Added a dedicated unbatched_parallel SuggestionType, threaded it through every consumer (3 union decls, SAVINGS_MULTIPLIERS, FINDING_TITLE/LABEL_BY_TYPE, webview/dashboard label+icon maps, COST_LEAK_FINDING_TYPES). Both the AST detector (detectInlineParallel) and the regex fallback (detectInlineParallelFinding) now emit it, and the BOUNDED_REPLICATION guard was removed from the inline-parallel path — the inlineParallelCapable flag is the precision control (kept in detectBatch, where bounded replication is still legitimately suppressed).
  • ⏸️ Python cross-function batch FN — deferred (reverted). A cross-function (provider, methodChain) batching pass was implemented but fired on structurally-identical sibling helper files (openai_helper.py, cohere_helper.py) that the corpus labels inconsistently — 6 FPs, dropping batch precision to 14.3%. No AST signal distinguishes the labeled-TP case from the unlabeled-but-identical ones, so this is a corpus-labeling inconsistency, not a detector gap. The pass was reverted; python-waste-detector.ts is byte-identical to main. Follow-up tracked in [benchmark corpus] Resolve Python cross-function batch FN: relabel sibling helpers or accept as unrecoverable #134 (corpus relabel-or-accept decision on extension-benchmark).

Also kept (independent fix): package.json now wires python-waste-detector.test.js into test:scanner — it was compiled but never executed in CI.

Merge maintenance

  • Merged latest main (the B2 callTrace feature, feat(wave2): B2 dual locations for cross-file resolved calls (#81) #133) into this branch. Sole conflict was a both-sides-appended collision on the test:scanner line in package.json, resolved as a union (kept both python-waste-detector.test.js and call-trace.test.js). Verified: build:ext, build:webview, test:scanner (fail 0, incl. the merged-in B2 callTrace tests).
  • Drive-by: removed a stale committed merge-conflict marker in dashboard/src/styles/theme.css (empty HEAD side, no closing marker) that had sat on main since 7de2c63 — unrelated to this PR but cleaned up here. Dashboard build verified clean.

Benchmark result

metric before after
finding recall 33.33% 66.67%
finding precision 100% 100%
unbatched_parallel TP 0 / FP 0 / FN 1 TP 1 / FP 0 / FN 0
batch 0 / 0 / 1 0 / 0 / 1 (unchanged)

No metric dropped >1pp. baseline.json regenerated to lock the recovery.

Test Plan

  • npm run test:scanner — 415 pass / 0 fail
  • npm run build — clean (extension + webview + dashboard)
  • npm run benchmark — exit 0, gate green, unbatched_parallel TP1/FP0/FN0
  • Two-stage subagent review (spec + code quality) per task + final holistic review → READY TO MERGE

Docs

Spec: docs/superpowers/specs/2026-05-30-wave4-recall-recovery-design.md
Plan: docs/superpowers/plans/2026-05-30-wave4-recall-recovery.md
C1 calibration table updated in docs/accuracy/findings.md.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Introduced "unbatched parallel" suggestion type to identify parallel execution patterns in code.
  • Bug Fixes

    • Improved detection recall metrics from 33% to 67%.
    • Enhanced batch detection accuracy with better false-negative recovery.
  • Documentation

    • Updated accuracy calibration documentation with revised detection metrics.
    • Added design specifications and implementation plans for detection improvements.

[[Review Change Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/recost-dev/extension/pull/132?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack)

@coderabbitai

coderabbitai Bot commented May 30, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@AndresL230, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 55 minutes and 26 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 09a72316-5360-4a2b-a717-88a9ce85ad2e

📥 Commits

Reviewing files that changed from the base of the PR and between f3d0d05 and 5f4b855.

📒 Files selected for processing (2)
  • dashboard/src/styles/theme.css
  • docs/superpowers/specs/2026-05-30-wave4-recall-recovery-design.md
📝 Walkthrough

Walkthrough

This PR implements Wave 4 recall recovery by introducing a new unbatched_parallel finding type, removing a bounded-replication suppression for inline-parallel detection, emitting the new type from AST and scanner detectors, and wiring the type through types, UI, intelligence scoring, savings multipliers, tests, and documentation/benchmarks.

Changes

Unbatched Parallel Finding Type Rollout

Layer / File(s) Summary
Type definition for unbatched_parallel across type systems
dashboard/src/lib/types.ts, src/analysis/types.ts, webview/src/types.ts
SuggestionType union extended with the "unbatched_parallel" literal in dashboard, core analysis, and webview type definitions.
Detector logic: remove guard and emit unbatched_parallel
src/ast/waste/batch-detector.ts, src/scanner/local-waste-detector.ts
Removed BOUNDED_REPLICATION guard from detectInlineParallel and changed emitted finding type from "batch" to "unbatched_parallel"; scanner detector emits the new type and de-duplication comments updated.
Consumer site updates: UI labels, intelligence scoring, savings multiplier
dashboard/src/pages/Suggestions.tsx, webview/src/components/ResultsPage.tsx, src/intelligence/compression.ts, src/intelligence/INTEL_CONTEXT.md, src/intelligence/scorer.ts, src/scan-results.ts
Registered unbatched_parallel in icon/label maps, compression titles/labels, INTEL_CONTEXT docs, cost-leak scoring set (replacing n_plus_one), and SAVINGS_MULTIPLIERS (0.20).
Test updates: AST and scanner detection validation
src/test/ast-inline-parallel.test.ts, src/test/local-waste-detector.test.ts
Adds findInline helper, updates assertions to require type: "unbatched_parallel", adds bounded Array.from test cases and a precision-gate test.
Implementation plan, design specification, findings calibration, and benchmark baseline
docs/superpowers/plans/2026-05-30-wave4-recall-recovery.md, docs/superpowers/specs/2026-05-30-wave4-recall-recovery-design.md, docs/accuracy/findings.md, benchmark/baseline.json
Adds Wave 4 plan and design doc, updates calibration table and findings narrative, and updates benchmark baseline (per-type TP/FN adjustments and findingRecall from 0.3333→0.6666).
CI / test scripts
package.json
Expanded test:scanner script to run additional compiled scanner/intelligence test suites.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related issues

Possibly related PRs

Poem

🐰 I sniffed the fan-out, once hidden in batch,
I nudged the guard so small loops won't pass.
Now unbatched parallel hops into sight—
metrics sing louder, tests hold tight. 🥕✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely describes the main changes: recovering an unbatched_parallel false negative and deferring the Python batch false negative recovery, with clear reference to issue #117.
Linked Issues check ✅ Passed The PR successfully addresses the linked issue #117 objectives: unbatched_parallel FN is recovered with a dedicated SuggestionType and full integration; Python batch FN recovery is deferred with documented rationale and follow-up tracking in #134.
Out of Scope Changes check ✅ Passed All changes are directly scoped to addressing the #117 objectives: adding unbatched_parallel support throughout the codebase, removing BOUNDED_REPLICATION guard, updating documentation, and wiring tests into CI.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/wave4-recall-recovery

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
docs/superpowers/specs/2026-05-30-wave4-recall-recovery-design.md (1)

29-46: ⚡ Quick win

Track A design describes work that was reverted.

Similar to the implementation plan, this design spec describes Track A as if it will be implemented, but the PR summary states this work was "implemented then reverted" due to corpus-labeling inconsistencies that produced 6 false positives.

Consider adding a note at the beginning of the Track A section indicating the outcome, or moving this section to an "Attempted approaches" appendix.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/superpowers/specs/2026-05-30-wave4-recall-recovery-design.md` around
lines 29 - 46, The Track A section for the Python cross-function batch FN in
docs/superpowers/specs/2026-05-30-wave4-recall-recovery-design.md reports work
that was implemented then reverted; update the Track A text (the description
around the detectSequentialBatching design in
src/scanner/python-waste-detector.ts) to clearly state the outcome by adding a
short note at the start of the Track A subsection indicating the implementation
was reverted due to corpus-labeling inconsistencies producing false positives,
or move the entire Track A subsection into an "Attempted approaches" appendix
and add a one-line pointer from the main section; ensure the note references the
same identifiers (Track A, detectSequentialBatching, and
python-waste-detector.ts) so readers can correlate the design and its reverted
status.
docs/superpowers/plans/2026-05-30-wave4-recall-recovery.md (1)

42-192: ⚡ Quick win

Track A implementation was reverted but the plan document still describes it as active.

The PR summary states that the Python cross-function batch FN recovery was "implemented then reverted" due to 6 false positives caused by corpus-labeling inconsistencies. However, this plan document still describes Track A (lines 42-192) as if it will be implemented, including detailed steps, test cases, and commit instructions.

Consider adding a note at the beginning of the Track A section indicating that this track was attempted but reverted, with a reference to the outcome documented in docs/accuracy/findings.md or the PR summary. This will prevent future readers from attempting to execute these steps or being confused about why the code doesn't match the plan.

📝 Suggested documentation clarification

Add a note at the start of the Track A section:

 ## Track A — Python cross-function batch FN
 
+> **OUTCOME (2026-05-30):** This track was implemented and then reverted. The cross-function `(provider, methodChain)` batching pass recovered the target FN but produced 6 FPs on structurally-identical unlabeled sibling files. The issue is a corpus-labeling inconsistency, not recoverable by detector code alone. See `docs/accuracy/findings.md` C1 calibration table for details. This section is retained for reference but should not be re-executed.
+
 **File:** `src/scanner/python-waste-detector.ts`
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/superpowers/plans/2026-05-30-wave4-recall-recovery.md` around lines 42 -
192, The Track A section currently describes implementing cross-function
batching (steps referencing detectSequentialBatching, python-waste-detector.ts,
and tests in src/test/python-waste-detector.test.ts) as active work but that
implementation was reverted; update the Track A header so it clearly indicates
the cross-function batch FN was attempted and reverted due to false positives,
add a short note at the start of the Track A block referencing the PR summary
and docs/accuracy/findings.md for details, and mark the plan steps as historical
(e.g., prepend "REVERTED:" or "ARCHIVED:" and a one-line rationale) so future
readers won't try to execute detectSequentialBatching changes or the test
additions.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/superpowers/specs/2026-05-30-wave4-recall-recovery-design.md`:
- Line 58: The spec currently lists the savings multiplier for
unbatched_parallel as 0.18 but the implementation and plan use 0.20; update the
spec value to 0.20 to match the implementation by changing the
unbatched_parallel entry in the wave4-recall-recovery-design document to 0.20 so
it aligns with BASE_MULTIPLIERS in src/scan-results.ts (and the plan doc).

---

Nitpick comments:
In `@docs/superpowers/plans/2026-05-30-wave4-recall-recovery.md`:
- Around line 42-192: The Track A section currently describes implementing
cross-function batching (steps referencing detectSequentialBatching,
python-waste-detector.ts, and tests in src/test/python-waste-detector.test.ts)
as active work but that implementation was reverted; update the Track A header
so it clearly indicates the cross-function batch FN was attempted and reverted
due to false positives, add a short note at the start of the Track A block
referencing the PR summary and docs/accuracy/findings.md for details, and mark
the plan steps as historical (e.g., prepend "REVERTED:" or "ARCHIVED:" and a
one-line rationale) so future readers won't try to execute
detectSequentialBatching changes or the test additions.

In `@docs/superpowers/specs/2026-05-30-wave4-recall-recovery-design.md`:
- Around line 29-46: The Track A section for the Python cross-function batch FN
in docs/superpowers/specs/2026-05-30-wave4-recall-recovery-design.md reports
work that was implemented then reverted; update the Track A text (the
description around the detectSequentialBatching design in
src/scanner/python-waste-detector.ts) to clearly state the outcome by adding a
short note at the start of the Track A subsection indicating the implementation
was reverted due to corpus-labeling inconsistencies producing false positives,
or move the entire Track A subsection into an "Attempted approaches" appendix
and add a one-line pointer from the main section; ensure the note references the
same identifiers (Track A, detectSequentialBatching, and
python-waste-detector.ts) so readers can correlate the design and its reverted
status.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 34a55e25-cf70-4a67-8c76-78ac6e12b51c

📥 Commits

Reviewing files that changed from the base of the PR and between 229ee8d and 7c8713d.

📒 Files selected for processing (18)
  • benchmark/baseline.json
  • dashboard/src/lib/types.ts
  • dashboard/src/pages/Suggestions.tsx
  • docs/accuracy/findings.md
  • docs/superpowers/plans/2026-05-30-wave4-recall-recovery.md
  • docs/superpowers/specs/2026-05-30-wave4-recall-recovery-design.md
  • package.json
  • src/analysis/types.ts
  • src/ast/waste/batch-detector.ts
  • src/intelligence/INTEL_CONTEXT.md
  • src/intelligence/compression.ts
  • src/intelligence/scorer.ts
  • src/scan-results.ts
  • src/scanner/local-waste-detector.ts
  • src/test/ast-inline-parallel.test.ts
  • src/test/local-waste-detector.test.ts
  • webview/src/components/ResultsPage.tsx
  • webview/src/types.ts

Comment thread docs/superpowers/specs/2026-05-30-wave4-recall-recovery-design.md Outdated
claude added 3 commits May 31, 2026 01:43
…e.css

The `<<<<<<< HEAD` / `=======` markers (empty HEAD side, no closing
marker) had been committed to theme.css since 7de2c63 and sat identically
on every branch. They predate this PR; removing them keeps the pulseGlow
@Keyframes intact. Dashboard build verified clean.
The spec listed unbatched_parallel's BASE_MULTIPLIERS value as 0.18, but
both the plan and src/scan-results.ts ship 0.20 (matching batch, which is
also 0.20). Correct the stale spec value. Addresses CodeRabbit review.
@AndresL230
AndresL230 merged commit 814c8ac into main Jun 5, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Findings] Recover the two C1 false negatives — cross-function batch + inline-parallel unbatched

2 participants