fix(routes): /api/graph/edges must not write the canonical snapshot #161

Merged
will.anderson merged 1 commits from fix/graph-edges-no-canonical-clobber into main 2026-08-16 01:45:00 +00:00
Owner

This route called engram_save() over ~/.neuron/engram/snapshot.jsonthe engram server's canonical store — then read it back, to answer a read query.

It was a regression introduced tonight. The defect had been fixed once (export moved to a scratch path). In the @route dispatch conversion (#157), the hand-written dispatch block held the fixed version and the @route-decorated copy held the unfixed one — the merge kept the decorated copy. Calling the endpoint afterward overwrote the canonical snapshot and immediately preceded an engram crash loop.

Now calls engram_edges_json(limit, offset) (el#127) — the builtin this route's own TODO asked for — reading g->edges directly. No file is written or read. Bounded by default (limit 1000, offset supported), so the unbounded whole-graph read that fell over isn't reachable by default.

Verified: the same request that previously rewrote snapshot.json now leaves it byte-identical (sha256 unchanged before/after) and returns real edge records with every persisted field.

This route called `engram_save()` over `~/.neuron/engram/snapshot.json` — **the engram server's canonical store** — then read it back, to answer a **read** query. **It was a regression introduced tonight.** The defect had been fixed once (export moved to a scratch path). In the `@route` dispatch conversion (#157), the hand-written dispatch block held the *fixed* version and the `@route`-decorated copy held the *unfixed* one — the merge kept the decorated copy. Calling the endpoint afterward overwrote the canonical snapshot and immediately preceded an engram crash loop. Now calls `engram_edges_json(limit, offset)` (el#127) — the builtin this route's own TODO asked for — reading `g->edges` directly. **No file is written or read.** Bounded by default (limit 1000, offset supported), so the unbounded whole-graph read that fell over isn't reachable by default. **Verified:** the same request that previously rewrote `snapshot.json` now leaves it byte-identical (sha256 unchanged before/after) and returns real edge records with every persisted field.
will.anderson added 1 commit 2026-08-16 01:15:24 +00:00
fix(routes): /api/graph/edges must not write the canonical snapshot
Neuron Soul CI / build (pull_request) Failing after 13m44s
Neuron Soul CI / deploy (pull_request) Has been skipped
cf154387ce
This route called engram_save() over ~/.neuron/engram/snapshot.json — the
engram server's CANONICAL store — then fs_read it back, to answer a READ
query. A read route overwriting the persistence owner's file.

This defect was fixed once before (export redirected to a scratch path). It
came back tonight in the @route dispatch conversion: the hand-written dispatch
block held the FIXED version, the @route-decorated copy held the unfixed one,
and the merge kept the decorated copy. Calling the endpoint afterward
overwrote the canonical snapshot and immediately preceded an engram crash.

Now calls engram_edges_json(limit, offset) — the builtin the route's own TODO
asked for — which reads g->edges directly. No file is written or read.
Bounded: limit defaults to 1000, offset supported, so the whole-graph read
that fell over is not reachable by default.

Verified: same request that previously rewrote snapshot.json now leaves it
byte-identical (sha256 unchanged before/after), and returns real edge records
with every persisted field.
will.anderson merged commit 97bf91739e into main 2026-08-16 01:45:00 +00:00
Sign in to join this conversation.