Q165: the company's profile and how it runs can be changed after onboarding

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ZacharyZhang-NYandClaude Opus 5.5 committed 2026-10-09 03:20:39 -04:00
1 parent 93c5eb2d71
commit 20c37362f3
15 files changed
+208 -37

No files matched your search

+12
View File
@@ -76,6 +76,18 @@ test("the pinned CEO conversation is the Messages front door", async () => {
await page.getByRole("button", { name: "Settings" }).click();
await expect(page.getByRole("note").filter({ hasText: "Applies to FlowPilot only." })).toBeVisible();
await expect(page.getByRole("note").filter({ hasText: "Applies to every company in this app." })).toBeVisible();
// How the company runs can be changed after onboarding.
const editCompany = async (mode: string, autoHires: boolean) => {
await page.getByRole("button", { name: "Edit company" }).click();
await page.getByLabel("Who runs the work").selectOption(mode);
await page.getByLabel("Auto-approve hires").setChecked(autoHires);
await page.getByRole("button", { name: "Save" }).click();
};
await editCompany("ai_cofounder", false);
await expect(page.getByText("AI Co-Founder", { exact: true })).toBeVisible();
await expect(page.getByText("Hires require approval")).toBeVisible();
await editCompany("ai_ceo", true);
await expect(page.getByText("AI CEO", { exact: true })).toBeVisible();
// A goal's pace is measured against its target date; without one, no pace is claimed.
await page.getByRole("button", { name: "Home" }).click();
+30
View File
@@ -0,0 +1,30 @@
import { randomUUID } from "node:crypto";
import { tmpdir } from "node:os";
import { join } from "node:path";
import { describe, expect, test } from "vitest";
import { DatabaseConnection } from "../../src/main/database/connection";
import { OrganizationService } from "../../src/main/services/organization-service";
describe("company settings after onboarding", () => {
test("the profile and how the company runs can be changed later, and each change is audited", () => {
const connection = new DatabaseConnection(join(tmpdir(), `ac-org-update-${randomUUID()}.db`));
const organization = new OrganizationService(connection.db);
let orgId = "";
connection.transaction(() => {
orgId = organization.createOrganization({ organizationName: "Acme", employeeName: "Yang", mission: "m", goal: "g" });
});
const update = (change: Partial<{ name: string; executionMode: "ai_ceo" | "ai_cofounder" }>) => connection.transaction(() => organization.updateOrganization({
orgId, name: "Acme Labs", description: "Analytics for CSMs.", mission: "Keep customers.", goal: "Ship the MVP.",
executionMode: "ai_cofounder", autoApproveHires: false, reviewDeliverables: true, ...change,
}));
update({});
expect(connection.db.prepare("select name, description, mission, goal, execution_mode, auto_approve_hires, review_deliverables from organizations where id = ?").get(orgId))
.toEqual({ name: "Acme Labs", description: "Analytics for CSMs.", mission: "Keep customers.", goal: "Ship the MVP.", execution_mode: "ai_cofounder", auto_approve_hires: 0, review_deliverables: 1 });
const audit = connection.db.prepare("select payload_json from audit_events where entity_type = 'organization' and action = 'updated' order by rowid desc limit 1").get() as { payload_json: string };
expect(JSON.parse(audit.payload_json).changed).toEqual(expect.arrayContaining(["name", "executionMode", "reviewDeliverables"]));
expect(() => update({ name: " " })).toThrow("The company needs a name.");
expect(() => organization.updateOrganization({ orgId: "org_missing", name: "X", description: "", mission: "", goal: "", executionMode: "ai_ceo", autoApproveHires: true, reviewDeliverables: false }))
.toThrow("Organization was not found.");
connection.close();
});
});