From 217476f5f39dbf7792bf2b1550d4241a7298127a Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Wed, 4 Mar 2026 00:23:35 -0500 Subject: [PATCH] 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. --- lua/cp/scraper.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/cp/scraper.lua b/lua/cp/scraper.lua index 6c1242d..194e671 100644 --- a/lua/cp/scraper.lua +++ b/lua/cp/scraper.lua @@ -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