feat(credentials): guard login/submit/logout on credential helper

Problem: if no git credential helper is configured, login and
submit silently fail to persist credentials.

Solution: add `has_helper()` to `git_credential.lua` that checks
`git config credential.helper`. Guard the top of `login()`,
`logout()`, and `submit()` with an early-return error. Add a
healthcheck warning when no helper is configured. Add LuaCATS
annotations to all `git_credential` functions.
This commit is contained in:
Barrett Ruth 2026-03-07 19:50:04 -05:00
parent 8348b6195e
commit 5aa2c024e0
Signed by: barrett
GPG key ID: A6C96C9349D2FC81
4 changed files with 57 additions and 0 deletions

View file

@ -42,6 +42,14 @@ end
---@param opts { language?: string }?
function M.submit(opts)
if not git_credential.has_helper() then
logger.log(
'No git credential helper configured. See :help cp-credentials',
{ level = vim.log.levels.ERROR }
)
return
end
local platform = state.get_platform()
local contest_id = state.get_contest_id()
local problem_id = state.get_problem_id()