Bug
collectionSQL() in packages/editor-server/src/core/zotero/local/source.ts:594 has a stray single quote in the sub-collection branch:
const where = spec.parentKey.length > 0
? `AND collections.key = :k'` // <-- trailing '
: `AND libraries.libraryID = :k`;
The ' opens an unterminated string literal, so the query fails with a SQLite syntax error whenever spec.parentKey is non-empty, i.e. for any Zotero sub-collection read from the local database.
Impact
The error is caught in the collection reader (source.ts ~line 280: console.error(error); return collection;), so a sub-collection silently comes back with zero items. Users see the sub-collection in the citation UI with nothing in it, and nothing surfaces except a console log in the LSP output.
Top-level libraries are unaffected (they take the other branch).
Fix
Drop the quote: AND collections.key = :k. The sibling creatorsSQL() (~line 553) already has the correct form.
Testing
Worth adding a test that runs collectionSQL() for a spec with a non-empty parentKey against a fixture Zotero sqlite (or at least db.prepare()s the SQL), so a syntax error like this gets caught.
Found during the dependency-upgrade research.
Bug
collectionSQL()inpackages/editor-server/src/core/zotero/local/source.ts:594has a stray single quote in the sub-collection branch:The
'opens an unterminated string literal, so the query fails with a SQLite syntax error wheneverspec.parentKeyis non-empty, i.e. for any Zotero sub-collection read from the local database.Impact
The error is caught in the collection reader (
source.ts~line 280:console.error(error); return collection;), so a sub-collection silently comes back with zero items. Users see the sub-collection in the citation UI with nothing in it, and nothing surfaces except a console log in the LSP output.Top-level libraries are unaffected (they take the other branch).
Fix
Drop the quote:
AND collections.key = :k. The siblingcreatorsSQL()(~line 553) already has the correct form.Testing
Worth adding a test that runs
collectionSQL()for a spec with a non-emptyparentKeyagainst a fixture Zotero sqlite (or at leastdb.prepare()s the SQL), so a syntax error like this gets caught.Found during the dependency-upgrade research.