Skip to content

make sure program graph has the same semantics as old trace/ module #68

Open

Description

@darinkishore
  1. trace/ module — entire directory is orphaned
  • Graph, Node, NodeType, Executor, TrackedValue, IntoTracked, record_node, record_output, is_tracing, trace() — zero imports outside the trace module
    itself
  • This was a pre-V1 runtime execution tracing system (task-local DAG recording). Completely superseded by ProgramGraph for dynamic graph execution and
    tracing crate for observability.

yeah so we gotta fix that lol

Activity

  1. darinkishore commented on Feb 12, 2026

    @darinkishore
    CollaboratorAuthor

    Codebase audit — trace/ module status

    Files:

    • trace/mod.rs — module root, re-exports everything
    • trace/context.rs — task-local CURRENT_TRACE using tokio::task_local!, trace() wrapper function
    • trace/dag.rs — Graph, Node, NodeType, edge types
    • trace/executor.rs — Executor that replays a trace graph
    • trace/value.rs — TrackedValue, IntoTracked trait

    Usage: lib.rs exports pub mod trace and pub use trace::*. But nothing outside the trace module imports from it. The Predict::forward() code has no calls into trace recording.

    ProgramGraph from the design reference (docs/specs/modules/design_reference.md) was prototyped and intentionally removed — lib.rs docs say: "The type-erased ProgramGraph, DynModule, StrategyFactory layer was prototyped and intentionally removed."

    What "same semantics" means:
    The trace module captured a DAG of Predict invocations (inputs/outputs at each node). ProgramGraph was a structural graph (nodes = modules, edges = data flow between fields). They serve different purposes:

    • Trace = runtime execution record (what happened during a call)
    • ProgramGraph = structural description (how modules are wired together)

    Options:

    1. Revive trace/ for runtime recording — wire Predict::forward() to call record_node() when tracing is active. Migrate from Prediction/Example types to BamlValue/typed values. This gives you execution traces for debugging and optimizer data collection.
    2. Delete trace/ entirely — it's dead code. Runtime observability is handled by tracing crate spans (chore: add tracing #56). If you don't need DAG replay, the tracing spans are sufficient.
    3. Merge into the tracing story — use tracing spans for the execution DAG (custom span attributes for inputs/outputs/module names) instead of a separate recording system.

    Recommendation: option 3. The tracing crate already supports structured span hierarchies. A custom Layer impl could reconstruct the execution DAG from spans without maintaining a parallel recording system.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions