fix(approvals): friendly case title (no 32-hex business_subject leaks)
build-and-publish / test (push) Has been cancelled
build-and-publish / image (push) Has been cancelled

Buyer-script audit showed queue row titles falling through to raw
case-key hex when business_subject was empty / set to the case key
itself. New friendlyCaseTitle helper:
- prefer display_name if not machine-shaped
- prefer business_subject if not machine-shaped
- else 'Case in <step name>'
- else 'Untitled case'

isMachineId catches 20+-char hex AND process_<timestamp> pattern.
This commit is contained in:
2026-06-14 17:18:29 +04:00
parent c2815b4f7f
commit fb7344584d
2 changed files with 32 additions and 3 deletions
+16 -2
View File
@@ -88,11 +88,25 @@ if (await btn.count() > 0) {
await p.waitForTimeout(3000);
}
const tail = (await p.locator("body").innerText()).toLowerCase();
const tailFindings = FORBIDDEN_PATTERNS.filter((f) => f.re.test(tail)).map((f) => f.name).slice(0, 3);
const tailFindings = FORBIDDEN_PATTERNS.filter((f) => f.re.test(tail)).map((f) => ({ name: f.name, sample: (tail.match(f.re) || [""])[0].slice(0, 80) })).slice(0, 3);
// Find where the 32-hex actually lives — was it the case-row title, the
// active-step body, the toast, or something else?
const hex32Loc = await p.evaluate(() => {
const re = /[a-f0-9]{32}/i;
const out = [];
document.querySelectorAll("*").forEach((el) => {
if (el.children.length > 0) return;
const t = (el.textContent || "").trim();
if (t && re.test(t)) {
out.push({ tag: el.tagName, cls: (el.className || "").toString().slice(0, 60), text: t.slice(0, 120) });
}
});
return out.slice(0, 5);
});
record(
"buyer_approvals_action_click_no_embarrassing_copy",
tailFindings.length === 0,
tailFindings.length ? `LEAK: ${tailFindings.join(", ")} (was disabled? ${isDisabled})` : `clean (disabled? ${isDisabled})`
tailFindings.length ? `LEAK [${tailFindings.map((f) => `${f.name}=${f.sample}`).join(", ")}] (disabled? ${isDisabled}) | sites: ${hex32Loc.map((h) => `${h.tag}.${h.cls}:"${h.text}"`).join(" || ")}` : `clean (disabled? ${isDisabled})`
);
}