fix: Fail CV checks that return no extractable data

CVs that parse with no employment, no education, and unknown name are
likely scanned images or corrupted files. Instead of completing with
score 100 (misleading), fail with a clear error message.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-22 19:49:10 +00:00
parent 232036746f
commit 983fb5bd67

View File

@@ -92,6 +92,19 @@ public sealed class ProcessCVCheckJob
"Parsed CV for check {CheckId}: {EmploymentCount} employment entries",
cvCheckId, cvData.Employment.Count);
// Validate that the CV contains meaningful data
// A CV with no name, no employment AND no education is likely a parsing failure
if (cvData.Employment.Count == 0 && cvData.Education.Count == 0 &&
(string.IsNullOrWhiteSpace(cvData.FullName) || cvData.FullName == "Unknown"))
{
_logger.LogWarning(
"CV check {CheckId} parsed with no extractable data - possible scanned/image PDF or parsing failure",
cvCheckId);
throw new InvalidOperationException(
"Could not extract any employment or education data from this CV. " +
"The file may be a scanned image, password-protected, or in an unsupported format.");
}
// Step 4: Save extracted data
cvCheck.ExtractedDataJson = JsonSerializer.Serialize(cvData, JsonDefaults.CamelCaseIndented);
cvCheck.ProcessingStage = "Verifying Employment";