Skip to content

fix(cli): delete the temp .vsix that publish packages - #2286

Merged
netomi merged 2 commits into
eclipse-openvsx:mainfrom
trivikr:cleanup-temp-files
Oct 4, 2026
Merged

netomi merged 2 commits into
eclipse-openvsx:mainfrom
trivikr:cleanup-temp-files

Conversation

@trivikr

@trivikr trivikr commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

Refs: #2284 (comment)

ovsx publish packaged into a .vsix in the OS temp directory and never removed it, leaving one file per package and target.

doPublish now removes the file it packaged in a finally, so it is
deleted whether publishing succeeds or fails. A user-supplied .vsix is
never deleted.

The other temp files are already cleaned up:

  • verify.ts removes the downloaded .sigzip and .pem in a finally.
  • registry.ts download removes the partial file on failure.

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

🟢 Approval recommended

Cleanup is scoped to generated files, regression coverage addresses the affected paths, and no blocking issues remain.

Review effort: Balanced
Findings: None

What changed in this PR

Ensures CLI publishing removes generated temporary VSIX files while preserving user-supplied packages.

Changes:

  • Adds cleanup after successful or failed publishing.
  • Tests cleanup, target fan-out, and supplied-file preservation.
  • Documents the fix in the CLI changelog.
File Description
cli/​test/​unit/​publish.spec.ts Adds cleanup and file-preservation regression tests.
cli/​src/​publish.ts Removes generated packages in a finally block.
cli/​CHANGELOG.md Records the temporary-file cleanup fix.

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

trivikr and others added 2 commits October 4, 2026 20:23
publish packaged into a file in the OS temp directory and never removed
it, leaving one .vsix behind per package and target. It is now removed
once publishing finishes, whether it succeeded, failed, or was skipped
as a duplicate. A .vsix supplied by the user is left alone.

Signed-off-by: Trivikram Kamat <[email protected]>
Three of the new temp-file-cleanup tests broke once rebased past eclipse-openvsx#2129/
eclipse-openvsx#2287's size-limit overhaul:

- 'when it exceeds the registry size limit' relied on the old client-side
  size check, which is now advisory for a pre-1.3.0 registry (it warns and
  publishes rather than rejecting). Switched it to a namespace size-limit
  override on a 1.3.0+ registry, which does still reject before upload.
- 'given as --packagePath' and 'given as --extensionFile, even when the
  registry rejects it' called the now-async givenExtensionFile() without
  awaiting it, so they exercised a Promise instead of a file path.

Also adds a regression test for the finally-block fix: a cleanup failure
(e.g. EBUSY on a locked temp dir) must not replace the original publish
error.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@netomi
netomi force-pushed the cleanup-temp-files branch from 127f07a to 5451c1a Compare October 4, 2026 20:28
@netomi

netomi commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Thanks for this fix, @trivikr! I rebased this onto current main to resolve the conflicts with #2287's size-limit refactor, and pushed two commits:

  • 26863fb6 — your original fix, replayed onto the new publishExtensionFile/ensureWithinSizeLimit structure. No behavior change from your intent, just conflict resolution.
  • 5451c1a5 — a small follow-up:
    • Caught the finally block's fs.promises.rm so a cleanup failure (e.g. a locked/read-only temp dir) can't mask whatever error publishExtensionFile already threw — it's now logged as a warning instead.
    • Fixed three tests that broke across the rebase: one relied on the old client-side size check (now advisory for pre-1.3.0 registries, so it warns-and-publishes instead of rejecting — switched it to a namespace size-limit override on a 1.3.0+ registry, which does still reject), and two others were missing an await on givenExtensionFile(), which became async as part of feat: configurable extension size limits with namespace overrides #2287.
    • Added a regression test for the cleanup-masking fix.

Full suite (139 tests) and lint pass. Let me know if you'd like anything changed.

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

🟢 Approval recommended

Cleanup is limited to generated packages, with regression coverage for key success and failure paths and no unresolved findings.

Review effort: Balanced
Findings: None

@netomi
netomi merged commit c7b5306 into eclipse-openvsx:main Oct 4, 2026
5 checks passed
@trivikr
trivikr deleted the cleanup-temp-files branch October 19, 2026 14:11
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.

3 participants