Start building

Event starters

Timer · shared counter & scoped mapping

Timer · shared counter & scoped mapping. Explicit variable scopes and deterministic mapping.

  • Timer → JSON
  • Intermediate
  • 4 min

Last verified 2026-10-31 at f4ce7d0 — simulation fixtures

Try this template in Studio

Studio activation is a one-time payment of USD 20.

Flow

Drawn at build time from the node positions in the template's process definitions. Numbered markers are the walkthrough stages.

Main processTimer · shared counter & scoped mapping5 activities

Scroll sideways to see the whole flow.

Flow diagram of Timer · shared counter & scoped mapping5 activities and 4 transitions: Start, Increment shared counter, Cooperative wait, Map timer result, End.StartstartIncrement sharedcountervariables.increment1Cooperative waitsleep2Map timer resultdata.mapper3Endend
List the 5 activities and 4 transitions

Activities

  1. Start start
  2. Increment shared counter variables.increment
  3. Cooperative wait sleep
  4. Map timer result data.mapper
  5. End end

Transitions

  • Start → Increment shared counter (on success)
  • Increment shared counter → Cooperative wait (on success)
  • Cooperative wait → Map timer result (on success)
  • Map timer result → End (on success)

Walkthrough

  1. Increment shared counterInspect the activity and map its explicitly scoped input.
  2. Cooperative waitInspect the activity and map its explicitly scoped input.
  3. Map timer resultInspect the activity and map its explicitly scoped input.

What you will practise

  • Map upstream activity outputs without waiting for live runs.
  • Keep global, run-local and shared state separate.
  • Run a safe simulation without activating any listener.

Sample cases

1 case with 2 assertions, run with python -m server.integration examples --all in simulation.

Sample input

Passed

A complete deterministic simulation with isolated shared state. Sleep is skipped in simulation.

Expected result All fields match the scoped mapping result.

2/2 assertions

  • Successful simulation
  • Mapped output

This sample run only; not a production certification.

Prerequisites

Runtime
Cohuno runtime 1.27.0, the version recorded when these cases last passed.
Starter
Timer. The gallery never activates it; sample runs pass the case input directly.
Optional dependencies
None beyond the base runtime.
Simulation fixtures
None: no activity in this template uses a connector.
Verification details

Provenance

What was verified, and when. The content part changes whenever the pack, a process in its closure, the runtime version or a case result changes; the gallery check then fails until the gallery is regenerated and the changed templates are verified again.

Verified content

Pack SHA-256
1b8da1a3d654e4e21517cd4289ca2305506c027e50fc6ce2396dfef1170f0b8f
Closure SHA-256
01caadf9a70e4414a640baa4d919cf80ba9aaae3c29af7c0a9be2ffda6c5b50b
Runtime
1.27.0
Results
1/1 cases, 2/2 assertions, mode simulate, external calls: none.
Files in the closure
  • server/integration/example_packs/timer_context_lab.json
  • server/integration/templates/timer_context_lab.json

Verification event

Commit
f4ce7d08eedc90267b405ed1974344153a8b3a34
Verified at (UTC)
2026-10-31T21:19:21Z

How the Cohuno team reproduces this check

PYTHONPATH=. python -m server.integration examples --example timer_context_lab
PYTHONPATH=. python scripts/export_public_gallery.py --check