Skip to content

Commit a51d04f

Browse files
Neural header counts maps the way the status line does (#262)
The header said MAPS 4 beside 6 maps in the status line, from two different counts. The header now uses the shared note count. Also pinned that the Biggest gap line names the list's first pair; that finding did not reproduce.
1 parent f6ec0f1 commit a51d04f

3 files changed

Lines changed: 44 additions & 1 deletion

File tree

‎src/view/30-interact.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,7 @@
653653
if (!neural()) return;
654654
const n = st.selected && byId[st.selected];
655655
$(".vg-hud-title").innerHTML = `<b>VAULT // NEURAL MAP</b><span>${esc(DATA.vault || "").toUpperCase()} · ${esc(DATA.date)} · ${st.vision.toUpperCase()}</span>` +
656-
`<span>NOTES ${VGRules.noteCounts(active).notes} · LINKS ${visLinks.filter(l => l.kind === "link").length} · LOBES ${DATA.clusters.length} · MAPS ${mocs.length} ${(b => b ? " · BRIDGES " + b : "")(nodes.filter(n => n.bridge).length)}</span>` + (st.three && glOn() ? `<span>LIF NETWORK · 80/20 E/I · ${neuroRate().toFixed(1)} HZ · ×1/${NEURO_SLOW} SPEED</span>` : "");
656+
`<span>NOTES ${VGRules.noteCounts(active).notes} · LINKS ${visLinks.filter(l => l.kind === "link").length} · LOBES ${DATA.clusters.length} · MAPS ${VGRules.noteCounts(active).maps}${(b => b ? " · BRIDGES " + b : "")(nodes.filter(n => n.bridge).length)}</span>` + (st.three && glOn() ? `<span>LIF NETWORK · 80/20 E/I · ${neuroRate().toFixed(1)} HZ · ×1/${NEURO_SLOW} SPEED</span>` : "");
657657
const p = n && P.get(n.id);
658658
$(".vg-hud-tele").innerHTML = n ? `<b>TARGET ▸ ${esc(n.name.toUpperCase())}</b>` +
659659
`<span>LOBE ${esc(clusterName(n.cluster).toUpperCase())}</span>` +

‎tests/test_gap_toast_first.js‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env node
2+
// The "Biggest gap" line on the graph names the same pair as the first row of the Biggest gaps list (Neural persona, 0.6.249:
3+
// the line said Rental App and Infrastructure, the list started with Infrastructure and Plan · Marketing).
4+
// node tests/test_gap_toast_first.js exit 0 = pass
5+
const { sleep, checks, finish, openPage } = require("./kit"), env = require("./env");
6+
const { fails, ok: check } = checks();
7+
const D = "window.vaultGraph._debug";
8+
(async () => {
9+
const tab = await openPage({ html: env.pageWith("", env.data()) });
10+
try {
11+
if (!await tab.waitFor(`window.vaultGraph && ${D} ? 1 : 0`, 30000)) throw new Error("the graph didn't mount");
12+
await sleep(1500);
13+
await tab.ev(`${D}.openView("neural")`); await sleep(1500);
14+
const today = await tab.ev(`(() => { const e = document.querySelector(".vg-today"); return e ? e.textContent : ""; })()`);
15+
const first = await tab.ev(`(() => { const e = document.querySelector("[data-panel=insights] .vg-gap"); return e ? e.textContent : ""; })()`);
16+
check(/Biggest gap/.test(today), "the graph shows a Biggest gap line (the test can't fail without it): " + today.slice(0, 60));
17+
check(first.length > 0, "the Insights list has gap rows (the test can't fail without them)");
18+
const pair = (today.match(/Biggest gap:\s*(.+?)\s*↔\s*(.+?)\s*·/) || []).slice(1, 3);
19+
check(pair.length === 2 && pair.every(n => first.includes(n)), `the line (${pair.join(" ↔ ")}) names the list's first pair: ${first.slice(0, 80)}`);
20+
} finally { await tab.close(); }
21+
finish(fails, "the Biggest gap line and the list agree");
22+
})().catch(e => { console.error(e); process.exit(1); });

‎tests/test_neural_maps_count.js‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env node
2+
// Neural view: the header's MAPS count is the same number the status line gives as "N maps" (bewildered persona, 0.6.249: MAPS 4 beside 6 maps).
3+
// node tests/test_neural_maps_count.js exit 0 = pass
4+
const { sleep, checks, finish, openPage } = require("./kit"), env = require("./env");
5+
const { fails, ok: check } = checks();
6+
const D = "window.vaultGraph._debug";
7+
(async () => {
8+
const tab = await openPage({ html: env.pageWith("", env.data()) });
9+
try {
10+
if (!await tab.waitFor(`window.vaultGraph && ${D} ? 1 : 0`, 30000)) throw new Error("the graph didn't mount");
11+
await sleep(1500);
12+
await tab.ev(`${D}.openView("neural")`); await sleep(1500);
13+
const hdr = await tab.ev(`[...document.querySelectorAll("span")].filter(s => /LOBES/.test(s.textContent) && s.children.length === 0).map(s => s.textContent).join(" ")`);
14+
const bar = await tab.ev(`(document.querySelector(".vg-status") || {}).textContent || ""`);
15+
const head = (hdr.match(/MAPS\s*(\d+)/) || [])[1], stat = (bar.match(/(\d+) maps?\b/i) || [])[1];
16+
check(!!head, "the Neural header shows MAPS n (the test can't fail without it)");
17+
check(!!stat, "the status line shows N maps (the test can't fail without it)");
18+
check(head === stat, `header MAPS ${head} vs status ${stat} maps`);
19+
} finally { await tab.close(); }
20+
finish(fails, "the header and the status count the same maps");
21+
})().catch(e => { console.error(e); process.exit(1); });

0 commit comments

Comments
 (0)