Skip to content

Execution, limits and recovery

Use localExecution on createPivotController, or grid.pivot.engine.localExecution for the attached plugin. Keep a single analytical owner per grid.

let sourceRevision = 0;
const localExecution = {
mode: 'cooperative' as const, budgetMs: 8,
sourceRevision: () => sourceRevision,
};
// Supply localExecution to createPivotController({ report, source, localExecution }).
// Before changing accepted facts: sourceRevision++; then mutate; then refresh().
APIType/default/unitsBehavior
localExecution.mode'cooperative'; runtime opt-inDefault omission retains synchronous timing
budgetMsNumber, default 8; milliseconds, greater than 0 and at most 50Target between yields, not a deadline
sourceRevisionRequired callback returning a stable valueCompared with Object.is; change before source mutation
autoLoadBoolean, falseStart execution on controller creation
historyLimitNonnegative integer, 100Zero disables undo history
Query axis offsets/limitsNonnegative safe integers; omitted means complete local windowZero limit means empty window
cancel()No argumentsSettles pending work; prevents stale publication
dispose()No argumentsCancels work and releases subscriptions

Keep source membership, order and values stable until an operation settles. Source revision is a lease, not a deep snapshot; unannounced nested mutations cannot be reliably detected. Metadata admission is still synchronous. Opaque callbacks/getters/Proxy traps and atomic JavaScript operations can exceed the cooperative target. Remote scheduling, deadlines and database cancellation belong to the adapter/host.

PivotResourceLimits is runtime-only: pass resourceLimits to the standalone controller or engine.resourceLimits in native config. Each omitted metric is unbounded. Supplied values must be nonnegative safe integers; zero is valid. Unknown metrics, accessors or invalid policy shapes throw TypeError. Application/controller and selected engine policies intersect using the lower per-metric ceiling; reports cannot raise application ceilings.

MetricExact accounting unitExample ceilingWhat it does not measure
maxSourceSlotsOriginal selected array length, including holes10000Eligible facts, fields or heap
maxModelStateEntriesCumulative entries created in instrumented model Map/Set/dictionary owners: group/aggregate buckets, hierarchies, collision/subtotal/calculation/semantic indexes, ranked provenance and remote materialization, including replicated indexes200000Unique members alone, all JS objects or bytes
maxRetainedAggregateValuesCumulative raw aggregate input slots retained per destination occurrence500000Source length alone; one fact can contribute at several grains
maxModelRecordsCumulative generated/owned record creations, including raw dictionaries and publication copies50000Nested objects or current live-record count
maxModelPropertiesCumulative first own top-level property creations on those records, including string/symbol metadata references500000Recursive payload size or subsequent overwrites
maxExportDataCellsBody plus pinned indexed row spans × exported leaf columns, labels/blanks included100000Only nonempty numeric cells
maxExportHeaderNodesHeader object occurrences, shared subtrees counted per occurrence2000Unique header identities
maxExportUtf8BytesFinal escaped CSV/print HTML UTF-8 bytes, BOM/delimiters/markup included2000000Workbook ZIP size or heap
maxWorkbookXmlBytesSum of uncompressed XLSX XML part UTF-8 bytes4000000ZIP/container overhead or memory

Model counters are deterministic accounting in named SDK owners, not a global allocation interceptor. Nested application payloads and custom callback allocations stay outside them. Cumulative work is not refunded merely because temporary state is released. These example ceilings are application choices, not tested capacity promises.

PivotIntentLimits belongs to controller intentLimits or runtime engine.intentLimits. All metrics default to unbounded, use nonnegative safe integers and accept zero. Invalid policies throw; excess admitted intent raises WINDOW_LIMIT_EXCEEDED.

MetricUnit
maxMetadataNodesJSON container/scalar occurrences including root, excluding property keys
maxMetadataBytesCanonical admitted projection JSON UTF-8 bytes, not heap
maxFilterNodesExplicit WHERE/HAVING conditions, connectives, negations and HAVING list containers
maxMembershipValuesMembership operand occurrences, including report/native selections

engine.memberFilterLimits independently bounds transient contribution maxOwners, maxTuplesPerOwner, maxPredicates and maxBytes. Bytes count serialized intent: a complete request envelope or ordered active-owner [[ownerId, tuples], ...]; repeated references count per occurrence. Omitted metrics are unbounded and zero is valid. These limits do not establish tenant authorization.

The optional SQLite analytical profile requires trusted workLimits:

MetricUnit/defaultExclusions
maxDenseCoordinatesEach cube’s row-prefix × column-prefix product, including roots; required nonnegative safe integerScans, SQL workspace, heap
maxMaterializedRowsCumulative rows written to operation-owned SQL temporary tables; copies count again; required nonnegative safe integerInternal indexes, temp bytes, CPU
maxRankingMembersPositive ranking-member ceiling, default 1000All-purpose memory bound

These are reference/backend policies, not fields of PivotResourceLimits. An authorized cache hit performs zero new temporary work; tightening a work ceiling to zero does not invalidate an otherwise authorized cached response. Bound cache entries/bytes/TTL and reauthorize separately. Synchronous SQLite cannot interrupt an executing statement with AbortSignal.

Execution operations return committed, noop, prevented, superseded, cancelled or failed; only a commit publishes a new revision. Validate exceptions separately from asynchronous outcomes.

try {
const outcome = await controller.refresh();
if (outcome.status === 'failed') {
console.error(outcome.error.message, outcome.error.code, outcome.error.details);
// Keep controller.getSnapshot().view visible. Offer fewer facts/measures,
// a smaller export, or a host-approved revised policy, then retry.
}
} catch (error) {
console.error('Invalid input or policy', error);
}

For resource refusals, bounded controller details contain stage, metric, limit, observed. observed: null means unavailable/not representable, not zero. Arbitrary provider payloads are excluded. Last committed view/revision remain usable after execution failure; source intent and retained view can have different sourceRevision/viewSourceRevision.

The runnable example commits six facts under a six-slot ceiling, refuses seven facts with WINDOW_LIMIT_EXCEEDED, checks unchanged revision, and successfully recovers with six facts. It also refuses an oversized CSV before retrying a smaller output.

Error/situationCustomer action
WINDOW_LIMIT_EXCEEDEDReduce source/cardinality/export or obtain a host-approved limit change; retry
REVISION_MISMATCHRefresh current registry/report/snapshot; never download stale output
INVALID_SELECTOR / INVALID_SUMMARY_TYPESelect authorized fields/operations advertised by this engine
HIERARCHY_UNAVAILABLE / INVALID_HIERARCHY_PATHUse a supported hierarchy/profile and valid typed paths
AUTH_REQUIRED / FORBIDDENReauthenticate or request access; do not retry with client-supplied tenant metadata
Missing runtime binding / invalid reportRestore the named host binding or repair the document; preserve the accepted report

See exports and deployment acceptance. No logical counter promises hard heap, CPU, SQL preemption, latency or concurrency guarantees.