DEV Community

Cover image for I tested my ML model honestly. It beat "good issue" labels by 43%.
HARSH VORA
HARSH VORA

Posted on

I tested my ML model honestly. It beat "good issue" labels by 43%.

Honest failure analysis exposes data leakage traps

My first open source contribution took a week to write and never got merged. The code wasn't the problem. I had picked the wrong issue.

The idea

Lysis

Every newcomer hears the same advice: filter by "good first issue." In practice, those labels are stale, missing, or stuck on issues nobody wants help with.

So I asked a different question. Of the issues that got closed, which ones did a first-time contributor close with a merged PR?

That became Lysis. You type owner/repo and it ranks the open issues. Try it at trylysis.me, no signup needed.

What "success" means

An issue counts as a win when a first-time contributor's merged PR closes it. "First-time" means the author had no earlier commits in that repo, and the PR links the issue with a closing keyword.

That gave me 22,627 labeled issues, 4,646 of them wins. It is also the weakest part of the project, and I come back to it at the end.

Mistake one: I graded myself on the easy test

I only had labels for issues that already had a merged PR, so I trained and tested on those alone. My model scored 0.445 average precision (AP) against 0.333 for a baseline that just uses the label.

Then I added every closed issue, wins and non-wins, because that is what the model faces when it ranks an open one. The win rate fell from 24% to 10%, and AP fell to 0.278 (baseline 0.245).

Mistake two: statistics from the future

Stars, forks and repo size came from the day I downloaded the data, not the day each issue was opened. I replaced them with activity counted only from PRs merged before the issue existed.

I expected a drop. The honest version scored slightly better, 0.305.

Four ideas that did not help

Once the test was honest, I could finally lose arguments with myself properly:

  1. TF-IDF features from the issue text: AP 0.426, versus 0.446 without
  2. Repo PR-behaviour features: 0.437 versus 0.441
  3. One model per language: 0.152 versus 0.169 for a shared model (JavaScript)
  4. Maintainer response signals: 0.263 versus 0.260

Each one cost me an evening and ended in a revert. The metrics page I built to test them was the most useful thing in the repo.

The best number was a bug

When I added Go, TypeScript, Java and Rust, the labeling run stopped halfway on a GitHub rate limit. I evaluated anyway. AUC came back 0.90, the best result I had ever seen.

It was wrong. The unlabeled issues were silently counted as failures, which dragged the win rate down to 2.3% and made everything look easy to separate. After I finished the labeling, the real AUC was 0.789.

A score that jumps that far should make you suspicious before it makes you happy.

The bogus 0.90 run

Getting it online

Shipping took almost as long as modeling.

  • My org's OAuth restrictions blocked Streamlit from reading the repo, so I deployed from a personal fork.
  • A GitHub Actions run sat in the queue for close to an hour. Pushing the same code under a new branch name fixed it.
  • I lost an hour to CORS errors because a Docker container from nine hours earlier was still answering on port 8000 with old code.
  • Dependabot opened 13 pull requests at once. I also pinned scikit-learn, because the saved model is a pickle and a routine version bump could break it.
  • Render's free tier goes to sleep, so a cold request takes up to a minute. A five-minute uptime ping keeps it awake.

Everything looked done. I checked anyway.

I wrote a one-page checklist and ran it. Production only got gentle, read-only checks, and the aggressive ones ran on staging.

  • 78 backend tests pass, plus browser tests with Playwright.
  • pip-audit found nothing. gitleaks scanned the full git history and found no secrets. npm audit flagged 7 moderate issues, all in lint tooling that never ships.
  • ZAP's baseline scan found 0 high, 3 medium and 7 low alerts, nearly all missing security headers. I added CSP, HSTS, nosniff and clickjacking protection.
  • My Supabase insert policy for feedback was WITH CHECK (true), so anyone could write anything. It now validates the repo format, issue number and score range, and I proved it with curl.
  • Lighthouse after a production build: SEO 100, performance 87, accessibility 97, best practices 96.
  • A k6 run on staging (5 users, 30 seconds) passed all 2,693 checks with a 73 ms p95.

