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): gate format success toast on save result; harden format handler

[._.]/ Adam Eivya6ddc885f87f
diff --git a/client/src/components/pipeline/manuscript/ManuscriptSectionFrame.jsx b/client/src/components/pipeline/manuscript/ManuscriptSectionFrame.jsx
index 1f3124eea0..0ec4bedd6a 100644
--- a/client/src/components/pipeline/manuscript/ManuscriptSectionFrame.jsx
+++ b/client/src/components/pipeline/manuscript/ManuscriptSectionFrame.jsx
@@ -32,8 +32,11 @@ export default function ManuscriptSectionFrame({ section, saveState, onRevert, o
const format = async () => {
setFormatting(true);
- await onFormat();
- setFormatting(false);
+ try {
+ await onFormat();
+ } finally {
+ setFormatting(false);
+ }
};
// Prose reflows into paragraphs; scripts only get safe artifact cleanup.
diff --git a/client/src/lib/manuscriptFormat.js b/client/src/lib/manuscriptFormat.js
index 45dd8b97a9..5f85151d4a 100644
--- a/client/src/lib/manuscriptFormat.js
+++ b/client/src/lib/manuscriptFormat.js
@@ -45,7 +45,10 @@ const stripTrailingWs = (text) => text.split('\n').map((l) => l.replace(/[ \t]+$
// Join a syllable hyphenated across a wrap: "approxi-\nmating" → "approximating".
// Only letter-hyphen-newline-lowercase, so real line-final hyphens before a
-// capitalized word or number are left alone.
+// capitalized word or number are left alone. Accepted miss: a genuinely
+// hyphenated compound that happens to wrap at its hyphen ("over-\nride") is
+// merged without the hyphen ("override") — unavoidable without a dictionary, and
+// rare enough that reflowing the common case is the better trade.
const dehyphenate = (text) => text.replace(/([A-Za-z])-\n([a-z])/g, '$1$2');
// Re-attach a stylized drop-cap that landed on its own line: a line that is a
diff --git a/client/src/pages/PipelineManuscriptEditor.jsx b/client/src/pages/PipelineManuscriptEditor.jsx
index fba3d0cb0b..1003d84441 100644
--- a/client/src/pages/PipelineManuscriptEditor.jsx
+++ b/client/src/pages/PipelineManuscriptEditor.jsx
@@ -374,6 +374,7 @@ export default function PipelineManuscriptEditor() {
patchSection(section.issueId, { versions: result.section.versions });
}
setSaveState((prev) => ({ ...prev, [section.issueId]: result ? 'saved' : undefined }));
+ return result;
};
const saveSection = (section) => saveSectionContent(section, section.content);
@@ -390,8 +391,11 @@ export default function PipelineManuscriptEditor() {
return;
}
setSectionContent(section.issueId, formatted);
- await saveSectionContent(section, formatted);
- toast.success('Formatting cleaned up');
+ // Only claim success once the save lands — saveSectionContent swallows its
+ // own error (toasts "Failed to save…") and resolves null, so an
+ // unconditional success toast would stack a green toast on the red one.
+ const saved = await saveSectionContent(section, formatted);
+ if (saved) toast.success('Formatting cleaned up');
};
const revertSection = async (section, runId) => {