Extension control: removing the replacement from a deprecated entry does not clear it

Open Beginner friendly
#2,469 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
82/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
java
Domain
backend

Research direction

Start in ExtensionControlService#updateExtension, tracing the branches for deprecated and replacementId and how replacementChanged drives cache and search refresh. Add a failing case to ExtensionControlServiceTest where a deprecated extension has an existing replacement but the control file now supplies none, then make the service null the replacement and set replacementChanged. Done means that test passes and the refresh path runs for this case.

Written by the indexing model from the issue text.

Description

bug

Description

When an entry in extension-control/extensions.json (publish-extensions) stays deprecated but its extension (replacement) block is removed, the server keeps the previously stored replacement.

ExtensionControlJobRequestHandler#processDeprecatedExtensions computes replacementId = null when extension is absent and calls ExtensionControlService#updateExtension(id, true, null, downloadable). In updateExtension a null replacement is only acted on when !deprecated (the replacement is cleared). For a still-deprecated extension neither the !deprecated branch nor the replacementId != null branch runs, so extension.getReplacement() is unchanged. replacementChanged stays false, so the cached extension JSON and search entry are not refreshed either.

Observed

redhat.devspaces-copilot-chat-integration was deprecated in EclipseFdn/publish-extensions#1165 with a replacement pointing at itself (a typo). EclipseFdn/publish-extensions#1222 removes the extension block. Once merged, the server would still return the self-referencing replacement:

https://open-vsx.org/api/redhat/devspaces-copilot-chat-integration currently returns deprecated: true and replacement pointing to redhat/devspaces-copilot-chat-integration.

Expected

If the control file lists the extension as deprecated without a replacement, the stored replacement is set to null, and the caches and search entry are refreshed through the existing replacementChanged handling.

Suggested fix

In ExtensionControlService#updateExtension, set the replacement to null when deprecated is true and replacementId is null. ExtensionControlServiceTest has no case for a deprecated extension whose existing replacement is dropped; add one that fails without the fix.

Related: #2260 (same job, un-deprecation case). Until the fix is deployed, the stale value would need to be cleared manually in the DB, together with a cache eviction.

Dominant language
Java
Stars
2.1k
Forks
362
Avg merge
1d 3h
Merged PRs (30d)
44

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from eclipse-openvsx/openvsx

All issues in eclipse-openvsx/openvsx

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.