Store: unknown VR counts as flat; browse keeps unknown-fit VR first

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
saphidandClaude Opus 5.5 committed 2026-09-28 22:05:50 +10:00
1 parent 69f790b83a
commit ea73145fbc
2 files changed
+15 -2

No files matched your search

+12
View File
@@ -51,6 +51,18 @@ class SearchTests(SettingsTest):
self.assertEqual(len(search.group(ENTRIES, vr=False)), 1)
self.assertEqual(len(search.group(ENTRIES, installable=True)), 1)
def test_unknown_vr_counts_as_flat(self):
entries = [dict(ENTRIES[3], id='a', name='Flat', vr=False), dict(ENTRIES[3], id='b', name='Unknown', vr=None),
dict(ENTRIES[3], id='c', name='Headset', vr=True)]
self.assertEqual(sorted(a['name'] for a in search.group(entries, vr=False)), ['Flat', 'Unknown'])
self.assertEqual([a['name'] for a in search.group(entries, vr=True)], ['Headset'])
def test_browse_puts_unknown_fit_vr_first_and_blocked_last(self):
entries = [dict(source='s', id='flat', name='Flat', package='a.flat', vr=False, min_sdk=21, abis=[]),
dict(source='s', id='vr', name='Headset', package='a.vr', vr=True),
dict(source='s', id='bad', name='Blocked', package='a.bad', vr=True, min_sdk=34, abis=[])]
self.assertEqual([a['name'] for a in search.group(entries)], ['Headset', 'Flat', 'Blocked'])
def test_fit_unknown_and_native_free_and_vr_hints(self):
self.assertIsNone(search.fit({})['installable'])
self.assertTrue(search.fit({'min_sdk': 23, 'abis': []})['installable'])
+3 -2
View File
@@ -174,7 +174,7 @@ def group(entries, query='', vr=None, installable=False):
groups = {}
for entry in entries:
entry = decorate(entry)
if vr is not None and entry.get('vr') is not vr:
if vr is not None and (entry.get('vr') is True) != vr: # unknown counts as flat
continue
if installable and entry['fit']['installable'] is not True:
continue
@@ -196,7 +196,8 @@ def group(entries, query='', vr=None, installable=False):
return (o.get('vr') is not True, not art.get('banner'), not art.get('screenshots'),
''.join(chr(0x10ffff - ord(c)) for c in str(o.get('updated') or '')))
if not q:
result.sort(key=lambda a: (not any(o['fit']['installable'] is True for o in a['offers']),) + browse(a))
# Unknown fit stays in the VR-first order; only apps known not to install sink.
result.sort(key=lambda a: (all(o['fit']['installable'] is False for o in a['offers']),) + browse(a))
return result
result.sort(key=lambda a: (not any(normalise(o.get('name')) == q for o in a['offers']),
not any(o['fit']['installable'] is True for o in a['offers']),