Skip to content

chore: fleet remediation (KiCad 10, DRC gate, Makefile, gitignore, library re-points)#1

Open
CameronBrooks11 wants to merge 11 commits into
mainfrom
chore/mechanical-remediation
Open

chore: fleet remediation (KiCad 10, DRC gate, Makefile, gitignore, library re-points)#1
CameronBrooks11 wants to merge 11 commits into
mainfrom
chore/mechanical-remediation

Conversation

@CameronBrooks11

@CameronBrooks11 CameronBrooks11 commented Jul 12, 2026

Copy link
Copy Markdown
Member

Fleet-wide remediation. Each step is a separate commit — please merge, do not squash, so any one can be reverted independently.

Commits

  • 8348ad2 fix(hw): re-point stale library nicknames
  • 6e9258f chore: gitignore KiCad 10 local history
  • 6fb7ffc fix(hw): fail DRC on schematic/PCB footprint mismatch
  • c5b0275 fix(hw): un-swap the ERC and DRC Makefile targets
  • ab98797 chore(hw): migrate KiCad files to the KiCad 10 format

What each fixes

KiCad 10 kicad-cli sch upgrade / pcb upgrade. Verified lossless: identical netlist, footprint positions, routing. sch upgrade does not cascade into hierarchical sub-sheets, so every .kicad_sch is upgraded individually.
DRC gate KiCad's default for footprint_symbol_mismatch is warning, and KiBot's DRC preflight only fails on errors — so schematic_parity: true ran the check and could never fail it. Raised to error.
Makefile KiBot's -s skips the named preflight, so erc: … -s erc skipped ERC and ran DRC, and vice versa. Violations were reported under the wrong job name.
.gitignore KiCad 10's Local History git_repository_init()s <project>/.history — a nested git repo. Committing it adds a broken gitlink.
Library re-points Boards referenced libraries that no longer exist (kml-custom, KML-Custom, SparkFun libs that never held the part) or names the library has since changed. Nickname/name only — no geometry changed. Only references that failed to resolve were touched.

Generic parts (≤4 pins) and KiCad *-rescue libraries were deliberately excluded from the automated re-point: fingerprint matching cannot tell a 2-pin resistor from a 2-pin capacitor. Those are being done by hand.

Validator

FAIL  Slice_VCAC — 1 problem(s)
        unresolvable sym: kml-custom:SJ-3524-SMT — no such library 'kml-custom'

Via `kicad-cli sch upgrade` / `pcb upgrade` (bread-infra
scripts/upgrade_kicad10.sh). Verified lossless: identical netlist, footprint
positions and routing.

Note `sch upgrade` does not cascade into hierarchical sub-sheets, so every
.kicad_sch is upgraded individually -- upgrading only the root sheet leaves
sub-sheets on the old format, which looks migrated and is not.
KiBot's -s/--skip-pre SKIPS the named preflight, so `erc: kibot ... -s erc`
skipped ERC and ran DRC, and `drc: ... -s drc` did the reverse. Both checks
still ran, but every violation was reported under the wrong job name -- which
is exactly what made a broken DRC look like a passing one.
KiCad's stock default severity for footprint_symbol_mismatch is `warning`
(board_design_settings.cpp:189), and KiBot's DRC preflight only fails on
errors. So `schematic_parity: true` ran the check and could never fail it --
a mismatch was reported on every CI run for months, buried in ~100 warnings,
and every run went green.

Raising it to `error` makes the parity gate real.
KiCad 10 added a Local History feature. On first save it creates
<project>/.history and calls git_repository_init() on it, so the directory is
a nested git repository. KiCad writes a .gitignore inside it, but that governs
KiCad's own history repo -- this repo still sees an embedded repository and
reports it untracked. Committing it would add a broken gitlink.
These parts exist in KiCad-Master-Lib; the boards referenced libraries that no
longer exist (kml-custom, KML-Custom, and SparkFun libraries that never
contained the part) or names the library has since changed.

