chore: fleet remediation (KiCad 10, DRC gate, Makefile, gitignore, library re-points)#1
Open
CameronBrooks11 wants to merge 11 commits into
Open
chore: fleet remediation (KiCad 10, DRC gate, Makefile, gitignore, library re-points)#1CameronBrooks11 wants to merge 11 commits into
CameronBrooks11 wants to merge 11 commits into
Conversation
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.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fleet-wide remediation. Each step is a separate commit — please merge, do not squash, so any one can be reverted independently.
Commits
8348ad2fix(hw): re-point stale library nicknames6e9258fchore: gitignore KiCad 10 local history6fb7ffcfix(hw): fail DRC on schematic/PCB footprint mismatchc5b0275fix(hw): un-swap the ERC and DRC Makefile targetsab98797chore(hw): migrate KiCad files to the KiCad 10 formatWhat each fixes
kicad-cli sch upgrade/pcb upgrade. Verified lossless: identical netlist, footprint positions, routing.sch upgradedoes not cascade into hierarchical sub-sheets, so every.kicad_schis upgraded individually.footprint_symbol_mismatchiswarning, and KiBot's DRC preflight only fails on errors — soschematic_parity: trueran the check and could never fail it. Raised toerror.-sskips the named preflight, soerc: … -s ercskipped ERC and ran DRC, and vice versa. Violations were reported under the wrong job name.git_repository_init()s<project>/.history— a nested git repo. Committing it adds a broken gitlink.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
*-rescuelibraries 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