Skip to content

Commit e905f67

Browse files
authored
Merge branch 'main' into main
2 parents 49b07da + fc6a746 commit e905f67

File tree

12 files changed

+174
-94
lines changed

12 files changed

+174
-94
lines changed

ceres/src/api_service/buck_tree_builder.rs

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -762,15 +762,15 @@ mod tests {
762762

763763
// Find direct children in dir_trees (paths whose parent == "a")
764764
for (child_path, child_tree) in &dir_trees {
765-
if let Some(parent) = child_path.parent() {
766-
if parent == dir_path {
767-
let child_name = child_path.file_name().unwrap().to_str().unwrap();
768-
items.push(TreeItem {
769-
mode: TreeItemMode::Tree,
770-
id: child_tree.id,
771-
name: child_name.to_string(),
772-
});
773-
}
765+
if let Some(parent) = child_path.parent()
766+
&& parent == dir_path
767+
{
768+
let child_name = child_path.file_name().unwrap().to_str().unwrap();
769+
items.push(TreeItem {
770+
mode: TreeItemMode::Tree,
771+
id: child_tree.id,
772+
name: child_name.to_string(),
773+
});
774774
}
775775
}
776776

@@ -803,15 +803,15 @@ mod tests {
803803

804804
// Find direct children in dir_trees (paths whose parent == "")
805805
for (child_path, child_tree) in &dir_trees {
806-
if let Some(parent) = child_path.parent() {
807-
if parent.as_os_str().is_empty() {
808-
let child_name = child_path.file_name().unwrap().to_str().unwrap();
809-
items.push(TreeItem {
810-
mode: TreeItemMode::Tree,
811-
id: child_tree.id,
812-
name: child_name.to_string(),
813-
});
814-
}
806+
if let Some(parent) = child_path.parent()
807+
&& parent.as_os_str().is_empty()
808+
{
809+
let child_name = child_path.file_name().unwrap().to_str().unwrap();
810+
items.push(TreeItem {
811+
mode: TreeItemMode::Tree,
812+
id: child_tree.id,
813+
name: child_name.to_string(),
814+
});
815815
}
816816
}
817817

@@ -880,15 +880,15 @@ mod tests {
880880

881881
// Simulate the child directory linking logic
882882
for (child_path, child_tree) in &dir_trees {
883-
if let Some(parent) = child_path.parent() {
884-
if parent == current_dir.as_path() {
885-
let child_name = child_path.file_name().unwrap().to_str().unwrap();
886-
items.push(TreeItem {
887-
mode: TreeItemMode::Tree,
888-
id: child_tree.id,
889-
name: child_name.to_string(),
890-
});
891-
}
883+
if let Some(parent) = child_path.parent()
884+
&& parent == current_dir.as_path()
885+
{
886+
let child_name = child_path.file_name().unwrap().to_str().unwrap();
887+
items.push(TreeItem {
888+
mode: TreeItemMode::Tree,
889+
id: child_tree.id,
890+
name: child_name.to_string(),
891+
});
892892
}
893893
}
894894

ceres/src/api_service/mono_api_service.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2949,12 +2949,12 @@ mod test {
29492949
let commit_hash = ObjectHash::Sha1([3u8; 20]);
29502950

29512951
let item1 = TreeItem {
2952-
id: id1.clone(),
2952+
id: id1,
29532953
name: "file1.txt".into(),
29542954
mode: TreeItemMode::Blob,
29552955
};
29562956
let item2 = TreeItem {
2957-
id: id2.clone(),
2957+
id: id2,
29582958
name: "file2.txt".into(),
29592959
mode: TreeItemMode::Blob,
29602960
};
@@ -2976,7 +2976,7 @@ mod test {
29762976
};
29772977

29782978
let commit_a = Commit {
2979-
id: commit_hash.clone(),
2979+
id: commit_hash,
29802980
tree_id: ObjectHash::Sha1([8u8; 20]),
29812981
parent_commit_ids: vec![],
29822982
author: fake_sig.clone(),
@@ -3389,7 +3389,6 @@ mod test {
33893389
let diff_output: Vec<DiffItem> =
33903390
GitDiff::diff(old_blobs, new_blobs, Vec::new(), read_content)
33913391
.into_iter()
3392-
.map(DiffItem::from)
33933392
.collect();
33943393

33953394
// Verify diff output contains expected content
@@ -3437,7 +3436,6 @@ mod test {
34373436
let diff_output: Vec<DiffItem> =
34383437
GitDiff::diff(old_blobs, new_blobs, Vec::new(), read_content)
34393438
.into_iter()
3440-
.map(DiffItem::from)
34413439
.collect();
34423440

34433441
assert!(

ceres/src/merge_checker/gpg_signature_checker.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ F5MtAwnDBeT2Qg==
270270
=Q/C5
271271
-----END PGP PUBLIC KEY BLOCK-----
272272
"#;
273-
let pub_key = SignedPublicKey::from_string(&pk)
273+
let pub_key = SignedPublicKey::from_string(pk)
274274
.expect("unable to parse key")
275275
.0;
276276
let sig = StandaloneSignature::from_string(&sig)
@@ -280,6 +280,4 @@ F5MtAwnDBeT2Qg==
280280
sig.signature
281281
.verify(&pub_key, bytes)
282282
.expect("unable to verify");
283-
284-
assert!(true);
285283
}

ceres/src/pack/monorepo.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1085,7 +1085,7 @@ impl MonoRepo {
10851085

10861086
let req: OrionBuildRequest = OrionBuildRequest {
10871087
cl_link: link.clone(),
1088-
repo: path_str.to_string(),
1088+
mount_path: path_str.to_string(),
10891089
cl: cl_info.id,
10901090
builds: vec![BuildInfo {
10911091
changes: counter_changes,

common/src/config.rs

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -986,45 +986,55 @@ mod test {
986986

987987
#[test]
988988
fn test_buck_config_validate_upload_limit_zero() {
989-
let mut config = BuckConfig::default();
990-
config.upload_concurrency_limit = 0;
989+
let config = BuckConfig {
990+
upload_concurrency_limit: 0,
991+
..Default::default()
992+
};
991993
let result = config.validate();
992994
assert!(result.is_err());
993995
assert!(result.unwrap_err().contains("upload_concurrency_limit"));
994996
}
995997

996998
#[test]
997999
fn test_buck_config_validate_large_file_limit_zero() {
998-
let mut config = BuckConfig::default();
999-
config.large_file_concurrency_limit = 0;
1000+
let config = BuckConfig {
1001+
large_file_concurrency_limit: 0,
1002+
..Default::default()
1003+
};
10001004
let result = config.validate();
10011005
assert!(result.is_err());
10021006
assert!(result.unwrap_err().contains("large_file_concurrency_limit"));
10031007
}
10041008

10051009
#[test]
10061010
fn test_buck_config_validate_max_files_zero() {
1007-
let mut config = BuckConfig::default();
1008-
config.max_files = 0;
1011+
let config = BuckConfig {
1012+
max_files: 0,
1013+
..Default::default()
1014+
};
10091015
let result = config.validate();
10101016
assert!(result.is_err());
10111017
assert!(result.unwrap_err().contains("max_files"));
10121018
}
10131019

10141020
#[test]
10151021
fn test_buck_config_validate_session_timeout_zero() {
1016-
let mut config = BuckConfig::default();
1017-
config.session_timeout = 0;
1022+
let config = BuckConfig {
1023+
session_timeout: 0,
1024+
..Default::default()
1025+
};
10181026
let result = config.validate();
10191027
assert!(result.is_err());
10201028
assert!(result.unwrap_err().contains("session_timeout"));
10211029
}
10221030

10231031
#[test]
10241032
fn test_buck_config_validate_valid_values() {
1025-
let mut config = BuckConfig::default();
1026-
config.upload_concurrency_limit = 100;
1027-
config.large_file_concurrency_limit = 20;
1033+
let config = BuckConfig {
1034+
upload_concurrency_limit: 100,
1035+
large_file_concurrency_limit: 20,
1036+
..Default::default()
1037+
};
10281038
assert!(config.validate().is_ok());
10291039
}
10301040
}

orion-server/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Orion Server is a Buck2 build task scheduling service written in Rust. It provid
4646
- **Request Body:**
4747
```json
4848
{
49-
"repo": "string",
49+
"mount_path": "string", // monorepo mount path (buck project root), e.g. "/" or "/third-party/mega"
5050
"target": "string",
5151
"args": ["string", ...], // optional
5252
"cl": "string" // optional, Change List number
@@ -65,7 +65,7 @@ Orion Server is a Buck2 build task scheduling service written in Rust. It provid
6565
curl -X POST http://localhost:8004/task \
6666
-H "Content-Type: application/json" \
6767
-d '{
68-
"repo": "buck2-rust-third-party",
68+
"mount_path": "/third-party/mega",
6969
"target": "root//:rust-third-party",
7070
"args": [""],
7171
"cl": "123"
@@ -78,7 +78,7 @@ curl -X POST http://localhost:8004/task \
7878
- **Request Body:**
7979
```json
8080
{
81-
"repo": "string",
81+
"mount_path": "string", // monorepo mount path (buck project root), e.g. "/" or "/third-party/mega"
8282
"buck_hash": "string",
8383
"buckconfig_hash": "string",
8484
"args": ["string", ...], // optional

orion-server/bellatrix/src/orion_client/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ pub struct BuildInfo {
4141
#[derive(Serialize, Debug)]
4242
pub struct OrionBuildRequest {
4343
pub cl_link: String,
44-
pub repo: String,
44+
/// Monorepo mount path (Buck2 project root or subdirectory)
45+
#[serde(rename = "mount_path", alias = "repo", alias = "path")]
46+
pub mount_path: String,
4547
pub cl: i64,
4648
pub builds: Vec<BuildInfo>,
4749
}

orion-server/src/api.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,12 @@ pub enum TaskStatusEnum {
8080
/// Request structure for creating a task
8181
#[derive(Debug, Clone, Deserialize, ToSchema)]
8282
pub struct TaskRequest {
83+
#[serde(rename = "repo", alias = "mount_path", alias = "path")]
8384
pub repo: String,
8485
pub cl_link: String,
8586
pub cl: i64,
8687
pub builds: Vec<scheduler::BuildRequest>,
8788
}
88-
8989
/// Request structure for Retry a build
9090
#[derive(Debug, Clone, Deserialize, ToSchema)]
9191
pub struct RetryBuildRequest {

orion-server/src/scheduler.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ pub struct PendingTask {
5050
pub task_id: Uuid,
5151
pub cl_link: String,
5252
pub build_id: Uuid,
53+
/// Monorepo mount path (Buck2 project root or subdirectory)
5354
pub repo: String,
5455
pub target_id: Uuid,
5556
pub target_path: String,
@@ -158,6 +159,7 @@ pub struct BuildInfo {
158159
pub build_id: String,
159160
pub target_id: String,
160161
pub target_path: String,
162+
/// Monorepo mount path (Buck2 project root or subdirectory)
161163
pub repo: String,
162164
pub start_at: DateTimeUtc,
163165
pub changes: Vec<Status<ProjectRelativePath>>,

orion/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,4 @@ thiserror = { workspace = true }
2626
utoipa.workspace = true
2727
wiremock = "0.6.5"
2828
serial_test = { workspace = true }
29+
tempfile = { workspace = true }

0 commit comments

Comments
 (0)