8000 [BUG] Reusing a deleted workspace directory as a file returns 500 after writing bytes · Issue #47 · dmux/minilake · GitHub
[go: up one dir, main page]

Skip to content

[BUG] Reusing a deleted workspace directory as a file returns 500 after writing bytes #47

Closed

Description

@eddiethedean

Description

Deleting a directory leaves its own cached object metadata behind. A later import at the same path crashes after writing the file.

Reproduced on MiniLake 1.9.0, commit fe8837dcfac9df621dfabc440abc07ebb4cdbcbb, using the repository's Docker test image, a real HTTP server, and fresh disposable state. Image Python sources were verified byte-for-byte against this commit. No mocks or production data were used.

Affected Components

Steps to Reproduce

Use a disposable instance and data directory. Paths below are relative to its HTTP base URL; bodies are JSON unless explicitly described as raw bytes. IDs shown as W/J/R/Q/C/HANDLE are replaced with the IDs returned by prior calls.

  1. POST /api/2.0/workspace/mkdirs with {"path":"/old_directory"}.
  2. GET /api/2.0/workspace/get-status?path=/old_directory to cache its directory ID.
  3. POST /api/2.0/workspace/delete with {"path":"/old_directory","recursive":true}.
  4. POST /api/2.0/workspace/import with {"path":"/old_directory","content":"cHJpbnQoMSk=","format":"SOURCE","language":"PYTHON"}.
  5. GET /api/2.0/workspace/export?path=/old_directory.

Expected Behavior

The import succeeds as a newly created notebook/file with fresh consistent metadata, or fails without writing partial state.

Actual Behavior

Import returns HTTP 500; export nevertheless returns the just-written print(1) bytes. The stale directory entry lacks created_at.

Root Cause Analysis

Directory deletion removes keys below normalized + "/" but not normalized itself. Directory metadata holds only object_id. Import writes bytes and then accesses existing["created_at"], raising KeyError.

Impact

Replacing directories with files during synchronization/deployment produces errors after partially committing content. Retrying without overwrite then encounters an existing file.

Severity is assessed within MiniLake's documented local development/CI use; it does not assume a shared production Databricks deployment.

Suggested Fix

Remove the exact directory metadata key along with descendants. Handle object-type replacement explicitly and validate/build metadata before committing file contents.

Test Coverage Gaps

Workspace tests do not combine directory get-status, deletion, and same-path import. Cover both JSON notebook import and raw workspace-file import, and verify failed operations do not partially write.

Severity

Medium

Confidence

High — reproduced through the real HTTP API and traced to the source paths above.

Recommended Labels

bug

Existing Issue Matches

No reasonable duplicate found. Reviewed all open and closed issues and open pull requests in dmux/minilake, then searched component/function/symptom terms for this finding. The only open PR at review time, #29, changes the virtualenv lock entry and does not address this defect. The documented intentional limitations were checked before reporting.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0