• Subscribe to the change bus and recompute only affected root instances.

    Uses entity-level events: when data is absent, all dependents of the changed type are treated as dirty (documented limitation in ESCALATIONS).

    warm()'s own writeStatements calls re-emit upsert events on the store change bus (dual assertion), so this subscription would otherwise trigger itself. Two guards keep that self-triggering from becoming an unbounded, concurrently-racing write loop:

    • Always skipFresh: true. warm()'s fingerprint check already distinguishes "inputs actually changed" (re-warm needed) from "an echo of our own write" (fingerprint unchanged, writesIssued: 0, no further event emitted — the loop terminates). Forcing skipFresh: false here defeats that mechanism and was the source of an observed crash (concurrent warm() calls racing a read-modify-write on the same document via loadDocument → applyStatementWrites → persistDocument).
    • Single-flight with one coalesced trailing run. Overlapping triggers (including self-triggers) never start a second concurrent warm() against the same store; they merge into the next run once the current one finishes.

    Parameters

    • args: {
          affectedPlanner?: AffectedInstancePlanner;
          agent?: string;
          domainSchema: JSONSchema7;
          host?: CalcHostCapabilities;
          onError?: (error: unknown) => void;
          profile: CompiledProfile;
          rootTypeName: string;
          store: WarmStore & {
              subscribe: (
                  listener: (event: EntityChangeEvent) => void,
              ) => Unsubscribe;
          };
      }
      • OptionalaffectedPlanner?: AffectedInstancePlanner
      • Optionalagent?: string
      • domainSchema: JSONSchema7
      • Optionalhost?: CalcHostCapabilities
      • OptionalonError?: (error: unknown) => void
      • profile: CompiledProfile
      • rootTypeName: string

        Root type(s) to re-warm when affected.

      • store: WarmStore & {
            subscribe: (listener: (event: EntityChangeEvent) => void) => Unsubscribe;
        }

    Returns CalcInvalidationHandle