Bug: resume/GitHub cache keyed only on PDF basename, so two different resume.pdf files share cached data
Description
The resume and GitHub cache files are keyed only on the PDF's basename:
https://github.com/interviewstreet/hiring-agent/blob/70fd3ea/score.py#L211-L216
cache_filename = f"cache/resumecache_{os.path.basename(pdf_path).replace('.pdf', '')}.json"
github_cache_filename = f"cache/githubcache_{os.path.basename(pdf_path).replace('.pdf', '')}.json"and DEVELOPMENT_MODE is hardcoded to True (config.py L11), so caching is always on.
Resumes are very commonly named resume.pdf / CV.pdf. Scoring batchA/resume.pdf and then batchB/resume.pdf loads cache/resumecache_resume.json and cache/githubcache_resume.json from the first candidate, so the second candidate is scored (and written to the CSV) with another person's resume and GitHub data. Nothing in the output indicates this besides a Loading cached data from ... line.
Also, .replace('.pdf', '') is case-sensitive (Resume.PDF isn't stripped) and replaces anywhere in the name, not just the extension.
Steps to reproduce
python score.py a/resume.pdf --role software_engineering_internpython score.py b/resume.pdf --role software_engineering_intern(different candidate)- The second run prints
Loading cached data from cache/resumecache_resume.jsonand reports candidate A's name and scores.
Expected
Cache key derived from file content (e.g. SHA-256 of the PDF bytes) or at least the full resolved path, and Path(pdf_path).stem for display.
Source: interviewstreet/hiring-agent