fix(hub): harden test org seed and run hub-check only on push

seedTestOrganization now wipes+creates instead of fragile upsert.
hub-check drops pull_request triggers so push/PR pairs no longer double
migrate against the runner; branch push status remains the gate.
This commit is contained in:
2026-07-30 14:05:22 +08:00
parent 0ebfeb927a
commit 751d0c4100
+14 -19
View File
@@ -71,37 +71,32 @@ export async function resetDb(): Promise<void> {
`);
await seedTestOrganization();
}
export async function seedTestOrganization(
id: string = DEFAULT_ORG_ID,
slug: string = "test-default",
): Promise<void> {
// Prefer explicit create-after-wipe over upsert: leftover half-states after
// interrupted tests made Prisma upsert hit unique(id) while where saw zero.
await prisma.$transaction(async (tx) => {
await tx.organization.upsert({
where: { id },
update: {},
create: { id, slug, name: "Test Default Organization" },
});
await tx.organizationProjectSettings.upsert({
where: { organizationId: id },
update: {},
create: { organizationId: id, membersCanCreateProjects: true },
});
const defaultRole = await tx.organizationAgentRole.upsert({
where: { organizationId_roleId: { organizationId: id, roleId: "draft" } },
update: { label: "草稿", isDefault: true, disabledAt: null },
await tx.organization.deleteMany({ where: { OR: [{ id }, { slug }] } });
await tx.organization.create({
data: {
id,
slug,
name: "Test Default Organization",
projectSettings: {
create: { membersCanCreateProjects: true },
},
agentRoles: {
create: {
id: `agent_role_draft_${id}`,
organizationId: id,
roleId: "draft",
label: "草稿",
sortOrder: 10,
isDefault: true,
},
});
await tx.organizationAgentRole.updateMany({
where: { organizationId: id, id: { not: defaultRole.id }, isDefault: true },
data: { isDefault: false },
},
},
});
});
const inbox = await prisma.folder.findFirst({