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(pipeline): season delete confirm UX + suppress exporter warning storm
[._.]/ Adam Eivydd5277746910
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex 9b678250df..9a5a1ec1b9 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -1539,6 +1539,41 @@## Fixed+- **Pipeline volume delete: clearer confirmation, loading state, and no+ exporter warning storm.** Three coupled fixes to the trash button on a+ series volume / season in the Arc Canvas:+ 1. Replaced the two-click `useArmedAction` arm (which users found+ non-discoverable — first click looked like a no-op) with an inline+ confirm row matching `LayoutEditor`'s pattern: clicking the trash+ swaps the Edit + Trash controls for `Delete volume? [Cancel]+ [Delete]`.+ 2. The cascade reassigns every child issue's `seasonId`, which can take+ several seconds on a populated volume. Added a `Loader2`+ `Deleting…` state so the row visibly works instead of looking+ frozen.+ 3. Each per-issue `updateIssue` was emitting `emitRecordUpdated('series',+ …)`, which scheduled N debounced re-exports of the same series. Every+ re-export then walked the series and called `exportMediaJobAndAsset`+ for each issue's `imageJobId`, logging+ `⚠️ sharing.exporter: imageJobId <id> not found in live queue or+ archive` for any job already aged out of the persisted archive — one+ warning per missing job per re-export, multiplied by the cascade. The+ season-delete service now wraps the reassign cascade in+ `withReexportSuppressed('series', seriesId, …)` and emits a single+ `emitRecordUpdated` against the final state, collapsing the storm to+ one re-export.+ Moved `withReexportSuppressed` + its suppression registry from+ `sharing/subscriptions.js` down to `sharing/recordEvents.js` so pipeline+ services can suppress without transitively pulling the exporter / file-IO+ graph into their test mocks (matches the file's existing "Kept separate+ …so importing this bus doesn't drag in the heavyweight pipeline graph"+ intent). `subscriptions.js` re-exports `withReexportSuppressed` so+ `importer.js`'s import path stays stable. Touches+ `client/src/components/pipeline/ArcCanvas.jsx`,+ `server/services/pipeline/seasons.js`,+ `server/services/sharing/recordEvents.js`,+ `server/services/sharing/subscriptions.js`.+- **`update.sh` / `setup.sh` (+ PowerShell siblings) no longer hang onslash-do install when multiple AI environments are detected.** The`npx --yes slash-do@latest` call inside the four install/update scriptsdiff --git a/client/src/components/pipeline/ArcCanvas.jsx b/client/src/components/pipeline/ArcCanvas.jsxindex dba524eb17..b6a91af56e 100644--- a/client/src/components/pipeline/ArcCanvas.jsx+++ b/client/src/components/pipeline/ArcCanvas.jsx@@ -727,12 +727,20 @@ function SeasonRow({ series, season, seasons, issues, onSeriesUpdate, onIssuesUptoast.success(`Generated ${n} issue${n === 1 ? '' : 's'} / episode${n === 1 ? '' : 's'}${extractedSummary}`);};+ // 'idle' | 'confirm' | 'deleting' — drives an inline confirm row that swaps+ // in for the Edit/Trash buttons. Two-click "arm" was confusing (see+ // feedback memory); inline confirm matches LayoutEditor's pattern.+ const [deleteMode, setDeleteMode] = useState('idle');const runDeleteSeason = async () => {+ setDeleteMode('deleting');const result = await deletePipelineSeason(series.id, season.id, { reassignTo: null }).catch((err) => {toast.error(err.message || 'Delete failed');return null;});- if (!result) return;+ if (!result) {+ setDeleteMode('idle');+ return;+ }onSeriesUpdate({ ...series, seasons: seasons.filter((s) => s.id !== season.id) });const refreshed = await listPipelineIssues(series.id).catch(() => null);if (refreshed) onIssuesUpdate(refreshed);@@ -743,7 +751,6 @@ function SeasonRow({ series, season, seasons, issues, onSeriesUpdate, onIssuesUptoast.success('Volume / season deleted');}};- const [armDelete, deleteSeason] = useArmedAction(runDeleteSeason);return (<li className="bg-port-card border border-port-border rounded-lg">@@ -761,22 +768,53 @@ function SeasonRow({ series, season, seasons, issues, onSeriesUpdate, onIssuesUp<span className="text-[10px] uppercase tracking-wider text-gray-500" title="Issues / Episodes">{issues.length} / {season.episodeCountTarget || '?'} issues</span>- <button- type="button"- onClick={() => setEditing(!editing)}- className="ml-auto text-xs text-gray-400 hover:text-white"- >- {editing ? 'Done' : 'Edit'}- </button>- <button- type="button"- onClick={deleteSeason}- className={`p-1.5 ${armDelete ? 'text-port-error' : 'text-gray-500 hover:text-port-error'}`}- aria-label={armDelete ? `Confirm delete volume / season ${season.title}` : `Delete volume / season ${season.title}`}- title={armDelete ? 'Click again to confirm' : 'Delete volume / season'}- >- <Trash2 size={12} />- </button>+ <div className="ml-auto flex items-center gap-2">+ {deleteMode === 'idle' && (+ <>+ <button+ type="button"+ onClick={() => setEditing(!editing)}+ className="text-xs text-gray-400 hover:text-white"+ >+ {editing ? 'Done' : 'Edit'}+ </button>+ <button+ type="button"+ onClick={() => setDeleteMode('confirm')}+ className="p-1.5 text-gray-500 hover:text-port-error"+ aria-label={`Delete volume / season ${season.title}`}+ title="Delete volume / season"+ >+ <Trash2 size={12} />+ </button>+ </>+ )}+ {deleteMode === 'confirm' && (+ <>+ <span className="text-xs text-port-error">Delete volume?</span>+ <button+ type="button"+ onClick={() => setDeleteMode('idle')}+ className="px-2 py-0.5 text-xs text-gray-300 hover:text-white rounded border border-port-border"+ >+ Cancel+ </button>+ <button+ type="button"+ onClick={runDeleteSeason}+ className="px-2 py-0.5 text-xs rounded bg-port-error text-white hover:bg-port-error/80"+ >+ Delete+ </button>+ </>+ )}+ {deleteMode === 'deleting' && (+ <span className="flex items-center gap-1.5 text-xs text-gray-400">+ <Loader2 size={12} className="animate-spin" />+ Deleting…+ </span>+ )}+ </div></div>{editing ? (diff --git a/server/services/pipeline/seasons.js b/server/services/pipeline/seasons.jsindex 110b46c45a..938fb16ed6 100644--- a/server/services/pipeline/seasons.js+++ b/server/services/pipeline/seasons.js@@ -15,6 +15,7 @@ import { ARC_LIMITS, buildSeason, sanitizeSeason } from '../../lib/storyArc.js';import { isStr } from '../../lib/storyBible.js';import * as seriesSvc from './series.js';import * as issuesSvc from './issues.js';+import { emitRecordUpdated, withReexportSuppressed } from '../sharing/recordEvents.js';export const ERR_NOT_FOUND = 'PIPELINE_SEASON_NOT_FOUND';export const ERR_VALIDATION = 'PIPELINE_SEASON_VALIDATION';@@ -112,10 +113,19 @@ export async function deleteSeason(seriesId, seasonId, { reassignTo = null } = {// (issues per series ~< 100) so the cost is bounded.const childIssues = await issuesSvc.listIssues({ seriesId });const reassignList = childIssues.filter((iss) => iss.seasonId === seasonId);- for (const iss of reassignList) {- await issuesSvc.updateIssue(iss.id, { seasonId: reassignTo });- }const merged = seasons.filter((s) => s.id !== seasonId);- await seriesSvc.updateSeries(seriesId, { seasons: merged });+ // Each updateIssue + updateSeries emits `emitRecordUpdated('series', …)`. Without+ // suppression a cascade of N issues would schedule N debounced re-exports of the+ // same series; the exporter then logs "imageJobId not found" warnings per re-run+ // for any image jobs that have already aged out of the archive. Collapse the+ // cascade into a single re-export by suppressing during the writes and emitting+ // once at the end against the final state.+ await withReexportSuppressed('series', seriesId, async () => {+ for (const iss of reassignList) {+ await issuesSvc.updateIssue(iss.id, { seasonId: reassignTo });+ }+ await seriesSvc.updateSeries(seriesId, { seasons: merged });+ });+ emitRecordUpdated('series', seriesId);return { id: seasonId, reassignedIssueCount: reassignList.length, reassignedTo: reassignTo };}diff --git a/server/services/sharing/recordEvents.js b/server/services/sharing/recordEvents.jsindex 2462e52f08..046a594dac 100644--- a/server/services/sharing/recordEvents.js+++ b/server/services/sharing/recordEvents.js@@ -27,3 +27,35 @@ export function emitRecordDeleted(recordKind, recordId) {if (!recordKind || !recordId) return;recordEvents.emit('deleted', { recordKind, recordId });}++// Re-export suppression — lets a multi-write cascade (e.g. season delete+// re-pointing N child issues) avoid scheduling N debounced re-exports of+// the same record. Lives here (not in subscriptions.js) so service modules+// can use it without transitively pulling the exporter/file-IO graph in.+const suppressedReexports = new Map(); // `${kind}:${id}` → ref-count++function suppressionKey(recordKind, recordId) {+ return `${recordKind}:${recordId}`;+}++export function isReexportSuppressed(recordKind, recordId) {+ return suppressedReexports.has(suppressionKey(recordKind, recordId));+}++export async function withReexportSuppressed(recordKind, recordId, fn) {+ if (!recordKind || !recordId || typeof fn !== 'function') return fn?.();+ const key = suppressionKey(recordKind, recordId);+ suppressedReexports.set(key, (suppressedReexports.get(key) || 0) + 1);+ try {+ return await fn();+ } finally {+ const next = (suppressedReexports.get(key) || 1) - 1;+ if (next <= 0) suppressedReexports.delete(key);+ else suppressedReexports.set(key, next);+ }+}++/** Test-only: clear the suppression registry. */+export function __resetReexportSuppression() {+ suppressedReexports.clear();+}diff --git a/server/services/sharing/subscriptions.js b/server/services/sharing/subscriptions.jsindex fad7ae93ed..be4fbdaf43 100644--- a/server/services/sharing/subscriptions.js+++ b/server/services/sharing/subscriptions.js@@ -25,7 +25,16 @@ import { PATHS, atomicWrite, readJSONFile, ensureDir } from '../../lib/fileUtilsimport { isStr } from '../../lib/storyBible.js';import { getBucket } from './buckets.js';import { exportSeries, exportUniverse } from './exporter.js';-import { recordEvents } from './recordEvents.js';+import {+ recordEvents,+ isReexportSuppressed,+ withReexportSuppressed,+ __resetReexportSuppression,+} from './recordEvents.js';++// Re-export so existing callers (importer.js etc.) keep their import path+// stable; the canonical implementation now lives in recordEvents.js.+export { withReexportSuppressed };import { subscriptionFilename } from './manifest.js';// Re-export from the canonical source so other modules can import the@@ -217,24 +226,6 @@ export async function unsubscribeAllForRecord(recordKind, recordId) {*/const DEBOUNCE_MS = 3000;const pendingTimers = new Map(); // subId → Timeout-const suppressedReexports = new Map(); // `${kind}:${id}` → count--function suppressionKey(recordKind, recordId) {- return `${recordKind}:${recordId}`;-}--export async function withReexportSuppressed(recordKind, recordId, fn) {- if (!recordKind || !recordId || typeof fn !== 'function') return fn?.();- const key = suppressionKey(recordKind, recordId);- suppressedReexports.set(key, (suppressedReexports.get(key) || 0) + 1);- try {- return await fn();- } finally {- const next = (suppressedReexports.get(key) || 1) - 1;- if (next <= 0) suppressedReexports.delete(key);- else suppressedReexports.set(key, next);- }-}async function reexportNow(sub) {const exp = await runExport(sub).catch((err) => {@@ -252,7 +243,7 @@ async function reexportNow(sub) {}export async function reexportSubscribedRecord(recordKind, recordId) {- if (suppressedReexports.has(suppressionKey(recordKind, recordId))) return;+ if (isReexportSuppressed(recordKind, recordId)) return;const subs = await listSubscriptions({ recordKind, recordId });for (const sub of subs) {const existing = pendingTimers.get(sub.id);@@ -294,7 +285,7 @@ export function installSubscriptionListener() {export function __resetForTests() {for (const t of pendingTimers.values()) clearTimeout(t);pendingTimers.clear();- suppressedReexports.clear();+ __resetReexportSuppression();if (onUpdated) recordEvents.off('updated', onUpdated);if (onDeleted) recordEvents.off('deleted', onDeleted);onUpdated = null;