Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,22 @@ describe("OnboardingPreviewCard", () => {
expect(screen.queryByText(/Here's what LoopOver would have flagged/)).toBeNull();
expect(apiFetch).not.toHaveBeenCalled();
});

it("REGRESSION (#7782): migrates a pre-rebrand gittensory_ dismiss key and keeps the card hidden", async () => {
window.localStorage.setItem(
"gittensory_maintainer_onboarding_preview_dismissed",
JSON.stringify({ dismissed: true }),
);
apiFetch.mockResolvedValue({ ok: true, data: preview() });

render(<OnboardingPreviewCard reviewability={REVIEWABILITY} />);

await waitFor(() =>
expect(window.localStorage.getItem("loopover_maintainer_onboarding_preview_dismissed")).toBe(
JSON.stringify({ dismissed: true }),
),
);
expect(screen.queryByText(/Here's what LoopOver would have flagged/)).toBeNull();
expect(apiFetch).not.toHaveBeenCalled();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ type ReviewabilityRow = { pr: string; title: string; reason: string };

const DISMISS_KEY = "loopover_maintainer_onboarding_preview_dismissed";
// One-time rebrand migration fallback -- see useLocalStorage's legacyKey param.
const LEGACY_DISMISS_KEY = "loopover_maintainer_onboarding_preview_dismissed";
// Must stay as the pre-rebrand gittensory_ prefix (distinct from DISMISS_KEY); a blanket
// rename once collapsed these to the same string and silently broke migration (#7782).
const LEGACY_DISMISS_KEY = "gittensory_maintainer_onboarding_preview_dismissed";

/** Builds a settings-preview form from a REAL cached PR (title, and a linked-issue number scraped from
* `reason` when present) — everything else (author identity, labels, body) isn't in the reviewability
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { fireEvent, render, screen } from "@testing-library/react";
import { describe, expect, it, vi } from "vitest";
import { fireEvent, render, screen, waitFor } from "@testing-library/react";
import { beforeEach, describe, expect, it, vi } from "vitest";

// #6985: a real fetch failure used to render the same generic text as "still loading" — these tests
// pin the three render paths (loading / error / success) now that LoadingState/ErrorState replace it.
Expand Down Expand Up @@ -95,3 +95,25 @@ describe("NotificationReadinessCard loading/error states (#6985)", () => {
expect(screen.queryByText("Loading notification model…")).toBeNull();
});
});

describe("NotificationReadinessCard legacyKey migration (#7782)", () => {
beforeEach(() => {
window.localStorage.clear();
useApiResource.mockReturnValue({
status: "ready",
data: notificationModelFixture,
error: null,
loadedAt: Date.now(),
reload: () => {},
});
});

it("REGRESSION: migrates a pre-rebrand gittensory_ opt-in key and shows opt-in enabled", async () => {
window.localStorage.setItem("gittensory_notification_opt_in", JSON.stringify(true));

render(<NotificationReadinessCard />);

await waitFor(() => expect(screen.getByText("opt-in enabled")).toBeTruthy());
expect(window.localStorage.getItem("loopover_notification_opt_in")).toBe(JSON.stringify(true));
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,13 @@ export function NotificationReadinessCard() {
"/v1/app/notification-model",
"Notification model",
);
// Legacy key must stay as the pre-rebrand gittensory_ prefix (distinct from the current
// loopover_ key); a blanket rename once collapsed these to the same string and silently
// broke migration (#7782).
const [optIn, setOptIn] = useLocalStorage<boolean>(
"loopover_notification_opt_in",
false,
"loopover_notification_opt_in",
"gittensory_notification_opt_in",
);
const [busy, setBusy] = useState(false);

Expand Down
2 changes: 2 additions & 0 deletions scripts/branding-drift-baseline.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"apps/loopover-ui/src/components/site/api/try-it.tsx": 1,
"apps/loopover-ui/src/components/site/app-panels/onboarding-preview-card.tsx": 2,
"apps/loopover-ui/src/components/site/notification-readiness-card.tsx": 2,
"apps/loopover-ui/src/routes/app.index.tsx": 1,
"apps/loopover-ui/src/routes/app.runs.tsx": 1,
"apps/loopover-ui/src/routes/app.workbench.tsx": 1,
Expand Down
Loading