runtime: engram_edges_json — kill the whole-graph file round trip #127
Reference in New Issue
Block a user
Delete Branch "fix/elc-rebuildable-compiler-builtins"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
/api/graph/edgesanswered a read query by serializing the entire graph to disk (128 MB) and reading it back. Two defects in one line, both of which bit production tonight:~/.neuron/engram/snapshot.json— the engram's CANONICAL store. A read route overwriting the persistence owner's file. This had been fixed once (export moved to a scratch path); it came back when the hand-written dispatch block was replaced by@routedispatch and the unfixed copy survived the merge.Calling it tonight overwrote the canonical snapshot and immediately preceded an engram crash loop.
engram_edges_json(limit, offset)is the builtin that route's own TODO asked for — walksg->edgesdirectly, emits every persisted field, no file touched.limit <= 0defaults to 1000, not unbounded — this is the endpoint that fell over, and an unbounded default would preserve the failure mode under a new name.Registered in
codegen.el'sbuiltin_arity(plain +__) and wrapped inel_seed.cper the project's C-builtin recipe. Verified:elcrebuilds clean, soul amalgam regenerates and links./api/graph/edges answered a read query by calling engram_save() to serialize the ENTIRE graph to disk (128 MB) and then fs_read-ing it back. Two defects in one line, and both bit production on 2026-08-15: 1. The path it wrote was ~/.neuron/engram/snapshot.json — the engram server's CANONICAL store. A READ route overwriting the persistence owner's canonical file. This defect had been fixed once (export moved to a scratch path); it came back when the hand-written dispatch block was replaced by @route dispatch and the unfixed copy is the one that survived the merge. 2. Cost: a full snapshot write, a 128 MB read, and a parse of the whole graph, per request, to return a bounded slice. Calling it tonight overwrote the canonical snapshot and immediately preceded an engram crash loop. engram_edges_json(limit, offset) is the builtin that route's own TODO asked for ("Future: add an engram_edges_json() builtin and drop the file round trip entirely"). It walks g->edges directly and emits every persisted field. limit <= 0 defaults to 1000, not unbounded: this is the endpoint that fell over, and an unbounded default would preserve the failure mode under a new name. Callers page explicitly. Registered in codegen.el's builtin_arity (both plain and __ spellings) and wrapped in el_seed.c per the project's C-builtin recipe.