Skip to content
This repository was archived by the owner on Oct 19, 2026. It is now read-only.

Commit eca9971

Browse files
feat: implement secure reviewer assignment (#1749)
Signed-off-by: allure <1550220889@qq.com>
1 parent f8c2a23 commit eca9971

1 file changed

Lines changed: 7 additions & 10 deletions

File tree

‎ceres/src/pack/monorepo.rs‎

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -723,19 +723,10 @@ impl MonoRepo {
723723
Ok(())
724724
}
725725

726-
/// Check if a file path is a Cedar policy file
727-
fn is_policy_file(path: &str) -> bool {
728-
path.ends_with(".cedar/policies.cedar") || path.ends_with(".cedar\\policies.cedar")
729-
}
730-
731726
/// Resync reviewers when policy files are modified in an existing CL.
732727
async fn resync_current_cl_reviewers_if_policy_changed(&self) -> Result<(), MegaError> {
733728
let changed_files = self.get_changed_files().await?;
734729

735-
if !changed_files.iter().any(|f| Self::is_policy_file(f)) {
736-
return Ok(());
737-
}
738-
739730
let link_guard = self.cl_link.read().await;
740731
let cl_link = link_guard
741732
.as_ref()
@@ -825,6 +816,12 @@ impl MonoRepo {
825816
let mut policy_contents: Vec<(PathBuf, String)> = Vec::new();
826817
let mut seen_policies: HashSet<String> = HashSet::new();
827818

819+
let policy_commit = if self.from_hash == ZERO_ID {
820+
&self.to_hash
821+
} else {
822+
&self.from_hash
823+
};
824+
828825
for dir in sorted_dirs {
829826
let policy_relative_path = if dir.as_os_str().is_empty() {
830827
".cedar/policies.cedar".to_string()
@@ -843,7 +840,7 @@ impl MonoRepo {
843840
let full_policy_path = PathBuf::from(&full_policy_path_str);
844841

845842
if let Ok(Some(content)) = mono_api_service
846-
.get_blob_as_string(lookup_path, Some(&self.to_hash))
843+
.get_blob_as_string(lookup_path, Some(policy_commit))
847844
.await
848845
{
849846
seen_policies.insert(policy_relative_path);

0 commit comments

Comments
 (0)