codex: fix CI failure on PR #30854

This commit is contained in:
Chris Bookholt
2026-07-06 19:11:04 -07:00
parent fd873645bf
commit 0c28ba5ce2
6 changed files with 68 additions and 30 deletions
+1 -1
View File
@@ -359,7 +359,7 @@ impl GitRunner {
command: GitCommand,
isolated: &IsolatedGitCommonDir,
) -> io::Result<std::process::Output> {
self.output_in_isolated_common_dir_with_storage(command, isolated, None)
self.output_in_isolated_common_dir_with_storage(command, isolated, /*storage*/ None)
}
pub(crate) fn output_in_isolated_scratch(
@@ -759,7 +759,8 @@ impl<'git> GuardedGitConfig<'git> {
"merge-policy scratch proof does not match the final apply",
));
}
let current_index = self.capture_merge_index_stage_snapshot(&effective_paths, None)?;
let current_index =
self.capture_merge_index_stage_snapshot(&effective_paths, /*storage*/ None)?;
if current_index != proof.prospective_index {
return Err(io::Error::new(
io::ErrorKind::PermissionDenied,
@@ -181,10 +181,17 @@ fn exit_one_completion_witness_requires_new_noncustom_unmerged_state() {
}
let custom = BTreeSet::from(["custom.txt".to_string()]);
let clean_before = BTreeMap::from([("peer.txt".to_string(), BTreeMap::from([(0, entry(1))]))]);
let clean_before = BTreeMap::from([(
"peer.txt".to_string(),
BTreeMap::from([(0, entry(/*byte*/ 1))]),
)]);
let newly_conflicted = BTreeMap::from([(
"peer.txt".to_string(),
BTreeMap::from([(1, entry(1)), (2, entry(2)), (3, entry(3))]),
BTreeMap::from([
(1, entry(/*byte*/ 1)),
(2, entry(/*byte*/ 2)),
(3, entry(/*byte*/ 3)),
]),
)]);
assert!(newly_unmerged_noncustom_path(
&clean_before,
@@ -194,11 +201,19 @@ fn exit_one_completion_witness_requires_new_noncustom_unmerged_state() {
let already_unmerged = BTreeMap::from([(
"peer.txt".to_string(),
BTreeMap::from([(1, entry(1)), (2, entry(2)), (3, entry(3))]),
BTreeMap::from([
(1, entry(/*byte*/ 1)),
(2, entry(/*byte*/ 2)),
(3, entry(/*byte*/ 3)),
]),
)]);
let changed_unmerged = BTreeMap::from([(
"peer.txt".to_string(),
BTreeMap::from([(1, entry(4)), (2, entry(5)), (3, entry(6))]),
BTreeMap::from([
(1, entry(/*byte*/ 4)),
(2, entry(/*byte*/ 5)),
(3, entry(/*byte*/ 6)),
]),
)]);
assert!(!newly_unmerged_noncustom_path(
&already_unmerged,
@@ -208,7 +223,11 @@ fn exit_one_completion_witness_requires_new_noncustom_unmerged_state() {
let custom_conflict = BTreeMap::from([(
"custom.txt".to_string(),
BTreeMap::from([(1, entry(1)), (2, entry(2)), (3, entry(3))]),
BTreeMap::from([
(1, entry(/*byte*/ 1)),
(2, entry(/*byte*/ 2)),
(3, entry(/*byte*/ 3)),
]),
)]);
assert!(!newly_unmerged_noncustom_path(
&IndexStageSnapshot::new(),
+27 -10
View File
@@ -71,7 +71,7 @@ fn frozen_apply_policy_overrides_later_repository_config_changes() {
.expect("authorize filter path");
let patch = patch.to_str().expect("UTF-8 patch path");
let (rendered, gate) = config
.run_apply_policy_gate(false, patch)
.run_apply_policy_gate(/*revert*/ false, patch)
.expect("run policy gate");
assert!(rendered.contains("apply.whitespace=warn"), "{rendered}");
assert!(
@@ -93,7 +93,7 @@ fn frozen_apply_policy_overrides_later_repository_config_changes() {
run_git(root, &["config", "core.whitespace", "trailing-space"]);
let final_apply = config
.run_direct_apply(false, patch)
.run_direct_apply(/*revert*/ false, patch)
.expect("run final apply");
assert!(
final_apply.status.success(),
@@ -170,11 +170,17 @@ fn apply_whitespace_modes_are_typed_and_case_sensitive_at_the_gate() {
.expect("authorize filter path");
assert!(
config
.final_apply_whitespace_mode(false, patch.to_str().expect("UTF-8 patch path"))
.final_apply_whitespace_mode(
/*revert*/ false,
patch.to_str().expect("UTF-8 patch path"),
)
.is_err()
);
let (_, gate) = config
.run_apply_policy_gate(false, patch.to_str().expect("UTF-8 patch path"))
.run_apply_policy_gate(
/*revert*/ false,
patch.to_str().expect("UTF-8 patch path"),
)
.expect("run invalid policy gate");
assert!(!gate.status.success());
assert!(
@@ -184,7 +190,10 @@ fn apply_whitespace_modes_are_typed_and_case_sensitive_at_the_gate() {
);
assert!(
config
.final_apply_whitespace_mode(false, patch.to_str().expect("UTF-8 patch path"))
.final_apply_whitespace_mode(
/*revert*/ false,
patch.to_str().expect("UTF-8 patch path"),
)
.is_err()
);
}
@@ -217,22 +226,30 @@ fn successful_apply_policy_gate_is_one_shot_and_bound_to_patch_orientation() {
.authorize_filter_paths(&["file.txt".to_string()])
.expect("authorize filter path");
let (_, gate) = config
.run_apply_policy_gate(false, patch)
.run_apply_policy_gate(/*revert*/ false, patch)
.expect("run successful policy gate");
assert!(gate.status.success());
assert_eq!(
config
.final_apply_whitespace_mode(false, patch)
.final_apply_whitespace_mode(/*revert*/ false, patch)
.expect("matching proof"),
ApplyWhitespaceMode::Error
);
assert!(config.final_apply_whitespace_mode(true, patch).is_err());
assert!(
config
.final_apply_whitespace_mode(false, "different.patch")
.final_apply_whitespace_mode(/*revert*/ true, patch)
.is_err()
);
assert!(
config
.final_apply_whitespace_mode(/*revert*/ false, "different.patch")
.is_err()
);
assert!(
config
.run_apply_policy_gate(/*revert*/ false, patch)
.is_err()
);
assert!(config.run_apply_policy_gate(false, patch).is_err());
}
#[test]
+12 -12
View File
@@ -572,7 +572,7 @@ fn custom_merge_driver_proof_is_consumed_before_final_spawn() {
.authorize_filter_paths(&["file.txt".to_string()])
.expect("apply filter policy");
let (_, gate) = config
.run_apply_policy_gate(false, patch)
.run_apply_policy_gate(/*revert*/ false, patch)
.expect("policy gate");
assert!(gate.status.success());
config
@@ -580,15 +580,15 @@ fn custom_merge_driver_proof_is_consumed_before_final_spawn() {
.expect("merge policy");
let scratch = config.create_three_way_scratch_storage().expect("scratch");
config
.prove_three_way_merge_policy_safety(&scratch, false, patch)
.prove_three_way_merge_policy_safety(&scratch, /*revert*/ false, patch)
.expect("proof");
let first = config
.run_three_way_apply(false, patch)
.run_three_way_apply(/*revert*/ false, patch)
.expect("first final apply");
assert!(first.status.success());
let second = config
.run_three_way_apply(false, patch)
.run_three_way_apply(/*revert*/ false, patch)
.expect_err("proof must not be reusable");
assert_eq!(second.kind(), io::ErrorKind::PermissionDenied);
}
@@ -621,7 +621,7 @@ fn custom_merge_driver_proof_is_consumed_before_failed_index_revalidation() {
.authorize_filter_paths(&["file.txt".to_string()])
.expect("apply filter policy");
let (_, gate) = config
.run_apply_policy_gate(false, patch)
.run_apply_policy_gate(/*revert*/ false, patch)
.expect("policy gate");
assert!(gate.status.success());
config
@@ -629,20 +629,20 @@ fn custom_merge_driver_proof_is_consumed_before_failed_index_revalidation() {
.expect("merge policy");
let scratch = config.create_three_way_scratch_storage().expect("scratch");
config
.prove_three_way_merge_policy_safety(&scratch, false, patch)
.prove_three_way_merge_policy_safety(&scratch, /*revert*/ false, patch)
.expect("proof");
std::fs::write(root.join("file.txt"), "index-raced\n").expect("write raced index entry");
assert_eq!(run(root, &["git", "add", "file.txt"]).0, 0);
let first = config
.run_three_way_apply(false, patch)
.run_three_way_apply(/*revert*/ false, patch)
.expect_err("changed live index must invalidate proof");
assert_eq!(first.kind(), io::ErrorKind::PermissionDenied);
assert!(first.to_string().contains("index changed"), "{first}");
let second = config
.run_three_way_apply(false, patch)
.run_three_way_apply(/*revert*/ false, patch)
.expect_err("failed revalidation must still consume proof");
assert_eq!(second.kind(), io::ErrorKind::PermissionDenied);
assert!(
@@ -674,7 +674,7 @@ fn conditional_merge_config_proof_is_consumed_before_failed_index_revalidation()
.authorize_filter_paths(&["file.txt".to_string()])
.expect("apply filter policy");
let (_, gate) = config
.run_apply_policy_gate(false, patch)
.run_apply_policy_gate(/*revert*/ false, patch)
.expect("policy gate");
assert!(gate.status.success());
config
@@ -688,19 +688,19 @@ fn conditional_merge_config_proof_is_consumed_before_failed_index_revalidation()
);
let scratch = config.create_three_way_scratch_storage().expect("scratch");
config
.prove_three_way_merge_policy_safety(&scratch, false, patch)
.prove_three_way_merge_policy_safety(&scratch, /*revert*/ false, patch)
.expect("conditional merge-config proof");
std::fs::write(root.join("file.txt"), "index-raced\n").expect("write raced index entry");
assert_eq!(run(root, &["git", "add", "file.txt"]).0, 0);
let first = config
.run_three_way_apply(false, patch)
.run_three_way_apply(/*revert*/ false, patch)
.expect_err("changed live index must invalidate proof");
assert_eq!(first.kind(), io::ErrorKind::PermissionDenied);
assert!(first.to_string().contains("index changed"), "{first}");
let second = config
.run_three_way_apply(false, patch)
.run_three_way_apply(/*revert*/ false, patch)
.expect_err("failed revalidation must still consume proof");
assert_eq!(second.kind(), io::ErrorKind::PermissionDenied);
assert!(
+2 -1
View File
@@ -213,7 +213,8 @@ pub(crate) fn execute_reverse_staging_plan(
plan: SealedReverseStagingPlan,
) -> io::Result<()> {
config.ensure_operation_identity(&plan.owner)?;
let result = execute_prepared_reverse_index_update(config, &plan.update, None)?;
let result =
execute_prepared_reverse_index_update(config, &plan.update, /*scratch*/ None)?;
reverse_staging_result(result)
}