Skip to content

Build an operator's trace with a caller-supplied factory - #915

Draft
antiguru wants to merge 1 commit into
TimelyDataflow:master-nextfrom
antiguru:trace-factory
Draft

antiguru wants to merge 1 commit into
TimelyDataflow:master-nextfrom
antiguru:trace-factory

Conversation

@antiguru

Copy link
Copy Markdown
Member

arrange_core and reduce_with_tactic construct their trace with Trace::new and move it into a TraceAgent. From then on the only way to reach the trace instance is TraceAgent::trace_box_unstable, which is documented as unstable and makes mutating the box undefined behavior. A trace that shares state with something outside the operator, such as a handle through which other threads observe its batches, has no stable way to hand that state to its caller.

This adds arrange_core_with_trace and reduce_with_tactic_and_trace, which take a factory with the signature of Trace::new and call it once where the operator builds its trace. The caller takes a handle from the trace before returning it. arrange_core and reduce_with_tactic delegate with Trace::new, so existing callers are unchanged. arrange_from_upsert has the same construction pattern and is left as is, since nothing needs it yet.

Posted by Claude Code.

🤖 Generated with Claude Code

https://claude.ai/code/session_015tLhSbZdXrTSK2KwSocT59

`arrange_core` and `reduce_with_tactic` construct their trace with
`Trace::new` and move it into a `TraceAgent`, after which the only way to
reach the trace instance is `TraceAgent::trace_box_unstable`. A caller whose
trace shares state with something outside the operator, for example a
handle through which other threads observe its batches, has no stable way to
obtain that state.

`arrange_core_with_trace` and `reduce_with_tactic_and_trace` take a factory
with the signature of `Trace::new` and call it once, where the operator
builds its trace. The caller can take a handle from the trace before
returning it. `arrange_core` and `reduce_with_tactic` delegate with
`Trace::new`, so existing callers are unchanged.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015tLhSbZdXrTSK2KwSocT59

This branch has not been deployed

No deployments
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.

1 participant