fix(plan-tune): shared accumulation JS as a quoted string, not a heredoc (heredoc pipe-deadlock guard)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
This commit is contained in:
garrytanandcapy-ai[bot] committed 2026-10-25 00:01:14 +00:00
1 parent 3e15ce2acb
commit 2e99f2468d
1 file changed
+3 -4
+3 -4
View File
@@ -414,7 +414,7 @@ do_gap() {
# and about eight sessions pinned it at 1.0 (#2623). A row without a
# session_id is its own session.
# -----------------------------------------------------------------------
ACCUMULATE_SIGNALS_JS=$(cat <<'JS'
ACCUMULATE_SIGNALS_JS='
function accumulateSignals(lines, QUESTIONS, SIGNAL_MAP, dims) {
let cap = 0;
for (const byChoice of Object.values(SIGNAL_MAP)) {
@@ -442,7 +442,7 @@ function accumulateSignals(lines, QUESTIONS, SIGNAL_MAP, dims) {
const deltas = (def && def.signal_key && SIGNAL_MAP[def.signal_key]?.[e.user_choice]) || [];
if (deltas.length === 0) continue;
signalEvents++;
const session = typeof e.session_id === 'string' && e.session_id ? e.session_id : 'row-' + count;
const session = typeof e.session_id === "string" && e.session_id ? e.session_id : "row-" + count;
const sums = sessions.get(session) || {};
sessions.set(session, sums);
for (const d of deltas) {
@@ -462,8 +462,7 @@ function accumulateSignals(lines, QUESTIONS, SIGNAL_MAP, dims) {
}
return { cap, totals, contributing, rows, capped, count, signalEvents, skills, qids, days };
}
JS
)
'
# -----------------------------------------------------------------------
# Derive: recompute inferred dimensions from question-events.jsonl