v1.0.0: switch to TEXT hash primary key and harden sync/model switching#3
Merged
marcobambini merged 6 commits intomainfrom Apr 22, 2026
Merged
v1.0.0: switch to TEXT hash primary key and harden sync/model switching#3marcobambini merged 6 commits intomainfrom
marcobambini merged 6 commits intomainfrom
Conversation
dbmem_set_apikey called dbmem_remote_engine_set_apikey unconditionally, causing an undefined reference when linking builds compiled with OMIT_REMOTE_ENGINE=1 (all -local variants and the xcframework target). Wrap the call in #ifndef DBMEM_OMIT_REMOTE_ENGINE to match the pattern used elsewhere in the file.
Preserve the transactional behavior added to memory_set_model(), but release the previous engine after a successful switch even when the new model uses a different provider class. Without this, switching between custom, local, and remote providers can leave the old engine attached to the context until close or until the same provider class is selected again. For local models this can keep large model / VRAM allocations resident unnecessarily. Also add a regression test covering cross-class provider switches to ensure the previous engine is freed immediately and not double-freed on database close.
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
Release 1.0.0. Moves the memory primary key from
INTEGERto a hexTEXThash, makes model/API-key updates robust, and ships several bug fixes.Highlights
hashcolumns (indbmem_content,dbmem_vault,dbmem_cache) are now 16-char hex strings.memory_delete()takes the hex string, and search results exposehashas TEXT.memory_set_model— model switches run inside a SAVEPOINT and roll back on failure. The previous engine is freed immediately, even when switching across provider classes (custom /local / remote).
memory_set_apikey— updating the API key now takes effect on an already-running remote engine instead of waiting for the next re-init.memory_add_directory's "remove entries for deleted files" pass now runs in a single transaction. Per-file ingest transactions continue to isolatefailures, so one bad file doesn't undo previously-committed files.
embedding engine tightened error paths and fixed a free-on-close leak.
-localand xcframework builds no longer fail to link against the remote engine..load ./cloudsyncexample, hex-stringmemory_deleteexample.Test plan
make testandmake test DEFINES="-DTEST_SQLITE_EXTENSION"passtypeof(hash) = 'text'/length(hash) = 16indbmem_contentandmemory_search;memory_delete('<hex>')worksmemory_add_directoryover a mixed good/bad file set keeps committed files and leaves no partial rows for the failed filememory_set_apikeyon a live remote engine takes effect on the next embedding call