Skip to content

feat(testing): add skip-time virtual clock#523

Open
yaythomas wants to merge 3 commits into
feat/per-execution-workerfrom
feat/skip-time-clock
Open

feat(testing): add skip-time virtual clock#523
yaythomas wants to merge 3 commits into
feat/per-execution-workerfrom
feat/skip-time-clock

Conversation

@yaythomas

Copy link
Copy Markdown
Contributor

Description of changes:

  • Add Clock protocol with RealClock and SkipClock implementations
  • Give each ExecutionWorker its own clock via the registry factory
  • Drive wait and step-retry timers off the clock so modeled delays complete instantly under skip while history keeps real durations
  • Default DurableFunctionTestRunner to skip_time=True; pass skip_time=False for real wall-clock timing
  • Remove the DURABLE_EXECUTION_TIME_SCALE env-var scaling

Issue #, if available:
closes #437

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@yaythomas yaythomas force-pushed the feat/per-execution-worker branch from 5c208f2 to 355edf1 Compare July 9, 2026 08:49
@yaythomas yaythomas force-pushed the feat/skip-time-clock branch from 346a870 to 2e9ba2b Compare July 9, 2026 08:56
@yaythomas yaythomas force-pushed the feat/per-execution-worker branch from 355edf1 to 27adefe Compare July 9, 2026 09:22
yaythomas added 2 commits July 9, 2026 14:48
Replace the per-ARN lock with a per-execution worker that runs every
operation for one execution one at a time on its own serial lane.

- Worker model: SerialTaskLane, ExecutionWorker, ExecutionRegistry,
  ExecutionTask, CallableTask.
- One checkpoint write transaction in checkpoint/core.py shared by the
  web and in process paths.
- Checkpoint lifecycle actions returned as effects applied after the
  write. The reentrant notifier is gone.
- The invocation gate lives on the worker status.
- The blocking invoke runs off the lane so handler callbacks can run.
- Store integration test on memory, filesystem, and sqlite. Caught and
  fixed a non-atomic write in FileSystemStore.
- Runner accepts an optional store for store injection testing.
- docs/architecture.md: new, describes the worker model.

Closes #435
- Add ExecutionRegistry.submit with compare-and-evict retry so a
  worker that stops its lane between hand-out and submit no longer
  surfaces RuntimeError; reorder teardown to stop-then-remove.
- Add ExecutionRegistry.shutdown; WebRunner.stop and
  DurableFunctionTestRunner.close now stop per-execution lanes so
  they do not outlive the runner.
- Honor MaxItems in GetDurableExecutionState, clamped to the service
  page-count bounds, via the paginator's new count bound.
- Remove dead _release_gate and _cleanup_execution_state; fix
  logger.exception misuse on non-error paths; fix the
  wait_for_callback timeout message.
@yaythomas yaythomas force-pushed the feat/per-execution-worker branch from 9829546 to 71962f1 Compare July 9, 2026 14:50
@yaythomas yaythomas force-pushed the feat/skip-time-clock branch from 2e9ba2b to d2f04f2 Compare July 9, 2026 14:54
- Add Clock protocol with RealClock and SkipClock implementations
- Give each ExecutionWorker its own clock via the registry factory
- Drive wait and step-retry timers off the clock so modeled delays
  complete instantly under skip while history keeps real durations
- Default DurableFunctionTestRunner to skip_time=True; pass
  skip_time=False for real wall-clock timing
- Remove the DURABLE_EXECUTION_TIME_SCALE env-var scaling
@yaythomas yaythomas force-pushed the feat/skip-time-clock branch from d2f04f2 to c494657 Compare July 9, 2026 15:27
scheduled_end_timestamp = datetime.now(UTC) + timedelta(
seconds=scaled_wait_seconds
seconds=wait_seconds
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is still using the real time here, which causes the operation after the wait operation to have a start time stamp earlier than the scheduled end time of wait. This confuses the timeline of the history. Not sure if this is the desired behavior.

@yaythomas yaythomas force-pushed the feat/per-execution-worker branch from 71962f1 to 11103e3 Compare July 10, 2026 00:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants