From 8f9cbc4ef0eea31024b6ccf92ebe606230c5ca09 Mon Sep 17 00:00:00 2001 From: hanhvs Date: Tue, 8 Sep 2026 12:12:02 +0700 Subject: [PATCH] fix(ci): update source-pattern tests for the maxSizeBytes arg and fix clippy identity_op - externalSqlFileStartup.test.ts and sqlLibraryImportEncoding.test.ts matched the old single-arg readExternalSqlFile(Snapshot) call; update the expected source strings to include the size-limit argument. - external_sql.rs: 1 * 1024 * 1024 triggers clippy::identity_op under the CI toolchain; simplify to 1024 * 1024. --- packages/app-tests/externalSqlFileStartup.test.ts | 2 +- packages/app-tests/sqlLibraryImportEncoding.test.ts | 2 +- src-tauri/src/commands/external_sql.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/app-tests/externalSqlFileStartup.test.ts b/packages/app-tests/externalSqlFileStartup.test.ts index 7d28460fe0..2f400fa88f 100644 --- a/packages/app-tests/externalSqlFileStartup.test.ts +++ b/packages/app-tests/externalSqlFileStartup.test.ts @@ -128,7 +128,7 @@ test("cold-start SQL files wait for restored tabs before opening", () => { const openPathSource = appSource.slice(openPathStart, openPathEnd); const initializationWait = openPathSource.indexOf("await desktopOpenTabsRestorationBarrier?.settled"); - const fileRead = openPathSource.indexOf("api.readExternalSqlFileSnapshot(path)"); + const fileRead = openPathSource.indexOf("api.readExternalSqlFileSnapshot(path, externalSqlEditorMaxBytes(settingsStore.editorSettings.externalSqlEditorMaxMb))"); const tabOpen = openPathSource.indexOf("queryStore.openExternalSqlFile"); assert.ok(initializationWait >= 0); assert.ok(initializationWait < fileRead); diff --git a/packages/app-tests/sqlLibraryImportEncoding.test.ts b/packages/app-tests/sqlLibraryImportEncoding.test.ts index feab0df519..2cba3161fa 100644 --- a/packages/app-tests/sqlLibraryImportEncoding.test.ts +++ b/packages/app-tests/sqlLibraryImportEncoding.test.ts @@ -9,7 +9,7 @@ test("SQL library imports use the charset-aware external SQL reader", () => { const end = source.indexOf("async function chooseSyncDirectory", start); const handler = start >= 0 && end > start ? source.slice(start, end) : ""; - assert.match(handler, /await api\.readExternalSqlFile\(path\)/); + assert.match(handler, /await api\.readExternalSqlFile\(path, externalSqlEditorMaxBytes\(settingsStore\.editorSettings\.externalSqlEditorMaxMb\)\)/); assert.doesNotMatch(handler, /readTextFile/); }); diff --git a/src-tauri/src/commands/external_sql.rs b/src-tauri/src/commands/external_sql.rs index 6bce7c4362..7e479f1172 100644 --- a/src-tauri/src/commands/external_sql.rs +++ b/src-tauri/src/commands/external_sql.rs @@ -8,7 +8,7 @@ use sha2::{Digest, Sha256}; use tokio::io::AsyncReadExt; const MAX_EXTERNAL_SQL_EDITOR_FILE_BYTES: u64 = 64 * 1024 * 1024; -const MIN_EXTERNAL_SQL_EDITOR_FILE_BYTES: u64 = 1 * 1024 * 1024; +const MIN_EXTERNAL_SQL_EDITOR_FILE_BYTES: u64 = 1024 * 1024; const MAX_EXTERNAL_SQL_EDITOR_FILE_BYTES_LIMIT: u64 = 4096 * 1024 * 1024; fn clamp_external_sql_editor_limit(max_size_bytes: Option) -> u64 {