The job search that runs on your machine. AI job application framework built on Claude Code: evaluate postings, tailor CVs, write cover letters, prep interviews. Fork it and own it.
Python aiai-agentscareerclaude-codecover-lettercvinterview-preparationjob-applicationjob-huntingjob-searchlatexresume
fix(salary): reject non-finite converter baselines (#665)
Kienne6ce6a1decead
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex ec8db9f7..64f839f2 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -108,6 +108,13 @@ per-file diff commands.in `salary_data.json` and `--list-all`. A fallback-detected header with no salary column beside itnow skips the sheet with a warning; strictly detected headers are unchanged.+- **`convert_salary_excel.py` rejects a non-finite `--baseline`** (#665,+ `tools/convert_salary_excel.py`, `tests/test_salary_baseline_cli.py`) - `nan`, `inf`, `-inf` and+ an overflow such as `1e309` were accepted with exit 0 and written as `index_baseline`,+ overwriting a good `salary_data.json` with one that `salary_lookup.py --validate` rejects; every+ lookup then failed and `/apply` quietly dropped the benchmark. The converter now exits 2 before+ reading the workbook or opening the output, and `0` or a finite custom baseline still converts.+## [1.7.3] - 2026-10-19### Addeddiff --git a/tests/test_salary_baseline_cli.py b/tests/test_salary_baseline_cli.pynew file mode 100644index 00000000..ff915b73--- /dev/null+++ b/tests/test_salary_baseline_cli.py@@ -0,0 +1,57 @@+"""The converter must not write baselines rejected by salary_lookup --validate."""+import json+import subprocess+import sys+import unittest+from pathlib import Path+from tempfile import TemporaryDirectory++try:+ import openpyxl+except ImportError:+ openpyxl = None++TOOL = Path(__file__).resolve().parents[1] / "tools" / "convert_salary_excel.py"++[email protected](openpyxl, "requires optional openpyxl (installed in CI)")+class BaselineCLI(unittest.TestCase):+ def setUp(self):+ directory = TemporaryDirectory()+ self.addCleanup(directory.cleanup)+ self.root = Path(directory.name)+ self.workbook = self.root / "salary.xlsx"+ self.output = self.root / "salary.json"+ book = openpyxl.Workbook()+ try:+ book.active.append(["Company", "Count", "Index"])+ book.active.append(["Acme", 12, 108.5])+ book.save(self.workbook)+ finally:+ book.close()++ def convert(self, baseline):+ return subprocess.run(+ [sys.executable, str(TOOL), str(self.workbook),+ "--output", str(self.output), f"--baseline={baseline}"],+ capture_output=True, text=True, encoding="utf-8",+ )++ def test_nonfinite_baseline_is_rejected_without_overwriting_output(self):+ for baseline in ("nan", "inf", "-inf", "1e309"):+ with self.subTest(baseline=baseline):+ self.output.write_text("existing salary data\n", encoding="utf-8")+ result = self.convert(baseline)+ self.assertNotEqual(result.returncode, 0, result.stdout + result.stderr)+ self.assertIn("--baseline", result.stderr)+ self.assertIn("finite", result.stderr)+ self.assertNotIn("Traceback", result.stderr)+ self.assertEqual(self.output.read_text(encoding="utf-8"), "existing salary data\n")++ def test_finite_custom_and_zero_baselines_are_preserved(self):+ for baseline in ("150", "0"):+ with self.subTest(baseline=baseline):+ result = self.convert(baseline)+ self.assertEqual(result.returncode, 0, result.stderr)+ data = json.loads(self.output.read_text(encoding="utf-8"))+ self.assertEqual(data["metadata"]["index_baseline"], float(baseline))diff --git a/tools/convert_salary_excel.py b/tools/convert_salary_excel.pyindex 11362267..f844552e 100644--- a/tools/convert_salary_excel.py+++ b/tools/convert_salary_excel.py@@ -398,6 +398,9 @@ def main():)args = parser.parse_args()+ if not math.isfinite(args.baseline):+ parser.error("--baseline must be a finite number")+excel_path = Path(args.excel_file)if not excel_path.exists():print(f"Error: File not found: {excel_path}", file=sys.stderr)