Skip to content

Report failed extension discovery in the Packages tab and allow retry - #295

Open
SatyamKumarCS wants to merge 1 commit into
jupyterlab:mainfrom
SatyamKumarCS:fix/packages-discovery-retry
Open

SatyamKumarCS wants to merge 1 commit into
jupyterlab:mainfrom
SatyamKumarCS:fix/packages-discovery-retry

Conversation

@SatyamKumarCS

Copy link
Copy Markdown

References

Fixes #294

Code changes

When the package.json of a federated extension could not be fetched, the Packages tab silently showed that extension with almost no information, and it never retried until the whole page was reloaded. This PR makes the failure visible and recoverable.

src/known-modules.ts

  • discoverFederatedKnownModules now resolves with the names of the extensions whose metadata could not be loaded (an empty list when everything worked). Previously a failed fetch returned null and nothing reported it.
  • The "discovery complete" flag is only set when nothing failed. Extensions that failed are retried on the next call, even without force; force still refreshes everything.
  • The extension package.json files are now fetched with bounded concurrency (6 at a time) instead of one after another.
  • Added listFederatedDiscoveryFailures() which returns the names of the extensions that failed in the last run.

src/token-sidebar.tsx

  • Added a Refresh button to the Packages view. It uses the existing force path of discoverKnownModules, which no part of the UI called before.
  • When some extensions fail, the view shows a message such as "4 extensions could not be loaded: ... Refresh to retry."
  • A partially failed discovery is no longer remembered as done, so switching back to the Packages tab retries the failures.
  • discoverKnownModules in TokenSidebar.IOptions now returns Promise<ReadonlyArray<string>> (the failed names). The only caller is in src/index.ts, and its code did not need to change.

style/base.css: small layout rules for the message and the button.

ui-tests/tests/plugin-playground.spec.ts: new test, "packages view reports failed extension discovery and recovers on refresh". It blocks the extension package.json requests, checks that the message appears, unblocks, clicks Refresh, and checks that the extension recovers its real description.

User-facing changes

Before this change, if the package.json request failed (for example a flaky network), an entry like jupyterlab-tour went from having Docs / GitHub / package.json links and its real description to showing only an npm link and "Discovered federated extension package". The packages it shares (ajv, react-joyride) disappeared from the list too. There was no message, and the entry stayed broken even after the network recovered, until a full reload.

Before

The request for package.json is blocked, then restored without reloading:

Discovery fails silently Still broken after the network recovers
before-1-discovery-fails-silently before-2-still-broken-after-network-recovers

After

Failure is reported, Refresh is offered Recovered after clicking Refresh
after-1-failure-reported-with-refresh after-2-recovered-after-refresh

The Refresh button shows as an icon in the narrow sidebar (the text label is hidden by existing styles at that width). It has the tooltip and aria-label "Refresh packages".

How I tested it

  • Reproduced the problem in a clean environment with jupyterlab-tour and jupyterlab-js-logs installed, by blocking *extensions*package.json in the browser, then checked all three scenarios on the fixed build:
    • blocked: the message names the failed extensions;
    • unblocked, then switching to another tab and back: the entries recover without a reload;
    • blocked, reload, unblocked, click Refresh: the entries recover and the message disappears.
  • jlpm playwright test tests/plugin-playground.spec.ts -g packages passes locally on JupyterLab 4.6.4: the new test and the existing Packages-view test.
  • tsc --noEmit, ESLint and Prettier pass on the changed files.

AI usage

  • Some or all of the content of this PR was generated by AI.
  • The human author has carefully reviewed this PR and run this code.
  • AI tools and models used: Claude (via Claude Code)

Backwards-incompatible changes

None for users. discoverFederatedKnownModules now returns the failed extension names instead of void, and TokenSidebar.IOptions.discoverKnownModules has the matching return type. Neither is part of the public IPluginPlayground API, and no other code in the repo used the old return value.

When the package.json of a federated extension could not be fetched, the
Packages tab silently showed incomplete metadata and never retried until a
full page reload.

- Return the names of extensions whose metadata failed to load, and only
  mark discovery as complete when none failed; retry failed ones on the
  next discovery even without `force`.
- Fetch extension metadata with bounded concurrency.
- Add a Refresh button and a "could not be loaded" message to the
  Packages view.
- Add an integration test for the failure and recovery flow.

Fixes jupyterlab#294
@github-actions

github-actions Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Preview environments for this pull request:

Preview Lab Notebook v7
Binder Binder Binder Notebook v7
JupyterLite JupyterLite JupyterLite Notebook v7

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

Packages tab silently loses extension metadata when discovery fails, and never retries until reload

1 participant