Expand description
Structural and destructive spreadsheet edits via spreadsheets.batchUpdate.
The drive sheets add-sheet/rename-sheet/insert-rows/insert-columns
(additive, issue #1613, ADR-0075),
insert-range (additive, issue #1838),
duplicate-sheet/reorder-sheet/hide-sheet/show-sheet (also
additive, issue #1643, ADR-0078),
move-rows/move-columns (also additive — nothing is discarded, issue
#1834, ADR-0083),
delete-sheet/delete-rows/delete-columns/delete-range (destructive,
issue #1623,
ADR-0077),
and update-workbook-properties (also additive, issue #1836,
ADR-0086) engines,
gated by the ADR-0071 folder write-permission rules.
update-workbook-properties is the one verb here with no sheet target:
every other verb acts on a tab within the workbook, this one acts on the
workbook itself (locale, time zone, auto-recalc, iterative calculation —
deliberately not spreadsheetTheme, a large nested type left for a
future issue). StructureVerb::sheet_title returns Option<&str>
rather than &str for exactly this reason, and [resolve_sheet] returns
Ok(None) for it without consulting the sheet list at all. Turning
iterative calculation on is a value effect reached indirectly — it
changes what a circular-reference formula elsewhere evaluates to
without changing that formula itself, the same shape of concern
ADR-0081 raised for named-range deletion — so it stays gated as
sheets-structure rather than treated as a data mutation; see
crate::drive::sheets::types::IterativeCalculationSettings’s doc
comment.
ADR-0073 §12 deferred this surface
because batchUpdate is where “one call destroys far more than its
arguments suggest”. Two properties answer that, and each is structural
rather than a matter of care:
- Typed verbs, no raw request passthrough. Every verb builds its own
BatchUpdateRequestItem, so the gate and--dry-runcan describe the exact effect. There is no--requests file.jsonand deliberately no escape hatch, following ADR-0061’s handling of force-push: the dangerous form must be unreachable, not merely discouraged. This still holds for the destructive verbs added by ADR-0077 — they gained typed variants, not a passthrough. - A distinct gate operation per risk class. Additive verbs check
DriveOperation::SheetsStructure; the four destructive verbs checkDriveOperation::SheetsDeleteinstead — never folded together, and never reusingSheetsWriteeither. See each variant’s doc comment for why reuse would be silent privilege widening.StructureVerb::gate_operationis the single place this split is decided.
ADR-0075 §3/§4 originally kept deleteSheet/deleteDimension/
deleteRange unreachable at the type level, pinned by a
no_destructive_request_is_reachable grep-guard test. ADR-0077
supersedes that: those requests are now reachable, but only through this
module’s gated, validated path — never through a raw passthrough, and
never under the sheets-structure operation an existing allow rule may
already grant.
Shape follows write.rs exactly: a public wrapper that logs, an _inner
that classifies then mutates, and --dry-run as an early return after
the gate so a preview and a real run share one classification by
construction. One difference is deliberate and tested: a dry run here does
issue a single spreadsheets.get, because describing a structural effect
honestly requires the sheet’s real current dimensions. It still issues no
batchUpdate, and a gate-blocked attempt still issues no Sheets call at
all. --dry-run for a destructive verb stays structural-only — no
values.get read and no cell content in its output or the request log —
and instead states a fixed caveat that formulas elsewhere in the workbook
may reference what would be deleted, which cannot be checked from the
sheet’s own dimensions (ADR-0077).
Structs§
- Sheet
Snapshot - The sheet a verb resolved to, plus its dimensions at that moment.
- Structure
Options - Per-call options.
- Structure
Outcome - The full outcome of one attempt.
Enums§
- Iterative
Calculation Toggle - Which way
update-workbook-properties --iterative-calculationsets iterative calculation. - Structure
Result - What happened (or, under
--dry-run, would happen). - Structure
Verb - Which structural mutation to perform.
Functions§
- describe
- Renders an outcome as human-readable text.
- describe_
lines - Renders an outcome as its individual lines, none of which contains a newline.
- structure
- Runs one structural mutation, logging every attempt that isn’t a dry run.