fix: final review pass — email collision, orphaned-run loop, null confidence guards

- changeEmail validates and refuses an address another account owns (users.email is UNIQUE; a collision was a 500 inside the settings form).
- /app/[id] no longer redirects a 'running' row to itself; it renders what exists and says the run was interrupted.
- ScoreBar / OptionRow / VerdictBlock survive null numbers from the model instead of throwing and losing the block (seen live: '[openui] runtime/render-error: Component ScoreBar render failed').
- drop the ad-hoc render-debug scripts now that Playwright covers the browser.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
ahmed mohammed
2026-09-22 09:10:29 +03:00
co-authored by Claude Opus 4.7
parent 07dd3d6bf8
commit 5160a00db5
12 changed files with 101 additions and 80 deletions
-24
View File
@@ -1,24 +0,0 @@
import { chromium } from "@playwright/test";
const b = await chromium.launch();
const page = await (await b.newContext()).newPage();
page.on("console", (m) => console.log("QAI console", m.type(), m.text().slice(0, 200)));
page.on("pageerror", (e) => console.log("QAI pageerror", String(e).slice(0, 300)));
await page.goto("http://localhost:3000/signup");
await page.fill("#email", `dbg4328+${Date.now()}@qai.test`);
await page.fill("#password", "playwright password");
await page.getByRole("button", { name: "Create account" }).click();
await page.waitForTimeout(3000);
console.log("QAI url after signup", page.url());
console.log("QAI body after signup", (await page.locator("body").innerText()).replace(/\n+/g, " | ").slice(0, 260));
console.log("QAI cookie", (await page.context().cookies()).map(c=>c.name+"="+c.value.slice(0,8)).join(","));
await page.getByRole("link", { name: "Next" }).click();
await page.waitForTimeout(2000);
await page.fill("#analyst_base_url", "http://192.168.88.131:8888/v1");
await page.fill("#analyst_key", "EMPTY");
await page.fill("#analyst_model", "qwen3.8-flash-next");
await page.fill("#jev_key", "ts-test-key");
await page.getByRole("button", { name: "Save" }).click();
await page.waitForTimeout(4000);
console.log("QAI url after save", page.url());
console.log("QAI body", (await page.locator("body").innerText()).replace(/\n+/g, " | ").slice(0, 320));
await b.close();
-27
View File
@@ -1,27 +0,0 @@
import { chromium } from "@playwright/test";
const ID = process.argv[2] ?? "660dd007-cc6f-4644-a57b-9c32a012e60a";;
const b = await chromium.launch();
const ctx = await b.newContext();
await ctx.addCookies([{ name: "qai_s", value: "tokAPI", url: "http://localhost:3117" }]);
const page = await ctx.newPage();
const errs = [];
page.on("pageerror", (e) => errs.push(String(e.message).slice(0, 140)));
await page.goto(`http://localhost:3117/app/${ID}`, { waitUntil: "domcontentloaded" });
await page.waitForSelector("#report", { timeout: 25000 });
const q = async (sel) => page.locator(sel).count();
console.log("QAI report", await q("#report"), "cards", await q("#report .card"), "sql blocks", await q("#report pre.sql"),
"copy buttons", await q("#report button"), "tables", await q("#report table"), "bars", await q("#report .bar"),
"verdict", await q("[data-verdict]"), "metrics", await q(".grid-metrics .card"));
console.log("QAI headline", (await page.locator("#report h2").first().textContent())?.slice(0, 90));
console.log("QAI console errors", errs.length, errs.slice(0, 2));
for (const w of [320, 375, 414, 768]) {
await page.setViewportSize({ width: w, height: 800 });
await page.waitForTimeout(250);
const over = await page.evaluate(() => document.documentElement.scrollWidth - document.documentElement.clientWidth);
console.log(`QAI ${w}px overflow ${over}`);
}
await page.setViewportSize({ width: 1280, height: 900 });
await page.emulateMedia({ media: "print" });
console.log("QAI print rail hidden", await page.locator(".rail").isHidden(), "toolbar hidden", await page.locator(".toolbar").first().isHidden(),
"body bg", await page.evaluate(() => getComputedStyle(document.body).backgroundColor));
await b.close();
-13
View File
@@ -1,13 +0,0 @@
import { chromium } from "@playwright/test";
const ID = process.argv[2];
const PORT = process.argv[3] ?? "3117";
const b = await chromium.launch();
const ctx = await b.newContext();
await ctx.addCookies([{ name: "qai_s", value: "tokAPI", url: `http://localhost:${PORT}` }]);
const page = await ctx.newPage();
page.on("console", (m) => { if (m.type() === "error") console.log("QAI console", m.text().slice(0, 400)); });
page.on("pageerror", (e) => console.log("QAI pageerror", String(e).slice(0, 500)));
await page.goto(`http://localhost:${PORT}/app/${ID}`, { waitUntil: "load" });
await page.waitForTimeout(6000);
console.log("QAI report count", await page.locator("#report").count());
await b.close();