Skip to content

trace: #traces notebook surface — Obj::Traces, tr[i], #trace/#lin/#project (#63) - #72

Merged
0xErgod merged 2 commits into
masterfrom
trace/63-notebook
Jul 5, 2026
Merged

0xErgod merged 2 commits into
masterfrom
trace/63-notebook

Conversation

@0xErgod

@0xErgod 0xErgod commented Jul 5, 2026

Copy link
Copy Markdown
Owner

Phase 6 — the user-facing surface for the trace toolkit. Builds on #59–#62.

What

crates/stratum-notebook/src/{eval,lib,script,service}.rs:

  • #traces <p> [bound=N] -> tr — enumerates the trace-set (stratum::lts::traces), renders the indexed list (render_traces), binds a new Obj::Traces { traces, truncated }.
  • tr[i] addressing — parse_index + resolve_trace resolve a name[i] handle against a #traces binding, with clean out-of-range / wrong-kind / unknown-name errors.
  • Single-trace verbs on a handle:
    • #trace tr[i] — the trace's partial order via render_trace (dir_trace now branches: an LTS name → sample run as before; a name[i] handle → trace detail).
    • #lin tr[i] — its linearizations, as label words.
    • #project tr[i] <a,b> — one agent's view (the events on those channels, induced order).
  • Obj::Traces arms added to the Rune bridge (script.rs → its size) and the inspector (service.rs); #help gains the four lines.

Supporting change in stratum-lts

Trace::project(keep) — keep the events satisfying keep under the induced causal order (a ≤ b in the projection iff a ≤ b in the original). Unit-tested.

Tests (acceptance)

Directive-level integration tests: #traces binds + lists (Obj::Traces); tr[0] selects and renders (diamond shows ∥); #lin reports 2 linearizations; #project a restricts to one event; out-of-range index and unknown handle both error cleanly (the eval never-panic contract).

fmt / clippy -D warnings / cargo test --workspace green locally.

Closes #63

0xErgod and others added 2 commits July 5, 2026 03:06
Phase 6 — the user-facing trace toolkit.

- `#traces <p> [bound=N] -> tr` enumerates the trace-set, renders the indexed
  list, and binds `Obj::Traces { traces, truncated }`.
- `tr[i]` addressing via `parse_index`/`resolve_trace`.
- Single-trace verbs on a handle:
  - `#trace tr[i]` — the trace's partial order (dir_trace now branches an
    LTS-sample vs a trace handle); `#lin tr[i]` — its linearizations;
    `#project tr[i] <a,b>` — one agent's view (via the new Trace::project).
- Obj::Traces arms added to the Rune bridge (script.rs) and inspector
  (service.rs); `#help` updated.

Adds `Trace::project` in stratum-lts (keep events on given channels, induced
causal order) with a unit test.

Tests: `#traces` binds + lists; `tr[0]` selects and renders (∥ for the
diamond); `#lin` counts linearizations; `#project a` restricts to one event;
out-of-range / unknown-handle errors are clean.

Refs #63

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Address review items:
- #project with no channels now errors with a usage message instead of
  silently yielding an empty trace.
- Add examples/traces.ipynb — a short worked notebook (diamond → one trace,
  #trace / #lin / #project, then a race → two traces), satisfying the #63
  acceptance criterion without touching the unrelated WIP example notebooks.

Refs #63

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@0xErgod
0xErgod merged commit e6522e6 into master Jul 5, 2026
3 checks passed
@0xErgod
0xErgod deleted the trace/63-notebook branch July 5, 2026 01:18
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.

trace: notebook wiring — #traces directive, Obj::Traces, tr[i] addressing

1 participant