The checks also broke a few of my own things. My new CSP blocked my CI test build, and my browser smoke test passed locally only because my backend was running.

ZAP summary, Supabase policy and k6 output

Where it ended up

About 54,000 closed issues across six languages, 5-fold cross-validation where no repo appears in both train and test:

AP (Average Precision) AUC (Area Under Curve)
Random 0.067 0.50
Label 0.176 0.706
Lysis 0.251 0.789

By language (Lysis vs label only, AP): Python 0.301 vs 0.225, Go 0.322 vs 0.206, TypeScript 0.222 vs 0.162, Rust 0.205 vs 0.162, Java 0.170 vs 0.131. JavaScript is a tie, 0.190 vs 0.191.

A language only gets a "validated" tag if the model beats the label baseline on both AP and AUC, so JavaScript doesn't have one.

It is about 3.7 times better than random and clearly better than labels, but it is still a modest signal. When a repo has 100 open issues, it helps you pick a better five. It does not tell you which one will be merged.

Try it

If a ranking looks wrong for a repo you know, tell me in the comments. That is the feedback I want most.

Top comments (10)

Collapse
 
gautamtalksdev profile image
Gautam K •

Picking issues that first-timers actually closed with a merged PR, instead of trusting the label, is a smart reframe. Beating good-first-issue labels by 43 is a strong number. Does Lysis also look at how fast maintainers reviewed those PRs? A merged PR after 3 months is a different experience.

Collapse
 
harsh0641 profile image
HARSH VORA •

Yes, that’s actually something I’ve been thinking about as well. I’m currently training the model, and this is the V1 that’s live right now. I’m planning to incorporate maintainer response and review times into the next iteration. Once the training is complete, I’ll push an updated version with these improvements.

Collapse
 
gautamtalksdev profile image
Gautam K •

Adding maintainer response and review times sounds like a strong next step, since a merged PR depends on someone actually answering. Looking forward to the next version.

Collapse
 
golflover2023 profile image
golflover •

This is the honest-eval writeup most '43% better' posts skip. One question on your weakest link: you treat still-open issues as non-wins, but they're censored samples - an issue opened last week being unclaimed tells you little. A survival/hazard framing (time to first merged PR, censored at today) would use those rows instead of discarding them, and would answer whether your ranking degrades on recent issues, where censoring is heaviest. Also worth a second look: the leak fix RAISED AP (0.278 -> 0.305). Removing leaky features usually drops measured performance, so either the leak was anti-correlated with ranking quality or the eval set shifted; feature importances before/after would settle it.

Collapse
 
harsh0641 profile image
HARSH VORA •

Great points, thanks. Open issues aren't labeled as non-wins, since I only train on closed ones, but I haven't checked whether the ranking degrades on recent issues, and a time-to-merge framing is a good idea. On 0.278 to 0.305, I changed the features and the eval together, so I can't separate the two yet. I'll run before/after feature importances and share what I find.

Collapse
 
vaidehi_joshi_305ddc6da64a632 profile image
Vaidehi Joshi •

This is the kind of tool I wish existed when I started contributing. Bookmarking it for my next first PR.

Collapse
 
ben_halpern18d41b1963c1bc profile image
Ben Halpern •

Honest evaluation is rare in posts like this. Most people would've kept the 0.445 and moved on. Respect for showing the drop

Collapse
 
anmol_baranwal142123 profile image
Anmol Baranwal •

The 0.90 to 0.789 bug story is painful and so relatable. I've celebrated a bad metric before too. Great reminder to distrust a score that looks too good

Collapse
 
syedfahads profile image
Syed Fahad •

the closing keyword rule might be hiding a lot of wins. plenty of first PRs just say "for issue 123" and a maintainer closes it by hand. did you check how many merged first PRs had no keyword?

Collapse
 
jess_lee_7324337803cd0e profile image
Jess Lee •

Tried it on a repo I contribute to and the top picks were actually reasonable. Any plans to add live data instead of weekly snapshots?