Skip to content

fix(mcpb): keep upload rename destination absent on Windows - #1314

Merged
samanhappy merged 2 commits into
samanhappy:mainfrom
remote-controlled-man:codex/mcphub-mcpb-windows-rename
Oct 15, 2026
Merged

samanhappy merged 2 commits into
samanhappy:mainfrom
remote-controlled-man:codex/mcphub-mcpb-windows-rename

Conversation

@remote-controlled-man

Copy link
Copy Markdown
Contributor

Valid admin MCPB uploads fail at installation on Windows: /api/mcpb/upload pre-creates the destination directory and then renames the extracted archive onto it. Windows rejects that directory rename with EPERM, so the existing upload test receives HTTP 500 instead of success.

Ensure the destination is absent before moving the extracted directory into place. The existing old-installation cleanup catches its own errors, so recheck and remove the validated exact destination if it remains. The server-name and path-containment validation, admin gates, extraction and response contracts stay the same. Existing overwrite behavior already removes the previous installation before the rename; this does not add transactional rollback.

Validation on Windows, Node 22.20.0 and pinned pnpm 10.12.4:

  • The existing tests/controllers/mcpbController.test.ts reproduces the base failure (one failed / three passed) and passes at the fix (four passed), including unsafe-name and admin rejection. No test was changed.
  • A fresh independent review reran that suite and eight real archive/filesystem probes: base EPERM/500, successful new/replacement installation, cleanup-error fallback, deletion/rename failures and validation/admin guards.
  • Earlier lint, docs validation, frontend typecheck, backend/frontend builds and distribution verification passed. The earlier bounded full run remains red: 224 passed / 20 failed suites and 2,120 passed / 21 failed tests; eleven failures are the separate jose load problem, and nine other failures were already present on the base.

The full suite/builds were not rerun during the independent review. POSIX compatibility follows from using an absent rename destination; no fresh Linux, live dashboard or hosted-CI run is claimed. This fixes a self-discovered portability defect in the existing MCPB feature without changing workflows or dependencies.

Valid admin MCPB uploads reach installation but fail with EPERM on Windows
because the extracted directory is renamed onto a pre-created destination.

Clear the validated exact destination if cleanup left it behind, then move
the extraction into place. Existing overwrite, admin, name and containment
checks remain unchanged. The existing real-filesystem upload regression
fails on the base and passes after this change on Windows.
Copilot AI balanced review requested due to automatic review settings October 12, 2026 05:33

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 was unable to review this pull request because the user who requested the review has reached their quota limit.

@codecov

codecov Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (main@0ee8100). Learn more about missing BASE report.

Files with missing lines Patch % Lines
src/controllers/mcpbController.ts 0.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1314   +/-   ##
=======================================
  Coverage        ?   61.05%           
=======================================
  Files           ?      235           
  Lines           ?    19608           
  Branches        ?     4948           
=======================================
  Hits            ?    11972           
  Misses          ?     6025           
  Partials        ?     1611           
Flag Coverage Δ
unittests 61.05% <0.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.

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.

🟡 Changes recommended

The Windows-specific regression lacks platform-independent automated coverage in the Ubuntu-only CI pipeline.

1 open finding

🧠 Review effort: Balanced

Comment on lines +169 to +170
if (fs.existsSync(finalExtractDir)) {
fs.rmSync(finalExtractDir, { recursive: true, force: true });
@samanhappy
samanhappy merged commit b3ec898 into samanhappy:main Oct 15, 2026
4 checks passed
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