fix(scraper): coerce vim.NIL precision to nil before cache write

Problem: vim.json.decode maps JSON null to vim.NIL (userdata), but
cache.set_test_cases validates precision as number|nil, causing a
type error on every scrape where precision is absent.

Solution: guard the precision field when building the callback
table, converting vim.NIL to nil.
This commit is contained in:
Barrett Ruth 2026-03-04 00:23:35 -05:00
parent 488260f769
commit 5354119faf
Signed by: barrett
GPG key ID: A6C96C9349D2FC81

View file

@ -237,7 +237,7 @@ function M.scrape_all_tests(platform, contest_id, callback)
memory_mb = ev.memory_mb or 0,
interactive = ev.interactive or false,
multi_test = ev.multi_test or false,
precision = ev.precision,
precision = ev.precision ~= vim.NIL and ev.precision or nil,
problem_id = ev.problem_id,
})
end