Skip to content

Fix: Crash in deep_scan, validate LLM output, ruff cleanup - #1

Open
Chocapikk wants to merge 1 commit into
Christbowel:mainfrom
Chocapikk:improve-heuristics
Open

Fix: Crash in deep_scan, validate LLM output, ruff cleanup#1
Chocapikk wants to merge 1 commit into
Christbowel:mainfrom
Chocapikk:improve-heuristics

Conversation

@Chocapikk

@Chocapikk Chocapikk commented Apr 16, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Fix crash in deep_scan.py: suspects_count used before assignment
  • Validate LLM output: confidence field constrained to HIGH/MEDIUM/LOW enum
  • Diff truncation marker: LLM now knows when context is incomplete
  • Ruff cleanup: 32 issues fixed across 11 files (unused imports, f-strings without placeholders, unused variables)

What's NOT in this PR

Patterns, thresholds, and skip pattern changes from the previous version have been dropped per your feedback. Specifically:

  • Thresholds untouched: fingerprint similarity stays at 0.05, silent scan layer2 stays at 20
  • Skip patterns untouched: no negative lookaheads added on bump/deprecate/release
  • No new msg_words: keyword list stays as-is
  • No any()/list comprehension refactors: kept your style

Changes

Bug fixes

  • deep_scan.py: suspects_count was referenced before assignment on progress print (line 149), crashes on first batch of 50 commits. Replaced with len(suspects)
  • deep_scan.py: removed unused raw_combined variable
  • analyze.py: LLM confidence output now validated to HIGH/MEDIUM/LOW, falls back to LOW on garbage
  • analyze.py: diff truncation adds [diff truncated] marker so the LLM knows context is incomplete

Ruff (32 fixes)

  • Unused imports removed: RATE_LIMIT_DELAY, Path, os, sys, date, defaultdict, README_DAYS_SHOWN, get_advisories_for_date, get_recent_dates, get_all_advisories
  • f-strings without placeholders replaced with plain strings
  • Unused local variable exc in fetch.py

Test plan

  • Run python -m src.deep_scan on a test repo, confirm no crash on progress output
  • Run ruff check src/ - should return 0 errors

@Christbowel

Copy link
Copy Markdown
Owner

Thanks @Chocapikk.
Cherry-picked the multi-language patterns (23926f6) and regex caching (d3a9930). Kept our existing thresholds and rate limit handling. Great contribution, looking forward to future PRs. Closing in favor of the cherry-picks

@Chocapikk

Copy link
Copy Markdown
Contributor Author

Bro tu cherry-pick les patterns et le cache mais tu laisses les bug fixes? 😂 Le fingerprint threshold à 0.05 c'est 5% de similarité, ça matche n'importe quoi. Le skip pattern bouffe les security releases. Et deep_scan.py a une variable undefined qui crash si tu tombes dessus. Le ruff c'est 41 issues dont des unused imports et des f-strings vides.

Fais confiance stp gro 😂😂 tu veux que je split en PRs séparées ou tu reprends le reste?

- Fix undefined suspects_count in deep_scan.py (crashes on progress print)
- Remove unused raw_combined variable in deep_scan.py
- Add confidence validation (HIGH/MEDIUM/LOW) in analyze.py
- Add diff truncation marker for LLM context awareness
- Fix 32 ruff issues across 11 files (unused imports, f-strings without placeholders)
@Chocapikk
Chocapikk force-pushed the improve-heuristics branch from ab21dfd to e32c610 Compare April 16, 2026 18:30
@Chocapikk Chocapikk changed the title Expand heuristic detection, fix bugs, improve performance Fix: Crash in deep_scan, validate LLM output, ruff cleanup Apr 16, 2026
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.

2 participants