Skip to content

Allow refreshing parts from the info provider they were created with - #1532

Open
killecaptron wants to merge 2 commits into
Part-DB:masterfrom
killecaptron:refresh-parts-from-provider
Open

Allow refreshing parts from the info provider they were created with#1532
killecaptron wants to merge 2 commits into
Part-DB:masterfrom
killecaptron:refresh-parts-from-provider

Conversation

@killecaptron

Copy link
Copy Markdown
Contributor

Problem

Updating a part from its info provider means going through the provider search again, even
though the part already stores which provider and which provider-specific ID it came from. For
a part that is refreshed regularly this is three steps to reach a page the part could link to
directly — and there is no way at all to refresh several parts without repeating those steps
for each one.

Change

Two steps, one per commit:

  1. If a part was created by a provider which is still installed and active, the part page shows
    a button that goes straight to the existing update route with the stored provider key and ID,
    bypassing the search. The tooltip shows when the part was last updated from the provider.
  2. The same for several parts at once, from the parts list. This reuses the existing bulk import
    infrastructure (BulkInfoProviderImportJob) rather than adding a second mechanism, so batch
    size, the part count limit and the timeout handling all apply unchanged.

The new BulkRefreshResultsBuilder sorts the selection out beforehand: parts which were not
created from a provider, and parts whose provider is no longer installed or is disabled, are
skipped and reported in the result instead of failing the whole job.

Both use no_cache, since the point of an explicit refresh is to get current data.

Notes on rate limits

Every refreshed part costs one provider request, and providers enforce limits per account
(TrustedParts, for example, allows 50 requests per 10 seconds) and often bill per request. This
PR does not add any pacing of its own — it inherits the bulk import's batch size and part count
limit, which bound the work but not the request rate. I have a follow-up which paces Part-DB's
provider requests centrally; happy to submit that first if you would rather have the guard rail
in place before this.

Permissions

No new permission: the button appears under the same conditions as the existing "update from
info provider" entry (edit on the part plus @info_providers.create_parts).

killecaptron and others added 2 commits September 7, 2026 17:20
Updating a part from an info provider so far always went through the
provider search: pick a provider, search for the part again, choose the
right result - even though the part already knows exactly which provider
and which provider ID it was created from.

Add a button which uses that reference directly and jumps straight to
the merge view of the same part at the same provider. It is only shown
if the part actually was created by a provider and that provider is
still active, and its tooltip states when the part was last updated from
the provider.

The link bypasses the info provider cache, as the whole point of
pressing it is to get the current data.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The refresh button updates a single part from the provider it was
created with, but keeping a whole shelf of parts up to date meant
pressing it once per part.

Add a "Refresh from info providers" action to the parts table, which
does the same thing for the whole selection. It reuses the existing bulk
import job for that: only the search step is replaced, as nothing has to
be searched for - every part already knows its provider and provider ID,
so its single result is exactly that provider entry, and the user lands
directly in the well-known review step, where parts can be applied one
by one or all at once.

Building the results contacts no provider at all: the data is fetched
when a part is actually applied, exactly as it is for an imported part.
Parts which can not be refreshed (not created by a provider, or their
provider is gone or disabled) are kept in the job with an error, so they
stay visible instead of silently dropping out of the selection.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@codecov

codecov Bot commented Sep 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 47.12644% with 46 lines in your changes missing coverage. Please review.
✅ Project coverage is 62.33%. Comparing base (0f0ee60) to head (fff11fe).

Files with missing lines Patch % Lines
...rc/Controller/BulkInfoProviderImportController.php 0.00% 40 Missing ⚠️
src/Services/Parts/PartsTableActionHandler.php 14.28% 6 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #1532      +/-   ##
============================================
- Coverage     62.39%   62.33%   -0.07%     
- Complexity     9879     9897      +18     
============================================
  Files           736      737       +1     
  Lines         31779    31866      +87     
============================================
+ Hits          19829    19864      +35     
- Misses        11950    12002      +52     

☔ 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