Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion core/codegen/src/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,9 @@ pub fn all_tools() -> Vec<ToolDef> {
//
// Provider, model, and criteria are pipeline config (baked into DAG via
// LoadPipelineConfig node), NOT CLI flags.
// TODO: base_ref should come from repo branching model config.
// The CLI default for base_ref mirrors ReviewPipelineConfig::default_branch.
// The graph builder's config is the source of truth; this CLI default is
// only a fallback for when no config override is provided.
ToolDef::new(
"gunbc-lib-review",
"review",
Expand Down
17 changes: 11 additions & 6 deletions core/ir/src/transport/tool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,13 @@ pub static RUST: ToolDef = ToolDef {
via: "brew",
inputs: InstallInputs::packages(&["rustup"]),
},
// TODO: apt has rustc package but rustup is preferred
// apt provides rustc directly; rustup is preferred for toolchain
// management but isn't universally packaged. The rustc package
// satisfies the "rustc --version" verify check.
InstallOption {
via: "apt",
inputs: InstallInputs::packages(&["rustc"]),
Comment thread
briansrls marked this conversation as resolved.
Resolved
},
],
depends_on: &[],
};
Expand Down Expand Up @@ -984,12 +990,11 @@ mod tests {
}

#[test]
fn test_rust_not_satisfiable_on_ubuntu_only_apt() {
fn test_rust_satisfiable_on_ubuntu_with_apt() {
let registry = super::default_tool_registry();
let available: HashSet<&str> = ["apt"].into_iter().collect();

// rust only has brew install option, so not satisfiable with just apt
let result = super::is_satisfiable(&super::RUST, &available, &registry);
assert!(result.is_err());

// apt provides the rustc package, satisfying the tool requirement
assert!(super::is_satisfiable(&super::RUST, &available, &registry).is_ok());
}
}
14 changes: 6 additions & 8 deletions gunbc-dag/src/makegen/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -770,16 +770,14 @@ impl ToolRegistry {

/// Check if any codegen is needed.
///
/// BUILD-TIME EXCEPTION: This function previously checked the filesystem directly.
/// Since we've closed the execute_transport escape hatch, this check would need
/// to be part of a DAG execution. For now, we always return true (assume codegen needed).
/// Returns true if the registry contains tools that require code generation.
/// This is a conservative check — it does not verify whether generated files
/// are stale, only whether the registry has anything to generate.
///
/// TODO: Properly integrate this check into a build DAG or use a separate
/// build-time mechanism.
/// For staleness checking at runtime, the CI graph uses transport-based file
/// existence checks (see `CIOp::PrepareCodegenExistsCheck`).
pub fn needs_codegen(&self) -> bool {
// STUB: Always return true until we have proper build-time file checking
// This means codegen will always run, which is safe but potentially redundant.
true
!self.tools.is_empty()
}

/// Check if any daggen is needed.
Expand Down
9 changes: 6 additions & 3 deletions lib/review/src/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,8 @@ pub fn build_diff_review_graph_with(
) -> Dag<ReviewGraphOp> {
let mut dag = Dag::new();

let default_branch = config.default_branch.clone();

// ========================================================================
// Pipeline Config (zero-input node, emits constants)
// ========================================================================
Expand All @@ -400,8 +402,8 @@ pub fn build_diff_review_graph_with(
// ========================================================================

// PrepareDiff - builds git diff request.
// base_ref default is baked into the op; the optional port allows CLI override.
// TODO: base_ref default should come from repo branching model config.
// base_ref default comes from pipeline config (GitConfig::default_branch);
// the optional port allows CLI override.
dag.add_node(Node::opaque(
"prepare_diff",
vec![
Expand All @@ -410,7 +412,7 @@ pub fn build_diff_review_graph_with(
],
vec![port("request", "TransportRequest")],
ReviewGraphOp::Git(GitOps::PrepareDiff {
base_ref: "main".to_string(),
base_ref: default_branch,
extensions: vec![],
}),
));
Expand Down Expand Up @@ -896,6 +898,7 @@ mod tests {
provider: "anthropic".to_string(),
model: "claude-sonnet-4-20250514".to_string(),
criteria: crate::graph_mock::default_criteria(),
default_branch: "develop".to_string(),
};
let dag = build_diff_review_graph_with(config);
assert_eq!(dag.nodes.len(), 10);
Expand Down
16 changes: 15 additions & 1 deletion lib/review/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,17 +187,31 @@ pub struct ReviewPipelineConfig {
pub model: String,
/// Review criteria to apply.
pub criteria: Criteria,
/// Default branch for diff operations (e.g., "main", "master", "develop").
///
/// Sourced from `GitConfig::default_branch` — the single source of truth
/// for the repo's branching model. The graph builder uses this instead of
/// hardcoding a branch name.
#[serde(default = "default_branch")]
pub default_branch: String,
}

fn default_branch() -> String {
"main".to_string()
}

impl ReviewPipelineConfig {
/// Default pipeline config for gunbc's own repo.
///
/// TODO: Eventually load from repo config (e.g., `gunbc.toml`).
/// For repo-specific config, construct a `ReviewPipelineConfig` directly
/// or deserialize from a config file (e.g., `gunbc.toml`). The
/// `default_branch` field defaults to `"main"` via `GitConfig::default()`.
pub fn gunbc_default() -> Self {
Self {
provider: "openai".to_string(),
model: "gpt-4o".to_string(),
criteria: crate::graph_mock::default_criteria(),
default_branch: "main".to_string(),
}
}
}
Expand Down
18 changes: 8 additions & 10 deletions lib/tools/buck2/src/ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,14 +188,12 @@ fn extract_version(spec: &serde_json::Value) -> String {
}
}

/// Check if a file exists.
/// Check if a workspace member is a binary crate.
///
/// TODO: This should be done via transport in the graph, not hidden here.
/// For now, stub to assume library crate (return false for main.rs check).
fn file_exists(_path: &Path) -> bool {
// STUB: This hidden I/O is problematic. In a proper implementation,
// file existence checks should be explicit transport nodes in the graph.
// For now, assume library crate (no main.rs).
/// Currently assumes all members are library crates. To detect binaries,
/// add an upstream transport node using `FileRequest::exists("src/main.rs")`
/// per member and pass the results as an input port (e.g., `binary_members: StrList`).
fn is_binary_crate(_member_path: &Path) -> bool {
false
}

Expand Down Expand Up @@ -238,10 +236,10 @@ fn execute_generate_targets(
.unwrap_or(member)
.replace(['-', '/'], "_");

// Determine if it's a binary or library (would be: Branch based on file exists)
// Determine if it's a binary or library.
// See is_binary_crate doc for how to extend with transport-based detection.
let member_path = Path::new(member);
let has_main = file_exists(&member_path.join("src/main.rs"))
|| file_exists(&Path::new(".").join(member).join("src/main.rs"));
let has_main = is_binary_crate(member_path);

// Generate target (would be: Format with template)
if has_main {
Expand Down