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): repair using the current local value

Tinaf3409a204a0
diff --git a/apps/api/src/plugins/github/services/deferred-issue-edits.ts b/apps/api/src/plugins/github/services/deferred-issue-edits.ts
index b30435c22..fcf9e2ea4 100644
--- a/apps/api/src/plugins/github/services/deferred-issue-edits.ts
+++ b/apps/api/src/plugins/github/services/deferred-issue-edits.ts
@@ -251,7 +251,6 @@ export async function replayDeferredIssueEdits() {
if (
uncertain &&
stamp?.source === "kaneo" &&
- stamp.value === local &&
local !== values[field]
) {
if (uncertain.intentId)
diff --git a/tests/api-integration/deferred-issue-edits.test.ts b/tests/api-integration/deferred-issue-edits.test.ts
index bb45eb496..970ef58f4 100644
--- a/tests/api-integration/deferred-issue-edits.test.ts
+++ b/tests/api-integration/deferred-issue-edits.test.ts
@@ -387,3 +387,32 @@ it.each(
expect(publishEvent).not.toHaveBeenCalled();
},
);
+
+it("repairs an orphaned write using a newer local value whose subscriber has not stamped it", async () => {
+ const { task, integration, link } = await seed();
+ const stamp = outboundStamp(
+ outboundStamp(undefined, "A", undefined, {
+ intentId: "orphan",
+ pending: true,
+ }),
+ "B",
+ "2026-09-30T00:00:02Z",
+ { intentId: "completed" },
+ );
+ const orphan = stamp.outbound?.find((entry) => entry.intentId === "orphan");
+ if (!orphan) throw new Error("Missing orphan fixture");
+ orphan.timestamp = new Date(Date.now() - 300_001).toISOString();
+ await db
+ .update(schema.externalLinkTable)
+ .set({ metadata: JSON.stringify({ lastSync: { title: stamp } }) })
+ .where(eq(schema.externalLinkTable.id, link.id));
+ await db
+ .update(schema.taskTable)
+ .set({ title: "C" })
+ .where(eq(schema.taskTable.id, task.id));
+ await deferIssueEdit(link, integration, ["title"]);
+ await replayDeferredIssueEdits();
+ expect((await current(task.id))?.title).toBe("C");
+ expect(m.write).toHaveBeenCalledWith(expect.objectContaining({ title: "C" }));
+ expect((await metadata(link.id)).deferredIssueEdit).toBeUndefined();
+});