KiCad embeds footprint geometry in the .kicad_pcb, so the boards rendered and
fabricated correctly and the rot stayed invisible -- it only surfaces on
update-from-library, or when a generator tries to resolve a nickname.

Nickname/name only. No geometry is changed:

  SparkFun-LED:WS2812-5050-4PIN -> KMLib_IC_SMD:WS2812-5050-4PIN
  kml-custom:AP63205WU-7 -> KMLib_IC_Power:AP63205WU-7_Buck_Regulator
  kml-custom:CUI_SJ-3524-SMT -> KMLib_Connectors:CUI_SJ-3524-SMT
  kml-custom:SOIC_05WU-7_DIO -> KMLib_IC_SMD:SOIC_05WU-7_DIO
  kml-custom:Thermal Pad -> KMLib_Mounting:Thermal_Pad

Only references that failed to resolve were touched. Generic parts (<=4 pins)
and KiCad *-rescue libraries are deliberately excluded: fingerprint matching
cannot distinguish a 2-pin resistor from a 2-pin capacitor, so those are being
done by hand.
@CameronBrooks11 CameronBrooks11 changed the title chore: mechanical remediation (KiCad 10, DRC gate, Makefile, gitignore) chore: fleet remediation (KiCad 10, DRC gate, Makefile, gitignore, library re-points) Jul 12, 2026
KiCad rewrites .kicad_prl on every project open -- open sheet, zoom level,
selection filter. It is per-developer local state, not design intent, so
tracking it means the working tree goes dirty every time anyone opens the board.
- add the validate-board job: KiCad 10 format, a real (error-severity) DRC
  parity gate, every library reference resolving, un-swapped Makefile targets,
  and .history/.kicad_prl gitignored. Green means the board is done.
- run on pull_request, not just push to main. Hardware checks previously ran
  only AFTER a change had merged: they could report that main was broken, but
  never stop it from breaking. A gate that only fires post-merge is a
  notification, not a gate.
- pin bread-infra to v1.0.0 rather than @main, so a bread-infra commit cannot
  silently change what this PR is gated on.
KiCad 10 adds design-block libraries and generates a design-block-lib-table
alongside fp-lib-table and sym-lib-table. Like those, it holds absolute paths,
so it is machine-local and generated -- never committed.

Also ignores KiCad's project lock file (~<project>.kicad_pro.lck), written
whenever a project is open.

The existing .gitignore predates KiCad 10 and covered neither, so simply opening
a board left the working tree dirty.
The library re-point renamed symbols in lib_symbols from LIB:OLD to LIB:NEW,
but a symbol's sub-units carry the bare item name:

    (symbol "KMLib_IC_Power:AP63205WU-7_Buck_Regulator"
        (symbol "AP63205_0_1" ...)      <- still the old prefix

KiCad requires every sub-unit to be named "<parent item>_<unit>_<style>", so any
symbol whose ITEM name changed (not merely its library) failed to load:

    Invalid symbol unit name prefix AP63205_0_1

Rename each sub-unit to match its parent. Nickname-only re-points were never
affected -- their item name is unchanged.

Note kicad-cli reports "Failed to load schematic" and still EXITS 0, so this was
invisible to CI and to a scripted ERC sweep. Only the GUI surfaced it.
v1.1.0 adds the schematic-load check. kicad-cli prints 'Failed to load
schematic' and still exits 0, so an unloadable schematic scored as zero ERC
violations -- 34 boards were unopenable while every automated check said they
were fine. validate-board now runs in the KiCad container and actually loads
every sheet.
config.kibot.yaml had drifted into five variants across the fleet. Three differed
only in trailing comments; the two real variants are 2-layer and 4-layer.

Adopts bread-infra templates/config.kibot.2-layer.yaml, chosen from the board's
actual copper layer count (2).

Also pins bread-infra to v1.2.0, which adds a validate-board check that a board
must plot every copper layer it has.
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