AI Engineering Workspace
PartialChat, files, terminal and preview in one place. Chat sessions run on a durable Postgres-backed queue (chat only: no tools or shell). Live models need an API key; the terminal is unavailable.
Project files
read-onlyapp/qa/acceptance.mjs
1// Owner Acceptance Center: protection, owner-only decisions, bug reports, screenshots. Fixture rows are removed afterwards.2import fs from "node:fs"; import os from "node:os"; import path from "node:path"; import pg from "pg"; import { chromium } from "playwright";3const CFG = path.join(os.homedir(), ".config/zoo-cloud-studio"); const BASE = "https://127.0.0.1:8443"; const tok = fs.readFileSync(path.join(CFG, "admin-token"), "utf8").trim(); const out = path.resolve("../design/screenshots"); const O = { origin: BASE };4const owner = new pg.Pool({ connectionString: `postgres://studio:${encodeURIComponent(fs.readFileSync(path.join(CFG, "pg-password"), "utf8").trim())}@127.0.0.1:5432/studio`, max: 1 });5const results = []; const rec = (n, ok, d = "") => { results.push({ name: n, ok: !!ok }); console.log((ok ? "PASS " : "FAIL ") + n + (ok ? "" : " -> " + d)); };6const b = await chromium.launch();7const anon = await b.newContext({ ignoreHTTPSErrors: true, baseURL: BASE });8rec("anonymous API access to acceptance is refused", [401, 403].includes((await anon.request.get("/api/acceptance")).status()));9rec("anonymous write refused", [401, 403].includes((await anon.request.post("/api/acceptance", { data: { action: "decide", moduleKey: "D20", status: "accepted" }, headers: O })).status()));10const ap = await anon.newPage(); await ap.goto("/superadmin/acceptance", { waitUntil: "networkidle" }); rec("anonymous page shows sign-in and no acceptance data or decision controls", await (async () => { const c = await ap.content(); return /Sign in/.test(c) && !c.includes("Awaiting owner acceptance") && !c.includes("Report a bug") && !c.includes("Integration health"); })());11try {12 for (const [name, vp] of [["desktop", { width: 1440, height: 900 }], ["tablet", { width: 820, height: 1100 }], ["mobile", { width: 390, height: 844 }]]) {13 const ctx = await b.newContext({ viewport: vp, ignoreHTTPSErrors: true, baseURL: BASE }); const r = await ctx.request.post("/api/auth/login", { data: { token: tok }, headers: O }); if (!r.ok()) throw new Error("login " + r.status());14 const pg2 = await ctx.newPage(); await pg2.goto("/superadmin/acceptance", { waitUntil: "networkidle" }); await pg2.waitForSelector("text=Owner Acceptance Center");15 if (name === "desktop") {16 rec("page lists modules with automated state and awaiting-owner badges", (await pg2.locator("details").count()) >= 15 && (await pg2.content()).includes("Awaiting owner acceptance"));17 rec("nothing is Accepted before the owner decides", !(await pg2.content()).includes("Accepted by owner"));18 await pg2.locator("details", { hasText: "Zloud Brand" }).locator("summary").click(); await pg2.getByRole("button", { name: "Accept" }).first().click(); await pg2.waitForTimeout(800);19 const row = (await owner.query("SELECT status,updated_by FROM acceptance WHERE module_key='D20'")).rows[0]; rec("owner pressing Accept records the decision with their identity", row?.status === "accepted" && row.updated_by);20 const bug = await ctx.request.post("/api/acceptance", { data: { action: "bug", title: "QA fixture bug", severity: "minor" }, headers: O }); rec("bug report can be filed", bug.ok());21 rec("invalid module / status refused", (await ctx.request.post("/api/acceptance", { data: { action: "decide", moduleKey: "NOPE", status: "accepted" }, headers: O })).status() === 422 && (await ctx.request.post("/api/acceptance", { data: { action: "decide", moduleKey: "D20", status: "hacked" }, headers: O })).status() === 422);22 rec("cross-origin decision refused", (await ctx.request.post("/api/acceptance", { data: { action: "decide", moduleKey: "D20", status: "accepted" }, headers: { origin: "https://evil.example" } })).status() === 403);23 await owner.query("DELETE FROM acceptance WHERE module_key='D20'"); await owner.query("DELETE FROM acceptance_bugs WHERE title='QA fixture bug'"); await pg2.reload({ waitUntil: "networkidle" });24 }25 const ov = await pg2.evaluate(() => document.documentElement.scrollWidth > innerWidth + 1); rec(`${name}: no horizontal overflow on the acceptance page`, !ov);26 await pg2.screenshot({ path: path.join(out, `acceptance-center-${name}.png`), fullPage: true });27 const lp = await ctx.newPage(); await lp.goto("/", { waitUntil: "networkidle" }); rec(`${name}: landing page shows Zloud brand and tagline`, (await lp.content()).includes("Deploy Everywhere") && (await lp.title()).includes("Zloud")); rec(`${name}: no horizontal overflow on landing`, !(await lp.evaluate(() => document.documentElement.scrollWidth > innerWidth + 1)));28 await lp.screenshot({ path: path.join(out, `zloud-landing-${name}.png`), fullPage: false });29 await ctx.request.post("/api/auth/logout", { headers: O }).catch(() => {}); await ctx.close();30 }31 const lc = await b.newContext({ viewport: { width: 390, height: 844 }, ignoreHTTPSErrors: true, baseURL: BASE }); const lp = await lc.newPage(); await lp.goto("/login", { waitUntil: "networkidle" }); await lp.screenshot({ path: path.join(out, "zloud-login-mobile.png") });32 const pwb = await lp.getByRole("tab", { name: /E-mail/ }).click().then(() => true); const live = await lc.request.post("/api/auth/login", { data: { email: "belayetriadbd@gmail.com", password: "x".repeat(20) }, headers: O });33 rec("PUBLIC site: owner password sign-in is refused while TLS is untrusted", live.status() === 403, String(live.status()));34} finally { await owner.end(); await b.close(); }35const f = results.filter(r => !r.ok); console.log(`${results.length - f.length}/${results.length} acceptance checks passed`);36fs.writeFileSync("../design/verification/acceptance.json", JSON.stringify({ at: new Date().toISOString(), total: results.length, passed: results.length - f.length, results }, null, 1)); process.exit(f.length ? 1 : 0);37
Conversation
PartialSign in to start AI sessions.
Task checklist
- Application shell deployed
- Persistent projects
- Agent runtime
- Sandboxed terminal
Execution activity
No agent sessions. Git HEAD 692573d on master.
Approval requests
None pending.