Distinguish main matches from related suggestions and ship 0.1.9
This commit is contained in:
1 parent
a8ba594d0e
commit
b0bdfc7816
40 files changed
+2463
-185
No files matched your search
@@ -88,3 +88,37 @@ 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/);
|
||||
});
|
||||
|
||||
import {baseMatchKind,partitionResults} from '../src/match-display.ts';
|
||||
import {ResultSelection} from '../src/selection-state.ts';
|
||||
test('related candidates remain retained but excluded from collapsed keyboard selection', () => {
|
||||
const weak={path:'mountain',match_kind:'semantic_image_related'}, strong={path:'supplier',match_kind:'semantic'}, exact={path:'name',match_kind:'exact_filename'};
|
||||
const found=[weak,strong,exact];
|
||||
assert.deepEqual(partitionResults(found),{primary:[strong,exact],related:[weak],visible:[strong,exact]});
|
||||
assert.deepEqual(partitionResults(found,true).visible,[strong,exact,weak]);
|
||||
assert.deepEqual(found,[weak,strong,exact]);
|
||||
});
|
||||
test('only related has no implicit Enter target; empty stays distinct', () => {
|
||||
const weak={path:'weak',match_kind:'semantic_related'};
|
||||
const selection=new ResultSelection(); selection.begin('missing');
|
||||
assert.equal(selection.resolve(partitionResults([weak]).visible.map(r=>r.path)),-1);
|
||||
assert.equal(selection.resolve(partitionResults([weak],true).visible.map(r=>r.path)),0);
|
||||
assert.deepEqual(partitionResults([]),{primary:[],related:[],visible:[]});
|
||||
});
|
||||
test('progressive primary results preserve user intent across related disclosure', () => {
|
||||
const a={path:'a',match_kind:'content'},b={path:'b',match_kind:'semantic_related'};
|
||||
const selection=new ResultSelection(); selection.begin('query');
|
||||
selection.resolve(partitionResults([a,b]).visible.map(r=>r.path)); selection.choose('b');
|
||||
assert.equal(selection.resolve(partitionResults([a,b],true).visible.map(r=>r.path)),1);
|
||||
assert.equal(selection.resolve(partitionResults([a,b]).visible.map(r=>r.path)),0);
|
||||
assert.equal(selection.resolve(partitionResults([a,b],true).visible.map(r=>r.path)),1);
|
||||
});
|
||||
test('related media and speech retain source routes and explain unverified similarity', () => {
|
||||
for(const kind of ['semantic','semantic_image','semantic_audio','semantic_video','semantic_speech']) {
|
||||
assert.equal(baseMatchKind(kind+'_related'),kind);
|
||||
const primary=matchExplanation({match_kind:kind,source:{kind:'timestamp_ms',number:1500}});
|
||||
const related=matchExplanation({match_kind:kind+'_related',source:{kind:'timestamp_ms',number:1500}});
|
||||
assert.equal(related.semanticPassage,primary.semanticPassage); assert.equal(related.legend,primary.legend);
|
||||
assert.ok(related.reason.includes('similarity alone does not verify')); assert.ok(related.reason.endsWith(primary.reason));
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user