Skip to content

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

address review (claude): remount particle geometry on density change, precise dirty gates

[._.]/ Adam Eivy686bd819facf
diff --git a/client/src/components/city/CityDataRain.jsx b/client/src/components/city/CityDataRain.jsx
index 22156b314a..509d252742 100644
--- a/client/src/components/city/CityDataRain.jsx
+++ b/client/src/components/city/CityDataRain.jsx
@@ -113,7 +113,10 @@ export default function CityDataRain({ settings }) {
return (
<points ref={pointsRef}>
- <bufferGeometry>
+ {/* key remounts the geometry when density changes — three.js cannot resize
+ a live BufferAttribute in place, and the warm-up clamp restores density
+ ~1.2s after every mount. */}
+ <bufferGeometry key={count}>
<bufferAttribute attach="attributes-position" count={count} array={positions} itemSize={3} />
<bufferAttribute attach="attributes-charIndex" count={count} array={charIndices} itemSize={1} />
<bufferAttribute attach="attributes-columnPhase" count={count} array={columnPhases} itemSize={1} />
diff --git a/client/src/components/city/CityEmbers.jsx b/client/src/components/city/CityEmbers.jsx
index 944b353b5e..d99a2a2426 100644
--- a/client/src/components/city/CityEmbers.jsx
+++ b/client/src/components/city/CityEmbers.jsx
@@ -101,7 +101,10 @@ export default function CityEmbers({ settings }) {
return (
<points ref={pointsRef}>
- <bufferGeometry>
+ {/* key remounts the geometry when density changes — three.js cannot resize
+ a live BufferAttribute in place, and the warm-up clamp restores density
+ ~1.2s after every mount. */}
+ <bufferGeometry key={count}>
<bufferAttribute attach="attributes-position" count={count} array={positions} itemSize={3} />
<bufferAttribute attach="attributes-size" count={count} array={sizes} itemSize={1} />
<bufferAttribute attach="attributes-speed" count={count} array={speeds} itemSize={1} />
diff --git a/client/src/components/city/audio/citySynthMusic.test.js b/client/src/components/city/audio/citySynthMusic.test.js
index b8fd1c925b..79bfa6abfc 100644
--- a/client/src/components/city/audio/citySynthMusic.test.js
+++ b/client/src/components/city/audio/citySynthMusic.test.js
@@ -147,6 +147,25 @@ describe('citySynthMusic', () => {
expect(settleMs).toBe((STOP_SETTLE + STOP_RAMP_TC) * 1000);
});
+ it('defers node disconnects until the ramp settles (the pop-fix contract)', () => {
+ vi.useFakeTimers();
+ try {
+ synth.startMusic();
+ const settleMs = synth.stopMusic();
+
+ // An immediate disconnect would cut the fade short — nothing may
+ // disconnect at stopMusic() return time.
+ const disconnects = () =>
+ fakeCtx.oscillators.filter(o => o.disconnect.mock.calls.length > 0).length;
+ expect(disconnects()).toBe(0);
+
+ vi.advanceTimersByTime(settleMs + 1);
+ expect(disconnects()).toBe(fakeCtx.oscillators.length);
+ } finally {
+ vi.useRealTimers();
+ }
+ });
+
it('clears is-playing state so a later startMusic creates fresh nodes', () => {
synth.startMusic();
const firstOscCount = fakeCtx.oscillators.length;
diff --git a/client/src/components/pipeline/stages/ExtractCanonButton.jsx b/client/src/components/pipeline/stages/ExtractCanonButton.jsx
index 5ee1ad4bab..0036ecd12f 100644
--- a/client/src/components/pipeline/stages/ExtractCanonButton.jsx
+++ b/client/src/components/pipeline/stages/ExtractCanonButton.jsx
@@ -7,22 +7,23 @@ import { extractPipelineCanonFromScript, PIPELINE_STAGE_LABELS } from '../../../
// Auto-extract runs only after `prose` (server/services/pipeline/textStages.js),
// so characters/places/objects introduced only in panel directions or
// dialogue cues never make it into the bible until the writer clicks this.
-function getTooltip({ gated, hasContent, hasUniverse, busy, stageLabel }) {
+function getTooltip({ gated, dirty, hasContent, hasUniverse, busy, stageLabel }) {
if (gated) return 'Saving settings…';
+ if (dirty) return 'Save or discard your edits first — extraction reads the saved script.';
if (!hasContent) return `Generate the ${stageLabel} stage first`;
if (!hasUniverse) return 'Link a universe to the series first — extraction needs a target bible.';
if (busy) return 'Extraction in progress…';
return 'Extract characters / places / objects from this script and merge into the linked universe.';
}
-export default function ExtractCanonButton({ issue, series, stageId, gated = false }) {
+export default function ExtractCanonButton({ issue, series, stageId, gated = false, dirty = false }) {
const [busy, setBusy] = useState(false);
const hintId = useId();
const hasContent = !!(issue.stages?.[stageId]?.output || '').trim();
const hasUniverse = !!series?.universeId;
- const disabled = busy || gated || !hasContent || !hasUniverse;
+ const disabled = busy || gated || dirty || !hasContent || !hasUniverse;
const stageLabel = PIPELINE_STAGE_LABELS[stageId] || stageId;
- const tooltip = getTooltip({ gated, hasContent, hasUniverse, busy, stageLabel });
+ const tooltip = getTooltip({ gated, dirty, hasContent, hasUniverse, busy, stageLabel });
const handleClick = async () => {
setBusy(true);
diff --git a/client/src/components/pipeline/stages/TeleplayStage.jsx b/client/src/components/pipeline/stages/TeleplayStage.jsx
index 02a9c7d35c..ab82982e4d 100644
--- a/client/src/components/pipeline/stages/TeleplayStage.jsx
+++ b/client/src/components/pipeline/stages/TeleplayStage.jsx
@@ -8,12 +8,13 @@ export default function TeleplayStage(props) {
stageId="teleplay"
generateLabel="Adapt to teleplay"
outputPlaceholder="Slugline → action → dialogue. Standard TV format with act breaks. Generated from the prose stage; iterates independently of the comic script."
- extraActions={(
+ extraActions={({ dirty }) => (
<ExtractCanonButton
issue={props.issue}
series={props.series}
stageId="teleplay"
gated={props.actionsGated}
+ dirty={dirty}
/>
)}
/>
diff --git a/client/src/components/pipeline/stages/TextStagePanel.jsx b/client/src/components/pipeline/stages/TextStagePanel.jsx
index 797c91dc7b..6ac7e79bc9 100644
--- a/client/src/components/pipeline/stages/TextStagePanel.jsx
+++ b/client/src/components/pipeline/stages/TextStagePanel.jsx
@@ -99,6 +99,10 @@ export default function TextStagePanel({
};
const dirty = draftOutput !== (stage.output || '') || draftInput !== (stage.input || '');
+ // Generate gates on OUTPUT drift only: the seed input is sent live with the
+ // request (seedInput: draftInput), so unsaved seed edits are consumed, not
+ // skipped — only an unsaved output edit would be clobbered by the result.
+ const outputDirty = draftOutput !== (stage.output || '');
const [runSave, saving] = useAsyncAction(
() => updatePipelineIssue(issue.id, {
@@ -133,7 +137,7 @@ export default function TextStagePanel({
) : null}
</div>
<div className="flex items-center gap-2">
- {extraActions}
+ {typeof extraActions === 'function' ? extraActions({ dirty: outputDirty }) : extraActions}
<button
type="button"
onClick={() => setHistoryOpen(true)}
@@ -156,8 +160,8 @@ export default function TextStagePanel({
<button
type="button"
onClick={handleGenerate}
- disabled={generating || actionsGated || dirty}
- title={actionsGated ? 'Saving settings…' : (dirty ? 'Save or discard your edits first' : undefined)}
+ disabled={generating || actionsGated || outputDirty}
+ title={actionsGated ? 'Saving settings…' : (outputDirty ? 'Save or discard your edits first' : undefined)}
className="inline-flex items-center gap-2 px-3 py-1.5 rounded-lg bg-port-accent text-white text-sm font-medium disabled:opacity-50"
>
{generating ? <Loader2 size={14} className="animate-spin" /> : <Sparkles size={14} />}
diff --git a/client/src/components/writers-room/StoryboardBibleTab.jsx b/client/src/components/writers-room/StoryboardBibleTab.jsx
index bd00511b0e..a2004fc6f4 100644
--- a/client/src/components/writers-room/StoryboardBibleTab.jsx
+++ b/client/src/components/writers-room/StoryboardBibleTab.jsx
@@ -30,7 +30,7 @@ const BIBLE_KINDS = {
},
};
-function RefreshHeader({ noun, label, sub, running, anyRunning, onRefresh, empty }) {
+function RefreshHeader({ noun, label, sub, running, anyRunning, onRefresh, empty, dirty = false }) {
return (
<div className="flex items-start justify-between gap-2 pb-2 border-b border-port-border">
<div className="min-w-0">
@@ -40,9 +40,9 @@ function RefreshHeader({ noun, label, sub, running, anyRunning, onRefresh, empty
<button
type="button"
onClick={onRefresh}
- disabled={anyRunning || !onRefresh}
+ disabled={anyRunning || !onRefresh || dirty}
className="shrink-0 flex items-center gap-1 px-2 py-1 text-[10px] rounded bg-port-bg border border-port-border text-gray-300 hover:bg-port-card hover:text-white disabled:opacity-50 disabled:cursor-not-allowed"
- title={empty ? `Extract ${noun} from prose` : `Re-extract ${noun} from prose (merges into existing)`}
+ title={dirty ? 'Save your draft first — extraction reads the saved prose.' : (empty ? `Extract ${noun} from prose` : `Re-extract ${noun} from prose (merges into existing)`)}
>
{running
? <Loader2 size={10} className="animate-spin text-port-accent" />
@@ -64,6 +64,7 @@ export default function StoryboardBibleTab({
anyRunning,
readingTheme,
hotRefId = null,
+ dirty = false,
}) {
const meta = BIBLE_KINDS[kind];
const Bible = meta.Component;
@@ -84,6 +85,7 @@ export default function StoryboardBibleTab({
anyRunning={anyRunning}
onRefresh={onRefresh}
empty={items.length === 0}
+ dirty={dirty}
/>
<Bible {...bibleProps} />
</div>
diff --git a/client/src/components/writers-room/StoryboardPanel.jsx b/client/src/components/writers-room/StoryboardPanel.jsx
index 703568add6..9c0fb999fd 100644
--- a/client/src/components/writers-room/StoryboardPanel.jsx
+++ b/client/src/components/writers-room/StoryboardPanel.jsx
@@ -323,6 +323,7 @@ export default function StoryboardPanel({
onRefresh={onRunCharacters}
running={runningKind === 'characters'}
anyRunning={!!runningKind}
+ dirty={dirty}
readingTheme={readingTheme}
hotRefId={hotRef?.kind === 'char' ? hotRef.refId : null}
/>
@@ -336,6 +337,7 @@ export default function StoryboardPanel({
onRefresh={onRunPlaces}
running={runningKind === 'places'}
anyRunning={!!runningKind}
+ dirty={dirty}
readingTheme={readingTheme}
hotRefId={hotRef?.kind === 'place' ? hotRef.refId : null}
/>
@@ -349,6 +351,7 @@ export default function StoryboardPanel({
onRefresh={onRunObjects}
running={runningKind === 'objects'}
anyRunning={!!runningKind}
+ dirty={dirty}
readingTheme={readingTheme}
hotRefId={hotRef?.kind === 'object' ? hotRef.refId : null}
/>