Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

fix(integrations): preserve drafts and refresh initial comparisons

Tin59e6a7dccd7f
diff --git a/apps/api/src/github-integration/controllers/import-issues.ts b/apps/api/src/github-integration/controllers/import-issues.ts
index 53b017460..70b213da9 100644
--- a/apps/api/src/github-integration/controllers/import-issues.ts
+++ b/apps/api/src/github-integration/controllers/import-issues.ts
@@ -176,9 +176,9 @@ export async function importIssues(projectId: string, runId?: string) {
message: "GitHub import paused; retry to resume saved progress",
});
}
- let admitted = true;
- let scopeLabels: unknown = [];
const rules = readSyncRules(integration.config);
+ let admitted = rules !== null;
+ let scopeLabels: unknown = [];
if (
run.state.phase === "issues" &&
(rules?.incoming.mode === "labels" || rules?.outgoing.mode === "labels")
diff --git a/apps/web/src/components/project/sync-rules/resume-sync-dialog.tsx b/apps/web/src/components/project/sync-rules/resume-sync-dialog.tsx
index a2369ff8e..983dd7a44 100644
--- a/apps/web/src/components/project/sync-rules/resume-sync-dialog.tsx
+++ b/apps/web/src/components/project/sync-rules/resume-sync-dialog.tsx
@@ -17,14 +17,16 @@ import { useResumePreview } from "@/hooks/queries/integration-sync/use-resume-pr
export function ResumeSyncDialog({
param,
linkId,
+ taskId,
onClose,
}: {
param: SyncParams;
linkId: string;
+ taskId: string;
onClose: () => void;
}) {
const { t } = useTranslation();
- const preview = useResumePreview(param, linkId);
+ const preview = useResumePreview(param, linkId, taskId);
const resume = useResumeSync(param, linkId);
const data = preview.data;
const choose = (source: "kaneo" | "provider") => {
diff --git a/apps/web/src/components/project/sync-rules/sync-rules-editor.tsx b/apps/web/src/components/project/sync-rules/sync-rules-editor.tsx
index d3a515351..2d270b87f 100644
--- a/apps/web/src/components/project/sync-rules/sync-rules-editor.tsx
+++ b/apps/web/src/components/project/sync-rules/sync-rules-editor.tsx
@@ -19,8 +19,22 @@ export function SyncRulesEditor({
}) {
const { t } = useTranslation();
const [rules, setRules] = useState(saved.rules);
+ const [previousSavedRules, setPreviousSavedRules] = useState(saved.rules);
const save = useSaveSyncRules(param);
- const dirty = JSON.stringify(rules) !== JSON.stringify(saved.rules);
+ const rulesKey = JSON.stringify(rules);
+ const savedKey = JSON.stringify(saved.rules);
+ const previousSavedKey = JSON.stringify(previousSavedRules);
+ const dirty = rulesKey !== previousSavedKey;
+ const savedChanged = savedKey !== previousSavedKey;
+ if (savedChanged && (!dirty || rulesKey === savedKey)) {
+ setRules(saved.rules);
+ setPreviousSavedRules(saved.rules);
+ }
+ const resetDraft = () => {
+ setRules(saved.rules);
+ setPreviousSavedRules(saved.rules);
+ save.reset();
+ };
const valid = [rules.outgoing, rules.incoming].every(
(rule) => rule.mode === "all" || rule.labels.length > 0,
);
@@ -33,6 +47,21 @@ export function SyncRulesEditor({
const impact = dirty ? preview.data : saved;
return (
<div className="space-y-5 border-t border-border pt-5">
+ {savedChanged && dirty && (
+ <div role="alert" className="space-y-2">
+ <p className="text-xs text-muted-foreground">
+ {t("settings:syncRules.rulesChanged")}
+ </p>
+ <Button
+ variant="outline"
+ size="xs"
+ disabled={save.isPending}
+ onClick={resetDraft}
+ >
+ {t("settings:syncRules.loadSavedRules")}
+ </Button>
+ </div>
+ )}
<div className="grid gap-6 sm:grid-cols-2">
<LabelRuleEditor
direction="outgoing"
@@ -143,10 +172,7 @@ export function SyncRulesEditor({
variant="ghost"
size="sm"
disabled={save.isPending}
- onClick={() => {
- setRules(saved.rules);
- save.reset();
- }}
+ onClick={resetDraft}
>
{t("common:actions.cancel")}
</Button>
diff --git a/apps/web/src/components/project/sync-rules/sync-rules-section.tsx b/apps/web/src/components/project/sync-rules/sync-rules-section.tsx
index 1f0d18108..6869944b4 100644
--- a/apps/web/src/components/project/sync-rules/sync-rules-section.tsx
+++ b/apps/web/src/components/project/sync-rules/sync-rules-section.tsx
@@ -17,7 +17,10 @@ export function SyncRulesSection({ projectId, provider }: SyncParams) {
const canManage = canManageSettings();
const canResume = canManage && canUpdateTasks();
const [pages, setPages] = useState<string[]>([]);
- const [reviewLinkId, setReviewLinkId] = useState<string | null>(null);
+ const [reviewTask, setReviewTask] = useState<{
+ taskId: string;
+ linkId: string;
+ } | null>(null);
const param = { projectId, provider };
const query = useSyncRules(param, pages.at(-1));
const data = query.data;
@@ -101,7 +104,7 @@ export function SyncRulesSection({ projectId, provider }: SyncParams) {
)}
{advanced && canManage ? (
<SyncRulesEditor
- key={JSON.stringify(data.rules)}
+ key={`${projectId}:${provider}`}
param={param}
saved={data}
/>
@@ -144,7 +147,9 @@ export function SyncRulesSection({ projectId, provider }: SyncParams) {
<Button
size="xs"
variant="outline"
- onClick={() => setReviewLinkId(task.linkId)}
+ onClick={() =>
+ setReviewTask({ taskId: task.id, linkId: task.linkId })
+ }
>
{t("settings:syncRules.review")}
</Button>
@@ -177,11 +182,12 @@ export function SyncRulesSection({ projectId, provider }: SyncParams) {
)}
</div>
)}
- {reviewLinkId && (
+ {reviewTask && (
<ResumeSyncDialog
param={param}
- linkId={reviewLinkId}
- onClose={() => setReviewLinkId(null)}
+ linkId={reviewTask.linkId}
+ taskId={reviewTask.taskId}
+ onClose={() => setReviewTask(null)}
/>
)}
</section>
diff --git a/apps/web/src/components/project/sync-rules/sync-rules.test.tsx b/apps/web/src/components/project/sync-rules/sync-rules.test.tsx
index 284b0eed2..91d237d05 100644
--- a/apps/web/src/components/project/sync-rules/sync-rules.test.tsx
+++ b/apps/web/src/components/project/sync-rules/sync-rules.test.tsx
@@ -107,9 +107,93 @@ function mount(node = <SyncRulesSection {...param} />) {
}
describe("advanced sync settings", () => {
+ it.each(["apply", "reload"])(
+ "keeps a dirty draft after shared rules change until %s",
+ async (choice) => {
+ useUserPreferencesStore.setState({ advancedSettings: true });
+ const initial = {
+ ...saved,
+ labels: [
+ ...saved.labels,
+ { id: "label-2", name: "later", color: "#654321" },
+ ],
+ };
+ mocks.get.mockResolvedValue(initial);
+ const { client } = mount();
+ fireEvent.click(await screen.findByRole("checkbox", { name: "later" }));
+ const draft = {
+ ...saved.rules,
+ outgoing: {
+ mode: "labels",
+ match: "any",
+ labels: ["label-1", "label-2"],
+ },
+ };
+ act(() =>
+ client.setQueryData(
+ ["integration-sync", param.projectId, param.provider, ""],
+ {
+ ...initial,
+ rules: { outgoing: { mode: "all" }, incoming: { mode: "all" } },
+ },
+ ),
+ );
+ await screen.findByText("settings:syncRules.rulesChanged");
+ expect(screen.getByRole("checkbox", { name: "sync" })).toBeChecked();
+ expect(screen.getByRole("checkbox", { name: "later" })).toBeChecked();
+ expect(mocks.save).not.toHaveBeenCalled();
+ if (choice === "reload") {
+ fireEvent.click(
+ screen.getByRole("button", {
+ name: "settings:syncRules.loadSavedRules",
+ }),
+ );
+ expect(screen.queryByRole("checkbox")).toBeNull();
+ expect(
+ screen.queryByText("settings:syncRules.rulesChanged"),
+ ).toBeNull();
+ expect(mocks.save).not.toHaveBeenCalled();
+ } else {
+ const apply = screen.getByRole("button", {
+ name: "settings:syncRules.apply",
+ });
+ await waitFor(() => expect(apply).toBeEnabled());
+ fireEvent.click(apply);
+ await waitFor(() =>
+ expect(mocks.save).toHaveBeenCalledWith(param, draft, "b".repeat(64)),
+ );
+ }
+ },
+ );
+
+ it("adopts refreshed shared rules when the editor has no draft changes", async () => {
+ useUserPreferencesStore.setState({ advancedSettings: true });
+ const { client } = mount();
+ await screen.findByRole("checkbox", { name: "sync" });
+ act(() =>
+ client.setQueryData(
+ ["integration-sync", param.projectId, param.provider, ""],
+ {
+ ...saved,
+ rules: { outgoing: { mode: "all" }, incoming: { mode: "all" } },
+ },
+ ),
+ );
+ await waitFor(() => expect(screen.queryByRole("checkbox")).toBeNull());
+ expect(screen.queryByText("settings:syncRules.rulesChanged")).toBeNull();
+ expect(
+ screen.getByRole("button", { name: "settings:syncRules.apply" }),
+ ).toBeDisabled();
+ });
+
it("invalidates a cached rule preview after resuming a link", async () => {
const { client } = mount(
- <ResumeSyncDialog param={param} linkId="link-1" onClose={vi.fn()} />,
+ <ResumeSyncDialog
+ param={param}
+ linkId="link-1"
+ taskId="task-1"
+ onClose={vi.fn()}
+ />,
);
const key = [
"integration-sync-preview",
@@ -166,7 +250,12 @@ describe("advanced sync settings", () => {
it("refreshes an open comparison and submits its new token after invalidation", async () => {
const { client } = mount(
- <ResumeSyncDialog param={param} linkId="link-1" onClose={vi.fn()} />,
+ <ResumeSyncDialog
+ param={param}
+ linkId="link-1"
+ taskId="task-1"
+ onClose={vi.fn()}
+ />,
);
await screen.findByText("Kaneo title");
mocks.review.mockResolvedValueOnce({
@@ -377,7 +466,14 @@ describe("advanced sync settings", () => {
it("keeps the comparison open and requires refresh after a failed resume", async () => {
const onClose = vi.fn();
mocks.resume.mockRejectedValue(new Error("Comparison changed"));
- mount(<ResumeSyncDialog param={param} linkId="link-1" onClose={onClose} />);
+ mount(
+ <ResumeSyncDialog
+ param={param}
+ linkId="link-1"
+ taskId="task-1"
+ onClose={onClose}
+ />,
+ );
await screen.findByText("Repository title");
const keepLocal = screen.getByRole("button", {
name: "settings:syncRules.useKaneo",
diff --git a/apps/web/src/fetchers/integration-sync/review-sync-resume.ts b/apps/web/src/fetchers/integration-sync/review-sync-resume.ts
index b94bb2f1f..d70a10e7d 100644
--- a/apps/web/src/fetchers/integration-sync/review-sync-resume.ts
+++ b/apps/web/src/fetchers/integration-sync/review-sync-resume.ts
@@ -5,10 +5,14 @@ import type { SyncParams } from "./types";
export default async function reviewSyncResume(
param: SyncParams,
linkId: string,
+ signal?: AbortSignal,
) {
const response = await client["integration-sync"].project[":projectId"][
":provider"
- ].links[":linkId"].review.$get({ param: { ...param, linkId } });
+ ].links[":linkId"].review.$get(
+ { param: { ...param, linkId } },
+ { init: { signal } },
+ );
if (!response.ok) throw new HttpError(response.status, await response.text());
return response.json();
}
diff --git a/apps/web/src/hooks/queries/integration-sync/use-resume-preview.ts b/apps/web/src/hooks/queries/integration-sync/use-resume-preview.ts
index 2729c26f3..0521ac44d 100644
--- a/apps/web/src/hooks/queries/integration-sync/use-resume-preview.ts
+++ b/apps/web/src/hooks/queries/integration-sync/use-resume-preview.ts
@@ -2,7 +2,11 @@ import { useQuery } from "@tanstack/react-query";
import reviewSyncResume from "@/fetchers/integration-sync/review-sync-resume";
import type { SyncParams } from "@/fetchers/integration-sync/types";
-export function useResumePreview(param: SyncParams, linkId: string) {
+export function useResumePreview(
+ param: SyncParams,
+ linkId: string,
+ taskId: string,
+) {
return useQuery({
queryKey: [
"integration-sync-review",
@@ -10,7 +14,8 @@ export function useResumePreview(param: SyncParams, linkId: string) {
param.provider,
linkId,
],
- queryFn: () => reviewSyncResume(param, linkId),
+ queryFn: ({ signal }) => reviewSyncResume(param, linkId, signal),
+ meta: { taskId },
retry: false,
staleTime: 0,
});
diff --git a/apps/web/src/hooks/use-project-websocket-access.test.tsx b/apps/web/src/hooks/use-project-websocket-access.test.tsx
index a82d86879..d0fa1b55e 100644
--- a/apps/web/src/hooks/use-project-websocket-access.test.tsx
+++ b/apps/web/src/hooks/use-project-websocket-access.test.tsx
@@ -11,7 +11,7 @@ import { useProjectWebSocket } from "./use-project-websocket";
const { client, auth, navigate } = vi.hoisted(() => ({
client: {
- getQueryCache: () => ({ subscribe: () => () => {} }),
+ getQueryCache: () => ({ subscribe: () => () => {}, findAll: () => [] }),
getQueryState: vi.fn(),
getQueryData: vi.fn(),
setQueryData: vi.fn(),
diff --git a/apps/web/src/hooks/use-project-websocket-cache.test.tsx b/apps/web/src/hooks/use-project-websocket-cache.test.tsx
index a0d488b38..4eaaa9e6d 100644
--- a/apps/web/src/hooks/use-project-websocket-cache.test.tsx
+++ b/apps/web/src/hooks/use-project-websocket-cache.test.tsx
@@ -15,6 +15,7 @@ const mocks = vi.hoisted(() => ({
subscribe: vi.fn(),
client: {
getQueryCache: () => ({
+ findAll: () => [],
subscribe: (listener: unknown) => {
mocks.subscribe(listener);
return () => {};
diff --git a/apps/web/src/hooks/use-project-websocket-lifecycle.test.tsx b/apps/web/src/hooks/use-project-websocket-lifecycle.test.tsx
index 9672ce64f..c9433f491 100644
--- a/apps/web/src/hooks/use-project-websocket-lifecycle.test.tsx
+++ b/apps/web/src/hooks/use-project-websocket-lifecycle.test.tsx
@@ -11,7 +11,7 @@ import { useProjectWebSocket } from "./use-project-websocket";
const { client, auth } = vi.hoisted(() => ({
client: {
- getQueryCache: () => ({ subscribe: () => () => {} }),
+ getQueryCache: () => ({ subscribe: () => () => {}, findAll: () => [] }),
getQueryState: vi.fn(),
cancelQueries: vi.fn().mockResolvedValue(undefined),
invalidateQueries: vi.fn(),
diff --git a/apps/web/src/hooks/use-project-websocket-resume.test.tsx b/apps/web/src/hooks/use-project-websocket-resume.test.tsx
index af789c23b..9e8985afd 100644
--- a/apps/web/src/hooks/use-project-websocket-resume.test.tsx
+++ b/apps/web/src/hooks/use-project-websocket-resume.test.tsx
@@ -62,6 +62,7 @@ it("refreshes only the affected open comparison before accepting its new token",
const preview = useResumePreview(
{ projectId: "project", provider: "github" },
"link",
+ "task",
);
return { data: preview.data, isFetching: preview.isFetching };
},
@@ -140,3 +141,70 @@ it("refreshes only the affected open comparison before accepting its new token",
await boardFetch;
client.clear();
});
+
+it("replaces a pre-edit initial review fetch and ignores its late response", async () => {
+ vi.stubGlobal("WebSocket", Socket);
+ const client = new QueryClient();
+ const stale: ResumePreview = {
+ task: { id: "task", title: "Old", number: 1 },
+ local: { title: "Old", description: "", state: "open" },
+ remote: { title: "Remote", description: "", state: "open" },
+ token: "old-token",
+ };
+ let originalSignal: AbortSignal | undefined;
+ let finishOriginal!: (value: ResumePreview) => void;
+ let finishCurrent!: (value: ResumePreview) => void;
+ mocks.review
+ .mockReset()
+ .mockImplementationOnce((_param, _link, signal) => {
+ originalSignal = signal;
+ return new Promise<ResumePreview>((resolve) => {
+ finishOriginal = resolve;
+ });
+ })
+ .mockImplementationOnce(
+ () =>
+ new Promise<ResumePreview>((resolve) => {
+ finishCurrent = resolve;
+ }),
+ );
+ const { result } = renderHook(
+ () => {
+ useProjectWebSocket("project");
+ const preview = useResumePreview(
+ { projectId: "project", provider: "github" },
+ "link",
+ "task",
+ );
+ return { data: preview.data, isFetching: preview.isFetching };
+ },
+ {
+ wrapper: ({ children }: { children: ReactNode }) => (
+ <QueryClientProvider client={client}>{children}</QueryClientProvider>
+ ),
+ },
+ );
+ await waitFor(() => expect(mocks.review).toHaveBeenCalledOnce());
+ act(() => Socket.current.message("unrelated-task"));
+ expect(mocks.review).toHaveBeenCalledOnce();
+ act(() => Socket.current.message("task"));
+ await waitFor(() => expect(mocks.review).toHaveBeenCalledTimes(2));
+ expect(originalSignal?.aborted).toBe(true);
+ await act(async () => finishOriginal(stale));
+ expect(result.current.data).toBeUndefined();
+ expect(result.current.isFetching).toBe(true);
+ act(() =>
+ finishCurrent({
+ ...stale,
+ task: { ...stale.task, title: "Current" },
+ local: { ...stale.local, title: "Current" },
+ token: "current-token",
+ }),
+ );
+ await waitFor(() => {
+ expect(result.current.isFetching).toBe(false);
+ expect(result.current.data?.token).toBe("current-token");
+ });
+ cleanup();
+ client.clear();
+});
diff --git a/apps/web/src/hooks/use-project-websocket.test.ts b/apps/web/src/hooks/use-project-websocket.test.ts
index 2920488d2..b5787eb00 100644
--- a/apps/web/src/hooks/use-project-websocket.test.ts
+++ b/apps/web/src/hooks/use-project-websocket.test.ts
@@ -20,7 +20,7 @@ const cancelQueries = vi.fn().mockResolvedValue(undefined);
vi.mock("@tanstack/react-query", () => ({
useQueryClient: () => ({
invalidateQueries,
- getQueryCache: () => ({ subscribe: () => () => {} }),
+ getQueryCache: () => ({ subscribe: () => () => {}, findAll: () => [] }),
getQueryState,
getQueryData: () => undefined,
getQueriesData: () => [],
diff --git a/apps/web/src/hooks/use-project-websocket.ts b/apps/web/src/hooks/use-project-websocket.ts
index 3c2de3376..088b4d24b 100644
--- a/apps/web/src/hooks/use-project-websocket.ts
+++ b/apps/web/src/hooks/use-project-websocket.ts
@@ -198,15 +198,19 @@ export function useProjectWebSocket(projectId: string) {
)
// An open comparison needs a fresh token; other tasks and closed
// dialogs must not cause provider reads during routine edits.
- for (const [
- queryKey,
- review,
- ] of queryClient.getQueriesData<ResumePreview>({
+ for (const query of queryClient.getQueryCache().findAll({
queryKey: ["integration-sync-review", projectId],
type: "active",
- }))
- if (review?.task?.id === message.taskId)
- void queryClient.invalidateQueries({ queryKey, exact: true });
+ })) {
+ const review = query.state.data as ResumePreview | undefined;
+ if ((review?.task.id ?? query.meta?.taskId) !== message.taskId)
+ continue;
+ const filters = { queryKey: query.queryKey, exact: true };
+ // Invalidation reuses an initial fetch with no data. Reset it so
+ // a pre-edit snapshot cannot become the first displayed token.
+ if (!review) void queryClient.resetQueries(filters);
+ else void queryClient.invalidateQueries(filters);
+ }
let titleTaskRequest: ReturnType<typeof getTask> | undefined;
if (
message.taskId &&
diff --git a/i18n/az-AZ.json b/i18n/az-AZ.json
index 34ae6a912..038cf4ce9 100644
--- a/i18n/az-AZ.json
+++ b/i18n/az-AZ.json
@@ -1928,7 +1928,9 @@
"useKaneo": "Keep Kaneo values",
"useRepository": "Keep repository values",
"exportPending": "Export matching tasks",
- "inactiveHint": "This integration is paused. No tasks will be exported until it is reactivated."
+ "inactiveHint": "This integration is paused. No tasks will be exported until it is reactivated.",
+ "loadSavedRules": "Load saved rules",
+ "rulesChanged": "The saved rules changed while you were editing. Your draft is preserved. Review the current rules above before applying it, or load the saved rules."
}
},
"navigation": {
diff --git a/i18n/de-DE.json b/i18n/de-DE.json
index 22ba25580..16a945ff1 100644
--- a/i18n/de-DE.json
+++ b/i18n/de-DE.json
@@ -1928,7 +1928,9 @@
"useKaneo": "Kaneo-Werte übernehmen",
"useRepository": "Repository-Werte übernehmen",
"exportPending": "Passende Aufgaben exportieren",
- "inactiveHint": "Diese Integration ist pausiert. Aufgaben werden erst nach ihrer Reaktivierung exportiert."
+ "inactiveHint": "Diese Integration ist pausiert. Aufgaben werden erst nach ihrer Reaktivierung exportiert.",
+ "loadSavedRules": "Load saved rules",
+ "rulesChanged": "The saved rules changed while you were editing. Your draft is preserved. Review the current rules above before applying it, or load the saved rules."
}
},
"navigation": {
diff --git a/i18n/el-GR.json b/i18n/el-GR.json
index fd6eab7f6..884d78692 100644
--- a/i18n/el-GR.json
+++ b/i18n/el-GR.json
@@ -1928,7 +1928,9 @@
"useKaneo": "Keep Kaneo values",
"useRepository": "Keep repository values",
"exportPending": "Export matching tasks",
- "inactiveHint": "This integration is paused. No tasks will be exported until it is reactivated."
+ "inactiveHint": "This integration is paused. No tasks will be exported until it is reactivated.",
+ "loadSavedRules": "Load saved rules",
+ "rulesChanged": "The saved rules changed while you were editing. Your draft is preserved. Review the current rules above before applying it, or load the saved rules."
}
},
"navigation": {
diff --git a/i18n/en-US.json b/i18n/en-US.json
index 1c29a3db1..b7b70c042 100644
--- a/i18n/en-US.json
+++ b/i18n/en-US.json
@@ -451,6 +451,8 @@
"previewing": "Checking sync impact…",
"saveError": "Could not apply these rules. The integration or task scope may have changed. Refresh the preview and try again.",
"refreshPreview": "Refresh preview",
+ "rulesChanged": "The saved rules changed while you were editing. Your draft is preserved. Review the current rules above before applying it, or load the saved rules.",
+ "loadSavedRules": "Load saved rules",
"missingLabels": "A selected workspace label is unavailable. Sync stays paused until the rule is repaired.",
"removeMissingLabels": "Remove unavailable labels",
"apply": "Apply sync rules",
diff --git a/i18n/es-ES.json b/i18n/es-ES.json
index 4b5e9e0a4..932141c9d 100644
--- a/i18n/es-ES.json
+++ b/i18n/es-ES.json
@@ -1936,7 +1936,9 @@
"useKaneo": "Keep Kaneo values",
"useRepository": "Keep repository values",
"exportPending": "Export matching tasks",
- "inactiveHint": "This integration is paused. No tasks will be exported until it is reactivated."
+ "inactiveHint": "This integration is paused. No tasks will be exported until it is reactivated.",
+ "loadSavedRules": "Load saved rules",
+ "rulesChanged": "The saved rules changed while you were editing. Your draft is preserved. Review the current rules above before applying it, or load the saved rules."
}
},
"navigation": {
diff --git a/i18n/fr-FR.json b/i18n/fr-FR.json
index d7911b094..77ee9b005 100644
--- a/i18n/fr-FR.json
+++ b/i18n/fr-FR.json
@@ -1936,7 +1936,9 @@
"useKaneo": "Keep Kaneo values",
"useRepository": "Keep repository values",
"exportPending": "Export matching tasks",
- "inactiveHint": "This integration is paused. No tasks will be exported until it is reactivated."
+ "inactiveHint": "This integration is paused. No tasks will be exported until it is reactivated.",
+ "loadSavedRules": "Load saved rules",
+ "rulesChanged": "The saved rules changed while you were editing. Your draft is preserved. Review the current rules above before applying it, or load the saved rules."
}
},
"navigation": {
diff --git a/i18n/hi-IN.json b/i18n/hi-IN.json
index 7e98a45a5..bcda8c66d 100644
--- a/i18n/hi-IN.json
+++ b/i18n/hi-IN.json
@@ -1928,7 +1928,9 @@
"useKaneo": "Keep Kaneo values",
"useRepository": "Keep repository values",
"exportPending": "Export matching tasks",
- "inactiveHint": "This integration is paused. No tasks will be exported until it is reactivated."
+ "inactiveHint": "This integration is paused. No tasks will be exported until it is reactivated.",
+ "loadSavedRules": "Load saved rules",
+ "rulesChanged": "The saved rules changed while you were editing. Your draft is preserved. Review the current rules above before applying it, or load the saved rules."
}
},
"navigation": {
diff --git a/i18n/id-ID.json b/i18n/id-ID.json
index 9faf5bd9b..5697a5ca4 100644
--- a/i18n/id-ID.json
+++ b/i18n/id-ID.json
@@ -1920,7 +1920,9 @@
"useKaneo": "Keep Kaneo values",
"useRepository": "Keep repository values",
"exportPending": "Export matching tasks",
- "inactiveHint": "This integration is paused. No tasks will be exported until it is reactivated."
+ "inactiveHint": "This integration is paused. No tasks will be exported until it is reactivated.",
+ "loadSavedRules": "Load saved rules",
+ "rulesChanged": "The saved rules changed while you were editing. Your draft is preserved. Review the current rules above before applying it, or load the saved rules."
}
},
"navigation": {
diff --git a/i18n/it-IT.json b/i18n/it-IT.json
index 3eaddb124..5664424cf 100644
--- a/i18n/it-IT.json
+++ b/i18n/it-IT.json
@@ -1936,7 +1936,9 @@
"useKaneo": "Keep Kaneo values",
"useRepository": "Keep repository values",
"exportPending": "Export matching tasks",
- "inactiveHint": "This integration is paused. No tasks will be exported until it is reactivated."
+ "inactiveHint": "This integration is paused. No tasks will be exported until it is reactivated.",
+ "loadSavedRules": "Load saved rules",
+ "rulesChanged": "The saved rules changed while you were editing. Your draft is preserved. Review the current rules above before applying it, or load the saved rules."
}
},
"navigation": {
diff --git a/i18n/ja-JP.json b/i18n/ja-JP.json
index f1b78048c..d985f2341 100644
--- a/i18n/ja-JP.json
+++ b/i18n/ja-JP.json
@@ -1920,7 +1920,9 @@
"useKaneo": "Keep Kaneo values",
"useRepository": "Keep repository values",
"exportPending": "Export matching tasks",
- "inactiveHint": "This integration is paused. No tasks will be exported until it is reactivated."
+ "inactiveHint": "This integration is paused. No tasks will be exported until it is reactivated.",
+ "loadSavedRules": "Load saved rules",
+ "rulesChanged": "The saved rules changed while you were editing. Your draft is preserved. Review the current rules above before applying it, or load the saved rules."
}
},
"navigation": {
diff --git a/i18n/ko-KR.json b/i18n/ko-KR.json
index 915817bff..48b6bc730 100644
--- a/i18n/ko-KR.json
+++ b/i18n/ko-KR.json
@@ -1920,7 +1920,9 @@
"useKaneo": "Keep Kaneo values",
"useRepository": "Keep repository values",
"exportPending": "Export matching tasks",
- "inactiveHint": "This integration is paused. No tasks will be exported until it is reactivated."
+ "inactiveHint": "This integration is paused. No tasks will be exported until it is reactivated.",
+ "loadSavedRules": "Load saved rules",
+ "rulesChanged": "The saved rules changed while you were editing. Your draft is preserved. Review the current rules above before applying it, or load the saved rules."
}
},
"navigation": {
diff --git a/i18n/mk-MK.json b/i18n/mk-MK.json
index c85ee6d00..55322fe10 100644
--- a/i18n/mk-MK.json
+++ b/i18n/mk-MK.json
@@ -1928,7 +1928,9 @@
"useKaneo": "Keep Kaneo values",
"useRepository": "Keep repository values",
"exportPending": "Export matching tasks",
- "inactiveHint": "This integration is paused. No tasks will be exported until it is reactivated."
+ "inactiveHint": "This integration is paused. No tasks will be exported until it is reactivated.",
+ "loadSavedRules": "Load saved rules",
+ "rulesChanged": "The saved rules changed while you were editing. Your draft is preserved. Review the current rules above before applying it, or load the saved rules."
}
},
"navigation": {
diff --git a/i18n/nl-NL.json b/i18n/nl-NL.json
index 89f6c4c77..755321001 100644
--- a/i18n/nl-NL.json
+++ b/i18n/nl-NL.json
@@ -1928,7 +1928,9 @@
"useKaneo": "Keep Kaneo values",
"useRepository": "Keep repository values",
"exportPending": "Export matching tasks",
- "inactiveHint": "This integration is paused. No tasks will be exported until it is reactivated."
+ "inactiveHint": "This integration is paused. No tasks will be exported until it is reactivated.",
+ "loadSavedRules": "Load saved rules",
+ "rulesChanged": "The saved rules changed while you were editing. Your draft is preserved. Review the current rules above before applying it, or load the saved rules."
}
},
"navigation": {
diff --git a/i18n/pl-PL.json b/i18n/pl-PL.json
index 88dab863a..143292077 100644
--- a/i18n/pl-PL.json
+++ b/i18n/pl-PL.json
@@ -2501,7 +2501,9 @@
"useKaneo": "Keep Kaneo values",
"useRepository": "Keep repository values",
"exportPending": "Export matching tasks",
- "inactiveHint": "This integration is paused. No tasks will be exported until it is reactivated."
+ "inactiveHint": "This integration is paused. No tasks will be exported until it is reactivated.",
+ "loadSavedRules": "Load saved rules",
+ "rulesChanged": "The saved rules changed while you were editing. Your draft is preserved. Review the current rules above before applying it, or load the saved rules."
}
},
"tasks": {
diff --git a/i18n/pt-BR.json b/i18n/pt-BR.json
index 9aa753720..e1575bb38 100644
--- a/i18n/pt-BR.json
+++ b/i18n/pt-BR.json
@@ -1936,7 +1936,9 @@
"useKaneo": "Keep Kaneo values",
"useRepository": "Keep repository values",
"exportPending": "Export matching tasks",
- "inactiveHint": "This integration is paused. No tasks will be exported until it is reactivated."
+ "inactiveHint": "This integration is paused. No tasks will be exported until it is reactivated.",
+ "loadSavedRules": "Load saved rules",
+ "rulesChanged": "The saved rules changed while you were editing. Your draft is preserved. Review the current rules above before applying it, or load the saved rules."
}
},
"navigation": {
diff --git a/i18n/ru-RU.json b/i18n/ru-RU.json
index 66c968119..f3304e0fd 100644
--- a/i18n/ru-RU.json
+++ b/i18n/ru-RU.json
@@ -1952,7 +1952,9 @@
"useKaneo": "Keep Kaneo values",
"useRepository": "Keep repository values",
"exportPending": "Export matching tasks",
- "inactiveHint": "This integration is paused. No tasks will be exported until it is reactivated."
+ "inactiveHint": "This integration is paused. No tasks will be exported until it is reactivated.",
+ "loadSavedRules": "Load saved rules",
+ "rulesChanged": "The saved rules changed while you were editing. Your draft is preserved. Review the current rules above before applying it, or load the saved rules."
}
},
"navigation": {
diff --git a/i18n/schema.json b/i18n/schema.json
index 8e23154e0..d00489b38 100644
--- a/i18n/schema.json
+++ b/i18n/schema.json
@@ -1771,6 +1771,12 @@
"refreshPreview": {
"type": "string"
},
+ "rulesChanged": {
+ "type": "string"
+ },
+ "loadSavedRules": {
+ "type": "string"
+ },
"missingLabels": {
"type": "string"
},
@@ -1895,6 +1901,8 @@
"previewing",
"saveError",
"refreshPreview",
+ "rulesChanged",
+ "loadSavedRules",
"missingLabels",
"removeMissingLabels",
"apply",
diff --git a/i18n/tr-TR.json b/i18n/tr-TR.json
index c7e3ffefe..3c9c0ffba 100644
--- a/i18n/tr-TR.json
+++ b/i18n/tr-TR.json
@@ -1928,7 +1928,9 @@
"useKaneo": "Keep Kaneo values",
"useRepository": "Keep repository values",
"exportPending": "Export matching tasks",
- "inactiveHint": "This integration is paused. No tasks will be exported until it is reactivated."
+ "inactiveHint": "This integration is paused. No tasks will be exported until it is reactivated.",
+ "loadSavedRules": "Load saved rules",
+ "rulesChanged": "The saved rules changed while you were editing. Your draft is preserved. Review the current rules above before applying it, or load the saved rules."
}
},
"navigation": {
diff --git a/i18n/uk-UA.json b/i18n/uk-UA.json
index 7badbaef8..e527d74c4 100644
--- a/i18n/uk-UA.json
+++ b/i18n/uk-UA.json
@@ -1944,7 +1944,9 @@
"useKaneo": "Keep Kaneo values",
"useRepository": "Keep repository values",
"exportPending": "Export matching tasks",
- "inactiveHint": "This integration is paused. No tasks will be exported until it is reactivated."
+ "inactiveHint": "This integration is paused. No tasks will be exported until it is reactivated.",
+ "loadSavedRules": "Load saved rules",
+ "rulesChanged": "The saved rules changed while you were editing. Your draft is preserved. Review the current rules above before applying it, or load the saved rules."
}
},
"navigation": {
diff --git a/i18n/vi-VN.json b/i18n/vi-VN.json
index bf5007f33..103b76699 100644
--- a/i18n/vi-VN.json
+++ b/i18n/vi-VN.json
@@ -1920,7 +1920,9 @@
"useKaneo": "Keep Kaneo values",
"useRepository": "Keep repository values",
"exportPending": "Export matching tasks",
- "inactiveHint": "This integration is paused. No tasks will be exported until it is reactivated."
+ "inactiveHint": "This integration is paused. No tasks will be exported until it is reactivated.",
+ "loadSavedRules": "Load saved rules",
+ "rulesChanged": "The saved rules changed while you were editing. Your draft is preserved. Review the current rules above before applying it, or load the saved rules."
}
},
"navigation": {
diff --git a/i18n/zh-CN.json b/i18n/zh-CN.json
index a853c9e9e..8a5a90fa5 100644
--- a/i18n/zh-CN.json
+++ b/i18n/zh-CN.json
@@ -1920,7 +1920,9 @@
"useKaneo": "Keep Kaneo values",
"useRepository": "Keep repository values",
"exportPending": "Export matching tasks",
- "inactiveHint": "This integration is paused. No tasks will be exported until it is reactivated."
+ "inactiveHint": "This integration is paused. No tasks will be exported until it is reactivated.",
+ "loadSavedRules": "Load saved rules",
+ "rulesChanged": "The saved rules changed while you were editing. Your draft is preserved. Review the current rules above before applying it, or load the saved rules."
}
},
"navigation": {
diff --git a/tests/api-integration/github-import-bounds.test.ts b/tests/api-integration/github-import-bounds.test.ts
index a86531d8e..1f8e5d430 100644
--- a/tests/api-integration/github-import-bounds.test.ts
+++ b/tests/api-integration/github-import-bounds.test.ts
@@ -158,6 +158,56 @@ async function saved() {
}
describe("bounded resumable GitHub import", () => {
+ it.each([false, true])(
+ "fails closed for invalid stored rules (linked=%s)",
+ async (linked) => {
+ const { project, integration, config, request } = await setup();
+ if (linked) {
+ const [task] = await db
+ .insert(schema.taskTable)
+ .values({
+ projectId: project.id,
+ title: "Existing task",
+ number: 1,
+ status: "to-do",
+ })
+ .returning();
+ await db.insert(schema.externalLinkTable).values({
+ taskId: task!.id,
+ integrationId: integration.id,
+ resourceType: "issue",
+ externalId: "1",
+ url: "https://github.com/example/repo/issues/1",
+ });
+ }
+ await db
+ .update(schema.integrationTable)
+ .set({
+ config: JSON.stringify({
+ ...config,
+ syncRules: {
+ outgoing: { mode: "all" },
+ incoming: { mode: "labels", match: "any", labels: [] },
+ },
+ }),
+ })
+ .where(eq(schema.integrationTable.id, integration.id));
+ serveIssues(1);
+ const response = await request();
+ expect(response.status).toBe(200);
+ expect(await response.json()).toMatchObject({ imported: 0, skipped: 1 });
+ const tasks = await db.query.taskTable.findMany();
+ const links = await db.query.externalLinkTable.findMany();
+ expect(tasks).toHaveLength(linked ? 1 : 0);
+ expect(links).toHaveLength(linked ? 1 : 0);
+ if (linked) {
+ expect(tasks[0]?.title).toBe("Existing task");
+ expect(JSON.parse(links[0]!.metadata!)).toMatchObject({
+ syncFilterPaused: true,
+ });
+ }
+ },
+ );
it("preserves provider colors when rule checks import labels before the page", async () => {
const { member, integration, config, request } = await setup();
await db.insert(schema.labelTable).values({