Track HiveGrid Cloud planning reference
This commit is contained in:
1 parent
b3d5ea6764
commit
e341c5938a
5784 files changed
+1104929
-3
No files matched your search
+79
@@ -0,0 +1,79 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { DefaultFeatures } from "~/application/dtos/shared/DefaultFeatures";
|
||||
import { readRepoFile } from "~/utils/testing/repoPaths";
|
||||
import { getOnboardingStepDefinitions, onboardingStepRegistryEvidence } from "./registry.server";
|
||||
|
||||
const sensitiveSamples = [
|
||||
"tenant_123",
|
||||
"secret-token",
|
||||
"user_456",
|
||||
"subscription_789",
|
||||
"provider_api_key_live",
|
||||
"raw-feature-input=workspace-roles",
|
||||
"DATABASE_URL",
|
||||
"bearer jwt-token",
|
||||
] as const;
|
||||
|
||||
function expectSafeStaticPayload(payload: unknown) {
|
||||
const serialized = JSON.stringify(payload);
|
||||
|
||||
for (const sample of sensitiveSamples) {
|
||||
expect(serialized).not.toContain(sample);
|
||||
}
|
||||
|
||||
expect(serialized).not.toMatch(/user[_-]?\d+|subscription[_-]?\d+|provider[_-]?api[_-]?key|bearer\s+jwt|jwt-token|secret-token/i);
|
||||
}
|
||||
|
||||
describe("onboarding step registry", () => {
|
||||
it("defines stable onboarding step IDs for ungated, feature-gated, and plan-gated steps", () => {
|
||||
expect(getOnboardingStepDefinitions()).toEqual(
|
||||
expect.arrayContaining([
|
||||
expect.objectContaining({ id: "profile-basics" }),
|
||||
expect.objectContaining({ id: "team-invites", featureFlagKey: "workspace-roles" }),
|
||||
expect.objectContaining({ id: "priority-support-setup", planFeatureKey: DefaultFeatures.PrioritySupport }),
|
||||
]),
|
||||
);
|
||||
});
|
||||
|
||||
it("exports registry evidence that mirrors stable IDs and represented gate sources", () => {
|
||||
const definitions = getOnboardingStepDefinitions();
|
||||
|
||||
expect(onboardingStepRegistryEvidence.registryName).toBe("Onboarding Step Registry");
|
||||
expect(onboardingStepRegistryEvidence.registryScope).toBe("source-backed-onboarding-steps");
|
||||
expect(onboardingStepRegistryEvidence.expectedStepIds).toEqual(definitions.map((step) => step.id));
|
||||
expect(onboardingStepRegistryEvidence.expectedStepIds).toEqual(["profile-basics", "team-invites", "priority-support-setup"]);
|
||||
expect(onboardingStepRegistryEvidence.gatingSourcesRepresented).toEqual(["feature-flag", "plan"]);
|
||||
});
|
||||
|
||||
it("keeps gate metadata typed and attached only to gated steps", () => {
|
||||
const definitions = getOnboardingStepDefinitions();
|
||||
|
||||
expect(definitions.find((step) => step.id === "profile-basics")).toEqual(expect.not.objectContaining({ featureFlagKey: expect.any(String) }));
|
||||
expect(definitions.find((step) => step.id === "profile-basics")).toEqual(expect.not.objectContaining({ planFeatureKey: expect.any(String) }));
|
||||
expect(definitions.find((step) => step.id === "team-invites")).toEqual(expect.objectContaining({ featureFlagKey: "workspace-roles" }));
|
||||
expect(definitions.find((step) => step.id === "priority-support-setup")).toEqual(
|
||||
expect.objectContaining({ planFeatureKey: DefaultFeatures.PrioritySupport }),
|
||||
);
|
||||
});
|
||||
|
||||
it("keeps registry evidence limited to safe static metadata without sensitive samples", () => {
|
||||
expect(onboardingStepRegistryEvidence.redactionGuarantee).toContain("static source metadata only");
|
||||
expect(onboardingStepRegistryEvidence.redactionGuarantee).toContain(
|
||||
"excludes request, tenant, subscription, user, token, environment, and raw feature input values",
|
||||
);
|
||||
expect(onboardingStepRegistryEvidence.expectedStepIds.length).toBe(getOnboardingStepDefinitions().length);
|
||||
expectSafeStaticPayload(onboardingStepRegistryEvidence);
|
||||
});
|
||||
|
||||
it("keeps registry copy behind semantic onboarding keys", () => {
|
||||
const source = readRepoFile("apps/web/app/modules/onboarding/services/step-registry/registry.server.ts");
|
||||
|
||||
expect(source).toContain("onboarding.stepRegistry.profileBasics.title");
|
||||
expect(source).toContain("onboarding.stepRegistry.profileBasics.description");
|
||||
expect(source).toContain("onboarding.stepRegistry.teamInvites.title");
|
||||
expect(source).toContain("onboarding.stepRegistry.teamInvites.description");
|
||||
expect(source).toContain("onboarding.stepRegistry.prioritySupportSetup.title");
|
||||
expect(source).toContain("onboarding.stepRegistry.prioritySupportSetup.description");
|
||||
expect(source).not.toContain("ui.autogenerated");
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user