Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix: refuse resuming an import onto a planned position another issue took (#10762)
Adam Eivy9ee34473448d
diff --git a/server/services/importer.js b/server/services/importer.jsindex d70a3af60d..75c35754e8 100644--- a/server/services/importer.js+++ b/server/services/importer.js@@ -1329,6 +1329,21 @@ async function commitImportOnce({}}}+ // A resume still owes the series unique positions: an issue added since the+ // earlier attempt may have taken a slot the plan reserved for a missing issue.+ if (!replaceMode && resumePlan) {+ const takenByOthers = new Set(existingIssues+ .filter((ex) => !resumeLive.has(ex.id) && Number.isInteger(ex.arcPosition))+ .map((ex) => ex.arcPosition));+ resumePlan.items.forEach((item, i) => {+ if (!resumeLive.has(item.issueId) && takenByOthers.has(item.arcPosition)) {+ throw codedError(+ `Issue at position ${i + 1} was planned for arcPosition ${item.arcPosition}, which an issue added since now occupies — commit refused before any state changed. Move or delete that issue, then retry to finish this import.`,+ ERR_VALIDATION,+ );+ }+ });+ }const allUsedArcPositions = new Set([...seenArcPositions, ...existingArcPositions]);let nextFreeArcPos = (allUsedArcPositions.size === 0) ? 1 : Math.max(...allUsedArcPositions) + 1;const withAutoPosition = (proposal) => {diff --git a/server/services/importer.test.js b/server/services/importer.test.jsindex 2d77f89ab2..1620480425 100644--- a/server/services/importer.test.js+++ b/server/services/importer.test.js@@ -1923,6 +1923,18 @@ describe('commitImport import sessions (#9943)', () => {expect((await analyze()).importSession).toEqual({ status: 'committed', createdIssueIds: retried.createdIssueIds });});+ it('refuses to resume onto a planned position another issue took since', async () => {+ wireDefaultLLMResponses();+ const preview = await analyze();+ const issues = [{ title: 'I1', arcPosition: 1, proseExcerpt: 'p1' }, { title: 'I2', arcPosition: 2, proseExcerpt: 'p2' }];+ await interruptAfterFirstIssue(preview, issues);+ await issuesSvc.createIssue({ seriesId: preview.series.id, title: 'Added since', arcPosition: 2 });++ await expect(importerSvc.commitImport(payloadFor(preview, { issues })))+ .rejects.toMatchObject({ code: importerSvc.ERR_VALIDATION });+ expect(await issueCount(preview)).toBe(2);+ });+it("refuses a changed issue list while an earlier attempt's issues still exist", async () => {wireDefaultLLMResponses();const preview = await analyze();