Skip to content

Expose RejectedChange in but-sdk#12913

Open
OliverJAsh wants to merge 1 commit intomasterfrom
push-untxmwtywksz
Open

Expose RejectedChange in but-sdk#12913
OliverJAsh wants to merge 1 commit intomasterfrom
push-untxmwtywksz

Conversation

@OliverJAsh
Copy link
Contributor

@OliverJAsh OliverJAsh commented Mar 18, 2026

This type would be useful for the front-end.

I used AI to generate this and I have no idea if it's correct. If it looks wrong, would someone else be able to pick this up? 🙏

Closes GB-1168

Copilot AI review requested due to automatic review settings March 18, 2026 18:39
@vercel
Copy link

vercel bot commented Mar 18, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
gitbutler-web Ignored Ignored Mar 18, 2026 6:39pm

Request Review

@github-actions github-actions bot added the rust Pull requests that update Rust code label Mar 18, 2026
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 aims to expose commit-application rejection details (reason + path) through the Rust schema → TypeScript type pipeline so frontend code can consume a typed RejectedChange instead of a loose [string, string] tuple.

Changes:

  • Add RejectedChange (tuple) and RejectionReason (string-union) to the generated @gitbutler/but-sdk TypeScript declarations.
  • Introduce a RejectedChange transport type in but-api and update UICommitCreateResult.paths_to_rejected_changes to use it.
  • Add schemars::JsonSchema derivation support for but-core::tree::create_tree::RejectionReason behind export-schema.

Reviewed changes

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

File Description
packages/but-sdk/src/generated/index.d.ts Exposes RejectedChange / RejectionReason types and uses them in UICommitCreateResult.
crates/but-core/src/tree/mod.rs Makes RejectionReason schema-exportable when export-schema is enabled.
crates/but-api/src/commit.rs Adds RejectedChange schema type + registration and updates commit-create result to return it.

pub struct RejectedChange(
pub RejectionReason,
#[cfg_attr(feature = "export-schema", schemars(with = "String"))]
pub but_serde::BStringForFrontend,
Comment on lines +100 to +103
#[cfg(feature = "export-schema")]
but_schemars::register_sdk_type!(RejectedChange);
#[cfg(feature = "export-schema")]
but_schemars::register_sdk_type!(RejectionReason);
@krlvi
Copy link
Member

krlvi commented Mar 18, 2026

@OliverJAsh the svelte app might need to be adapted for the new type. Also it would be neat to document the fields so that it's nice to consume

@OliverJAsh
Copy link
Contributor Author

the svelte app might need to be adapted for the new type.

I was aiming to just expose the type without changing it, but I'm not sure if I achieved that…

@krlvi
Copy link
Member

krlvi commented Mar 18, 2026

right maybe nothing needs doing 🤷‍♂️

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

Labels

rust Pull requests that update Rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants