Skip to content

fix: a pull request snapshot without a file count shows none - #704

Merged
Tryanks merged 1 commit into
mainfrom
fix/optional-file-count
Oct 11, 2026
Merged

Tryanks merged 1 commit into
mainfrom
fix/optional-file-count

Conversation

@Tryanks

@Tryanks Tryanks commented Oct 11, 2026 •

Copy link
Copy Markdown
Owner

Summary

A Bitbucket or Azure DevOps summary has no changed-file count, so the snapshot carried changed_files: 0 and the PR page's Files tab read "Files 0" until a files read answered. The count is now optional end to end, as #690 made additions and deletions.

 crates/core/src/pull_request.rs     PullRequestSnapshot.changed_files: u64 -> Option<u64>, #[serde(default)]
 crates/protocol/src/lib.rs          wire note above PROTOCOL_VERSION (no bump)
 crates/services/src/github/…        Some(changedFiles)          (unchanged value)
 crates/services/src/forgejo/reads   Some(changed_files)         (unchanged value)
 crates/services/src/gitlab/reads    Some(changes_count)         (unchanged value)
 crates/services/src/bitbucket/reads 0 -> None
 crates/services/src/azure/reads     0 -> None
 crates/ui/src/pull_requests/detail  files_label(): files read's count, else the snapshot's, else plain "Files"

Readers of the snapshot's count: only the Files tab label (detail.rs). The row detail in pull_requests/mod.rs shows the line stat, not the file count; the watch fingerprint (pull_request_watch.rs) does not include it; nothing sorts by it. Once the files read answers, the tab shows the read's PullRequestFiles.changed_files, which the label already preferred; no new state.

Evidence

Tests:

  • tcode-core pull_request::tests::a_kept_snapshot_reads_its_counts (was a_kept_snapshot_reads_its_line_counts, extended): a literal snapshot kept before this change, with changed_files: 2, still reads Some(2); one without the field reads None. Before this change the type was u64, so a missing field could not read as absent at all; with Option<u64> serde already reads a missing field as None, so the serde(default) matches feat: GitLab merge requests as pull requests #690's form rather than being load-bearing.
  • tcode-ui pull_requests::detail::tests::a_snapshot_without_a_file_count_labels_the_files_tab_without_one: a linked snapshot without a count labels the tab "Files"; once the files read answers (150), it reads "Files 150". gpui's test context cannot read rendered text, so the label moved from a closure in switch into PullRequestView::files_label, which switch renders.

Checks (macOS):

  • cargo fmt --all --check: clean
  • cargo clippy --workspace --all-targets --locked -- -D warnings: Finished, no warnings
  • cargo nextest run --workspace --locked: 1156 tests run: 1156 passed, 13 skipped
  • cargo machete: no unused dependencies

Windows/Linux, mobile and Web: CI. Phone and dark theme not attached (desktop light only for this fix).

Merge Danger

Door: two-way
Blast Radius: small
The wire's changed_files may now be null. Client and host build from one tree between releases (Principle 9). A snapshot kept before this change still loads.

Closes #698

@Tryanks
Tryanks marked this pull request as ready for review October 11, 2026 07:30
@Tryanks
Tryanks enabled auto-merge (squash) October 11, 2026 07:30
@Tryanks
Tryanks merged commit fd2416c into main Oct 11, 2026
7 checks passed
@Tryanks
Tryanks deleted the fix/optional-file-count branch October 11, 2026 07:40
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.

Pull requests: the Files tab says "Files 0" before the first files read on hosts without a file count

1 participant