Skip to content

Refactor but-api transport return types so but_api macro performs the JSON conversion#12775

Merged
Byron merged 3 commits intogitbutlerapp:masterfrom
Byron:fix
Mar 11, 2026
Merged

Refactor but-api transport return types so but_api macro performs the JSON conversion#12775
Byron merged 3 commits intogitbutlerapp:masterfrom
Byron:fix

Conversation

@Byron
Copy link
Collaborator

@Byron Byron commented Mar 11, 2026

Motivated by #12756

Tasks

  • pick low-hanging fruit
  • see if head_info can be corrected

@vercel
Copy link

vercel bot commented Mar 11, 2026

@chatgpt-codex-connector[bot] is attempting to deploy a commit to the GitButler Team on Vercel.

A member of the Team first needs to authorize it.

…he JSON conversion

Co-authored-by: Sebastian Thiel <sebastian.thiel@icloud.com>
@Byron Byron marked this pull request as ready for review March 11, 2026 08:27
Copilot AI review requested due to automatic review settings March 11, 2026 08:27
@Byron Byron enabled auto-merge March 11, 2026 08:29
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors several but-api legacy endpoints to return non-UI (“plumbing”) types and rely on the #[but_api] macro to perform the transport/UI conversion, reducing ad-hoc conversion code at call sites. It also updates but-workspace’s RefInfo pipeline to carry enough remote-name context to perform UI conversion without repository access.

Changes:

  • Switch legacy::workspace::head_info (and several other endpoints) to return core types and configure #[but_api(..., try_from = ...)] / #[but_api(UIType)] for JSON/NAPI conversion.
  • Add symbolic_remote_names to but_workspace::RefInfo and implement TryFrom<RefInfo> for but_workspace::ui::RefInfo using that data.
  • Update but-workspace snapshot tests to include the new symbolic_remote_names field and adjust UI conversion call sites accordingly.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
crates/but-workspace/tests/workspace/ui.rs Updates UI test to convert RefInfo via TryInto rather than for_ui(...).
crates/but-workspace/tests/workspace/ref_info/mod.rs Updates snapshots to include symbolic_remote_names.
crates/but-workspace/tests/workspace/ref_info/with_workspace_commit/mod.rs Updates extensive snapshots to include symbolic_remote_names (often "origin").
crates/but-workspace/tests/workspace/ref_info/with_workspace_commit/journey/integrate_with_rebase.rs Snapshot updates for new field.
crates/but-workspace/tests/workspace/ref_info/with_workspace_commit/journey/integrate_with_merges.rs Snapshot updates for new field.
crates/but-workspace/tests/workspace/ref_info/with_workspace_commit/journey/exhaustive_with_squash_merges.rs Snapshot updates for new field.
crates/but-workspace/src/ui/ref_info.rs Replaces repo-dependent UI conversion with TryFrom<crate::RefInfo> using symbolic_remote_names.
crates/but-workspace/src/ref_info.rs Plumbs graph.symbolic_remote_names into RefInfo.
crates/but-workspace/src/lib.rs Adds symbolic_remote_names plus RefInfo::pruned_to_entrypoint.
crates/but-api/src/legacy/workspace.rs Adjusts multiple endpoints to return core types and delegate JSON/UI conversion to #[but_api].
crates/but-api/src/legacy/forge.rs Moves ReviewTemplateInfo out of an internal json module and updates return type.
crates/but-api/src/legacy/absorb.rs Updates absorb bookkeeping for commit mapping + rejected counts to match new outcome shape.

Copy link
Contributor

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d1cd1f94fb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copilot AI review requested due to automatic review settings March 11, 2026 09:03
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 28 out of 28 changed files in this pull request and generated no new comments.

@Byron Byron merged commit 041f6df into gitbutlerapp:master Mar 11, 2026
37 of 38 checks passed
@Byron Byron deleted the fix branch March 11, 2026 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants