Skip to content

Manifest import leaves temp.zip in cwd; zip path should be temp + always cleaned up #163

@codyfrisch

Description

@codyfrisch

Summary

mapps manifest:import builds a zip before upload. Today that zip is written as temp.zip in the current working directory, and the import task never deletes it. The task only removes the intermediate *.processed manifest file in finally.

That leaves temp.zip behind after a successful import (and can leave it behind or partially written on failure, depending on when things fail). Using a fixed name in cwd is also awkward for concurrent runs or if temp.zip already exists.

Current behavior

  • compressFilesToZip in files-service uses a literal temp.zip path (relative to cwd).
  • uploadManifestTsk in import-manifest-service calls unlink only for ctx.manifestFilePath (the .processed file), not for the zip path.

Expected behavior

  • Zip should be created under the OS temp directory with a unique name (e.g. mapps-compress-<uuid>.zip).
  • The zip file should be removed in a finally block (best-effort if the file is already gone), so cleanup happens on both success and failure after the zip was created.

Suggested fix (reference)

  • Change compressFilesToZip to write under os.tmpdir() with a unique filename.
  • In uploadManifestTsk, track zipFilePath and unlink it in finally (e.g. zip cleanup first with best-effort error handling, then existing .processed cleanup).

Tests

  • Unit tests for uploadManifestTsk that assert unlink is invoked for both the temp zip path and the .processed manifest on success and when upload throws after the zip exists.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions