Skip to content

fix(stack-service): normalize commit stats shape#12370

Merged
PavelLaptev merged 1 commit intomasterfrom
fix/normalize-commit-stats-shape
Feb 16, 2026
Merged

fix(stack-service): normalize commit stats shape#12370
PavelLaptev merged 1 commit intomasterfrom
fix/normalize-commit-stats-shape

Conversation

@PavelLaptev
Copy link
Contributor

@PavelLaptev PavelLaptev commented Feb 16, 2026

Screenshot 2026-02-16 at 15 24 47

The statistics for commits were not visible because the backend keys were in snake_case format, while the UI expected camelCase.

Copilot AI review requested due to automatic review settings February 16, 2026 14:39
@vercel
Copy link

vercel bot commented Feb 16, 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 Preview Feb 16, 2026 3:20pm

Request Review

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 addresses an issue where backend commit stats are returned with inconsistent naming conventions (snake_case vs camelCase). The fix normalizes the stats object shape in the frontend's transformResponse function to ensure all downstream code can consistently access stats using camelCase properties.

Changes:

  • Added runtime detection and normalization of commit stats field names from snake_case to camelCase in the commitDetails endpoint's transform response handler

Copilot AI review requested due to automatic review settings February 16, 2026 14:44
@PavelLaptev PavelLaptev force-pushed the fix/normalize-commit-stats-shape branch from ac3df95 to 9f857f3 Compare February 16, 2026 14:46
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 1 out of 1 changed files in this pull request and generated no new comments.

@PavelLaptev PavelLaptev force-pushed the fix/normalize-commit-stats-shape branch from 9f857f3 to 56acbae Compare February 16, 2026 14:50
@github-actions github-actions bot added the rust Pull requests that update Rust code label Feb 16, 2026
],
transformResponse(rsp: CommitDetails) {
const changes = changesAdapter.addMany(changesAdapter.getInitialState(), rsp.changes);
const stats = rsp.stats as TreeStats;
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it required to say as TreeStats here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

nope

Copy link
Contributor Author

Choose a reason for hiding this comment

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

should I remove it?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes please

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed. Thanks :-)

@PavelLaptev PavelLaptev force-pushed the fix/normalize-commit-stats-shape branch from 56acbae to 59b69a3 Compare February 16, 2026 15:12
Copilot AI review requested due to automatic review settings February 16, 2026 15:12
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 2 out of 2 changed files in this pull request and generated no new comments.

Convert various backend commit stats shapes into a single frontend
format expected by the UI. Some responses use camelCase keys
(linesAdded/linesRemoved/filesChanged) while others use snake_case
(lines_added/lines_removed/files_changed). The code now detects the
shape and maps snake_case to the canonical camelCase shape before
storing in the response transform.

This prevents mismatched stat access and makes downstream code rely on
one consistent stats object.
@PavelLaptev PavelLaptev force-pushed the fix/normalize-commit-stats-shape branch from 59b69a3 to 439c1db Compare February 16, 2026 15:19
@PavelLaptev PavelLaptev enabled auto-merge (squash) February 16, 2026 15:28
@PavelLaptev PavelLaptev merged commit 1d7393b into master Feb 16, 2026
28 checks passed
@PavelLaptev PavelLaptev deleted the fix/normalize-commit-stats-shape branch February 16, 2026 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

@gitbutler/desktop rust Pull requests that update Rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants