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
feat([issue-730]): per-session cross-machine resume toggle + reconcile in Story Builder
[._.]/ Adam Eivyc74b1edd5390
diff --git a/client/src/pages/StoryBuilder.jsx b/client/src/pages/StoryBuilder.jsxindex 2a41c968d7..057bcc66ee 100644--- a/client/src/pages/StoryBuilder.jsx+++ b/client/src/pages/StoryBuilder.jsx@@ -11,7 +11,7 @@ import StyleProbeImage from '../components/universe/StyleProbeImage';import ProviderModelSelector from '../components/ProviderModelSelector';import {Sparkles, Lock, Unlock, Check, ChevronRight, ChevronLeft, AlertTriangle,- Plus, RefreshCw, Loader2, ExternalLink, Wand2,+ Plus, RefreshCw, Loader2, ExternalLink, Wand2, Cloud, CloudOff,} from 'lucide-react';import toast from '../components/ui/Toast';import Banner from '../components/ui/Banner';@@ -21,6 +21,7 @@ import {getStoryBuilderSteps, listStorySessions, getStorySession, createStorySession,updateStorySession, setStoryCurrentStep, lockStoryStep, unlockStoryStep,generateStoryStep, refineStoryStep, setStoryIssueLock, generateStoryIssues,+ setStorySessionSync, reconcileStorySession,getUniverse, getPipelineSeries, listPipelineIssues,analyzeImport, commitImport, retryImporterIssues, IMPORTER_CONTENT_TYPES,getProviders, updateUniverse,@@ -972,16 +973,19 @@ function StoryBuilderDetail({ storyId, stepParam }) {const [steps, setSteps] = useState([]);const [session, setSession] = useState(null);const [staleSteps, setStaleSteps] = useState([]);+ const [syncDrift, setSyncDrift] = useState(false);const [universe, setUniverse] = useState(null);const [series, setSeries] = useState(null);const [issues, setIssues] = useState([]);const [loading, setLoading] = useState(true);+ const [syncBusy, setSyncBusy] = useState(false);const reload = useCallback(async () => {const s = await getStorySession(storyId, { silent: true }).catch(() => null);if (!s) { setSession(null); setLoading(false); return; }setSession(s);setStaleSteps(s.staleSteps || []);+ setSyncDrift(s.syncDrift === true);// These GETs own their fallback (.catch → null/[]), so silence the helper's// default error toast — otherwise a transient failure double-toasts.const [u, ser] = await Promise.all([@@ -1090,6 +1094,34 @@ function StoryBuilderDetail({ storyId, stepParam }) {if (updated) setSession((prev) => (prev ? { ...prev, llm: updated.llm } : prev));};+ // Cross-machine resume (#730). Toggling sync on captures a fresh staleness+ // baseline from this machine's live records; reconcile re-captures it. Both+ // settle drift to false, so we merge the server-confirmed `sync` flag and+ // clear drift locally rather than refetching the whole view.+ const toggleSync = async () => {+ if (!session || syncBusy) return;+ const next = session.sync !== true;+ setSyncBusy(true);+ const updated = await setStorySessionSync(storyId, next, { silent: true })+ .catch(() => null)+ .finally(() => setSyncBusy(false));+ if (!updated) { toast.error('Failed to update cross-machine resume'); return; }+ setSession((prev) => (prev ? { ...prev, sync: updated.sync === true } : prev));+ setSyncDrift(false);+ toast.success(next ? 'Cross-machine resume enabled' : 'Cross-machine resume disabled');+ };++ const reconcile = async () => {+ if (!session || session.sync !== true || syncBusy) return;+ setSyncBusy(true);+ const updated = await reconcileStorySession(storyId, { silent: true })+ .catch(() => null)+ .finally(() => setSyncBusy(false));+ if (!updated) { toast.error('Failed to reconcile'); return; }+ setSyncDrift(false);+ toast.success('Re-baselined to this machine');+ };+if (loading) return <div className="p-6 text-gray-400 flex items-center gap-2"><Loader2 className="w-5 h-5 animate-spin" /> Loading…</div>;if (!session) return <div className="p-6 text-gray-400">Session not found. <Link to="/story-builder" className="text-port-accent">Back to Story Builder</Link></div>;@@ -1111,6 +1143,53 @@ function StoryBuilderDetail({ storyId, stepParam }) {/></header>+ {/* Cross-machine resume (#730): opt this session into peer sync so it can+ resume on another federated machine, and re-baseline its staleness+ against the current machine's live records. Local-only is the default. */}+ <div className="mb-4 flex items-center flex-wrap gap-x-3 gap-y-2 text-sm bg-port-card border border-port-border rounded-lg px-3 py-2">+ <button+ type="button"+ onClick={toggleSync}+ disabled={syncBusy}+ aria-pressed={session.sync === true}+ className={`inline-flex items-center gap-2 px-3 py-1.5 rounded border disabled:opacity-50 ${+ session.sync === true+ ? 'border-port-accent text-port-accent bg-port-bg'+ : 'border-port-border text-gray-400 hover:text-white'+ }`}+ title="Toggle whether this session resumes across your federated machines"+ >+ {syncBusy ? <Loader2 className="w-4 h-4 animate-spin" /> : (session.sync === true ? <Cloud className="w-4 h-4" /> : <CloudOff className="w-4 h-4" />)}+ {session.sync === true ? 'Cross-machine resume on' : 'Cross-machine resume off'}+ </button>++ {session.sync === true && (+ <>+ <span className="text-xs text-gray-500">+ {syncDrift+ ? 'This machine’s records have drifted from the synced baseline.'+ : 'Baseline matches this machine.'}+ </span>+ <button+ type="button"+ onClick={reconcile}+ disabled={syncBusy || !syncDrift}+ className={`inline-flex items-center gap-2 px-3 py-1.5 rounded border disabled:opacity-40 ${+ syncDrift+ ? 'border-port-warning text-port-warning hover:bg-port-bg'+ : 'border-port-border text-gray-500'+ }`}+ title={syncDrift+ ? 'Adopt this machine’s current records as the new staleness baseline'+ : 'Nothing to reconcile — the baseline already matches this machine'}+ >+ {syncBusy ? <Loader2 className="w-4 h-4 animate-spin" /> : <RefreshCw className="w-4 h-4" />}+ Reconcile+ </button>+ </>+ )}+ </div>+<div className="grid grid-cols-1 md:grid-cols-[220px_1fr] gap-6">{/* Step rail */}<nav className="space-y-1">diff --git a/client/src/pages/StoryBuilder.test.jsx b/client/src/pages/StoryBuilder.test.jsxindex c9e460abd5..ad8e6e42f1 100644--- a/client/src/pages/StoryBuilder.test.jsx+++ b/client/src/pages/StoryBuilder.test.jsx@@ -27,6 +27,8 @@ const api = vi.hoisted(() => ({unlockStoryStep: vi.fn(),generateStoryStep: vi.fn(),refineStoryStep: vi.fn(),+ setStorySessionSync: vi.fn(),+ reconcileStorySession: vi.fn(),storyStepProgressSseUrl: vi.fn((id, stepId) => `/api/story-builder/${id}/steps/${stepId}/progress`),setStoryIssueLock: vi.fn(),getUniverse: vi.fn(),@@ -93,6 +95,8 @@ beforeEach(() => {api.generateStoryStep.mockResolvedValue({ result: {} });api.refineStoryStep.mockResolvedValue({ result: {}, changes: [] });api.setStoryIssueLock.mockResolvedValue({});+ api.setStorySessionSync.mockImplementation(async (_id, sync) => ({ id: 'stb-1', sync }));+ api.reconcileStorySession.mockResolvedValue({ id: 'stb-1', sync: true });api.getUniverse.mockResolvedValue({ id: 'u1', logline: 'L', premise: 'P', styleNotes: 'S', influences: { embrace: [], avoid: [] }, characters: [] });api.getPipelineSeries.mockResolvedValue({ id: 's1', arc: { logline: 'AL', summary: 'AS', readerMap: { hooks: [{ id: 'rm-1', label: 'Why?' }] } } });api.listPipelineIssues.mockResolvedValue([]);@@ -471,4 +475,41 @@ describe('StoryBuilder — detail stepper', () => {// Locked step → the action flips to "Unlock to revise".expect(screen.getByText('Unlock to revise')).toBeTruthy();});++ it('cross-machine resume: toggles sync on and reveals the reconcile control (#730)', async () => {+ const { fireEvent } = await import('@testing-library/react');+ api.getStorySession.mockResolvedValue({+ id: 'stb-1', title: 'Salt Run', currentStep: 'idea', seedIdea: 'seed',+ universeId: 'u1', seriesId: 's1', steps: mkSteps(), staleSteps: [], sync: false, syncDrift: false, llm: { provider: '', model: '' },+ });+ renderAt('/story-builder/stb-1/idea');+ await waitFor(() => expect(screen.getByText('Cross-machine resume off')).toBeTruthy());+ // Reconcile is hidden while sync is off (local-only sessions can't reconcile).+ expect(screen.queryByRole('button', { name: /Reconcile/i })).toBeNull();++ fireEvent.click(screen.getByText('Cross-machine resume off'));+ await waitFor(() => expect(api.setStorySessionSync).toHaveBeenCalledWith('stb-1', true, expect.objectContaining({ silent: true })));+ // Reactive: label flips and the reconcile control appears without a refetch.+ await waitFor(() => expect(screen.getByText('Cross-machine resume on')).toBeTruthy());+ expect(screen.getByRole('button', { name: /Reconcile/i })).toBeTruthy();+ });++ it('cross-machine resume: reconcile is enabled only when drift exists, and clears it (#730)', async () => {+ const { fireEvent } = await import('@testing-library/react');+ api.getStorySession.mockResolvedValue({+ id: 'stb-1', title: 'Salt Run', currentStep: 'idea', seedIdea: 'seed',+ universeId: 'u1', seriesId: 's1', steps: mkSteps(), staleSteps: [], sync: true, syncDrift: true, llm: { provider: '', model: '' },+ });+ renderAt('/story-builder/stb-1/idea');+ await waitFor(() => expect(screen.getByText('Cross-machine resume on')).toBeTruthy());+ const reconcileBtn = screen.getByRole('button', { name: /Reconcile/i });+ expect(reconcileBtn.disabled).toBe(false);+ expect(screen.getByText(/drifted from the synced baseline/i)).toBeTruthy();++ fireEvent.click(reconcileBtn);+ await waitFor(() => expect(api.reconcileStorySession).toHaveBeenCalledWith('stb-1', expect.objectContaining({ silent: true })));+ // Drift clears reactively → message flips and the button disables.+ await waitFor(() => expect(screen.getByText(/Baseline matches this machine/i)).toBeTruthy());+ expect(screen.getByRole('button', { name: /Reconcile/i }).disabled).toBe(true);+ });});diff --git a/client/src/services/README.md b/client/src/services/README.mdindex e5137d535f..1bbcd68498 100644--- a/client/src/services/README.md+++ b/client/src/services/README.md@@ -97,7 +97,7 @@ toasts on throw). **Custom catch ⇒ `silent: true`** — otherwise toasts fire| `apiAsk.js` | Ask page (chat-like). || `apiGSD.js` | "Get Stuff Done" integration. || `apiImporter.js` | Manuscript / chat importer. |-| `apiStoryBuilder.js` | Unified Story Builder conductor (sessions, step lock/unlock, generate/refine). |+| `apiStoryBuilder.js` | Unified Story Builder conductor (sessions, step lock/unlock, generate/refine, cross-machine sync toggle + reconcile). || `apiOpenClaw.js` | File browser / picker backend. || `apiPalette.js` | Command-palette manifest + action dispatch. || `apiVoice.js` | Voice synthesis / processing. |diff --git a/client/src/services/apiStoryBuilder.js b/client/src/services/apiStoryBuilder.jsindex b817076527..b2eb4a96c0 100644--- a/client/src/services/apiStoryBuilder.js+++ b/client/src/services/apiStoryBuilder.js@@ -27,6 +27,20 @@ export const deleteStorySession = (id, options = {}) => request(`/story-builder/...options,});+// Cross-machine resume (#730). setStorySessionSync toggles whether a session+// participates in peer sync; reconcileStorySession re-baselines a synced+// session's staleness baseline to the current machine's live records (rejected+// server-side for a local-only session).+export const setStorySessionSync = (id, sync, options = {}) =>+ request(`/story-builder/${id}/sync`, {+ method: 'POST',+ body: JSON.stringify({ sync }),+ ...options,+ });++export const reconcileStorySession = (id, options = {}) =>+ request(`/story-builder/${id}/reconcile`, { method: 'POST', ...options });+export const setStoryCurrentStep = (id, stepId, options = {}) =>request(`/story-builder/${id}/current-step/${stepId}`, { method: 'POST', ...options });diff --git a/server/lib/storyBuilderIntegrity.js b/server/lib/storyBuilderIntegrity.jsindex 268dea589a..42e73c8a04 100644--- a/server/lib/storyBuilderIntegrity.js+++ b/server/lib/storyBuilderIntegrity.js@@ -61,3 +61,24 @@ export function computeStaleSteps(session, currentHashes = {}) {}return stale;}++/**+ * For a sync-enabled session, report whether THIS machine's live upstream+ * records have drifted from the session-carried `syncedHashes` baseline (#730).+ * That's the "reconcile would change something" signal: a synced session keys+ * its staleness off `syncedHashes` (so a peer's edit can't false-positive it),+ * but the user may still want to adopt this machine's current records as the new+ * baseline — and they only need to when at least one locked step's live hash no+ * longer matches the carried baseline. Returns false when no baseline exists or+ * no locked step diverges.+ */+export function computeSyncDrift(session, currentHashes = {}, syncedHashes = {}) {+ const steps = session?.steps || {};+ for (const [stepId, state] of Object.entries(steps)) {+ if (!state || state.locked !== true) continue;+ const current = currentHashes[stepId];+ if (current == null) continue;+ if ((syncedHashes?.[stepId] ?? null) !== current) return true;+ }+ return false;+}diff --git a/server/lib/storyBuilderIntegrity.test.js b/server/lib/storyBuilderIntegrity.test.jsindex e84c6aa911..4cc0c8782d 100644--- a/server/lib/storyBuilderIntegrity.test.js+++ b/server/lib/storyBuilderIntegrity.test.js@@ -1,5 +1,5 @@import { describe, it, expect } from 'vitest';-import { hashUpstream, computeStaleSteps } from './storyBuilderIntegrity.js';+import { hashUpstream, computeStaleSteps, computeSyncDrift } from './storyBuilderIntegrity.js';describe('storyBuilderIntegrity — hashUpstream', () => {it('is deterministic for the same inputs', () => {@@ -73,3 +73,46 @@ describe('storyBuilderIntegrity — computeStaleSteps', () => {expect(computeStaleSteps({ steps: {} }, { a: 'b' })).toEqual([]);});});++describe('storyBuilderIntegrity — computeSyncDrift', () => {+ const session = {+ steps: {+ idea: { locked: true, upstreamHash: 'h-idea' },+ plotArc: { locked: false, upstreamHash: 'h-arc' },+ readerMap: { locked: true, upstreamHash: 'h-reader' },+ },+ };++ it('reports drift when a locked step\'s live hash differs from the synced baseline', () => {+ const live = { idea: 'h-idea', readerMap: 'h-reader-CHANGED' };+ const synced = { idea: 'h-idea', readerMap: 'h-reader' };+ expect(computeSyncDrift(session, live, synced)).toBe(true);+ });++ it('reports no drift when every locked step matches the baseline', () => {+ const live = { idea: 'h-idea', readerMap: 'h-reader' };+ expect(computeSyncDrift(session, live, live)).toBe(false);+ });++ it('ignores unlocked-step divergence', () => {+ const live = { idea: 'h-idea', plotArc: 'h-arc-CHANGED', readerMap: 'h-reader' };+ const synced = { idea: 'h-idea', plotArc: 'h-arc', readerMap: 'h-reader' };+ expect(computeSyncDrift(session, live, synced)).toBe(false);+ });++ it('treats a baseline missing a locked step\'s hash as drift', () => {+ const live = { idea: 'h-idea', readerMap: 'h-reader' };+ expect(computeSyncDrift(session, live, {})).toBe(true);+ });++ it('skips locked steps with no live hash available', () => {+ const live = { idea: 'h-idea' }; // readerMap has no live hash+ const synced = { idea: 'h-idea' };+ expect(computeSyncDrift(session, live, synced)).toBe(false);+ });++ it('returns false for an empty/missing session', () => {+ expect(computeSyncDrift(null, {}, {})).toBe(false);+ expect(computeSyncDrift({ steps: {} }, { a: 'b' }, {})).toBe(false);+ });+});diff --git a/server/routes/storyBuilder.js b/server/routes/storyBuilder.jsindex 482566669a..96f302a12f 100644--- a/server/routes/storyBuilder.js+++ b/server/routes/storyBuilder.js@@ -60,8 +60,9 @@ router.post('/', asyncHandler(async (req, res) => {router.get('/:id', asyncHandler(async (req, res) => {const view = await getStorySessionView(req.params.id).catch((err) => { throw mapServiceError(err); });- // Flatten the session with the computed (non-persisted) staleSteps array.- res.json({ ...view.session, staleSteps: view.staleSteps });+ // Flatten the session with the computed (non-persisted) staleSteps array ++ // the syncDrift flag (#730: live records diverged from the synced baseline).+ res.json({ ...view.session, staleSteps: view.staleSteps, syncDrift: view.syncDrift });}));router.patch('/:id', asyncHandler(async (req, res) => {diff --git a/server/routes/storyBuilder.test.js b/server/routes/storyBuilder.test.jsindex e6912fa4a6..574dfb9e60 100644--- a/server/routes/storyBuilder.test.js+++ b/server/routes/storyBuilder.test.js@@ -7,7 +7,7 @@ import { errorMiddleware } from '../lib/errorHandler.js';// service dispatch, not the service logic (covered by storyBuilder.test.js).const svc = {listStorySessions: vi.fn(async () => [{ id: 'stb-1' }]),- getStorySessionView: vi.fn(async () => ({ session: { id: 'stb-1', title: 'X' }, staleSteps: ['readerMap'] })),+ getStorySessionView: vi.fn(async () => ({ session: { id: 'stb-1', title: 'X' }, staleSteps: ['readerMap'], syncDrift: true })),createStorySession: vi.fn(async (input) => ({ id: 'stb-new', ...input })),updateStorySession: vi.fn(async (id, patch) => ({ id, ...patch })),deleteStorySession: vi.fn(async (id) => ({ id })),@@ -18,6 +18,8 @@ const svc = {generateStep: vi.fn(async () => ({ result: { ok: true } })),refineStep: vi.fn(async () => ({ result: { ok: true }, changes: ['c'], rationale: 'r' })),getStorySession: vi.fn(async () => ({ id: 'stb-1' })),+ setStorySessionSync: vi.fn(async (id, sync) => ({ id, sync })),+ reconcileStorySession: vi.fn(async (id) => ({ id, sync: true, reconciled: true })),ERR_NOT_FOUND: 'STORY_BUILDER_NOT_FOUND',ERR_VALIDATION: 'STORY_BUILDER_VALIDATION',};@@ -74,11 +76,12 @@ describe('POST /api/story-builder', () => {});describe('GET /api/story-builder/:id', () => {- it('flattens the session with the computed staleSteps', async () => {+ it('flattens the session with the computed staleSteps and syncDrift flag', async () => {const res = await request(makeApp()).get('/api/story-builder/stb-1');expect(res.status).toBe(200);expect(res.body.id).toBe('stb-1');expect(res.body.staleSteps).toEqual(['readerMap']);+ expect(res.body.syncDrift).toBe(true);});it('maps a service NOT_FOUND to 404', async () => {@@ -88,6 +91,34 @@ describe('GET /api/story-builder/:id', () => {});});+describe('cross-machine resume routes (#730)', () => {+ it('POST /:id/sync toggles sync and dispatches to the service', async () => {+ const res = await request(makeApp()).post('/api/story-builder/stb-1/sync').send({ sync: true });+ expect(res.status).toBe(200);+ expect(svc.setStorySessionSync).toHaveBeenCalledWith('stb-1', true);+ expect(res.body.sync).toBe(true);+ });++ it('POST /:id/sync rejects a missing sync flag with 400', async () => {+ const res = await request(makeApp()).post('/api/story-builder/stb-1/sync').send({});+ expect(res.status).toBe(400);+ expect(svc.setStorySessionSync).not.toHaveBeenCalled();+ });++ it('POST /:id/reconcile re-baselines and dispatches to the service', async () => {+ const res = await request(makeApp()).post('/api/story-builder/stb-1/reconcile').send({});+ expect(res.status).toBe(200);+ expect(svc.reconcileStorySession).toHaveBeenCalledWith('stb-1');+ expect(res.body.reconciled).toBe(true);+ });++ it('maps a reconcile VALIDATION error (local-only session) to 400', async () => {+ svc.reconcileStorySession.mockRejectedValueOnce(Object.assign(new Error('off'), { code: svc.ERR_VALIDATION }));+ const res = await request(makeApp()).post('/api/story-builder/stb-1/reconcile').send({});+ expect(res.status).toBe(400);+ });+});+describe('step state machine routes', () => {it('locks a valid step', async () => {const res = await request(makeApp()).post('/api/story-builder/stb-1/steps/plotArc/lock').send({});diff --git a/server/services/storyBuilder.js b/server/services/storyBuilder.jsindex 959a28edfe..a2b8da1bf6 100644--- a/server/services/storyBuilder.js+++ b/server/services/storyBuilder.js@@ -44,7 +44,7 @@ import { runStagedLLM } from '../lib/stageRunner.js';import {STEP_IDS, STEP_STATUSES, isValidStepId,} from '../lib/storyBuilderSteps.js';-import { hashUpstream, computeStaleSteps } from '../lib/storyBuilderIntegrity.js';+import { hashUpstream, computeStaleSteps, computeSyncDrift } from '../lib/storyBuilderIntegrity.js';import { createUniverse, deleteUniverse, getUniverse, updateUniverse } from './universeBuilder.js';import { expandWorldTemplate } from './universeBuilderExpand.js';import { refineWorldPrompts } from './universeBuilderRefine.js';@@ -540,7 +540,14 @@ export async function getStorySessionView(id) {const { hashes, universe, series } = await computeCurrentHashes(session);const baseline = session.sync === true ? (session.syncedHashes || {}) : hashes;const staleSteps = computeStaleSteps(session, baseline);- return { session, staleSteps, universe, series };+ // For a synced session, also report whether THIS machine's live records have+ // drifted from the carried baseline — the "reconcile would adopt new state"+ // signal the UI shows next to the reconcile action (#730). Always false for+ // local-only sessions (their staleness already live-diffs).+ const syncDrift = session.sync === true+ ? computeSyncDrift(session, hashes, session.syncedHashes || {})+ : false;+ return { session, staleSteps, syncDrift, universe, series };}// Persist sync mode + (when enabled) a fresh live-hash baseline. Bothdiff --git a/server/services/storyBuilder.test.js b/server/services/storyBuilder.test.jsindex d6ba80e9bd..c53caa1805 100644--- a/server/services/storyBuilder.test.js+++ b/server/services/storyBuilder.test.js@@ -381,6 +381,33 @@ describe('storyBuilder — sync-safe staleness (#730)', () => {expect(view.staleSteps).toContain('plotArc');});+ it('view reports syncDrift when live records diverge from the synced baseline, and clears it on reconcile (#730)', async () => {+ const s = await sb.createStorySession({ title: 'X' });+ await sb.setStorySessionSync(s.id, true);+ await seriesSvc.updateSeries(s.seriesId, { arc: { logline: 'spine', summary: 'sum' } });+ await sb.lockStep(s.id, 'plotArc');+ // Baseline freshly captured at lock → no drift yet.+ let view = await sb.getStorySessionView(s.id);+ expect(view.syncDrift).toBe(false);+ // A peer edit moves the live records but not the carried baseline → drift.+ await seriesSvc.updateSeries(s.seriesId, { arc: { logline: 'DRIFTED', summary: 'sum' }, locked: {} });+ view = await sb.getStorySessionView(s.id);+ expect(view.syncDrift).toBe(true);+ // Reconcile adopts the live records as the new baseline → drift clears.+ await sb.reconcileStorySession(s.id);+ view = await sb.getStorySessionView(s.id);+ expect(view.syncDrift).toBe(false);+ });++ it('a local-only session always reports syncDrift:false', async () => {+ const s = await sb.createStorySession({ title: 'X' });+ await seriesSvc.updateSeries(s.seriesId, { arc: { logline: 'spine', summary: 'sum' } });+ await sb.lockStep(s.id, 'plotArc');+ await seriesSvc.updateSeries(s.seriesId, { arc: { logline: 'CHANGED', summary: 'sum' }, locked: {} });+ const view = await sb.getStorySessionView(s.id);+ expect(view.syncDrift).toBe(false);+ });+it('turning sync OFF reverts to live-diff staleness and drops the baseline', async () => {const s = await sb.createStorySession({ title: 'X' });await sb.setStorySessionSync(s.id, true);