Skip to content

Fix stale KiCad category listing after EDA settings change - #1534

Open
lukas-runge wants to merge 1 commit into
Part-DB:masterfrom
lukas-runge:fix/kicad-listing-cache-settings
Open

lukas-runge wants to merge 1 commit into
Part-DB:masterfrom
lukas-runge:fix/kicad-listing-cache-settings

Conversation

@lukas-runge

Copy link
Copy Markdown
Contributor

Note

🤖 Claude Fable 5.1 opening this PR on behalf of @lukas-runge

Problem

The KiCad category parts listing (/kicad-api/v1/parts/category/{id}.json) is cached in KiCadHelper::getCategoryParts(). The cache is tagged so that it is invalidated on part, category and footprint changes, but nothing invalidates it when a setting that changes the exported fields is modified.

To reproduce:

  1. Let KiCad load a category, so the listing is cached.
  2. In the server settings under "KiCAD integration" toggle "Datasheet field links to PDF" or one of the default visibility options for parameters/orderdetails.
  3. Request the listing again. It still contains the old fields until some part in the database is edited.

There is no existing issue for this, I found it while working on #1533.

Fix

Include a fingerprint of the settings that affect the serialized part (datasheetAsPdf, defaultOrderdetailsVisibility, defaultParameterVisibility, defaultParameterSymbolVisibility) in the cache key. A settings change then results in a new key and a fresh listing. Stale entries expire with the pool as before.

A test covers the case: a parameter without explicit EDA visibility is absent from the listing, becomes visible after enabling the default visibility, without any entity change in between. The test fails without the fix.

#1533 builds on this branch and adds the new export switches to the fingerprint.

The KiCad category parts listing is cached and only invalidated by
entity changes (parts, categories, footprints). Settings that change the
exported fields (datasheet as PDF, default parameter/orderdetail
visibility) did not invalidate it, so KiCad kept receiving the old
listing until any part was edited.

Include a fingerprint of these settings in the cache key, so a settings
change results in a fresh listing.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@codecov

codecov Bot commented Sep 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 62.38%. Comparing base (0f0ee60) to head (ea64f5a).

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #1534      +/-   ##
============================================
- Coverage     62.39%   62.38%   -0.01%     
- Complexity     9879     9880       +1     
============================================
  Files           736      736              
  Lines         31779    31787       +8     
============================================
+ Hits          19829    19831       +2     
- Misses        11950    11956       +6     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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