Skip to content

Drop implausibly small per-occupation salary estimates (#275) - #276

Merged
Monster0506 merged 1 commit into
mainfrom
fix/occupation-salary-scale-validation
Sep 20, 2026
Merged

Monster0506 merged 1 commit into
mainfrom
fix/occupation-salary-scale-validation

Conversation

@Monster0506

Copy link
Copy Markdown
Member

Summary

Found via real browser testing (Puppeteer): /market-potential occasionally showed nonsensical per-occupation salary ranges like "C#/.NET Developer - $80 – $120" and a Growth Path step of "(~$100)", while the page's separate, top-level "Estimated Compensation Range" (a different LLM call) correctly showed "$90,000 – $150,000" on the same load.

Root cause

AiSuggestedOccupationMatchingService's prompt asks for typicalMinUsd/typicalMaxUsd as "a rough typical US annual salary range" with no example number format. The model sometimes returns an abbreviated figure (e.g. 80, presumably meaning "$80k") instead of 80000. It's a valid, correctly-ordered positive integer, so none of the existing validation (< 0, min > max) catches it.

I confirmed this isn't a deterministic code bug (the downstream arithmetic in OpportunityFinder.BuildProgression is plain, correct averaging) by comparing two live runs of the exact same code path: one produced the "$80 – $120" nonsense, a later one (fresh LLM completion) produced correctly-scaled "(~$100,000)" etc. Same code, different LLM output.

Changes

  • HumanCapital/AiSuggestedOccupationMatchingService.cs:
    • Strengthened the prompt with an explicit example (85000, never 85 or "85k") to reduce how often this happens.
    • Added a plausibility floor ($1,000/year) as a safety net: any occupation match with implausibly small compensation values has both nulled out rather than displayed, consistent with the prompt's own "omit both if you cannot give a reasonable estimate" instruction and the codebase's existing explicit-no-estimate-over-fabricated-data philosophy.

Verification

  • dotnet test — all 222 tests pass, including a new test asserting a {80, 120} range gets nulled while a normal {85000, 130000} range is untouched.
  • dotnet csharpier check — clean.

Closes #275.

…ad of 80000)

Found via real browser testing: the Market Potential page occasionally
showed nonsensical ranges like "$80 - $120" for a Software Engineer
match. The LLM sometimes returns typicalMinUsd/typicalMaxUsd as an
abbreviated figure (e.g. 80, presumably meaning "$80k") rather than a
full annual-salary number - a valid, correctly-ordered positive range,
so the existing negative/min>max validation didn't catch it.

- Strengthened the prompt with an explicit example ("85000, never 85 or
  '85k'") to reduce how often this happens.
- Added a plausibility floor (any value under $1,000/year is obviously
  not a real full-time salary) that nulls out both values rather than
  keeping them, consistent with the prompt's own "omit both if you
  cannot give a reasonable estimate" contract and the codebase's
  existing explicit-no-estimate-over-fabricated-data philosophy.
@Sumedh-Joshi
Sumedh-Joshi force-pushed the fix/occupation-salary-scale-validation branch from 3800b6d to 5c2449e Compare September 20, 2026 11:01
@Monster0506
Monster0506 merged commit 3706052 into main Sep 20, 2026
2 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.

Market Potential occasionally shows nonsensical per-occupation salaries like "$80 - $120"

1 participant