feat: support empty directory markers#11
Merged
Conversation
Add explicit empty directory markers via memory_add_content('dirname/', '') for path-preserving virtual filesystem workflows. Directory marker creation now requires preserve_duplicate_paths=1, stores marker paths with a trailing slash, rejects file/directory conflicts, and keeps markers out of search indexes.
Update listing, delete, rename, materialize, directory sync cleanup, and reindex paths to handle markers consistently. Document the new behavior and add focused unit coverage for marker creation, conflicts, listing, deletion, materialization, and reindex survival.
Verification: make test TEST_DEFINES='-DSQLITE_CORE -DTEST_SQLITE_EXTENSION'
Add a focused regression test confirming memory_reindex preserves empty non-marker files created with preserve_duplicate_paths=1. This documents the intentional broader behavior alongside directory marker preservation. Verification: make test TEST_DEFINES='-DSQLITE_CORE -DTEST_SQLITE_EXTENSION'
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
SELECT memory_add_content('dirname/', '');for virtual filesystem workflows.preserve_duplicate_paths=1before marker creation so empty marker identity stays path-scoped.dbmem_contentwith a trailing slash path and no vault/FTS rows, so search ignores them.Planned Choices
memory_add_content('dirname/', '').preserve_duplicate_paths=1is enabled.dirname/.memory_list_files()renders marker rows as directory nodes and returns directory JSON paths without the trailing slash, for example"path":"dirname".dirname/anddirname/file.md; the marker is retained so the empty directory can survive after children are removed.dirnameanddirname/cannot both exist as rows.memory_delete_file('dirname')andmemory_delete_file('dirname/')delete only the explicit marker row; child files are not deleted recursively.memory_rename_file()supports marker-to-marker renames only when the new path also has a trailing slash, and it does not rename child paths.memory_materialize_files()creates directories for marker rows instead of writing empty files.memory_reindex()and model-change reindex preserve marker rows without indexing them.memory_add_directory()cleanup skips marker rows instead of treating them as missing files.save_content=0, because the value is marker metadata needed for materialization and sync behavior.Verification
make test TEST_DEFINES='-DSQLITE_CORE -DTEST_SQLITE_EXTENSION'