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 *stringtoOrbitGraphStatus(primary bug) - Add
FormattedText *stringtoOrbitStatus(same gap, pre-emptive) - Add
GetOrbitStatusOptionsstruct withResponseFormatfield - Update
GetStatussignature:GetStatus(opt *GetOrbitStatusOptions, ...)
- Add
orbit_test.go:- Fix
TestOrbitService_GetGraphStatus_LLMFormat: mock now returns the actual llm response shape ({"formatted_text":"..."}) and assertsFormattedTextis populated and structured fields are nil - Add
TestOrbitService_GetStatus_LLMFormatwith the same coverage - Update two existing
GetStatus()call sites to passnil
- Fix
testing/orbit_mock.go: regenerated for updatedGetStatussignature
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.