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.
This commit is contained in:
hanhvs
2026-09-08 19:37:56 +08:00
committed by t8y2
parent 56572bd255
commit 8f9cbc4ef0
3 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -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);
+1 -1
View File
@@ -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/);
});
+1 -1
View File
@@ -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>) -> u64 {