Skip to content

Robustness fix for renderer instantiation errors - #454

Merged
maximiliani merged 5 commits into
mainfrom
fix-cors-issues
Sep 29, 2026
Merged

maximiliani merged 5 commits into
mainfrom
fix-cors-issues

Conversation

@maximiliani

Copy link
Copy Markdown
Member

This is a continuation of #438. It ensures that the pid-component shows something if a renderer fails during init or hasMeaningfulInformation, i.e., It somehow isn't able to load meaningful information.

getEstimatedPriority() had the same flaw as ordered mode: it claimed a
renderer whose quickCheck() returned true without confirming it actually
resolves via hasMeaningfulInformation(). It feeds auto-detection priority
scoring, so a format-only match could be ranked without the resource being
real. Apply the same resolution gate used by default and ordered modes.
A renderer that throws inside init() after a successful probe (most notably
Handle/ORCID, which re-fetch with no catch) previously propagated up through
IndexedDBUtil.getEntity() and blanked the whole component. Wrap init()
defensively:

- Parser default mode now uses tryInit() like ordered mode; it still returns
  the best candidate so the identifier stays visible instead of blanking.
- IndexedDBUtil.getEntity() fresh path guards init() and returns the renderer
  on throw (skipping the cache) so it is not treated as unmatched and hidden.

During loading the PID candidate continues to render as plaintext and is only
replaced once data is ready, so users are never shown a blank/error.
Copilot AI balanced review requested due to automatic review settings September 29, 2026 14:51
@github-actions

Copy link
Copy Markdown

🎨 Chromatic Visual Tests

✅ No visual changes

Review

View in Chromatic

Chromatic provides automated visual testing and review for component changes.

@github-actions

Copy link
Copy Markdown

🎨 Chromatic Visual Tests

✅ No visual changes

Review

View in Chromatic

Chromatic provides automated visual testing and review for component changes.

@github-actions

Copy link
Copy Markdown

Test Results

Coverage Summary

Node Lines Statements Branches Functions
22 80.01% 79.31% 66.78% 82.70%
24 80.01% 79.31% 66.78% 82.70%
26 80.01% 79.31% 66.78% 82.70%

Coverage & Quality Reports

📊 Codecov Report
🎨 Chromatic Status


For more details, check the workflow run

@github-actions

Copy link
Copy Markdown

Test Results

Coverage Summary

Node Lines Statements Branches Functions
22 80.01% 79.31% 66.78% 82.70%
24 80.01% 79.31% 66.78% 82.70%
26 80.04% 79.34% 66.78% 82.70%

Coverage & Quality Reports

📊 Codecov Report
🎨 Chromatic Status


For more details, check the workflow run

@codecov

codecov Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.77%. Comparing base (9401bff) to head (38cd6d3).
⚠️ Report is 10 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...ackages/stencil-library/src/utils/IndexedDBUtil.ts 66.66% 2 Missing ⚠️
packages/stencil-library/src/utils/Parser.ts 94.73% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #454      +/-   ##
==========================================
+ Coverage   80.69%   80.77%   +0.08%     
==========================================
  Files          57       57              
  Lines        3787     3803      +16     
  Branches     1147     1172      +25     
==========================================
+ Hits         3056     3072      +16     
  Misses        727      727              
  Partials        4        4              
Files with missing lines Coverage Δ
packages/stencil-library/src/utils/Parser.ts 97.19% <94.73%> (+2.45%) ⬆️
...ackages/stencil-library/src/utils/IndexedDBUtil.ts 76.85% <66.66%> (-1.04%) ⬇️
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@maximiliani
maximiliani merged commit 99237c0 into main Sep 29, 2026
18 checks passed
@maximiliani
maximiliani deleted the fix-cors-issues branch September 29, 2026 14:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Rejected probes can still abort selection, and ordered initialization failures can hide the identifier.

Review effort: Balanced
Findings: 4 Medium severity

Open (4)
What changed in this PR

This PR aims to keep the PID component visible when a renderer cannot initialize, continuing the SPDX-related work in #438.

Changes:

  • Checks whether quick-matching renderers have meaningful data and guards initialization failures.
  • Avoids caching a renderer when initialization fails.
  • Updates parser tests, an SPDX integration assertion, and SPDX documentation.
File Description
README.md Removes the documented SPDX request timeout.
packages/​stencil-library/​src/​utils/​Parser.ts Changes renderer selection and guards initialization.
packages/​stencil-library/​src/​utils/​IndexedDBUtil.ts Returns failed-init renderers without caching them.
packages/​stencil-library/​src/​utils/​__tests__/​Parser.unit.ts Adds ordered-selection and probe tests.
packages/​stencil-library/​src/​rendererModules/​SPDXType/​__tests__/​SPDXType.integration.ts Updates a license ID assertion.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +41 to 47
const hasMeaningful = await obj.hasMeaningfulInformation();
if (hasMeaningful) {
return i;
}
}
if (quickResult === undefined) {
const hasMeaningful = await obj.hasMeaningfulInformation();
Parser.applySettings(obj, settings);
await obj.init();
return obj;
if (await obj.hasMeaningfulInformation()) {
await obj.init();
return obj;
if (await obj.hasMeaningfulInformation()) {
Parser.applySettings(obj, settings);
if (await this.tryInit(obj)) {
return obj;
}
continue;
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.

2 participants