Description
In src/core/xref-db.js:90, cacheXrefData() stores results.get(query.id) ?? [] into IDB. When the xref API returns no result for a query ID, an empty array is cached.
On subsequent page loads, resolveXrefCache() finds a cache hit (the empty array) and considers the query resolved, never re-fetching from the network. This permanently suppresses xref results for terms that were temporarily missing from the API.
Steps to reproduce
- Author uses
[=some-term=] that is temporarily not in the xref database
- ReSpec fetches xref API, gets no result
- Empty array
[] is cached in IDB for that query
- Term is later added to the xref database
- ReSpec never re-fetches because IDB has a cache hit
Suggested fix
Skip caching queries with no results:
for (const query of queries) {
const result = results.get(query.id);
if (result?.length) {
tx.objectStore(STORE_NAME).add({ query, result });
}
}
Found by
Adversarial gate holdout test (blind review of PR #5169).
Description
In
src/core/xref-db.js:90,cacheXrefData()storesresults.get(query.id) ?? []into IDB. When the xref API returns no result for a query ID, an empty array is cached.On subsequent page loads,
resolveXrefCache()finds a cache hit (the empty array) and considers the query resolved, never re-fetching from the network. This permanently suppresses xref results for terms that were temporarily missing from the API.Steps to reproduce
[=some-term=]that is temporarily not in the xref database[]is cached in IDB for that querySuggested fix
Skip caching queries with no results:
Found by
Adversarial gate holdout test (blind review of PR #5169).