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

fix([issue-1286]): getReverseOutline distinguishes no-content from none

[._.]/ Adam Eivyd0efbed78d46
diff --git a/server/services/pipeline/reverseOutline.js b/server/services/pipeline/reverseOutline.js
index 4a0e42bd58..f1b83b47ef 100644
--- a/server/services/pipeline/reverseOutline.js
+++ b/server/services/pipeline/reverseOutline.js
@@ -295,15 +295,21 @@ function isOutlineStale(outline, corpus) {
}
/**
- * Read the stored reverse outline with a `stale` flag. Returns a
- * `{ status:'none' }` shell (never null) when one has never been generated, so
- * the route/UI has a consistent shape to render.
+ * Read the stored reverse outline with a `stale` flag. Returns a shell (never
+ * null) when one has never been generated, so the route/UI has a consistent
+ * shape to render — and distinguishes `none` (no outline yet, but there IS
+ * draftable manuscript) from `no-content` (nothing drafted yet). Without that
+ * split the UI prompts the user to "Generate" again after a no-content run
+ * instead of telling them to draft/import first (the generate run reports
+ * `no-content`, so the GET must agree once the page refetches).
*/
export async function getReverseOutline(seriesId) {
assertValidSeriesId(seriesId);
const outline = await readOutline(seriesId);
- if (!outline) return { ...emptyOutline(), seriesId };
const { corpus } = await buildManuscriptCorpus(seriesId);
+ if (!outline) {
+ return { ...emptyOutline(), seriesId, status: corpus.trim() ? 'none' : 'no-content' };
+ }
return { ...outline, seriesId, stale: isOutlineStale(outline, corpus) };
}
diff --git a/server/services/pipeline/reverseOutline.test.js b/server/services/pipeline/reverseOutline.test.js
index 39236a7d20..c76a80884e 100644
--- a/server/services/pipeline/reverseOutline.test.js
+++ b/server/services/pipeline/reverseOutline.test.js
@@ -125,12 +125,19 @@ describe('generateReverseOutline', () => {
});
describe('getReverseOutline + staleness', () => {
- it('returns a none shell when never generated', async () => {
+ it('returns a none shell when never generated but a draft exists', async () => {
const out = await svc.getReverseOutline(SERIES_ID);
expect(out.status).toBe('none');
expect(out.scenes).toEqual([]);
});
+ it('returns no-content (not none) when nothing is drafted yet', async () => {
+ sectionsFixture = []; // empty manuscript corpus
+ const out = await svc.getReverseOutline(SERIES_ID);
+ expect(out.status).toBe('no-content');
+ expect(out.scenes).toEqual([]);
+ });
+
it('flags stale when the manuscript changes after generation', async () => {
llmQueue.push(cannedOutline());
await svc.generateReverseOutline(SERIES_ID, {});