Add command completion call-budget regression tests #745

Closed
opened 2026-05-13 18:38:34 +00:00 by barrettruth · 0 comments
Owner

Parent tracker: #744

Scope

Add regression coverage for the command-line completion lag identified in #744.

This issue is test-only unless the tests require a tiny test helper refactor. It should not change completion behavior yet.

Problem

The current completion specs assert candidate lists, but they do not protect the performance-critical call budget. :Forge pr <Tab> can return only static-looking candidates while still synchronously invoking backend PR lookup commands.

We need tests that fail for that class of regression before changing completion behavior in follow-up issues.

Required coverage

Add completion call-budget coverage for repeated vim.fn.getcompletion() calls, preferring external-call assertions over wall-clock timing.

Cover at least:

  • Forge pr
  • Forge pr m
  • Forge pr re
  • Forge pr merge method=
  • release completion cold and warm cache behavior
  • repeated local git-backed completion for ref/target values

The key expectation for this first issue is to capture the current problematic budget clearly enough that follow-up fixes can tighten it.

Backend expectations

The tests should distinguish:

  • local git/file commands
  • backend/forge CLI commands (gh, glab, tea, shell pipelines that call them)
  • state/cache reads
  • resolver calls such as current_pr() / branch_pr()

The test model should make it possible for follow-up PRs to assert that GitHub, GitLab, and Forgejo command completion do not synchronously call backend list/detail commands.

Non-goals

  • Do not change completion behavior in this issue.
  • Do not make Ex-mode require a picker backend.
  • Do not add numeric PR/issue/CI subject completion.
  • Do not solve #744 in the same PR.

Verification

Run focused tests first:

nix develop .#ci --command just test spec/command_spec.lua spec/completion_policy_spec.lua spec/state_spec.lua

Before PR, run the full gate if practical:

nix develop .#ci --command just ci
Parent tracker: #744 ## Scope Add regression coverage for the command-line completion lag identified in #744. This issue is test-only unless the tests require a tiny test helper refactor. It should not change completion behavior yet. ## Problem The current completion specs assert candidate lists, but they do not protect the performance-critical call budget. `:Forge pr <Tab>` can return only static-looking candidates while still synchronously invoking backend PR lookup commands. We need tests that fail for that class of regression before changing completion behavior in follow-up issues. ## Required coverage Add completion call-budget coverage for repeated `vim.fn.getcompletion()` calls, preferring external-call assertions over wall-clock timing. Cover at least: - `Forge pr ` - `Forge pr m` - `Forge pr re` - `Forge pr merge method=` - release completion cold and warm cache behavior - repeated local git-backed completion for ref/target values The key expectation for this first issue is to capture the current problematic budget clearly enough that follow-up fixes can tighten it. ## Backend expectations The tests should distinguish: - local git/file commands - backend/forge CLI commands (`gh`, `glab`, `tea`, shell pipelines that call them) - state/cache reads - resolver calls such as `current_pr()` / `branch_pr()` The test model should make it possible for follow-up PRs to assert that GitHub, GitLab, and Forgejo command completion do not synchronously call backend list/detail commands. ## Non-goals - Do not change completion behavior in this issue. - Do not make Ex-mode require a picker backend. - Do not add numeric PR/issue/CI subject completion. - Do not solve #744 in the same PR. ## Verification Run focused tests first: ```sh nix develop .#ci --command just test spec/command_spec.lua spec/completion_policy_spec.lua spec/state_spec.lua ``` Before PR, run the full gate if practical: ```sh nix develop .#ci --command just ci ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
barrettruth/forge.nvim#745
No description provided.