Update hivegrid-cloud reference to latest main

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
davidandClaude Fable 5 committed 2026-07-08 16:15:37 +02:00
1 parent e98d38e716
commit 7b21524c86
3781 files changed
+373484 -225607

No files matched your search

@@ -4,7 +4,7 @@ import { beforeEach, describe, expect, it, vi } from "vitest";
vi.mock("~/components/app/AppLayout", () => ({ default: ({ children }: { children: React.ReactNode }) => children }));
vi.mock("~/utils/data/useAppData", () => ({ useAppData: vi.fn() }));
vi.mock("~/utils/data/.server/appData", () => ({ loadAppData: vi.fn() }));
vi.mock("@toolctrl/db/auth-boundary.server", () => ({
vi.mock("@hivegrid/db/auth-boundary.server", () => ({
getAuthUserWithoutPasswordById: vi.fn(),
getTenantMembershipByIds: vi.fn(),
updateAuthUserDefaultTenantId: vi.fn(),
@@ -25,12 +25,17 @@ vi.mock("~/modules/metrics/services/.server/MetricTracker", () => ({
})),
}));
vi.mock("~/modules/metrics/utils/defaultHeaders", () => ({ serverTimingHeaders: vi.fn() }));
vi.mock("~/lib/metrics/ssr", () => ({ withMetrics: (_name: string, handler: unknown) => handler }));
vi.mock("~/locale/i18next.server", () => ({ getTranslations: vi.fn(async () => ({ t: (key: string) => key })) }));
vi.mock("~/modules/helpDesk/services/Feedback.server", () => ({ default: { send: vi.fn() } }));
vi.mock("~/stores/themePreviewStore", () => ({ useThemePreviewStore: vi.fn() }));
vi.mock("~/utils/theme/ThemeConfig", () => ({ getThemeStyle: vi.fn(), parseThemeConfig: vi.fn() }));
vi.mock("@toolctrl/config", async () => {
const actual = await vi.importActual<typeof import("@toolctrl/config")>("@toolctrl/config");
vi.mock("~/utils/services/.server/billingStatusService", () => ({
buildBillingStatusBannerVm: vi.fn(() => ({ visible: false })),
getTenantBillingReadOnlyState: vi.fn(async () => ({ readOnly: false, status: null })),
}));
vi.mock("@hivegrid/config", async () => {
const actual = await vi.importActual<typeof import("@hivegrid/config")>("@hivegrid/config");
return {
...actual,
loadRequiredWebConfig: () => ({
@@ -45,7 +50,7 @@ vi.mock("@toolctrl/config", async () => {
};
});
import { getAuthUserWithoutPasswordById, getTenantMembershipByIds, updateAuthUserDefaultTenantId } from "@toolctrl/db/auth-boundary.server";
import { getAuthUserWithoutPasswordById, getTenantMembershipByIds, updateAuthUserDefaultTenantId } from "@hivegrid/db/auth-boundary.server";
import { DefaultFeatures } from "~/application/dtos/shared/DefaultFeatures";
import { SubscriptionFeatureLimitType } from "~/application/enums/subscriptions/SubscriptionFeatureLimitType";
import { getAppConfiguration } from "~/utils/db/appConfiguration.db.server";
@@ -53,6 +58,7 @@ import { ensureTenantUserAppRoles } from "~/utils/db/permissions/userRoles.db.se
import { createUniqueTenantIpAddress } from "~/utils/db/tenants/tenantIpAddress.db.server";
import { loadAppData } from "~/utils/data/.server/appData";
import { getTenantIdFromUrl } from "~/utils/services/.server/urlService";
import { getTenantBillingReadOnlyState } from "~/utils/services/.server/billingStatusService";
import { getUserInfo } from "~/utils/session.server";
import { getIsSuperAdminByUserId, requireAuth } from "~/utils/loaders.middleware";
import FeedbackServer from "~/modules/helpDesk/services/Feedback.server";
@@ -136,6 +142,7 @@ describe("app.$tenant subscription entitlement guard", () => {
tenantId: "tenant_1",
userInfo: { userId: "user_1" },
user: adminUser,
isOperatorAdmin: true,
});
});
@@ -256,6 +263,7 @@ describe("app.$tenant feedback action", () => {
beforeEach(() => {
vi.clearAllMocks();
vi.mocked(getTenantIdFromUrl).mockResolvedValue("tenant_1");
vi.mocked(getTenantBillingReadOnlyState).mockResolvedValue({ readOnly: false, status: null });
vi.mocked(requireAuth).mockResolvedValue({ userId: "user_1" } as never);
});
@@ -270,7 +278,7 @@ describe("app.$tenant feedback action", () => {
request: new Request("https://app.example.test/acme", {
method: "POST",
headers: { "content-type": "application/x-www-form-urlencoded" },
body: formData,
body: formData.toString(),
}),
params: tenantParams,
context: {},
@@ -291,4 +299,28 @@ describe("app.$tenant feedback action", () => {
);
expect(FeedbackServer.send).not.toHaveBeenCalledWith(expect.objectContaining({ tenantId: "tenant_other" }));
});
it("blocks tenant feedback mutations while billing is read-only", async () => {
vi.mocked(getTenantBillingReadOnlyState).mockResolvedValue({ readOnly: true, status: "frozen" });
const formData = new URLSearchParams();
formData.set("action", "add-feedback");
formData.set("message", "Tenant-scoped feedback");
formData.set("fromUrl", "/acme/dashboard");
const response = await action({
request: new Request("https://app.example.test/acme", {
method: "POST",
headers: { "content-type": "application/x-www-form-urlencoded" },
body: formData.toString(),
}),
params: tenantParams,
context: {},
unstable_pattern: "app.$tenant",
} as ActionFunctionArgs);
expect(response).toBeInstanceOf(Response);
expect((response as Response).status).toBe(423);
await expect((response as Response).json()).resolves.toEqual({ error: "billing:status.readOnly" });
expect(FeedbackServer.send).not.toHaveBeenCalled();
});
});