Skip to content

forge: PrSearchItem carries no state field, so pr-search callers cannot filter by PR state #1469

Description

@amrmelsayed

Problem

The pr-search forge concept's output contract (PrSearchItem in packages/codev/src/lib/forge-contracts.ts:112) is {number, headRefName, baseRefName} — it carries no state field. Callers therefore cannot tell an open PR from a merged or closed one in the results, and their only defense is encoding state into the search query string itself.

This surfaced during the PR #1331 integration review (pr-search moving to --state all, fixing #759):

Proposal

Add state to PrSearchItem and populate it in each provider script:

  • github: gh pr list --json supports a state field directly.
  • gitlab: glab mr list --output json includes state.
  • gitea: no pr-search script exists (concept disabled in the preset) — nothing to do.

Then let callers say what they mean: spawn-worktree filters state === 'OPEN' (belt-and-braces alongside its is:open query), and the consult helpers disambiguate instead of taking prs[0] blind.

Contract-shape note: PrSearchItem is a wire contract; the filtering/ranking policy belongs in the callers, not in the scripts.

References

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/coreArea: shared core library / forge abstraction (packages/core, packages/codev/src/lib)

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions