routes: @route dispatch conversion + latent Bool/String crash fixes (clean re-merge) #157

Merged
will.anderson merged 2 commits from merge-pr151-v2 into main 2026-08-15 23:46:36 +00:00
Owner

Re-does PR #151's merge clean off current main. Real conflicts:

  • memory.el, neuron-api.el: main independently fixed a real crash since #151 branched — engram_save returns Int (1/0), not Bool; calling it as Bool SIGSEGVs on a SUCCESSFUL save via EL_CSTR(1) (issue #150). Kept main's Int-checking version at both call sites.
  • routes.el handle_request: kept main's write-through flush wrapper (neuron#117 — guarantees wt_drain() runs on every return path, not just some) around #151's new @route-table dispatch.
  • routes.el fallback dispatch: main had grown a large hand-written if/else block since #151 branched, all needing @route conversion. Verified line-by-line: every path in it is already covered by an @route-decorated handler elsewhere in the file EXCEPT ONE — /api/neuron/audit/structural, whose handler lives in neuron-api.el (out of file, so the @route conversion missed it). Kept that one route explicit; deleted the rest of the dead fallback tree per #151's intent.
  • dist/soul.c: left as-is, real regen comes with #154 next.

Verified: routes.el/memory.el/neuron-api.el all parse clean through the real elc.

Re-does PR #151's merge clean off current main. Real conflicts: - memory.el, neuron-api.el: main independently fixed a real crash since #151 branched — engram_save returns Int (1/0), not Bool; calling it as Bool SIGSEGVs on a SUCCESSFUL save via EL_CSTR(1) (issue #150). Kept main's Int-checking version at both call sites. - routes.el handle_request: kept main's write-through flush wrapper (neuron#117 — guarantees wt_drain() runs on every return path, not just some) around #151's new @route-table dispatch. - routes.el fallback dispatch: main had grown a large hand-written if/else block since #151 branched, all needing @route conversion. Verified line-by-line: every path in it is already covered by an @route-decorated handler elsewhere in the file EXCEPT ONE — /api/neuron/audit/structural, whose handler lives in neuron-api.el (out of file, so the @route conversion missed it). Kept that one route explicit; deleted the rest of the dead fallback tree per #151's intent. - dist/soul.c: left as-is, real regen comes with #154 next. Verified: routes.el/memory.el/neuron-api.el all parse clean through the real elc.
will.anderson added 2 commits 2026-08-15 23:46:12 +00:00
routes: convert manual dispatch to @route + fix latent Bool/String crashes
Neuron Soul CI / build (pull_request) Failing after 45s
Neuron Soul CI / deploy (pull_request) Failing after 10m28s
a5f411e739
Convert routes.el from ~89 hand-written dispatch branches to 75 @route-decorated
handlers with VBD roles (@manager/@accessor/@utility), driven by the modular
compiler's native @route dispatch. routes.elh updated to match.

Fix four latent bugs that the modular compiler surfaces (unlike the old inlining
compiler, it faithfully emits every source statement, so per-module compilation
no longer silently drops code):
  - safety.el: malformed soft-phrases literal (extra unescaped quote)
  - sessions.el: str_replace quote arg + topic_tags JSON escaping
  - memory.el mem_save and neuron-api.el consolidate: engram_save returns a Bool,
    not a String; str_eq(result, "") dereferenced the Bool value (0x1) as a char*,
    segfaulting the awareness loop on boot and POST /api/neuron/consolidate.
    Check it as a Bool (if !save_result). The old compiler dropped these checks,
    masking the bug in the shipped dist/soul.c.

Regenerate dist/soul.c through the bounded per-module path (modular elc per module
plus amalgamation that embeds dist/elp-c-decls.h), never by folding soul.el through
elc (27GB OOM). Verified on a throwaway snapshot and port: boots with the awareness
loop active and no segfault, @route dispatch matches the manual dispatcher across
all sampled routes and the four shadowing-hazard pairs, and consolidate returns 200.
Merge remote-tracking branch 'origin/pr/151' into HEAD
Neuron Soul CI / build (pull_request) Has been cancelled
Neuron Soul CI / deploy (pull_request) Has been cancelled
a0c0403b78
# Conflicts:
#	dist/soul.c
#	memory.el
#	neuron-api.el
#	routes.el
will.anderson merged commit d105360cce into main 2026-08-15 23:46:36 +00:00
Sign in to join this conversation.