12 Commits

Author SHA1 Message Date
135e774f71 feat: Replace AI compound name detection with rule-based approach
Eliminates one Anthropic API call entirely by using pattern matching:

- Add 120+ known single-company names (Ernst & Young, M&S, law firms, etc.)
- Detect "/" separator as clear indicator of multiple companies
- Use company suffixes (Ltd, PLC) to identify when "&" means two companies
- Conservative approach: don't split ambiguous cases

Added 40 unit tests for compound name detection covering:
- Known single companies with & and "and"
- Slash-separated company names
- Ambiguous cases
- Edge cases (empty, null, short names)

Estimated savings: ~$0.01 per CV check, 100% elimination of this API call

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 20:08:28 +00:00
3d666d5f9c feat: Reduce false positives in company verification
Major improvements to company name matching accuracy:

- Add well-known brands dictionary with correct Companies House numbers
  for fast-track verification (Boots, Legal & General, EY, etc.)
- Add safe expansion words (UK, LIMITED, GROUP, PLC) that don't change
  company identity
- Fix core word validation to require original company's core words
- Remove overly aggressive skip words that removed meaningful identifiers
  (industries, technology, consulting, services, etc.)
- Add industry context hints for AI matching
- Fix CVBatchTester JSON deserialization for test files

Before: 98% verified but with false positives like:
- Boots → BOOTS AND BEARDS (wrong)
- Legal & General → LEGAL LIMITED (wrong)

After: 97% verified with correct matches:
- Boots → BOOTS UK LIMITED (correct)
- Legal & General → fast-tracked to correct company

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 19:07:17 +00:00
94ca6e1b9a feat: Add AI-powered compound company name splitting
Uses Claude Haiku to intelligently detect when a company name contains
multiple companies (e.g., "ASDA/WALMART", "Corus & Laura Ashley Hotels")
vs single companies with similar patterns (e.g., "Ernst & Young").

- Adds ExtractCompanyNamesAsync to ICompanyNameMatcherService
- Only triggers for names with potential separators (/, &, "and")
- Verifies each extracted part individually, returns first match
- Uses fast Haiku model to minimize cost

Results:
- ASDA/WALMART → verified via 'ASDA' → ASDA GROUP LIMITED
- Corus & Laura Ashley Hotels → verified via 'Corus' → Tata Steel UK
- Employers: 104/120 verified (86%)

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 11:04:30 +00:00
998e9a8ab8 Rename project to RealCV with new logo and font updates
- Rename all TrueCV references to RealCV across the codebase
- Add new transparent RealCV logo
- Switch from JetBrains Mono to Inter font for better number clarity
- Update solution, project files, and namespaces

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 15:07:20 +00:00
28d7d41b25 feat: Add Stripe payment integration and subscription management
- Add Stripe.net SDK for payment processing
- Implement StripeService with checkout sessions, customer portal, webhooks
- Implement SubscriptionService for quota management
- Add quota enforcement to CVCheckService
- Create Pricing, Billing, Settings pages
- Add checkout success/cancel pages
- Update Check and Dashboard with usage indicators
- Add ResetMonthlyUsageJob for billing cycle resets
- Add database migration for subscription fields

Plan tiers: Free (3 checks), Professional £49/mo (30), Enterprise £199/mo (unlimited)

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 12:03:24 +00:00
28a61552cc Fix ProcessCVCheckJob tests for current behaviour
- Update flag assertions to filter by specific flag types
  (job now creates additional informational flags)
- Update overlap tests: now "Concurrent Employment" with Info severity
- Update overlap score tests: no penalty for overlaps
  (legitimate for part-time, consulting, job transitions)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 01:36:25 +01:00
