Skip to content

Commit 4b6be1c

Browse files
rsthorntonclaude
andcommitted
chore(gates): repo-wide fmt + clippy green ahead of #88 merge
Greens two failing quality gates on feature/bert-core: - cargo fmt: repo-wide format pass resolving pre-existing drift across bert-compose, bert-core, and the main bert crate (29 files). - cargo clippy: collapse if_same_then_else in launch_panel.rs SimPanel toggle glyph (both ▼ branches merged into `maximized || expanded`). bert-typedb WIP (typedb-driver 3.11.5 API migration) is intentionally parked out of this commit; it is separable (sims run without typedb). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent f535aa4 commit 4b6be1c

29 files changed

Lines changed: 1018 additions & 478 deletions

bert-compose/src/app.rs

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,9 @@ impl App {
9090
let d = &node.out_substance;
9191
if !d.name.is_empty()
9292
&& !self.declared.contains(d)
93-
&& !SUBSTANCES.iter().any(|(n, b, u)| *n == d.name && *b == d.base && *u == d.unit)
93+
&& !SUBSTANCES
94+
.iter()
95+
.any(|(n, b, u)| *n == d.name && *b == d.base && *u == d.unit)
9496
{
9597
self.declared.push(d.clone());
9698
}
@@ -149,7 +151,10 @@ impl App {
149151
self.adopt_circuit(
150152
circuit,
151153
name,
152-
format!("loaded {} — {n} components, {b} bonds · press Run", path.display()),
154+
format!(
155+
"loaded {} — {n} components, {b} bonds · press Run",
156+
path.display()
157+
),
153158
);
154159
}
155160
Err(e) => self.status = format!("load failed: {e}"),
@@ -217,7 +222,9 @@ impl App {
217222
pub fn add_node(&mut self, kind: NodeKind, canvas_center: Pos2) {
218223
let i = self.circuit.nodes.len();
219224
let jitter = vec2(((i % 5) as f32 - 2.0) * 70.0, ((i / 5) as f32 - 1.0) * 80.0);
220-
self.circuit.nodes.push(Node::new(kind, self.next_n, canvas_center + jitter));
225+
self.circuit
226+
.nodes
227+
.push(Node::new(kind, self.next_n, canvas_center + jitter));
221228
self.next_n += 1;
222229
self.selected = Some(i);
223230
}
@@ -326,15 +333,21 @@ impl App {
326333
// Capacity legibility: report the ceiling and whether it ever bit
327334
// (a regulated stock often never reaches its capacity — see the
328335
// history max vs the ceiling).
329-
if matches!(node.kind, NodeKind::Process(bert_core::ProcessPrimitive::Buffering))
330-
&& node.capacity > 0.0
336+
if matches!(
337+
node.kind,
338+
NodeKind::Process(bert_core::ProcessPrimitive::Buffering)
339+
) && node.capacity > 0.0
331340
{
332341
let max_seen = c
333342
.history
334343
.iter()
335344
.filter_map(|r| r.get(i * 3 + 2).copied())
336345
.fold(0.0f32, f32::max);
337-
let bind = if max_seen >= node.capacity - 0.01 { "binding" } else { "dormant" };
346+
let bind = if max_seen >= node.capacity - 0.01 {
347+
"binding"
348+
} else {
349+
"dormant"
350+
};
338351
detail.push_str(&format!(", capacity {:.0} ({bind})", node.capacity));
339352
}
340353
s.push_str(&format!(
@@ -379,8 +392,11 @@ impl App {
379392
pub fn save(&mut self) {
380393
let model = export::to_world_model(&self.circuit, &self.name);
381394
let home = std::env::var("HOME").unwrap_or_default();
382-
let path =
383-
Self::unique_path(&format!("{home}/Desktop"), &self.name.replace(' ', "-"), "json");
395+
let path = Self::unique_path(
396+
&format!("{home}/Desktop"),
397+
&self.name.replace(' ', "-"),
398+
"json",
399+
);
384400
match serde_json::to_string_pretty(&model)
385401
.map_err(|e| e.to_string())
386402
.and_then(|s| std::fs::write(&path, s).map_err(|e| e.to_string()))
@@ -408,9 +424,8 @@ impl eframe::App for App {
408424
// Delete / Backspace removes the selected node — unless a text field
409425
// (a name editor) has focus, where those keys edit text.
410426
if let Some(i) = self.selected {
411-
let del = ctx.input(|i| {
412-
i.key_pressed(egui::Key::Delete) || i.key_pressed(egui::Key::Backspace)
413-
});
427+
let del = ctx
428+
.input(|i| i.key_pressed(egui::Key::Delete) || i.key_pressed(egui::Key::Backspace));
414429
if del && !ctx.wants_keyboard_input() {
415430
self.delete_node(i);
416431
}

bert-compose/src/askhal.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,12 @@ pub fn ask(summary: String, model: String) -> Receiver<Result<String, String>> {
3232
.timeout(std::time::Duration::from_secs(120))
3333
.set("Authorization", &format!("Bearer {KEY}"))
3434
.send_json(body)
35-
.map_err(|e| format!("hal unreachable: {e}\n\nIs the proxy up? `launch start litellm-proxy`"))
35+
.map_err(|e| {
36+
format!("hal unreachable: {e}\n\nIs the proxy up? `launch start litellm-proxy`")
37+
})
3638
.and_then(|resp| {
37-
resp.into_json::<serde_json::Value>().map_err(|e| format!("parse: {e}"))
39+
resp.into_json::<serde_json::Value>()
40+
.map_err(|e| format!("parse: {e}"))
3841
})
3942
.map(|j| {
4043
j["choices"][0]["message"]["content"]
@@ -49,8 +52,13 @@ pub fn ask(summary: String, model: String) -> Receiver<Result<String, String>> {
4952
}
5053

5154
/// Local-first model menu (sovereign by default; cloud options last).
52-
pub const MODELS: &[&str] =
53-
&["llama3", "mistral-small", "gemma4", "claude-haiku", "claude-sonnet"];
55+
pub const MODELS: &[&str] = &[
56+
"llama3",
57+
"mistral-small",
58+
"gemma4",
59+
"claude-haiku",
60+
"claude-sonnet",
61+
];
5462

5563
pub fn is_local(model: &str) -> bool {
5664
!(model.starts_with("claude") || model.starts_with("gemini") || model.starts_with("gpt"))

0 commit comments

Comments
 (0)