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
refactor([issue-727]): extract sweepable-series predicate; add changelog
[._.]/ Adam Eivy701b6044892f
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex 467e9f0180..8d7d02c973 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -32,6 +32,7 @@## Changed+- **[issue-727] Abandoned imports no longer leave empty universes lying around** — starting an import and walking away before you commit it used to leave a blank universe and series behind in your library. Those scratch records are now hidden from sync and automatically cleaned up after a week if you never finish the import, while committing one keeps it for good.- **[issue-832]** The Review Hub's draft lookup now asks the data layer for just the unsent drafts it needs instead of loading every draft and filtering them in memory. Internal performance change with no behavior difference.- **[issue-705]** CyberCity now coalesces bursts of agent spawn/complete events into a single refresh instead of refetching once per event, so a wave of agents starting no longer fans out redundant requests. Internal performance change with no behavior difference.- **[issue-805]** Removed ~470 lines of dead, never-called self-improvement task-generation code left behind by an earlier rewrite. Internal cleanup with no behavior difference.diff --git a/server/services/importerOrphanGc.js b/server/services/importerOrphanGc.jsindex 74411f9ebf..a77e1a2841 100644--- a/server/services/importerOrphanGc.js+++ b/server/services/importerOrphanGc.js@@ -85,16 +85,24 @@ export async function sweepOrphanShells({ now = Date.now(), maxAgeMs = ORPHAN_SHsurvivingSeriesByUniverse.set(key, (survivingSeriesByUniverse.get(key) || 0) + 1);};- for (const s of allSeries) {- if (s.ephemeral !== true) { noteSurvivor(s); continue; }- if (seriesHasStoryWork(s)) { noteSurvivor(s); continue; }+ // True only for an ephemeral, story-work-free, aged-out, zero-issue shell.+ // Each gate runs cheapest-first (the listIssues read is reached only by a+ // series that already passed every in-memory check).+ const seriesIsSweepable = async (s) => {+ if (s.ephemeral !== true || seriesHasStoryWork(s)) return false;const age = ageMs(s, now);- if (!Number.isFinite(age) || age < maxAgeMs) { noteSurvivor(s); continue; }+ if (!Number.isFinite(age) || age < maxAgeMs) return false;const issues = await listIssues({ seriesId: s.id });- if (issues.length > 0) { noteSurvivor(s); continue; }- // Empty, ephemeral, aged-out, zero-issue series — sweep it.- await deleteSeries(s.id);- deletedSeries.push(s.id);+ return issues.length === 0;+ };++ for (const s of allSeries) {+ if (await seriesIsSweepable(s)) {+ await deleteSeries(s.id);+ deletedSeries.push(s.id);+ } else {+ noteSurvivor(s);+ }}// --- Pass 2: ephemeral, empty, aged-out universes with no surviving series ---