mirror of
https://github.com/MadsLorentzen/ai-job-search.git
synced 2026-09-17 16:46:24 +00:00
fix: NaN filter bypass in LinkedIn CLI --jobage/--page/--limit flags (#35)
* fix: silent zero output in salary converter and NaN filter bypass in LinkedIn CLI Bug #10 (convert_salary_excel.py): openpyxl ws[row_index] random access fails silently under read_only=True, leaving headers empty and producing no output. Fix: save the header row values during the existing iter_rows scan so ws[header_row] is never called. Bug #5 (.agents/skills/linkedin-search/cli/src/cli.ts): parseInt on --jobage/--page/--limit flags returns NaN on non-numeric input. NaN propagates silently — the jobage filter is dropped, page/limit are broken. Fix: validate each parsed int, exit 1 with a structured BAD_ARG error on NaN. Also adds: - tests/test_bug10_salary_converter.py: 10 scenarios, 31 assertions (all green) - tests/test_bug5_linkedin_cli.sh: 8 scenarios, 16 assertions (all green) - docs/bugfixes.md: root cause, impact, and fix explanation for both bugs, plus a note on the pre-existing detect_column_type "n" pattern issue Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix: address PR review — drop salary converter change, move test to bun - Drop tools/convert_salary_excel.py change (bug not reproducible on modern openpyxl; reviewer confirmed master works correctly) - Drop tests/test_bug10_salary_converter.py and top-level tests/ dir - Drop docs/bugfixes.md (analysis belongs in PR description, not repo) - Replace tests/test_bug5_linkedin_cli.sh with a proper bun test file at .agents/skills/linkedin-search/cli/tests/cli-flag-validation.test.ts following the jobindex-search/cli/tests/ convention (runCLI/parseJSON helpers, describe/test/expect, descriptive names) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
79b153764d
commit
e595663dc1
@@ -83,6 +83,32 @@ async function main(): Promise<number> {
|
||||
return 1
|
||||
}
|
||||
const fmt = (flags.format as string) || "json"
|
||||
|
||||
const parseIntFlag = (name: string, raw: string | boolean | string[]): number | null => {
|
||||
const val = parseInt(raw as string, 10)
|
||||
if (isNaN(val)) {
|
||||
process.stderr.write(JSON.stringify({ error: `--${name} must be a number, got "${raw}"`, code: "BAD_ARG" }) + "\n")
|
||||
return null
|
||||
}
|
||||
return val
|
||||
}
|
||||
|
||||
if (flags.jobage !== undefined) {
|
||||
const v = parseIntFlag("jobage", flags.jobage)
|
||||
if (v === null) return 1
|
||||
flags.jobage = String(v)
|
||||
}
|
||||
if (flags.page !== undefined) {
|
||||
const v = parseIntFlag("page", flags.page)
|
||||
if (v === null) return 1
|
||||
flags.page = String(v)
|
||||
}
|
||||
if (flags.limit !== undefined) {
|
||||
const v = parseIntFlag("limit", flags.limit)
|
||||
if (v === null) return 1
|
||||
flags.limit = String(v)
|
||||
}
|
||||
|
||||
const opts: SearchOpts = {
|
||||
query: typeof flags.query === "string" ? flags.query : undefined,
|
||||
location,
|
||||
|
||||
Reference in New Issue
Block a user