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
docs([merge-cascade-no-rollback]): remove from PLAN.md and log to changelog
[._.]/ Adam Eivy79c6b8ecff5f
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex c4bf3bafa3..19f56845bb 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -21,6 +21,7 @@- **[conflict-source-attribution] Sync conflicts now record which machine they came from.** When two of your machines edit the same universe, series, or issue and one push loses, the archived entry in Sharing → Conflicts now names the peer it collided with instead of showing an empty source — so you can tell which machine's edit you're reviewing. Previously every conflict was logged as an anonymous "sync".- **[conflict-restore-additive] "Restore mine" in Sharing → Conflicts is now a faithful restore of your whole version.** Restoring a universe's archived version now replaces its categories exactly as your version had them — a category that slipped in from the other machine's edit (after the timestamp-overwrite) is removed, instead of lingering. Merging back a single field still overlays it without disturbing the rest of the record.- **[series-merge-season-rehoming] Merging two series now keeps each issue in its season.** When you merge a duplicate series into another, issues that belonged to a season are placed into the surviving series' matching season (paired by season number) instead of all landing un-grouped for you to re-file by hand. Issues that had no season stay un-grouped, as before.+- **[merge-cascade-no-rollback] A merge that fails partway no longer leaves a broken half-merge — just re-run it.** If re-pointing a duplicate universe's child series (or moving a duplicate series' issues) fails mid-merge, the duplicate is now kept intact instead of being deleted over records that didn't move, and the merge reports exactly which children are stuck. Because every step is idempotent, simply running the merge again finishes the job cleanly.- **[conflict-journal-deep-diff] The Sharing → Conflicts tab now shows which sub-entry changed, not a wall of JSON.** For structured fields — universe categories and canon (characters/places/objects), series arc and seasons, issue stages — a conflict now breaks down into one focused before/after diff per changed entry, labelled by its name or key (e.g. just the character "Alice", or the "tone" category), instead of diffing the entire field as a single JSON blob. Restoring and merging still operate on the whole field.- **[conflict-journal-issues] Sync conflicts on individual issues are now captured and restorable, like universes and series.** When two of your machines independently edit the same issue while offline and then sync, the older edit is no longer silently overwritten — it's archived in Sharing → Conflicts where you can review what differs and restore your version (covering the issue's title, status, arc placement, length, and stage content such as prose and comic pages). Previously only universe and series conflicts were journaled; child issues rode last-write-wins silently.diff --git a/PLAN.md b/PLAN.mdindex d517c4ef31..c1d5d8191d 100644--- a/PLAN.md+++ b/PLAN.md@@ -6,7 +6,7 @@ For project goals, see [GOALS.md](./GOALS.md). For completed work, see [.changelClaimable, well-specified, no decision needed — `/claim`-able. Unordered.-- [ ] [merge-cascade-no-rollback] **`recordMerge.mergeUniverses`/`mergeSeries` cascade has no rollback.** Union-write survivor → re-point each child → tombstone loser runs as separate awaits; a mid-loop throw leaves the survivor merged but the loser un-tombstoned, and a retry trips `ERR_HAS_LIVE_SERIES` on the remaining children. Single-user/low-concurrency so low-probability, but a half-merge has no cleanup. Consider catching per-child and reporting, or finishing the loser tombstone best-effort. Surfaced in /code-review (medium).+- [ ] [conflict-source-attribution] **Conflict-journal `source` is `via:'sync'/peerId:null` on the peer-push path.** `applyIncomingPush` calls `mergeUniversesFromSync`/`mergeSeriesFromSync`/`mergeIssuesFromSync` without the `{ source }` arg even though `sourceInstanceId` is in scope, so the Conflicts tab can't attribute which peer collided. The snapshot-loop caller (`dataSync.applyPipelineRemote`) also drops the param, so snapshot-path issue/series conflicts record `{ via:'sync', peerId:null }`. Thread `{ via:'peer-push', peerId: sourceInstanceId }` from `applyIncomingPush` (and `{ via:'snapshot', peerId }` from the syncOrchestrator → `dataSync.applyRemote` path) into all three merge fns together. `mergeIssuesFromSync` already accepts the optional `source` param (added with the issue-journaling work); the universe/series fns mirror it — only the call sites need wiring. Surfaced in /code-review (low, attribution only).- [ ] [conflict-journal-push-flush-coalesce] **Coalesce per-push base-hash flushes.** `pushRecordToPeer` (`server/services/sharing/peerSync.js` ~947) stamps a base hash and calls `flushBaseHashes()` per pushed universe/series, so a large push loop rewrites `sync_base_hashes.json` once per record. A `setTimeout`-based debounce was tried and reverted (the unref'd timer leaked into `peerSync.test.js`'s settle-waits and made the suite flaky). A safe coalescing approach (microtask/`queueMicrotask` batch within a single push burst, or a test-injectable scheduler) could land the optimization without the timer-leak flake. Low priority.- [ ] [conflict-journal-base-hash-prune] **`sync_base_hashes.json` grows unbounded.** `server/lib/conflictJournal.js` seeds a base hash per synced universe/series and never prunes entries for deleted/tombstoned records. Tiny per-entry, but a long-lived install accumulates dead keys. Add a sweep (drop keys whose record no longer resolves) to the tombstone GC path.- [ ] [makesplitmigration-shared-factory] **Extract a shared `makeSplitMigration` factory into `scripts/migrations/_lib.js`.** The monolithic→per-record split scaffolding (`fileExists` / `readJsonStrict` / `readJsonTolerant` / `writeJson` + the `withFileTypes` already-split scan + the gate1/gate2/recovery/split/stamp/backup body) is now copied verbatim across **four** migrations: `034-split-universe-builder`, `035-split-pipeline-issues`, `036-split-pipeline-series`, `059-split-media-collections`. They differ only in `{ typeDirName, legacyFilename, backupSuffix, typeSchemaVersion, typeLabel, recordsKey, idPattern, buildConfig }` (e.g. `config: { runs }` for universes vs `config: {}` for collections). `_lib.js` already houses cross-migration families (`makePromptReplaceMigration`, layout helpers) — add a split family there and collapse the four to ~15-line config blocks. Pre-existing duplication; 059 was the 4th copy. Own change + test surface, so deferred out of the migration PR.