fix(tunnelsafety): halo map labels so connector lines never slice through text

Node labels were placed at a fixed y-offset regardless of local edge
geometry, so hub nodes with multiple fanning segments (Market Junction,
South Gate) had connector lines running straight through the label glyphs.
Added a white stroke halo behind the text (the standard SVG technique for
legibility over crossing graph edges) - works regardless of exact layout
geometry, independent of how many lines converge on a given node.

Found via a real-browser visual audit (Playwright + a real vite dev server,
real seeded demo data) across all 13 mini-apps plus the home grid, admin
panel, and upload-mini-app flow at mobile and desktop widths - the only
genuine defect found. Confirmed fixed via before/after screenshots and
independently reproduced (including a zoomed A/B comparison) by a fresh
gate reviewer. Build, test (668/668), and lint all stay green.
This commit is contained in:
OmO Orchestrator committed 2026-11-19 20:40:57 -05:00
1 parent a76293523a
commit f7176520ac
2 files changed
+199

No files matched your search

+189
View File
@@ -0,0 +1,189 @@
// Visual glitch audit: drives the real dev server with a real Playwright
// browser, seeds demo data via the /admin panel (same "Load Hollow demo"
// flow as e2e/demoRecording.e2e.mjs), populates a few mini-apps with real
// activity so screens aren't empty-state only, then screenshots every
// mini-app screen plus the shell chrome at mobile and desktop widths for
// manual visual inspection. Not a pass/fail test - a capture tool.
import { chromium } from "playwright";
import { createServer as createViteServer } from "vite";
import { mkdirSync } from "node:fs";
import { dirname, resolve } from "node:path";
import { fileURLToPath } from "node:url";
const __dirname = dirname(fileURLToPath(import.meta.url));
const ROOT = resolve(__dirname, "..");
const SHOT_DIR = resolve(ROOT, ".omo/evidence/visual-audit");
mkdirSync(SHOT_DIR, { recursive: true });
const VITE_PORT = 48000 + Math.floor(Math.random() * 10000);
const APP_URL = `http://127.0.0.1:${VITE_PORT}`;
const MOBILE = { width: 390, height: 844 };
const DESKTOP = { width: 1280, height: 900 };
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
async function waitFor(fn, label, timeoutMs = 20000) {
const start = Date.now();
while (Date.now() - start < timeoutMs) {
const v = await fn();
if (v) return v;
await sleep(150);
}
throw new Error(`timeout waiting for: ${label}`);
}
const MINIAPPS = [
"Fair Share",
"Water Watch",
"Tunnel Safety",
"Housing",
"Assembly",
"Find Family",
"Health Post",
"Light Clock",
"Farms",
"Fair Draw",
"The Climb",
"Mentor",
"Sky",
];
async function shot(page, name, viewportLabel) {
const path = resolve(SHOT_DIR, `${name}-${viewportLabel}.png`);
await page.screenshot({ path, fullPage: true });
console.log(`shot: ${path}`);
return path;
}
async function gotoMiniapp(page, label) {
await page.goto(`${APP_URL}/`, { waitUntil: "load" });
await page.getByRole("grid", { name: "Miniapps" }).waitFor({ state: "visible" });
await page.getByRole("button", { name: label }).click();
await page.locator(`[aria-label="${label}"]`).first().waitFor({ state: "visible", timeout: 10000 });
await sleep(400);
}
async function main() {
const vite = await createViteServer({
root: ROOT,
configFile: resolve(ROOT, "vite.config.ts"),
logLevel: "warn",
server: { host: "127.0.0.1", port: VITE_PORT, strictPort: true },
});
await vite.listen();
const browser = await chromium.launch({ headless: true, args: ["--no-sandbox"] });
for (const [viewportLabel, viewport] of [["mobile", MOBILE], ["desktop", DESKTOP]]) {
console.log(`\n=== viewport: ${viewportLabel} (${viewport.width}x${viewport.height}) ===`);
const context = await browser.newContext({ viewport });
const page = await context.newPage();
// --- Seed demo data (same flow as demoRecording.e2e.mjs) ---
await page.goto(`${APP_URL}/admin`, { waitUntil: "load" });
await shot(page, "admin-before-seed", viewportLabel);
await page.getByRole("button", { name: "Load Hollow demo" }).click();
await waitFor(
async () => (await page.getByTestId("demo-load-status").textContent())?.trim().length > 0,
"demo seed load status",
);
await sleep(500);
await shot(page, "admin-after-seed", viewportLabel);
// --- Home grid + wallet card ---
await page.goto(`${APP_URL}/`, { waitUntil: "load" });
await page.getByRole("grid", { name: "Miniapps" }).waitFor({ state: "visible" });
await sleep(300);
await shot(page, "home-grid", viewportLabel);
// --- Upload-a-mini-app flow ---
await page.getByRole("button", { name: "+ Upload a mini-app" }).click();
await sleep(300);
await shot(page, "upload-miniapp-empty", viewportLabel);
await page.getByLabel("Mini-app name").fill("Counter Widget");
await page.getByLabel("Icon (emoji or data URI)").fill("\uD83C\uDF31");
await page.getByLabel("Entry point").fill("index.html");
await page.getByLabel("ledger.read").check();
await page.setInputFiles("#upload-html-file", {
name: "index.html",
mimeType: "text/html",
buffer: Buffer.from("<html><body><p>Counter Widget</p></body></html>"),
});
await sleep(200);
await shot(page, "upload-miniapp-filled", viewportLabel);
await page.getByRole("button", { name: "Upload mini-app" }).click();
await page.getByTestId("upload-success").waitFor();
await shot(page, "upload-miniapp-success", viewportLabel);
// --- Populate a few mini-apps with real activity so screens aren't empty-state only ---
// Water Watch: report two corroborating readings (honesty-anchor chain)
await gotoMiniapp(page, "Water Watch");
await shot(page, "water-watch-initial", viewportLabel);
async function reportReading(sensorId, value) {
await page.getByTestId("report-reading-sensor").fill(sensorId);
await page.getByTestId("report-reading-value").fill(String(value));
await page.getByTestId("report-reading-submit").click();
await waitFor(
async () => !(await page.getByTestId("report-reading-status").textContent())?.includes("Submitting..."),
`submit ${sensorId}=${value} settles`,
);
}
await reportReading("sensor-A", 7);
await reportReading("sensor-A", 50);
await reportReading("sensor-B", 7);
await reportReading("sensor-B", 55);
await waitFor(
async () => (await page.getByTestId("device-monitor-status-light-pH").getAttribute("data-state")) === "alert",
"pH channel reaches alert",
);
await sleep(300);
await shot(page, "water-watch-populated", viewportLabel);
// Fair Share: should now reflect the re-solved allocation
await gotoMiniapp(page, "Fair Share");
await waitFor(async () => {
const text = await page.getByTestId("tile-water-allocation").textContent();
return text !== null && text.trim().length > 0 && text !== "No allocation yet";
}, "Fair Share water tile shows allocation");
await sleep(300);
await shot(page, "fair-share-populated", viewportLabel);
// Fair Draw: run a real commit -> reveal -> verify cycle
await gotoMiniapp(page, "Fair Draw");
await shot(page, "fair-draw-initial", viewportLabel);
await page.getByRole("button", { name: "Start Draw" }).click();
await page.getByRole("button", { name: "Reveal" }).click();
await waitFor(
async () => (await page.getByTestId("reveal-draw-badge").getAttribute("data-state")) !== null,
"Fair Draw reveal badge renders",
);
await sleep(300);
await shot(page, "fair-draw-populated", viewportLabel);
// --- Remaining mini-apps: visit + screenshot as-is (post-seed state) ---
for (const label of MINIAPPS) {
if (["Water Watch", "Fair Share", "Fair Draw"].includes(label)) continue;
const slug = label.toLowerCase().replace(/\s+/g, "-");
try {
await gotoMiniapp(page, label);
await sleep(400);
await shot(page, `miniapp-${slug}`, viewportLabel);
} catch (e) {
console.error(`FAILED to capture ${label}: ${e.message}`);
}
}
await context.close();
}
await browser.close();
await vite.close();
console.log(`\nAll screenshots saved under ${SHOT_DIR}`);
}
main().catch((e) => {
console.error("FATAL", e);
process.exitCode = 1;
});
@@ -70,6 +70,16 @@
font-size: 6px;
fill: var(--color-ink);
text-anchor: middle;
/* Hub nodes (e.g. Market Junction, South Gate) have segment lines
* fanning out in multiple directions right through the fixed label
* offset below the node - a white halo keeps the label legible instead
* of letting a crossing line visually slice through the text (visual
* QA finding, plan todo 58 follow-up). paint-order draws the stroke
* first so the solid fill still sits cleanly on top of it. */
paint-order: stroke;
stroke: #ffffff;
stroke-width: 3px;
stroke-linejoin: round;
}
.routeSummary {