Refactor but-api transport return types so but_api macro performs the JSON conversion#12775
Refactor but-api transport return types so but_api macro performs the JSON conversion#12775Byron merged 3 commits intogitbutlerapp:masterfrom
but_api macro performs the JSON conversion#12775Conversation
|
@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>
There was a problem hiding this comment.
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_namestobut_workspace::RefInfoand implementTryFrom<RefInfo> for but_workspace::ui::RefInfousing that data. - Update
but-workspacesnapshot tests to include the newsymbolic_remote_namesfield 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. |
There was a problem hiding this comment.
💡 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".
Motivated by #12756
Tasks
head_infocan be corrected