Add snapshot waiting and invocation tracing - #216
Merged
Conversation
Contributor
Type performanceMeasured with TypeScript 6.0.3 and
Marginal instantiations are measured against the matching setup without that API call:
Check times (informational)
Type instantiations are the comparison metric. Check time varies with runner load and is informational only. |
Contributor
Runtime performanceMedian of 5 independent benchmark processes on Pull request baseline
Process runtime reference points
Effect Machine change from base
Process runtime reference change from base
Regression guardNo large, noise-adjusted throughput or heap regressions detected. Versions and interpretation
Higher throughput is better; lower heap is better. Variability is the median absolute deviation across independent processes, relative to their median. Small differences on shared GitHub-hosted hardware remain informational; the required guard rejects only large changes beyond the measured noise allowance. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add
Machine.waitFor(ref, predicate)for external Effects and tests that need a current or subsequent published snapshot. It supports type narrowing, preserves unmatched failure Causes, distinguishes stopping from completion without a match, and releases observation on interruption. Timeouts compose through Effect; the API does not acknowledge sent events.Effect, Stream, and timer invocations now receive
Machine.invokespans with machine, state, registered source, and invocation identity. The implementation usesEffect.withSpanwithout stack capture and preserves existing resource ownership. Standard Effect tracing configuration applies.Fix indexed self-transitions and reentry for schema-less states. Add public behavior and type tests, forced generic/compiled runtime and planner coverage, documentation and agent guidance, and invocation benchmarks with tracing enabled and disabled.
Changeset
Minor changeset for the public observation API and invocation tracing, including the schema-less reentry fix.
Validation
pnpm checkLocal
pnpm perf:typesandpnpm perf:runtimepassed, including both invocation tracing scenarios. CI passed onf0d1f69790b7970a8f2faa820b37e4a1bb81e4b8, and both automated comparison reports were reviewed.Type instantiations are unchanged. Across five independent runtime processes, existing machine scenarios changed by -1.7% to +1.0%, with measured heap changes no greater than +1.0%. The dedicated empty-Effect invocation lifecycle has a measurable tracing cost: throughput is 13.2% lower with tracing enabled and 12.3% lower with tracing disabled; both pass the unchanged regression guard. Disabled tracing still uses Effect's no-op span and trace-context semantics, rather than bypassing
withSpan. See the automated reports below for the full comparison.