loom-core 0.1.5__tar.gz → 0.1.6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {loom_core-0.1.5 → loom_core-0.1.6}/PKG-INFO +1 -1
- {loom_core-0.1.5 → loom_core-0.1.6}/loom/core/context.py +30 -0
- {loom_core-0.1.5 → loom_core-0.1.6}/loom_core.egg-info/PKG-INFO +1 -1
- {loom_core-0.1.5 → loom_core-0.1.6}/pyproject.toml +1 -1
- {loom_core-0.1.5 → loom_core-0.1.6}/LICENSE +0 -0
- {loom_core-0.1.5 → loom_core-0.1.6}/MANIFEST.in +0 -0
- {loom_core-0.1.5 → loom_core-0.1.6}/QUICKSTART.md +0 -0
- {loom_core-0.1.5 → loom_core-0.1.6}/README.md +0 -0
- {loom_core-0.1.5 → loom_core-0.1.6}/loom/__init__.py +0 -0
- {loom_core-0.1.5 → loom_core-0.1.6}/loom/cli/__init__.py +0 -0
- {loom_core-0.1.5 → loom_core-0.1.6}/loom/cli/cli.py +0 -0
- {loom_core-0.1.5 → loom_core-0.1.6}/loom/common/activity.py +0 -0
- {loom_core-0.1.5 → loom_core-0.1.6}/loom/common/config.py +0 -0
- {loom_core-0.1.5 → loom_core-0.1.6}/loom/common/errors.py +0 -0
- {loom_core-0.1.5 → loom_core-0.1.6}/loom/common/workflow.py +0 -0
- {loom_core-0.1.5 → loom_core-0.1.6}/loom/core/__init__.py +0 -0
- {loom_core-0.1.5 → loom_core-0.1.6}/loom/core/compiled.py +0 -0
- {loom_core-0.1.5 → loom_core-0.1.6}/loom/core/engine.py +0 -0
- {loom_core-0.1.5 → loom_core-0.1.6}/loom/core/handle.py +0 -0
- {loom_core-0.1.5 → loom_core-0.1.6}/loom/core/logger.py +0 -0
- {loom_core-0.1.5 → loom_core-0.1.6}/loom/core/runner.py +0 -0
- {loom_core-0.1.5 → loom_core-0.1.6}/loom/core/state.py +0 -0
- {loom_core-0.1.5 → loom_core-0.1.6}/loom/core/worker.py +0 -0
- {loom_core-0.1.5 → loom_core-0.1.6}/loom/core/workflow.py +0 -0
- {loom_core-0.1.5 → loom_core-0.1.6}/loom/database/__init__.py +0 -0
- {loom_core-0.1.5 → loom_core-0.1.6}/loom/database/db.py +0 -0
- {loom_core-0.1.5 → loom_core-0.1.6}/loom/decorators/__init__.py +0 -0
- {loom_core-0.1.5 → loom_core-0.1.6}/loom/decorators/activity.py +0 -0
- {loom_core-0.1.5 → loom_core-0.1.6}/loom/decorators/workflow.py +0 -0
- {loom_core-0.1.5 → loom_core-0.1.6}/loom/lib/progress.py +0 -0
- {loom_core-0.1.5 → loom_core-0.1.6}/loom/lib/utils.py +0 -0
- {loom_core-0.1.5 → loom_core-0.1.6}/loom/migrations/down/001_setup_pragma.sql +0 -0
- {loom_core-0.1.5 → loom_core-0.1.6}/loom/migrations/down/002_create_workflows.sql +0 -0
- {loom_core-0.1.5 → loom_core-0.1.6}/loom/migrations/down/003.create_events.sql +0 -0
- {loom_core-0.1.5 → loom_core-0.1.6}/loom/migrations/down/004.create_tasks.sql +0 -0
- {loom_core-0.1.5 → loom_core-0.1.6}/loom/migrations/down/005.create_indexes.sql +0 -0
- {loom_core-0.1.5 → loom_core-0.1.6}/loom/migrations/down/006_auto_update_triggers.sql +0 -0
- {loom_core-0.1.5 → loom_core-0.1.6}/loom/migrations/down/007_create_logs.sql +0 -0
- {loom_core-0.1.5 → loom_core-0.1.6}/loom/migrations/up/001_setup_pragma.sql +0 -0
- {loom_core-0.1.5 → loom_core-0.1.6}/loom/migrations/up/002_create_workflows.sql +0 -0
- {loom_core-0.1.5 → loom_core-0.1.6}/loom/migrations/up/003_create_events.sql +0 -0
- {loom_core-0.1.5 → loom_core-0.1.6}/loom/migrations/up/004_create_tasks.sql +0 -0
- {loom_core-0.1.5 → loom_core-0.1.6}/loom/migrations/up/005_create_indexes.sql +0 -0
- {loom_core-0.1.5 → loom_core-0.1.6}/loom/migrations/up/006_auto_update_triggers.sql +0 -0
- {loom_core-0.1.5 → loom_core-0.1.6}/loom/migrations/up/007_create_logs.sql +0 -0
- {loom_core-0.1.5 → loom_core-0.1.6}/loom/schemas/__init__.py +0 -0
- {loom_core-0.1.5 → loom_core-0.1.6}/loom/schemas/activity.py +0 -0
- {loom_core-0.1.5 → loom_core-0.1.6}/loom/schemas/database.py +0 -0
- {loom_core-0.1.5 → loom_core-0.1.6}/loom/schemas/events.py +0 -0
- {loom_core-0.1.5 → loom_core-0.1.6}/loom/schemas/tasks.py +0 -0
- {loom_core-0.1.5 → loom_core-0.1.6}/loom/schemas/workflow.py +0 -0
- {loom_core-0.1.5 → loom_core-0.1.6}/loom_core.egg-info/SOURCES.txt +0 -0
- {loom_core-0.1.5 → loom_core-0.1.6}/loom_core.egg-info/dependency_links.txt +0 -0
- {loom_core-0.1.5 → loom_core-0.1.6}/loom_core.egg-info/entry_points.txt +0 -0
- {loom_core-0.1.5 → loom_core-0.1.6}/loom_core.egg-info/requires.txt +0 -0
- {loom_core-0.1.5 → loom_core-0.1.6}/loom_core.egg-info/top_level.txt +0 -0
- {loom_core-0.1.5 → loom_core-0.1.6}/setup.cfg +0 -0
- {loom_core-0.1.5 → loom_core-0.1.6}/setup.py +0 -0
|
@@ -82,6 +82,19 @@ class WorkflowContext(Generic[InputT, StateT]):
|
|
|
82
82
|
self.cursor += 1
|
|
83
83
|
return event
|
|
84
84
|
|
|
85
|
+
def _skip_step_events(self) -> None:
|
|
86
|
+
"""Skip over STEP_START and STEP_END events during replay.
|
|
87
|
+
|
|
88
|
+
These are internal workflow management events that don't affect
|
|
89
|
+
the deterministic execution logic.
|
|
90
|
+
"""
|
|
91
|
+
while True:
|
|
92
|
+
event = self._peek()
|
|
93
|
+
if event and event["type"] in ("STEP_START", "STEP_END"):
|
|
94
|
+
self._consume()
|
|
95
|
+
else:
|
|
96
|
+
break
|
|
97
|
+
|
|
85
98
|
def _match_event(self, expected_type: str) -> Event | None:
|
|
86
99
|
"""
|
|
87
100
|
Safe helper to check if the NEXT event matches what we expect.
|
|
@@ -145,6 +158,8 @@ class WorkflowContext(Generic[InputT, StateT]):
|
|
|
145
158
|
) -> FuncReturn:
|
|
146
159
|
metadata = self._extract_activity_metadata(fn, args)
|
|
147
160
|
|
|
161
|
+
# Skip any step events first
|
|
162
|
+
self._skip_step_events()
|
|
148
163
|
scheduled_event = self._match_event("ACTIVITY_SCHEDULED")
|
|
149
164
|
|
|
150
165
|
if scheduled_event:
|
|
@@ -156,6 +171,8 @@ class WorkflowContext(Generic[InputT, StateT]):
|
|
|
156
171
|
|
|
157
172
|
self._consume()
|
|
158
173
|
|
|
174
|
+
# Skip step events before checking for completion
|
|
175
|
+
self._skip_step_events()
|
|
159
176
|
completed_event = self._match_event("ACTIVITY_COMPLETED")
|
|
160
177
|
|
|
161
178
|
if completed_event:
|
|
@@ -164,6 +181,8 @@ class WorkflowContext(Generic[InputT, StateT]):
|
|
|
164
181
|
|
|
165
182
|
raise StopReplay
|
|
166
183
|
|
|
184
|
+
# Skip step events before checking for unexpected events
|
|
185
|
+
self._skip_step_events()
|
|
167
186
|
unexpected_event = self._peek()
|
|
168
187
|
if unexpected_event:
|
|
169
188
|
raise NonDeterministicWorkflowError(
|
|
@@ -189,11 +208,16 @@ class WorkflowContext(Generic[InputT, StateT]):
|
|
|
189
208
|
datetime.datetime.now(datetime.timezone.utc) + delta if delta else until # type: ignore
|
|
190
209
|
)
|
|
191
210
|
|
|
211
|
+
# Skip any step events first
|
|
212
|
+
self._skip_step_events()
|
|
213
|
+
|
|
192
214
|
scheduled_event = self._match_event("TIMER_SCHEDULED")
|
|
193
215
|
|
|
194
216
|
if scheduled_event:
|
|
195
217
|
self._consume()
|
|
196
218
|
|
|
219
|
+
# Skip step events before checking for timer fired
|
|
220
|
+
self._skip_step_events()
|
|
197
221
|
fired_event = self._match_event("TIMER_FIRED")
|
|
198
222
|
if fired_event:
|
|
199
223
|
self._consume()
|
|
@@ -201,6 +225,8 @@ class WorkflowContext(Generic[InputT, StateT]):
|
|
|
201
225
|
|
|
202
226
|
raise StopReplay
|
|
203
227
|
|
|
228
|
+
# Skip step events before checking for unexpected events
|
|
229
|
+
self._skip_step_events()
|
|
204
230
|
unexpected_event = self._peek()
|
|
205
231
|
if unexpected_event:
|
|
206
232
|
raise NonDeterministicWorkflowError(
|
|
@@ -219,6 +245,8 @@ class WorkflowContext(Generic[InputT, StateT]):
|
|
|
219
245
|
If the signal is already in history (replay), it returns the data immediately.
|
|
220
246
|
If not, it raises StopReplay to suspend execution until the signal arrives.
|
|
221
247
|
"""
|
|
248
|
+
# Skip any step events first
|
|
249
|
+
self._skip_step_events()
|
|
222
250
|
# 1. Check if the signal is next in history
|
|
223
251
|
event = self._match_event("SIGNAL_RECEIVED")
|
|
224
252
|
|
|
@@ -235,6 +263,8 @@ class WorkflowContext(Generic[InputT, StateT]):
|
|
|
235
263
|
self._consume()
|
|
236
264
|
return event["payload"]["data"]
|
|
237
265
|
|
|
266
|
+
# Skip step events before checking for unexpected events
|
|
267
|
+
self._skip_step_events()
|
|
238
268
|
unexpected_event = self._peek()
|
|
239
269
|
if unexpected_event:
|
|
240
270
|
raise NonDeterministicWorkflowError(
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|