You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(lisp): surface catalog_ops on Step (#920) (#937)
* feat(lisp): surface catalog_ops on Step (#920)
`EvalContext` already collected per-call records for the PTC-Lisp
`catalog/` builtins (operation, args, outcome, reason, duration_ms)
via `append_catalog_op/2`, but nothing propagated them out of the
sandbox — `Step` had `tool_calls` and `pmap_calls` but no
`catalog_ops`, so the tracing data was dropped at execution boundary.
## Changes
* `Step` gains a `:catalog_ops` field of type `[catalog_op()]`.
`@type catalog_op` mirrors the EvalContext definition.
Default-constructed steps (`Step.ok/2`, `Step.error/*`) initialise
it to `[]`.
* `Lisp.apply_memory_contract/3` propagates
`Enum.reverse(ctx.catalog_ops)` into the success Step.
* The `error_with_ctx` branch in `Lisp.run/2` does the same for
programs that fail mid-execution.
Ordering is chronological (oldest first), matching how `tool_calls`
and `pmap_calls` are already surfaced.
## Tests
Four new cases in `test/catalog_builtins_test.exs`:
1. Single successful op produces one `:ok` record with args + duration
2. Multiple ops appear in chronological order
3. World fault produces `:nil_world_fault` record with reason atom
4. Programs without catalog calls expose `step.catalog_ops == []`
Full suite green: 4927 tests, 0 failures.
Closes#920
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* fix(lisp): propagate catalog_ops through merge, closures, and HOF stash
Fixes three context-propagation gaps identified in PR #937 review:
- EvalContext.merge/2: add catalog_ops to parallel branch merge (pmap/pcalls)
- execute_closure/4: carry caller_ctx.catalog_ops into closure context
- push/stash/pop_side_effects: include catalog_ops in HOF stash mechanism
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
0 commit comments