Repository navigation
Description
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
- src/minilake/services/workspace.py —
_directory_object_id - src/minilake/services/workspace.py —
delete_object - src/minilake/services/workspace.py —
import_object - src/minilake/services/workspace.py —
import_file
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.
- POST
/api/2.0/workspace/mkdirswith{"path":"/old_directory"}. - GET
/api/2.0/workspace/get-status?path=/old_directoryto cache its directory ID. - POST
/api/2.0/workspace/deletewith{"path":"/old_directory","recursive":true}. - POST
/api/2.0/workspace/importwith{"path":"/old_directory","content":"cHJpbnQoMSk=","format":"SOURCE","language":"PYTHON"}. - 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