d047de1c84 Add AI-powered company name matching using Claude API
Replace fuzzy string matching with semantic AI matching to fix false
positives where similar-sounding but different companies were matched
(e.g., "Families First CiC" incorrectly matching "FAMILIES AGAINST
CONFORMITY LTD").

Changes:
- Add ICompanyNameMatcherService interface and AICompanyNameMatcherService
  implementation using Claude Sonnet 4 for semantic company name comparison
- Add SemanticMatchResult and related models for AI match results
- Update CompanyVerifierService to use AI matching with fuzzy fallback
- Add detection for public sector employers, charities, and self-employed
  entries that cannot be verified via Companies House
- Update tests to work with new AI matcher integration

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 00:51:24 +01:00
0eee5473e4 Add audit logging, processing stages, delete functionality, and bug fixes
- Add audit logging system for tracking CV uploads, processing, deletion,
  report views, and PDF exports for billing/reference purposes
- Add processing stage display on dashboard instead of generic "Processing"
- Add delete button for CV checks on dashboard
- Fix duplicate primary key error in CompanyCache (race condition)
- Fix DbContext concurrency in Dashboard (concurrent delete/load operations)
- Fix ProcessCVCheckJob to handle deleted records gracefully
- Fix duplicate flags in verification report by deduplicating on Title+Description
- Remove internal cache notes from verification results
- Add EF migrations for ProcessingStage and AuditLog table

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 20:58:12 +01:00
652aa2e612 Add comprehensive CV verification checks and dashboard auto-refresh
- Add dashboard auto-refresh polling to update when processing completes
- Skip verification for freelance employers (but not contractors)
- Add incorporation date check (flags employment before company existed)
- Add dissolution date check (flags employment at dissolved companies)
- Add dormant company check (flags non-director roles at dormant companies)
- Add company size vs role check (flags senior roles at micro-entities)
- Add SIC code mismatch check (flags tech roles at non-tech companies)
- Add director verification against Companies House officers
- Add rapid career progression detection (3+ seniority jumps in <2 years)
- Add early career senior role detection (<2 years after education)
- Extend CompanyVerificationResult with flags and company data
- Add officers endpoint to Companies House client
- Fix null reference warning in Report.razor

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 20:00:24 +01:00
04a7c3628a Fix DbContext concurrency error in parallel company verification
Use IDbContextFactory pattern to create isolated DbContext instances
for each cache operation, making parallel verification thread-safe.

Changes:
- Add IDbContextFactory<ApplicationDbContext> registration
- Update CompanyVerifierService to use factory for cache operations
- Update tests with InMemoryDatabaseRoot for shared test data

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 16:54:58 +01:00
f1ccd217d8 Add UK education verification and security fixes
Features:
- Add UK institution recognition (170+ universities)
- Add diploma mill detection (100+ blacklisted institutions)
- Add education verification service with date plausibility checks
- Add local file storage option (no Azure required)
- Add default admin user seeding on startup
- Enhance Serilog logging with file output

Security fixes:
- Fix path traversal vulnerability in LocalFileStorageService
- Fix open redirect in login endpoint (use LocalRedirect)
- Fix password validation message (12 chars, not 6)
- Fix login to use HTTP POST endpoint (avoid Blazor cookie issues)

Code improvements:
- Add CancellationToken propagation to CV parser
- Add shared helpers (JsonDefaults, DateHelpers, ScoreThresholds)
- Add IUserContextService for user ID extraction
- Parallelized company verification in ProcessCVCheckJob
- Add 28 unit tests for education verification

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 16:45:43 +01:00
89d1f7e33b Add comprehensive unit test suite
Test project with 143 tests covering:
- TimelineAnalyserService (27 tests): gap/overlap detection, edge cases
- CVParserService (35 tests): file parsing, extension handling, API calls
- CompanyVerifierService (23 tests): verification, caching, fuzzy matching
- CVCheckService (24 tests): CRUD operations, file upload, job queuing
- ProcessCVCheckJob (34 tests): full workflow, scoring algorithm, flags

Uses xUnit, Moq, FluentAssertions, EF Core InMemory

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-18 19:45:07 +01:00