fix: prevent false-positive horizontal orientation issues on vertical capacitors#26
fix: prevent false-positive horizontal orientation issues on vertical capacitors#26Bilal-Lodhi wants to merge 5 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the schematic placement analyzer’s capacitor-orientation solver to avoid raising a CapacitorSymbolHorizontal issue for capacitors that are clearly drawn vertically (e.g., rotated 90°), addressing false positives reported in #21.
Changes:
- Add explicit vertical capacitor symbol name allowlist (
capacitor_top,capacitor_bottom) to bypass the horizontal-orientation issue. - Add a geometry-based fallback: skip the horizontal-orientation issue when the schematic box is taller than it is wide (
height > width).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
I put together a standalone verification script to test the solver behavior directly. Here is the terminal output showing the horizontal issue triggering and the vertical one bypassing cleanly: E:\CODE\paid-bounty#21\circuit-json-schematic-placement-analysis>bun run test-scripts/verify-fix.tsx ALL CHECKS PASSED ✓ E:\CODE\paid-bounty#21\circuit-json-schematic-placement-analysis> |
|
You have to add tests here in this pr. |
|
done |
MustafaMulla29
left a comment
There was a problem hiding this comment.
That test is nowhere near the codebase patterns
Apologies I completely misunderstood it. I have deleted the custom test I ran the standard test runner via bun test and all 19 tests (including both the horizontal and vertical capacitor test cases) are passing cleanly: 19 pass |
MustafaMulla29
left a comment
There was a problem hiding this comment.
This is not the fix, please understand what is the issue and the fix does not belong here. This repo is just analysis repo.
Fixes #21. The solver was incorrectly throwing a CapacitorSymbolHorizontal error for vertical capacitors because it only checked for specific horizontal symbol string names.
I added early-return checks if the symbol matches known vertical names (capacitor_top, capacitor_bottom) or if the layout geometry clearly shows a vertical orientation (height > width).
All orientation tests pass successfully locally.