Skip to content

Latest commit

 

History

History
99 lines (71 loc) · 2.72 KB

File metadata and controls

99 lines (71 loc) · 2.72 KB

Counter (counterNode)

Category: Control Flow

Intended behavior

Increments/decrements a count on trigger signal.

Inputs

ID Label Type Unwired default
incTrigger Inc trigger undefined
decTrigger Dec trigger undefined
resetTrigger Reset trigger undefined

Outputs

ID Label Type Default
count Count number undefined

Configuration defaults

{
  "count": 0
}

Observed frontend behavior

This calls the production passive computation with the declared input/config defaults. Cached state, trigger execution and project wiring are separate.

{
  "kind": "passive-default-probe",
  "outputs": {
    "count": 0
  }
}

Observed backend behavior

Offline production passive computation with the same declared defaults; no device or model service is invoked.

{
  "kind": "passive-default-probe",
  "outputs": {}
}

Current frontend implementation

Extracted production branches; helper calls and project execution context are defined in the referenced modules.

src/lib/execution-helpers.ts:242

case "counterNode":
      outputs.count = Number(config.count ?? 0);
      break;

src/lib/execution-helpers.ts:415

if (type === "counterNode") {
    let change = 0;
    if (targetPortId === "incTrigger") change = 1;
    else if (targetPortId === "decTrigger") change = -1;

    // safeNum: a count that ever became non-numeric (stale saved file,
    // hand-edited config) would otherwise turn NaN and wedge the counter
    // forever — NaN + 1 is NaN, so no later trigger could recover it.
    const currentCount =
      targetPortId === "resetTrigger"
        ? 0
        : safeNum(config.count) + change;

    updatedConfig = { ...config, count: currentCount };
  }

Implementation references

Verification limits

  • Default passive probe is an observation, not proof of all configurations, trigger behavior, or correctness. See ../NODE_RUNTIME_AUDIT.md and ../AUDIT_VALIDATION.md for test evidence.
  • Trigger inputs schedule actions; passive evaluation alone does not execute those actions. Wire a trigger source and test the full chain.

Source fingerprint: 7e9d192bd3a559a7c50253919867601ef02c311d61e859f7afb4cadcfa508430. Rebuild with npm run docs:index.