This document specifies the observable behavior of the SQLiteFS filesystem and its relationship to SQLite database state. It serves as the authoritative specification for testing and ensuring behavioral consistency across implementations.

CREATE TABLE files (
    filename TEXT PRIMARY KEY,
    filecontent BLOB
);

Requirement: filecontent must be BLOB type for byte-level operations.

When listing /, the filesystem shows:

Example Database State:

filename = "topfile"        → shows as file "topfile"
filename = "a/b"           → shows as directory "a" 
filename = "a/c"           → shows as directory "a" (not duplicated)
filename = "x/y/z"         → shows as directory "x"

When listing /a/, the filesystem shows:

Example Database State:

filename = "a/file1"       → shows as file "file1"
filename = "a/file2"       → shows as file "file2"  
filename = "a/sub/file3"   → shows as directory "sub"
filename = "a/sub/file4"   → shows as directory "sub" (not duplicated)

  1. Path mapping: Verify filesystem paths correctly map to database entries
  2. Directory inference: Test directory creation/destruction based on file presence
  3. Listing behavior: Verify correct display names and entry types in directory listings
  4. File operations: Test read/write/create/delete with various offsets and sizes
  5. Permission enforcement: Verify read-only mode restrictions
  6. Error handling: Test all documented error conditions
  7. Edge cases: Empty files, mixed file/directory names, special characters
  8. Binary data handling: Test files with null bytes, non-UTF-8 content, large files