Evaluator: Stop holding a back-pointer to Invariants

Invariants held an array of Evaluators, each of which had been injected back with a reference to Invariants via setInvariants() so the Evaluator could read orchestratorConfig, logger, requestId, req, and getRemainingTime at evaluate-time. The result was a small but genuine reference cycle: every per-request object graph contained Invariants -> Evaluator[] -> Invariants.

Pass the invariants object through as an explicit argument to Evaluator.evaluate() (and the helpers it dispatches to) instead. Each Evaluator is now construction-time configuration only -- URI, websocket, useReentrance, programmingLanguages, its own logger -- with no edge back to Invariants. Invariants -> Evaluator[] remains as a one-way pointer.

The single production call site in WFImplementation is updated to pass this.wfConfig.invariants. EvaluatorTest.js is adjusted to pass the minimal-invariants object as a call argument rather than assigning to evaluator.invariants_.

Incidental fix: evaluateReentrant_ previously called this.evaluate_( functionCall ) with the second positional argument missing -- a latent bug in the istanbul-ignored re-entrant path (T322056). Since the line had to be touched to forward invariants, originalFunctionCall is now passed through correctly as well.

This is a code-health change, not a performance change. The cycle did not leak memory under V8 and the per-request property write it removes is below the noise floor. The larger refactor -- splitting Invariants into request-context and truly-invariant configuration -- is tracked separately as T426260.

Bug: T418016

Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com

Merge request reports

Loading