Function subscribeCalcInvalidation
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;
};
}Optionalagent?: string
domainSchema: JSONSchema7
OptionalonError?: (error: unknown) => void
profile: CompiledProfile
rootTypeName: string
store: WarmStore & {
subscribe: (listener: (event: EntityChangeEvent) => void) => Unsubscribe;
}
Subscribe to the change bus and recompute only affected root instances.
Uses entity-level events: when
datais absent, all dependents of the changed type are treated as dirty (documented limitation in ESCALATIONS).warm()'s ownwriteStatementscalls re-emitupsertevents 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: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). ForcingskipFresh: falsehere defeats that mechanism and was the source of an observed crash (concurrentwarm()calls racing a read-modify-write on the same document vialoadDocument→applyStatementWrites→persistDocument).warm()against the same store; they merge into the next run once the current one finishes.