Skip to content

use C_Small/R_Small#720

Draft
LK wants to merge 1 commit into
mainfrom
lenny/small
Draft

use C_Small/R_Small#720
LK wants to merge 1 commit into
mainfrom
lenny/small

Conversation

@LK
Copy link
Copy Markdown
Contributor

@LK LK commented Apr 14, 2026

Note

Low Risk
Low risk: this only changes which KiCad symbol names are emitted for generic resistors/capacitors, with minor chance of snapshot/EDA symbol mapping differences.

Overview
Updates the stdlib generic Resistor/Capacitor components and schematic import promotion logic to use KiCad Device:R_Small and Device:C_Small symbols instead of R/C.

Also includes a small test fixture string cleanup in crates/pcb/tests/simple.rs (no behavior change).

Reviewed by Cursor Bugbot for commit d037922. Bugbot is set up for automated code reviews on this repo. Configure here.

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

Bugbot Autofix prepared fixes for both issues found in the latest run.

  • ✅ Fixed: US resistor symbol not updated to small variant
    • Updated stdlib/generics/Resistor.zen so the use_us_symbol branch now selects R_Small_US instead of R_US for symbol-size consistency.
  • ✅ Fixed: Test fixtures reference stale Device:R target symbol key
    • Updated the resistor promotion fixtures in crates/pcb/src/import/generate.rs to use Device:R_Small/R_Small_0_1 so geometry lookup matches the new promoted target lib id.

Create PR

Or push these changes by commenting:

@cursor push e8ce129b05
Preview (e8ce129b05)
diff --git a/crates/pcb/src/import/generate.rs b/crates/pcb/src/import/generate.rs
--- a/crates/pcb/src/import/generate.rs
+++ b/crates/pcb/src/import/generate.rs
@@ -2861,9 +2861,9 @@
                 .to_string(),
             ),
             (
-                KiCadLibId::from("Device:R".to_string()),
-                r#"(symbol "Device:R"
-  (symbol "R_0_1"
+                KiCadLibId::from("Device:R_Small".to_string()),
+                r#"(symbol "Device:R_Small"
+  (symbol "R_Small_0_1"
     (rectangle (start -1 -2) (end 3 4))
   )
 )"#
@@ -2933,9 +2933,9 @@
                 .to_string(),
             ),
             (
-                KiCadLibId::from("Device:R".to_string()),
-                r#"(symbol "Device:R"
-  (symbol "R_0_1"
+                KiCadLibId::from("Device:R_Small".to_string()),
+                r#"(symbol "Device:R_Small"
+  (symbol "R_Small_0_1"
     (rectangle (start -1 -2) (end 3 4))
   )
 )"#
@@ -2974,9 +2974,9 @@
                 .to_string(),
             ),
             (
-                KiCadLibId::from("Device:R".to_string()),
-                r#"(symbol "Device:R"
-  (symbol "R_0_1"
+                KiCadLibId::from("Device:R_Small".to_string()),
+                r#"(symbol "Device:R_Small"
+  (symbol "R_Small_0_1"
     (rectangle (start -1 -2) (end 3 4))
   )
 )"#

diff --git a/stdlib/generics/Resistor.zen b/stdlib/generics/Resistor.zen
--- a/stdlib/generics/Resistor.zen
+++ b/stdlib/generics/Resistor.zen
@@ -43,7 +43,7 @@
 
 def _symbol(mount: Mount, package: Package, use_us_symbol: bool):
     if use_us_symbol:
-        name = "R_US"
+        name = "R_Small_US"
     else:
         name = "R_Small"

You can send follow-ups to the cloud agent here.

Reviewed by Cursor Bugbot for commit d037922. Configure here.

name = "R_US"
else:
name = "R"
name = "R_Small"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

US resistor symbol not updated to small variant

Medium Severity

The use_us_symbol branch still uses "R_US" instead of the small variant "R_Small_US" (which exists in KiCad's Device library). The non-US path was updated from "R" to "R_Small", but the US path was missed. This means users with use_us_symbol=True get a full-size symbol while everyone else gets a small one, creating an inconsistency.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit d037922. Configure here.

match self {
Self::GenericResistor => Some(KiCadLibId::from("Device:R".to_string())),
Self::GenericCapacitor => Some(KiCadLibId::from("Device:C".to_string())),
Self::GenericResistor => Some(KiCadLibId::from("Device:R_Small".to_string())),
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test fixtures reference stale Device:R target symbol key

High Severity

promoted_target_lib_id now returns Device:R_Small, but the test fixtures in generate.rs still provide Device:R as the embedded target symbol geometry. The geometry lookup for Device:R_Small won't find a match, causing it to fall back to source bounds. This changes the bbox alignment calculation, producing different coordinates than the expected assertions at lines 2875 and 2947.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit d037922. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant