Skip to content

Sequential pipeline emits invalid JSON: unterminated "broker" on ASYNC_CALLS edges, raw non-JSON Route properties #898

Description

@kriswill

Version: codebase-memory-mcp 0.8.1 (built from source)
Platform: macOS (Apple Silicon) · Install channel: Built from source · Binary variant: standard

What happened, and what did you expect?

Two JSON-emission bugs in pass_calls.c (the sequential pipeline path — small repos; the parallel path is correct):

  1. The ASYNC_CALLS edge props format closes the method field with a quote but not broker, producing "broker":"bullmq}. The fixup block beneath it only repairs the truncation case (props[plen-1] != '}'), which never fires in the normal case — so every brokered ASYNC_CALLS edge gets malformed properties.
  2. create_svc_route_node stores the raw method/broker string as the Route node's properties (e.g. literally bullmq instead of {"broker":"bullmq"}).

Consequence: any json_extract over those rows errors — including the edges generated columns (local_name_gen, the url_path index), so index-backed queries over such edges can fail, and PRAGMA quick_check (which recomputes generated columns) aborts with malformed JSON instead of completing. The parallel path's build_service_route / emit_http_async_service_edge handle both correctly, so the two pipelines produce different bytes for the same input.

Expected: the sequential path emits the same valid JSON as the parallel path.

Reproduction

Index this snippet as a small repo (small file counts take the sequential path):

const { Queue } = require("bullmq");
const mailQueue = new Queue("mail");
async function notify() { await mailQueue.add("welcome-email", {}); }

Then:

SELECT count(*) FROM edges WHERE json_valid(properties)=0;  -- expect >= 1
SELECT count(*) FROM nodes WHERE json_valid(properties)=0;  -- expect >= 1 (Route nodes)
PRAGMA quick_check;  -- aborts: "malformed JSON"

Observed field values: edges with {"callee":"mailQueue.add","url_path":"welcome-email","broker":"bullmq} and Route nodes whose properties column is the bare string bullmq.

Cascade

Found while root-causing #895/#896: a quick_check-based integrity gate (the natural fix for #895) trips over these rows, so this needs fixing first or the gate must tolerate non-corruption quick_check aborts — otherwise projects with brokered async calls would re-index into the same state repeatedly. Companion: #897.

Maintainer note

I have a working private fix for this (with reproduce-first regression tests) that I can submit as a PR. Before I do, I'd prefer you groom this issue — confirm the framing, tag, and prioritize — so the PR lands against an agreed shape.

Confirmations

  • I searched existing issues and this is not a duplicate.
  • My reproduction uses shareable code (a dummy snippet or a public OSS repository), not proprietary code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions