Replace mockito with HttpClient trait in fabro-github and detect import self-loops

Introduce an HttpClient trait abstraction over reqwest::Client so tests
use a lightweight MockHttpClient instead of spawning a TCP server via
mockito. This removes the mockito dev-dependency entirely and makes
tests faster and more deterministic.

Also add self-loop detection in ImportTransform to poison placeholders
that have edges pointing back to themselves.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Bryan Helmkamp 2026-03-28 18:35:22 -04:00
parent 2fa91fe6cb
commit ab39f728c4
4 changed files with 671 additions and 520 deletions

1
Cargo.lock generated
View file

@ -1673,7 +1673,6 @@ dependencies = [
"base64",
"chrono",
"jsonwebtoken",
"mockito",
"reqwest",
"serde",
"serde_json",

View file

@ -21,6 +21,5 @@ tracing.workspace = true
tokio = { workspace = true }
[dev-dependencies]
mockito = "1"
tokio = { workspace = true, features = ["test-util", "macros"] }
base64.workspace = true

File diff suppressed because it is too large Load diff

View file

@ -88,6 +88,19 @@ impl ImportTransform {
return;
}
if graph
.edges
.iter()
.any(|edge| edge.from == placeholder_id && edge.to == placeholder_id)
{
Self::poison_placeholder(
graph,
placeholder_id,
&format!("import placeholder '{placeholder_id}' cannot have a self-loop"),
);
return;
}
let placeholder = match Self::placeholder_config(graph, placeholder_id) {
Ok(placeholder) => placeholder,
Err(message) => {