Make lookup failures fallible #658

Merged
barrettruth merged 1 commit from fix/646-fallible-lookups into main 2026-05-06 23:17:37 +00:00
Owner

Summary

  • Makes repo info and PR state lookups return nil plus a human-readable failure instead of converting failed commands into READ, UNKNOWN, or default merge methods.
  • Preserves GitLab and Forgejo current-PR branch lookup stderr by splitting CLI output capture from jq filtering.
  • Keeps picker availability conservative and quiet when lookup details cannot be loaded, and avoids caching failed lookup results.

Reproduction

Before coding, I loaded the checkout with system nvim via vim.pack + lz.n, put failing fake gh, glab, and tea binaries first in PATH, and exercised repo info, PR state, and current-PR lookup paths.

Before After
Repo info failures became fallback data like permission = READ. Repo info returns no data and reports failed to fetch <Forge> repo info: authentication failed.
PR state failures became fallback data like state = UNKNOWN. PR state returns no data and reports failed to fetch <Forge> PR #42 state: authentication failed.
GitLab/Forgejo current-PR lookup could return no PR and no error. Current-PR lookup returns lookup_failed with failed to look up <PRs> for branch topic: authentication failed.

Verification

  • Packed repro with system nvim, vim.pack, lz.n, and fake failing gh/glab/tea
  • just test spec/sources_spec.lua
  • just test spec/state_spec.lua
  • just test spec/resolve_spec.lua
  • just test spec/pickers_spec.lua
  • just test
  • nix develop .#ci --command just format
  • nix develop .#ci --command just ci

Closes #646

## Summary - Makes repo info and PR state lookups return `nil` plus a human-readable failure instead of converting failed commands into `READ`, `UNKNOWN`, or default merge methods. - Preserves GitLab and Forgejo current-PR branch lookup stderr by splitting CLI output capture from `jq` filtering. - Keeps picker availability conservative and quiet when lookup details cannot be loaded, and avoids caching failed lookup results. ## Reproduction Before coding, I loaded the checkout with system nvim via `vim.pack` + `lz.n`, put failing fake `gh`, `glab`, and `tea` binaries first in PATH, and exercised repo info, PR state, and current-PR lookup paths. | Before | After | |---|---| | Repo info failures became fallback data like `permission = READ`. | Repo info returns no data and reports `failed to fetch <Forge> repo info: authentication failed`. | | PR state failures became fallback data like `state = UNKNOWN`. | PR state returns no data and reports `failed to fetch <Forge> PR #42 state: authentication failed`. | | GitLab/Forgejo current-PR lookup could return no PR and no error. | Current-PR lookup returns `lookup_failed` with `failed to look up <PRs> for branch topic: authentication failed`. | ## Verification - Packed repro with system nvim, `vim.pack`, `lz.n`, and fake failing `gh`/`glab`/`tea` - `just test spec/sources_spec.lua` - `just test spec/state_spec.lua` - `just test spec/resolve_spec.lua` - `just test spec/pickers_spec.lua` - `just test` - `nix develop .#ci --command just format` - `nix develop .#ci --command just ci` Closes #646
Make PR lookups fallible
All checks were successful
quality / Format (pull_request) Successful in 14s
quality / Test (pull_request) Successful in 16s
quality / Lint (pull_request) Successful in 17s
5c334db49d
barrettruth deleted branch fix/646-fallible-lookups 2026-05-06 23:17:37 +00:00
Sign in to join this conversation.
No description provided.