Skip to content

feat: forensic evaluator and permanent-loss filter (#89) - #118

Open
JLaborda wants to merge 4 commits into
developfrom
cursor/forensic-permanent-loss-89-b5eb
Open

feat: forensic evaluator and permanent-loss filter (#89)#118
JLaborda wants to merge 4 commits into
developfrom
cursor/forensic-permanent-loss-89-b5eb

Conversation

@JLaborda

@JLaborda JLaborda commented Jul 1, 2026

Copy link
Copy Markdown
Owner

Adds hermetic tests to close Codecov patch coverage gaps for the forensic evaluator (#89).

Coverage improvements:

  • forensic_evaluator.py: integration paths (review queue, beneish percentile gate, delisted, empty universe, CLI)
  • beneish_score.py: missing fields, derived-ratio edge cases, non-comparable inputs
  • distress_rules.py: Altman Z, interest coverage, net debt/EBITDA, delisted variants, getattr path
  • run_forensic_evaluator.py: __main__ entrypoint and review-queue echo
Open in Web Open in Cursor 

Add phase-2 forensic hard-exclusion module with distress rules (Altman Z,
interest coverage, net debt/EBITDA, negative equity, delisted), Beneish
M-Score from multi-period PIT fundamentals, and QVAL-style bottom-5%
cross-sectional gate. Versioned thresholds and coefficients live under
config/permanent_loss/ for future book alignment.

Writes curated/permanent_loss/run_date=*/exclusions.parquet and routes
missing inputs to the review queue. EDGAR fraud rules log unavailable
without blocking. CI regression covers Enron, Lehman, and WorldCom.
@codecov

codecov Bot commented Jul 1, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.93396% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 98.05%. Comparing base (b5d9586) to head (528fe3d).

Files with missing lines Patch % Lines
src/smartwealthai/forensic_evaluator.py 92.36% 4 Missing and 6 partials ⚠️
src/smartwealthai/beneish_score.py 97.59% 1 Missing and 1 partial ⚠️
src/smartwealthai/run_forensic_evaluator.py 95.45% 0 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #118      +/-   ##
===========================================
- Coverage    98.31%   98.05%   -0.26%     
===========================================
  Files           25       31       +6     
  Lines         1836     2260     +424     
  Branches       239      294      +55     
===========================================
+ Hits          1805     2216     +411     
- Misses          25       30       +5     
- Partials         6       14       +8     
Files with missing lines Coverage Δ
src/smartwealthai/distress_rules.py 100.00% <100.00%> (ø)
src/smartwealthai/forensic_percentile_gate.py 100.00% <100.00%> (ø)
src/smartwealthai/lake_paths.py 100.00% <100.00%> (ø)
src/smartwealthai/permanent_loss_config.py 100.00% <100.00%> (ø)
src/smartwealthai/run_forensic_evaluator.py 95.45% <95.45%> (ø)
src/smartwealthai/beneish_score.py 97.59% <97.59%> (ø)
src/smartwealthai/forensic_evaluator.py 92.36% <92.36%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Record closed phase 2a/2b forensic decisions in the permanent-loss
spec, add QV forensic terms to CONTEXT.md, and extend the backlog
with STA/SNOA/COMBOACCRUAL and PFD follow-ups.
@JLaborda
JLaborda marked this pull request as ready for review July 7, 2026 10:52
JLaborda added 2 commits July 7, 2026 13:03
Add hermetic edge-case and integration tests for the forensic evaluator,
Beneish scorer, and distress rules to raise patch coverage above Codecov
thresholds on PR #118.
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.

1 participant