Skip to content

feat: support empty directory markers#11

Merged
andinux merged 2 commits into
mainfrom
feat/empty-directory-markers
Jun 6, 2026
Merged

feat: support empty directory markers#11
andinux merged 2 commits into
mainfrom
feat/empty-directory-markers

Conversation

@andinux
Copy link
Copy Markdown
Contributor

@andinux andinux commented Jun 5, 2026

Summary

  • Add explicit empty directory markers with SELECT memory_add_content('dirname/', ''); for virtual filesystem workflows.
  • Require preserve_duplicate_paths=1 before marker creation so empty marker identity stays path-scoped.
  • Store marker rows in dbmem_content with a trailing slash path and no vault/FTS rows, so search ignores them.
  • Update listing, deletion, rename, materialization, directory cleanup, and reindex paths to handle markers consistently.
  • Document the feature in README and API docs and add focused unit coverage.

Planned Choices

  • Directory marker syntax is a trailing-slash path plus empty content: memory_add_content('dirname/', '').
  • Marker creation returns a clear error unless preserve_duplicate_paths=1 is enabled.
  • Non-empty content for a trailing-slash marker path is rejected.
  • Marker rows are stored internally with one canonical trailing slash, for example dirname/.
  • memory_list_files() renders marker rows as directory nodes and returns directory JSON paths without the trailing slash, for example "path":"dirname".
  • A marker can coexist with files below it, for example dirname/ and dirname/file.md; the marker is retained so the empty directory can survive after children are removed.
  • A file path and directory marker path with the same name conflict, so dirname and dirname/ cannot both exist as rows.
  • Creating the same directory marker repeatedly is idempotent.
  • Marker rows are metadata-only for search: no embeddings and no FTS rows are generated.
  • memory_delete_file('dirname') and memory_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.
  • Marker rows force their empty value to be stored even when 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'

andinux added 2 commits June 5, 2026 17:34
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'
@andinux andinux merged commit 59ee9ed into main Jun 6, 2026
40 checks passed
@andinux andinux deleted the feat/empty-directory-markers branch June 6, 2026 00:05
andinux added a commit that referenced this pull request Jun 6, 2026
- feat: lazily initialize engines from saved settings (#10)
- fix: keep preserved duplicate paths idempotent
- feat: support empty directory markers (#11)
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.

1 participant