Skip to content

tools.gleam extraction + record_read fix + trace scaffolding#1

Merged
systemic-engineer merged 2 commits into
mainfrom
reed/gall-tools-extraction
Mar 2, 2026
Merged

tools.gleam extraction + record_read fix + trace scaffolding#1
systemic-engineer merged 2 commits into
mainfrom
reed/gall-tools-extraction

Conversation

@systemic-engineer
Copy link
Copy Markdown
Contributor

Summary

  • tools.gleam — extracts all 9 MCP tool schemas from daemon.gleam and mcp.gleam into a shared module. Both transports now import from tools.gleam.
  • record_read fixrecord_read was discarding the updated session (let _ = s2), so HEAD never advanced on reads. Fixed.
  • trace.gleam — BEAM-native telemetry scaffolding. [:gall, :tool, :call] / [:gall, :tool, :result] with metadata maps. Erlang FFI calls :telemetry.execute/3 with graceful fallback.

23 new tests (40 total). TDD arc: red then green.

Test plan

  • 40 tests passing locally
  • Existing session tests still pass
  • CI (needs wiring)

🤖 Generated with Claude Code

systemic-engineer and others added 2 commits March 2, 2026 01:42
RED phase: tests for tools.gleam extraction, trace.gleam scaffolding,
and record_read HEAD advancement bug. All fail because modules
don't exist yet.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Extract all tool schemas from daemon.gleam and mcp.gleam into
tools.gleam — single source of truth for tool names, descriptions,
and input schemas. daemon uses daemon_tools_json(), mcp uses
mcp_tools_json() (ADO-only, with name-required commit).

Fix record_read bug: session.act() was called but the updated
session s2 was discarded (`let _ = s2`), so HEAD never advanced
on @READ. Now s2 is propagated through Active state.

Add trace.gleam with BEAM-native telemetry scaffolding:
- Event names: [:gall, :tool, :call] and [:gall, :tool, :result]
- Metadata type with tool, path, sha, session_id, duration_ms
- Erlang FFI (gall_trace_ffi.erl) that calls :telemetry.execute/3
  or falls back to no-op

Format-only changes in gall.gleam, session.gleam, store.gleam,
gall_store_test.gleam from gleam format.

40 tests pass (17 original + 23 new).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@systemic-engineer systemic-engineer merged commit 443f458 into main Mar 2, 2026
1 check failed
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