a73x

20afe11b

Rebase onto main (revision-refs) and fix test flakiness found in the process

a73x   2026-08-10 06:04

Commit message
Rebase onto main (revision-refs) and fix test flakiness found in the process

Rebased feat/patch-labels onto main after 8127cbd/ab09aff/d9a7efd landed
(patches carried as OID-named revision refs instead of branches). Resolved
mechanical conflicts in src/state.rs and src/tui/mod.rs: PatchState dropped
base_commit in favor of a per-revision base, so the labels field addition
just drops in alongside it; the PatchLabel/PatchUnlabel fold arms slot in
next to the now 4-field PatchRevision destructure unchanged.

Also found and fixed a pre-existing flakiness bug in two tests added during
the review revision: tests/cache_test.rs's stale_v3_patch_cache_entry_missing_labels_is_a_miss
and tests/collab_test.rs's test_patch_list_to_writer_renders_labels both
call patch::label(), which signs through the real HOME/XDG_CONFIG_HOME
signing-key path -- unlike every other helper those two files use, which
signs with an in-memory test key and never touches those env vars. Without
ScopedTestConfig, both tests read whatever HOME another concurrently
running test had temporarily pointed at, racing intermittently under the
full suite despite passing reliably in isolation. Wrapped both in
ScopedTestConfig, matching the existing pattern elsewhere in collab_test.rs.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

tests/cache_test.rs
Old New
@@ -2,6 +2,7 @@ mod common;
2 2
3 use common::{ 3 use common::{
4 add_comment, add_review, alice, bob, close_issue, create_patch, init_repo, open_issue, 4 add_comment, add_review, alice, bob, close_issue, create_patch, init_repo, open_issue,
5 ScopedTestConfig,
5 }; 6 };
6 use git_collab::cache; 7 use git_collab::cache;
7 use git_collab::event::ReviewVerdict; 8 use git_collab::event::ReviewVerdict;
@@ -228,6 +229,13 @@ fn stale_v3_patch_cache_entry_missing_labels_is_a_miss() {
228 // the label silently dropped, rather than forcing a refold. Bumping 229 // the label silently dropped, rather than forcing a refold. Bumping
229 // CACHE_FORMAT_VERSION to 4 closes that: any v3-tagged entry is 230 // CACHE_FORMAT_VERSION to 4 closes that: any v3-tagged entry is
230 // rejected outright, regardless of which fields it happens to have. 231 // rejected outright, regardless of which fields it happens to have.
232 //
233 // `patch::label` signs its event through the real signing-key path
234 // (`HOME`/`XDG_CONFIG_HOME`), unlike the other helpers in this file
235 // which sign with an in-memory test key -- so it needs `ScopedTestConfig`
236 // to avoid racing other tests that mutate those same env vars.
237 let cfg = ScopedTestConfig::new();
238 cfg.ensure_signing_key();
231 let dir = TempDir::new().unwrap(); 239 let dir = TempDir::new().unwrap();
232 let repo = init_repo(dir.path(), &alice()); 240 let repo = init_repo(dir.path(), &alice());
233 let (ref_name, id) = create_patch(&repo, &alice(), "Cache label test"); 241 let (ref_name, id) = create_patch(&repo, &alice(), "Cache label test");
tests/collab_test.rs
Old New
@@ -1462,6 +1462,13 @@ fn test_patch_list_to_writer_renders_labels() {
1462 // but, unlike issue::list_to_writer, did not render the ` [a, b]` suffix 1462 // but, unlike issue::list_to_writer, did not render the ` [a, b]` suffix
1463 // -- the one place a patch's labels were silently dropped. Regression 1463 // -- the one place a patch's labels were silently dropped. Regression
1464 // test for that parity gap. 1464 // test for that parity gap.
1465 //
1466 // `patch::label` signs through the real signing-key path (`HOME`/
1467 // `XDG_CONFIG_HOME`), unlike the other helpers used elsewhere in this
1468 // file, so it needs `ScopedTestConfig` to avoid racing other tests that
1469 // mutate those same env vars.
1470 let cfg = ScopedTestConfig::new();
1471 cfg.ensure_signing_key();
1465 let tmp = TempDir::new().unwrap(); 1472 let tmp = TempDir::new().unwrap();
1466 let repo = init_repo(tmp.path(), &alice()); 1473 let repo = init_repo(tmp.path(), &alice());
1467 1474