feat: add Google code retrieval across desktop CLI and MCP
Core CI / core (macos-latest) (push) Canceled after 0s
Core CI / core (windows-latest) (push) Canceled after 0s
Core CI / desktop (macos-latest) (push) Canceled after 0s
Core CI / desktop (ubuntu-latest) (push) Canceled after 0s
Core CI / desktop (windows-latest) (push) Canceled after 0s
Core CI / core (ubuntu-latest) (push) Canceled after 2m23s

This commit is contained in:
karl committed 2026-10-12 21:22:11 +02:00
1 parent 8b9b079469
commit 81846b3e98
32 files changed
+1303 -59

No files matched your search

@@ -80,3 +80,8 @@ test('optional reasons use real source routes and never claim semantic word conf
assert.equal(matchExplanation({match_kind:'hybrid',source:{kind:'page',number:2}}).semanticPassage,false);
assert.doesNotMatch(JSON.stringify(text),/confidence|percent|importance/);
});
test('code passage reasons retain actual indexed source line', () => {
assert.match(matchExplanation({match_kind:'semantic', source:{kind:'line',number:97}}).reason, /at line 97/);
assert.match(matchExplanation({match_kind:'hybrid', source:{kind:'line',number:97}}).reason, /showing the passage at line 97/);
});
+30 -1
View File
@@ -1,6 +1,6 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import { LatestLane, AutomaticIndexGate, emptySearchState, semanticAvailable, SEMANTIC_SETTLE_MS } from '../src/search-state.ts';
import { LatestLane, AutomaticIndexGate, emptySearchState, semanticAvailable, SEMANTIC_SETTLE_MS, scopedFilters } from '../src/search-state.ts';
const settle = () => new Promise(resolve => setImmediate(resolve));
test('coalesces queued keystrokes and discards stale responses', async () => {
@@ -78,3 +78,32 @@ test('old committed semantic generation stays available during rebuild, activati
assert.equal(semanticAvailable({ready: true, generation: 2, embedding: false}), true);
assert.equal(SEMANTIC_SETTLE_MS, 120);
});
test('scope snapshots freeze all filters independently of later control changes', () => {
const controls = { extension: 'rs', folder: '/project' };
const all = scopedFilters('all', controls);
const code = scopedFilters('code', controls);
controls.extension = 'pdf';
assert.equal(all.code_only, false);
assert.equal(code.code_only, true);
assert.equal(code.extension, 'rs');
assert.equal(code.folder, '/project');
assert.throws(() => { code.code_only = false; }, TypeError);
assert.throws(() => scopedFilters('unknown', {}), /scope/);
});
test('same-query scope change discards old lane output and runs latest scoped request', async () => {
let revision = 1; let release; const seen = []; const accepted = [];
const lane = new LatestLane(async request => {
seen.push(request.filters.code_only);
if (request.id === 1) await new Promise(resolve => { release = resolve; });
if (request.id === revision) accepted.push(request);
}, request => request.id === revision, () => assert.fail('Unexpected failure'));
lane.submit({id: 1, query: 'parse configuration', filters: scopedFilters('all', {})});
revision = 2;
lane.submit({id: 2, query: 'parse configuration', filters: scopedFilters('code', {extension: 'rs'})});
release(); await settle();
assert.deepEqual(seen, [false, true]);
assert.equal(accepted.length, 1);
assert.equal(accepted[0].filters.code_only, true);
assert.equal(accepted[0].filters.extension, 'rs');
});