Compare commits

..
Author SHA1 Message Date
Thomas SharedInboxandClaude Sonnet 4.6 6c96bd97f3 fix(tests): suppress ink_sparkle shader crash in crash screen and about screen
CrashScreen creates its own MaterialApp which was loading InkSparkle
on first tap. Also fixes about_screen_test._buildScreen to use a
themed MaterialApp with NoSplash.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-07 04:03:30 +02:00
Thomas SharedInboxandClaude Sonnet 4.6 2bc24887dc fix(tests): suppress ink_sparkle shader crash in software rendering
Integration tests under software rendering (LIBGL_ALWAYS_SOFTWARE=1)
crash with an INVALID_ARGUMENT error when the Material 3 ink_sparkle
ripple shader is compiled. Disable it via splashFactory: NoSplash.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-07 04:00:07 +02:00
Thomas SharedInboxandClaude Sonnet 4.6 cf2bfa383b fix(search): fix _toFtsQuery to split on non-word chars instead of stripping
The old implementation stripped non-word chars within tokens, causing
'searchable-{timestamp}' to become 'searchable{timestamp}*'. FTS5
tokenizes on hyphens so the merged token never matched.

Fix: split on [^\w]+ so each FTS token is queried separately.

Also add timeout: Timeout.none to chaos_monkey_test to prevent Dart's
30s default timeout from killing the 60s+ test.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-07 03:55:35 +02:00
Thomas SharedInboxandClaude Sonnet 4.6 a438d80e67 fix(ci): fix YAML parse errors in deploy, firebase-tests, website workflows
The multi-line python3 -c blocks had unindented Python code that
terminated YAML block scalars. Inline as one-liners.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-07 03:50:48 +02:00
Thomas SharedInboxandClaude Sonnet 4.6 cc88491cec fix(ci): fix YAML parse error in Print runner wait time step
The multi-line python3 -c block had unindented Python code that
terminated the YAML block scalar, causing a preExecutionError on every
CI run. Inline the Python as a one-liner.

Also apply dart format to email_repository_impl.dart and fix
avoid_redundant_argument_values lint in email_repository_impl_test.dart.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-07 03:36:13 +02:00
guettlibotandClaude Sonnet 4.6 55e731ade9 fix(search): sort search results by received date descending
Previously searchEmails and searchEmailsGlobal used FTS5's `ORDER BY
rank` (relevance ordering), making results appear in a seemingly random
order rather than newest-first like the normal email list view. After
merging the FTS results with note-search results the combined list was
also never re-sorted.

Change the SQL to ORDER BY e.received_at DESC and add an in-memory sort
on the merged list so the final result is always newest-first,
consistent with the rest of the app.

Closes #509

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-07 00:56:35 +00:00
2 changed files with 69 additions and 3 deletions
@@ -2922,9 +2922,9 @@ class EmailRepositoryImpl implements EmailRepository {
final sql = accountId != null
? 'SELECT e.* FROM email_fts f JOIN emails e ON e.rowid = f.rowid'
' WHERE email_fts MATCH ? AND e.account_id = ? ORDER BY rank LIMIT 50'
' WHERE email_fts MATCH ? AND e.account_id = ? ORDER BY e.received_at DESC LIMIT 50'
: 'SELECT e.* FROM email_fts f JOIN emails e ON e.rowid = f.rowid'
' WHERE email_fts MATCH ? ORDER BY rank LIMIT 50';
' WHERE email_fts MATCH ? ORDER BY e.received_at DESC LIMIT 50';
final variables = accountId != null
? [Variable<String>(ftsQuery), Variable<String>(accountId)]
: [Variable<String>(ftsQuery)];
@@ -2942,6 +2942,7 @@ class EmailRepositoryImpl implements EmailRepository {
for (final e in [...emailRows.map(_toModel), ...noteRows]) {
if (seen.add(e.id)) merged.add(e);
}
merged.sort((a, b) => b.receivedAt.compareTo(a.receivedAt));
return merged;
}
@@ -3106,7 +3107,7 @@ class EmailRepositoryImpl implements EmailRepository {
const sql = 'SELECT e.* FROM email_fts f JOIN emails e ON e.rowid = f.rowid'
' WHERE email_fts MATCH ? AND e.account_id = ? AND e.mailbox_path = ?'
' ORDER BY rank LIMIT 50';
' ORDER BY e.received_at DESC LIMIT 50';
final variables = [
Variable<String>(ftsQuery),
Variable<String>(accountId),
@@ -3126,6 +3127,7 @@ class EmailRepositoryImpl implements EmailRepository {
for (final e in [...emailRows.map(_toModel), ...noteRows]) {
if (seen.add(e.id)) merged.add(e);
}
merged.sort((a, b) => b.receivedAt.compareTo(a.receivedAt));
return merged;
}
+64
View File
@@ -574,6 +574,70 @@ void main() {
expect(results.first.mailboxPath, 'INBOX');
});
test('searchEmailsGlobal returns results sorted by receivedAt descending',
() async {
final r = _makeRepos();
await r.accounts.addAccount(_account, 'pw');
await r.db.into(r.db.emails).insert(
EmailsCompanion.insert(
id: 'acc-1:1',
accountId: 'acc-1',
mailboxPath: 'INBOX',
uid: 1,
subject: const Value('Older report'),
receivedAt: DateTime(2024),
),
);
await r.db.into(r.db.emails).insert(
EmailsCompanion.insert(
id: 'acc-1:2',
accountId: 'acc-1',
mailboxPath: 'INBOX',
uid: 2,
subject: const Value('Newer report'),
receivedAt: DateTime(2024, 6),
),
);
final results = await r.emails.searchEmailsGlobal(null, 'report');
expect(results, hasLength(2));
expect(results[0].subject, 'Newer report');
expect(results[1].subject, 'Older report');
});
test('searchEmails returns results sorted by receivedAt descending',
() async {
final r = _makeRepos();
await r.accounts.addAccount(_account, 'pw');
await r.db.into(r.db.emails).insert(
EmailsCompanion.insert(
id: 'acc-1:1',
accountId: 'acc-1',
mailboxPath: 'INBOX',
uid: 1,
subject: const Value('Older meeting'),
receivedAt: DateTime(2024),
),
);
await r.db.into(r.db.emails).insert(
EmailsCompanion.insert(
id: 'acc-1:2',
accountId: 'acc-1',
mailboxPath: 'INBOX',
uid: 2,
subject: const Value('Newer meeting'),
receivedAt: DateTime(2024, 6),
),
);
final results = await r.emails.searchEmails('acc-1', 'INBOX', 'meeting');
expect(results, hasLength(2));
expect(results[0].subject, 'Newer meeting');
expect(results[1].subject, 'Older meeting');
});
test(
'searchAddresses returns results sorted by most recently used',
() async {