Skip to content

fix(storage): make VikingFS.mkdir() actually create the target directory#96

Merged
qin-ctx merged 2 commits intovolcengine:mainfrom
ze-mu-zhou:fix/mkdir-no-op
Feb 9, 2026
Merged

fix(storage): make VikingFS.mkdir() actually create the target directory#96
qin-ctx merged 2 commits intovolcengine:mainfrom
ze-mu-zhou:fix/mkdir-no-op

Conversation

@ze-mu-zhou
Copy link
Contributor

Description

VikingFS.mkdir() calls _ensure_parent_dirs(path) to create all parent
directories, but never calls agfs.mkdir(path) to create the target directory
itself. The method unconditionally returns without performing the actual mkdir
operation, making every mkdir() call a no-op.

This affects TreeBuilder._move_directory_in_agfs, DirectoryInitializer,
and import_ovpack. The system may appear to work only because write_file
independently calls _ensure_parent_dirs.

Related Issue

Fixes #90

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Performance improvement
  • Test update

Changes Made

  • Replace the bare return at the end of mkdir() with
    await asyncio.to_thread(self.agfs.mkdir, path) to actually create the
    target directory
  • Add 5 unit tests covering normal creation, exist_ok behavior, and
    parent-before-target call ordering
  • Update tests/README.md with test_mkdir.py entry

Testing

  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have tested this on the following platforms:
    • Linux
    • macOS
    • Windows

Checklist

  • My code follows the project's coding style
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

Screenshots (if applicable)

N/A

Additional Notes

The bug was verified by calling viking_fs.mkdir("viking://resources/test_dir")
followed by viking_fs.stat() on the same URI, which raised
AGFSClientError: no such file or directory. See issue #90 for full
reproduction steps and output.

mkdir() only called _ensure_parent_dirs() which creates parent
directories but not the final component. The method returned without
ever calling agfs.mkdir(path), making every mkdir() call a no-op.

Add the missing agfs.mkdir(path) call after parent directory creation
and exist_ok handling.

Fixes #90
@ze-mu-zhou ze-mu-zhou marked this pull request as ready for review February 8, 2026 00:31
@CLAassistant
Copy link

CLAassistant commented Feb 9, 2026

CLA assistant check
All committers have signed the CLA.

@qin-ctx qin-ctx merged commit 847f507 into volcengine:main Feb 9, 2026
2 of 3 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.

[Bug]: VikingFS.mkdir() 从不创建目标目录,方法为空操作

3 participants