feat(settings): configurable query result max rows with unified load limit

This commit is contained in:
zipg authored and GitHub committed 2026-08-11 13:07:35 +08:00
1 parent 89d65e96ed
commit 0c407c2d03
26 files changed
+446 -187

No files matched your search

+8 -5
View File
@@ -3950,15 +3950,18 @@ test("MongoDB query result export rejects pagination-plan failures without repla
}
});
test("jdbc query pagination uses result sessions without capping max rows to one page", async () => {
test("jdbc query pagination sends the Agent-safe unlimited row boundary when the global limit is disabled", async () => {
const restoreStorage = installMemoryStorage();
setActivePinia(createPinia());
const connectionStore = useConnectionStore();
const settingsStore = useSettingsStore();
const store = useQueryStore();
const originalFetch = globalThis.fetch;
let prepareBody: any;
let executeBody: any;
settingsStore.updateEditorSettings({ queryResultMaxRowsEnabled: false });
connectionStore.addEphemeralConnection({
...conn("jdbc-1"),
db_type: "jdbc",
@@ -4014,7 +4017,7 @@ test("jdbc query pagination uses result sessions without capping max rows to one
assert.equal(prepareBody.options.useAgentCursor, true);
assert.equal(executeBody.pageSize, 100);
assert.equal(executeBody.fetchSize, 100);
assert.equal(executeBody.maxRows, 100000);
assert.equal(executeBody.maxRows, 2147483647);
assert.equal(executeBody.clientSessionId, tabId);
assert.equal(tab.resultSessionId, "session-1");
assert.equal(tab.result?.has_more, true);
@@ -6438,7 +6441,7 @@ for (const resultState of [
{ label: "truncated", result: { truncated: true, has_more: false } },
{ label: "ambiguous exhaustion", result: {} },
]) {
test(`oracle agent ${resultState.label} short page uses COUNT instead of inferring 10000`, async () => {
test(`oracle agent ${resultState.label} short page uses COUNT and caps the configured result total`, async () => {
const restoreStorage = installMemoryStorage();
setActivePinia(createPinia());
const connectionStore = useConnectionStore();
@@ -6496,11 +6499,11 @@ for (const resultState of [
try {
await store.executeTabSql(tabId, "SELECT ID FROM LARGE_TABLE");
await waitFor(() => tab.resultTotalRowCount === 3_357_833);
await waitFor(() => tab.resultTotalRowCount === 100_000);
assert.equal(countRequests, 1);
assert.equal(tab.result?.rows.length, 10_000);
assert.notEqual(tab.resultTotalRowCount, 10_000);
assert.equal(tab.resultTotalRowCount, 100_000);
} finally {
globalThis.fetch = originalFetch;
restoreStorage();
+14 -2
View File
@@ -63,20 +63,32 @@ async function withMockLocalStorage(initial: Record<string, string>, run: () =>
test("normalizes saved query result page size", () => {
assert.equal(DEFAULT_EDITOR_SETTINGS.pageSize, 100);
assert.equal(normalizeEditorSettings({ pageSize: 5000 }).pageSize, 5000);
assert.equal(normalizeEditorSettings({ pageSize: 200000 }).pageSize, 100000);
assert.equal(normalizeEditorSettings({ pageSize: 200000 }).pageSize, 200000);
assert.equal(normalizeEditorSettings({ pageSize: 2000000 }).pageSize, 1000000);
assert.equal(normalizeEditorSettings({ pageSize: 0 }).pageSize, 100);
});
test("normalizes the dedicated default row limit for table opens", () => {
assert.equal(DEFAULT_EDITOR_SETTINGS.tableOpenPageSize, 100);
assert.equal(normalizeEditorSettings({ tableOpenPageSize: 1000 }).tableOpenPageSize, 1000);
assert.equal(normalizeEditorSettings({ tableOpenPageSize: 200000 }).tableOpenPageSize, 100000);
assert.equal(normalizeEditorSettings({ tableOpenPageSize: 200000 }).tableOpenPageSize, 200000);
assert.equal(normalizeEditorSettings({ tableOpenPageSize: 2000000 }).tableOpenPageSize, 1000000);
assert.equal(normalizeEditorSettings({ tableOpenPageSize: 0 }).tableOpenPageSize, 100);
assert.equal(tableOpenPageLimit(), 100);
assert.equal(tableOpenPageLimit(1000), 1000);
assert.equal(tableOpenPageLimit(0), 100);
});
test("normalizes the global query result row limit", () => {
assert.equal(DEFAULT_EDITOR_SETTINGS.queryResultMaxRowsEnabled, true);
assert.equal(DEFAULT_EDITOR_SETTINGS.queryResultMaxRows, 100000);
assert.equal(normalizeEditorSettings({}).queryResultMaxRowsEnabled, true);
assert.equal(normalizeEditorSettings({}).queryResultMaxRows, 100000);
assert.equal(normalizeEditorSettings({ queryResultMaxRowsEnabled: false, queryResultMaxRows: 250000 }).queryResultMaxRowsEnabled, false);
assert.equal(normalizeEditorSettings({ queryResultMaxRows: 250000 }).queryResultMaxRows, 250000);
assert.equal(normalizeEditorSettings({ queryResultMaxRows: 2147483648 }).queryResultMaxRows, 2147483647);
});
test("numericColumnRightAlign defaults to true and round-trips through normalizeEditorSettings", () => {
assert.equal(DEFAULT_EDITOR_SETTINGS.numericColumnRightAlign, true);
assert.equal(normalizeEditorSettings({}).numericColumnRightAlign, true);
+1 -1
View File
@@ -198,7 +198,7 @@ test("infinite pagination fetches and appends only the next table segment", asyn
const connectionStore = useConnectionStore();
const queryStore = useQueryStore();
const settingsStore = useSettingsStore();
settingsStore.updateEditorSettings({ infiniteScroll: true, infiniteScrollMaxRows: 5000 });
settingsStore.updateEditorSettings({ infiniteScroll: true, queryResultMaxRowsEnabled: true, queryResultMaxRows: 5000 });
connectionStore.addEphemeralConnection(conn("mysql-1"));
const tabId = queryStore.createTab("mysql-1", "app", "orders", "data");
queryStore.setTableMeta(tabId, { tableName: "orders", tableType: "TABLE", columns: [], primaryKeys: [] });