diff --git a/shortcuts/sheets/data/flag-defs.json b/shortcuts/sheets/data/flag-defs.json index ba8390fb9..48dcdc94c 100644 --- a/shortcuts/sheets/data/flag-defs.json +++ b/shortcuts/sheets/data/flag-defs.json @@ -1196,15 +1196,6 @@ "data_validation" ] }, - { - "name": "cell-limit", - "kind": "own", - "type": "int", - "required": "optional", - "desc": "Safety cap; default 5000", - "default": "5000", - "hidden": true - }, { "name": "max-chars", "kind": "own", @@ -1314,15 +1305,6 @@ "formula" ] }, - { - "name": "max-rows", - "kind": "own", - "type": "int", - "required": "optional", - "desc": "Safety cap; default 100000", - "default": "100000", - "hidden": true - }, { "name": "max-chars", "kind": "own", diff --git a/shortcuts/sheets/flag_defs_test.go b/shortcuts/sheets/flag_defs_test.go index a4c47fdf3..2d0217849 100644 --- a/shortcuts/sheets/flag_defs_test.go +++ b/shortcuts/sheets/flag_defs_test.go @@ -66,9 +66,9 @@ func TestFlagsFor_MapsAllFields(t *testing.T) { t.Errorf("+sheet-create --url should not be cobra-required: %+v", url) } // hidden + int default - cap := byName("+cells-get", "cell-limit") - if cap == nil || !cap.Hidden || cap.Default != "5000" { - t.Errorf("+cells-get --cell-limit not mapped: %+v", cap) + cap := byName("+cells-get", "max-chars") + if cap == nil || !cap.Hidden || cap.Default != "200000" { + t.Errorf("+cells-get --max-chars not mapped: %+v", cap) } // input sources cells := byName("+cells-set", "cells") diff --git a/shortcuts/sheets/lark_sheet_read_data.go b/shortcuts/sheets/lark_sheet_read_data.go index 511413899..7c036ac3e 100644 --- a/shortcuts/sheets/lark_sheet_read_data.go +++ b/shortcuts/sheets/lark_sheet_read_data.go @@ -19,6 +19,14 @@ import ( // The sandbox tool (export_sheet_to_sandbox) is Sheet-Tool-only and has no // CLI surface here. +// unboundedReadLimit is pinned into the tool's cell_limit / max_rows so that +// --max-chars is the single effective read cap. The underlying tools default +// those two to smaller values; without an explicit high value they could +// truncate before max_chars. The CLI no longer exposes --cell-limit / --max-rows +// (only --max-chars), so we pass this sentinel to neutralize the tool defaults. +// Large enough to never bind on any real sheet. +const unboundedReadLimit = 1_000_000_000 + // CellsGet wraps get_cell_ranges: read multiple A1 ranges and return per-cell // values, formulas, styles, and other metadata as requested via --include. var CellsGet = common.Shortcut{ @@ -75,9 +83,10 @@ func cellsGetInput(runtime *common.RuntimeContext, token, sheetID, sheetName str if runtime.Bool("skip-hidden") { input["skip_hidden"] = true } - if n := runtime.Int("cell-limit"); n > 0 { - input["cell_limit"] = n - } + // --cell-limit was removed from the CLI surface; --max-chars is the single + // read cap. Pin cell_limit very high so the tool's own default never binds + // before max_chars. + input["cell_limit"] = unboundedReadLimit if n := runtime.Int("max-chars"); n > 0 { input["max_chars"] = n } @@ -172,9 +181,10 @@ func csvGetInput(runtime *common.RuntimeContext, token, sheetID, sheetName strin if runtime.Bool("skip-hidden") { input["skip_hidden"] = true } - if n := runtime.Int("max-rows"); n > 0 { - input["max_rows"] = n - } + // --max-rows was removed from the CLI surface; --max-chars is the single + // read cap. Pin max_rows very high so the tool's own default never binds + // before max_chars. + input["max_rows"] = unboundedReadLimit if n := runtime.Int("max-chars"); n > 0 { input["max_chars"] = n } diff --git a/shortcuts/sheets/lark_sheet_read_data_test.go b/shortcuts/sheets/lark_sheet_read_data_test.go index d63d4214a..30a9a1a55 100644 --- a/shortcuts/sheets/lark_sheet_read_data_test.go +++ b/shortcuts/sheets/lark_sheet_read_data_test.go @@ -31,6 +31,7 @@ func TestReadDataShortcuts_DryRun(t *testing.T) { "ranges": []interface{}{"A1:B2"}, "include_styles": true, "value_render_option": "formula", + "cell_limit": float64(unboundedReadLimit), // pinned high; --max-chars is the only cap }, }, { @@ -43,6 +44,7 @@ func TestReadDataShortcuts_DryRun(t *testing.T) { "sheet_id": testSheetID, "range": "A1:C10", "value_render_option": "formula", + "max_rows": float64(unboundedReadLimit), // pinned high; --max-chars is the only cap }, }, {