fix: add FormattedText field to OrbitGraphStatus and OrbitStatus

What

Adds FormattedText *string (with json:"formatted_text,omitempty") to OrbitGraphStatus and OrbitStatus.

Also adds GetOrbitStatusOptions (with ResponseFormat) so callers can request ?response_format=llm from GET /api/v4/orbit/status, consistent with the pattern used by GetGraphStatus.

Why

When the Orbit API is called with ?response_format=llm, the server returns a shape that is mutually exclusive from the structured response:

{"formatted_text": "...compact text for LLM consumption..."}

Without FormattedText on the structs, Go's encoding/json silently drops the key — the decoded struct stays zero-valued and callers receive {}.

This caused glab orbit remote graph-status --format llm to print {} instead of the formatted text. Discovered during E2E testing of gitlab-org/cli!3178 (merged) (glab orbit subcommands).

Changes

  • orbit.go:
    • Add FormattedText *string to OrbitGraphStatus (primary bug)
    • Add FormattedText *string to OrbitStatus (same gap, pre-emptive)
    • Add GetOrbitStatusOptions struct with ResponseFormat field
    • Update GetStatus signature: GetStatus(opt *GetOrbitStatusOptions, ...)
  • orbit_test.go:
    • Fix TestOrbitService_GetGraphStatus_LLMFormat: mock now returns the actual llm response shape ({"formatted_text":"..."}) and asserts FormattedText is populated and structured fields are nil
    • Add TestOrbitService_GetStatus_LLMFormat with the same coverage
    • Update two existing GetStatus() call sites to pass nil
  • testing/orbit_mock.go: regenerated for updated GetStatus signature

Migration note

Callers of GetStatus() that relied on the no-argument form will need to pass nil (or a *GetOrbitStatusOptions value) after this change:

// before
status, _, err := client.Orbit.GetStatus()

// after
status, _, err := client.Orbit.GetStatus(nil)
// or, to request llm format:
format := "llm"
status, _, err := client.Orbit.GetStatus(&gitlab.GetOrbitStatusOptions{ResponseFormat: &format})

The glab CLI's orbit remote status command will need a matching update in a follow-up MR once this is merged.

Edited by Dmitry Gruzd

Merge request reports

Loading