fix: yield results from _enumerate when metaOnly is true#22
Conversation
LiveSyncManagers.log() calls addLog during initialization, but the handler was never set. Other handlers (saveData, loadData) are set in the constructor — addLog was missed during the service refactor.
|
Update: Found a second bug in the same file while testing. Problem 2: addLog handler not set in DirectFileManipulator constructor LiveSyncManagers.log() calls addLog during initialization, but the handler is never assigned. Other handlers (saveData, loadData, onDatabaseInitialisation) are set in the constructor — addLog was missed during the service refactor. Fix: Set a no-op handler alongside the other handler assignments in the constructor: Both fixes are in this PR (two commits). |
- Set addLog handler on API service (prevents 'Handler addLog is not assigned') - Set settings on setting service before init (prevents undefined settings in HashManager) - Register LiveSyncLocalDB with database service (prevents 'Local database is not ready yet') All three are caused by DirectFileManipulator bypassing the normal DatabaseService.openDatabase() flow after the service architecture refactor.
|
Update 2: Two more initialization bugs, same pattern as Problem 2. Problem 3: Settings not initialized before
|
getByMeta can throw when decryption fails (wrong passphrase). Previously this was an unhandled rejection that killed the process. Now logs a warning and skips the document.
|
sorry, this is growing as I am finding issues. Happy to break this down if needed. Update 4: One more crash found during testing with encrypted vaults. Problem 5:
|
The service refactor moved path2id through PathService which reads usePathObfuscation from settings. DirectFileManipulator's settings getter never set this field, so path obfuscation was silently disabled. The old code bypassed PathService and passed obfuscatePassphrase directly to path2id_base.
|
Update 5: Path obfuscation regression. Problem 6:
|
Resubmitted from #21 with a clean base on current main.
Problem
DirectFileManipulator._enumerate()silently returns zero results when called withmetaOnly: true.In an
async *generator function, a barereturn <value>doesn't yield anything to the caller — it just sets the generator's return value (whichfor await...ofignores). The current code returns the async iterator fromfindEntries()as a completion value instead of delegating to it.This means
enumerateAllNormalDocs({ metaOnly: true })always produces an empty sequence.Fix
yield*delegates to the inner async generator, forwarding all its values to the caller.