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

Strengthen stage-config migration preservation tests (#11988)

Adam Eivybb5a50cd0ad1
diff --git a/scripts/migrations/043-story-builder-prompts.test.js b/scripts/migrations/043-story-builder-prompts.test.js
index c0e79349f5..f1316357cc 100644
--- a/scripts/migrations/043-story-builder-prompts.test.js
+++ b/scripts/migrations/043-story-builder-prompts.test.js
@@ -48,11 +48,12 @@ describe('migration 043 — seed Story Builder prompts', () => {
it('merges into an existing stage-config without clobbering other stages', async () => {
mkdirSync(installedStagesDir, { recursive: true });
- writeFileSync(installedConfigPath, JSON.stringify({ stages: { 'pipeline-prose': { name: 'Prose' } } }, null, 2) + '\n');
+ writeFileSync(installedConfigPath, JSON.stringify({ stages: { 'pipeline-prose': { name: 'Prose' }, [STAGES[0]]: { name: 'CUSTOM', model: 'my-model' } } }, null, 2) + '\n');
await migration.up({ rootDir });
const config = readJson(installedConfigPath);
- expect(config.stages['pipeline-prose']).toBeTruthy();
- for (const key of STAGES) {
+ expect(config.stages['pipeline-prose']).toEqual({ name: 'Prose' });
+ expect(config.stages[STAGES[0]]).toEqual({ name: 'CUSTOM', model: 'my-model' });
+ for (const key of STAGES.slice(1)) {
expect(config.stages[key]).toBeTruthy();
}
});
diff --git a/scripts/migrations/048-catalog-ideas-scenes-concepts-stage.test.js b/scripts/migrations/048-catalog-ideas-scenes-concepts-stage.test.js
index 348c1d5d3d..b207de3158 100644
--- a/scripts/migrations/048-catalog-ideas-scenes-concepts-stage.test.js
+++ b/scripts/migrations/048-catalog-ideas-scenes-concepts-stage.test.js
@@ -50,11 +50,12 @@ describe('migration 048 — seed catalog ingest light-shape stage', () => {
it('merges into an existing stage-config without clobbering other stages', async () => {
mkdirSync(installedStagesDir, { recursive: true });
- writeFileSync(installedConfigPath, JSON.stringify({ stages: { 'pipeline-prose': { name: 'Prose' } } }, null, 2) + '\n');
+ writeFileSync(installedConfigPath, JSON.stringify({ stages: { 'pipeline-prose': { name: 'Prose' }, [STAGES[0]]: { name: 'CUSTOM', model: 'my-model' } } }, null, 2) + '\n');
await migration.up({ rootDir });
const config = readJson(installedConfigPath);
- expect(config.stages['pipeline-prose']).toBeTruthy();
- for (const key of STAGES) {
+ expect(config.stages['pipeline-prose']).toEqual({ name: 'Prose' });
+ expect(config.stages[STAGES[0]]).toEqual({ name: 'CUSTOM', model: 'my-model' });
+ for (const key of STAGES.slice(1)) {
expect(config.stages[key]).toBeTruthy();
}
});
diff --git a/scripts/migrations/062-story-builder-arc-refine-prompt.test.js b/scripts/migrations/062-story-builder-arc-refine-prompt.test.js
index 80698aecd6..919bb4c423 100644
--- a/scripts/migrations/062-story-builder-arc-refine-prompt.test.js
+++ b/scripts/migrations/062-story-builder-arc-refine-prompt.test.js
@@ -37,11 +37,11 @@ describe('migration 062 — seed Story Builder plot-arc-refine prompt', () => {
it('merges into an existing stage-config without clobbering other stages', async () => {
mkdirSync(installedStagesDir, { recursive: true });
- writeFileSync(installedConfigPath, JSON.stringify({ stages: { 'pipeline-prose': { name: 'Prose' } } }, null, 2) + '\n');
+ writeFileSync(installedConfigPath, JSON.stringify({ stages: { 'pipeline-prose': { name: 'Prose' }, [STAGE]: { name: 'CUSTOM', model: 'my-model' } } }, null, 2) + '\n');
await migration.up({ rootDir });
const config = readJson(installedConfigPath);
- expect(config.stages['pipeline-prose']).toBeTruthy();
- expect(config.stages[STAGE]).toBeTruthy();
+ expect(config.stages['pipeline-prose']).toEqual({ name: 'Prose' });
+ expect(config.stages[STAGE]).toEqual({ name: 'CUSTOM', model: 'my-model' });
});
it('is idempotent and preserves a user-customized installed prompt', async () => {
diff --git a/scripts/migrations/065-writers-room-continue-prompt.test.js b/scripts/migrations/065-writers-room-continue-prompt.test.js
index becc68fa28..4f439180fc 100644
--- a/scripts/migrations/065-writers-room-continue-prompt.test.js
+++ b/scripts/migrations/065-writers-room-continue-prompt.test.js
@@ -37,11 +37,11 @@ describe('migration 065 — seed Writers Room live-continuation prompt', () => {
it('merges into an existing stage-config without clobbering other stages', async () => {
mkdirSync(installedStagesDir, { recursive: true });
- writeFileSync(installedConfigPath, JSON.stringify({ stages: { 'pipeline-prose': { name: 'Prose' } } }, null, 2) + '\n');
+ writeFileSync(installedConfigPath, JSON.stringify({ stages: { 'pipeline-prose': { name: 'Prose' }, [STAGE]: { name: 'CUSTOM', model: 'my-model' } } }, null, 2) + '\n');
await migration.up({ rootDir });
const config = readJson(installedConfigPath);
- expect(config.stages['pipeline-prose']).toBeTruthy();
- expect(config.stages[STAGE]).toBeTruthy();
+ expect(config.stages['pipeline-prose']).toEqual({ name: 'Prose' });
+ expect(config.stages[STAGE]).toEqual({ name: 'CUSTOM', model: 'my-model' });
});
it('is idempotent and preserves a user-customized installed prompt', async () => {
diff --git a/scripts/migrations/068-pipeline-audio-cues-prompt.test.js b/scripts/migrations/068-pipeline-audio-cues-prompt.test.js
index 068d54c3b3..a0741a45f9 100644
--- a/scripts/migrations/068-pipeline-audio-cues-prompt.test.js
+++ b/scripts/migrations/068-pipeline-audio-cues-prompt.test.js
@@ -37,11 +37,11 @@ describe('migration 068 — seed whole-episode audio cue-planner prompt', () =>
it('merges into an existing stage-config without clobbering other stages', async () => {
mkdirSync(installedStagesDir, { recursive: true });
- writeFileSync(installedConfigPath, JSON.stringify({ stages: { 'pipeline-prose': { name: 'Prose' } } }, null, 2) + '\n');
+ writeFileSync(installedConfigPath, JSON.stringify({ stages: { 'pipeline-prose': { name: 'Prose' }, [STAGE]: { name: 'CUSTOM', model: 'my-model' } } }, null, 2) + '\n');
await migration.up({ rootDir });
const config = readJson(installedConfigPath);
- expect(config.stages['pipeline-prose']).toBeTruthy();
- expect(config.stages[STAGE]).toBeTruthy();
+ expect(config.stages['pipeline-prose']).toEqual({ name: 'Prose' });
+ expect(config.stages[STAGE]).toEqual({ name: 'CUSTOM', model: 'my-model' });
});
it('is idempotent and preserves a user-customized installed prompt', async () => {
diff --git a/scripts/migrations/069-twin-spoken-written-compare-prompt.test.js b/scripts/migrations/069-twin-spoken-written-compare-prompt.test.js
index 8a4318035a..60466b1620 100644
--- a/scripts/migrations/069-twin-spoken-written-compare-prompt.test.js
+++ b/scripts/migrations/069-twin-spoken-written-compare-prompt.test.js
@@ -37,11 +37,11 @@ describe('migration 069 — seed twin spoken-vs-written comparison prompt', () =
it('merges into an existing stage-config without clobbering other stages', async () => {
mkdirSync(installedStagesDir, { recursive: true });
- writeFileSync(installedConfigPath, JSON.stringify({ stages: { 'pipeline-prose': { name: 'Prose' } } }, null, 2) + '\n');
+ writeFileSync(installedConfigPath, JSON.stringify({ stages: { 'pipeline-prose': { name: 'Prose' }, [STAGE]: { name: 'CUSTOM', model: 'my-model' } } }, null, 2) + '\n');
await migration.up({ rootDir });
const config = readJson(installedConfigPath);
- expect(config.stages['pipeline-prose']).toBeTruthy();
- expect(config.stages[STAGE]).toBeTruthy();
+ expect(config.stages['pipeline-prose']).toEqual({ name: 'Prose' });
+ expect(config.stages[STAGE]).toEqual({ name: 'CUSTOM', model: 'my-model' });
});
it('is idempotent and preserves a user-customized installed prompt', async () => {
diff --git a/scripts/migrations/071-writers-room-cd-bridge-prompt.test.js b/scripts/migrations/071-writers-room-cd-bridge-prompt.test.js
index e52b6c9891..ea20f77451 100644
--- a/scripts/migrations/071-writers-room-cd-bridge-prompt.test.js
+++ b/scripts/migrations/071-writers-room-cd-bridge-prompt.test.js
@@ -37,11 +37,11 @@ describe('migration 071 — seed Writers Room CD-bridge prompt', () => {
it('merges into an existing stage-config without clobbering other stages', async () => {
mkdirSync(installedStagesDir, { recursive: true });
- writeFileSync(installedConfigPath, JSON.stringify({ stages: { 'pipeline-prose': { name: 'Prose' } } }, null, 2) + '\n');
+ writeFileSync(installedConfigPath, JSON.stringify({ stages: { 'pipeline-prose': { name: 'Prose' }, [STAGE]: { name: 'CUSTOM', model: 'my-model' } } }, null, 2) + '\n');
await migration.up({ rootDir });
const config = readJson(installedConfigPath);
- expect(config.stages['pipeline-prose']).toBeTruthy();
- expect(config.stages[STAGE]).toBeTruthy();
+ expect(config.stages['pipeline-prose']).toEqual({ name: 'Prose' });
+ expect(config.stages[STAGE]).toEqual({ name: 'CUSTOM', model: 'my-model' });
});
it('is idempotent and preserves a user-customized installed prompt', async () => {
diff --git a/scripts/migrations/072-twin-image-identity-prompt.test.js b/scripts/migrations/072-twin-image-identity-prompt.test.js
index 96315d4761..693d275f54 100644
--- a/scripts/migrations/072-twin-image-identity-prompt.test.js
+++ b/scripts/migrations/072-twin-image-identity-prompt.test.js
@@ -8,7 +8,7 @@ import migration from './072-twin-image-identity-prompt.js';
const STAGE = 'twin-image-identity-analyze';
const readJson = (path) => JSON.parse(readFileSync(path, 'utf-8'));
-describe('migration 070 — seed twin image-identity analysis prompt', () => {
+describe('migration 072 — seed twin image-identity analysis prompt', () => {
let rootDir;
let installedStagesDir;
let installedConfigPath;
@@ -37,11 +37,11 @@ describe('migration 070 — seed twin image-identity analysis prompt', () => {
it('merges into an existing stage-config without clobbering other stages', async () => {
mkdirSync(installedStagesDir, { recursive: true });
- writeFileSync(installedConfigPath, JSON.stringify({ stages: { 'pipeline-prose': { name: 'Prose' } } }, null, 2) + '\n');
+ writeFileSync(installedConfigPath, JSON.stringify({ stages: { 'pipeline-prose': { name: 'Prose' }, [STAGE]: { name: 'CUSTOM', model: 'my-model' } } }, null, 2) + '\n');
await migration.up({ rootDir });
const config = readJson(installedConfigPath);
- expect(config.stages['pipeline-prose']).toBeTruthy();
- expect(config.stages[STAGE]).toBeTruthy();
+ expect(config.stages['pipeline-prose']).toEqual({ name: 'Prose' });
+ expect(config.stages[STAGE]).toEqual({ name: 'CUSTOM', model: 'my-model' });
});
it('is idempotent and preserves a user-customized installed prompt', async () => {
diff --git a/scripts/migrations/125-beat-continuity-prompts.test.js b/scripts/migrations/125-beat-continuity-prompts.test.js
index f97842688d..a9533fcf60 100644
--- a/scripts/migrations/125-beat-continuity-prompts.test.js
+++ b/scripts/migrations/125-beat-continuity-prompts.test.js
@@ -46,11 +46,12 @@ describe('migration 125 — seed whole-manuscript beat-continuity prompts (#1510
it('merges into an existing stage-config without clobbering other stages', async () => {
mkdirSync(installedStagesDir, { recursive: true });
- writeFileSync(installedConfigPath, JSON.stringify({ stages: { 'pipeline-prose': { name: 'Prose' } } }, null, 2) + '\n');
+ writeFileSync(installedConfigPath, JSON.stringify({ stages: { 'pipeline-prose': { name: 'Prose' }, [STAGES[0]]: { name: 'CUSTOM', model: 'my-model' } } }, null, 2) + '\n');
await migration.up({ rootDir });
const config = readJson(installedConfigPath);
- expect(config.stages['pipeline-prose']).toBeTruthy();
- for (const stage of STAGES) expect(config.stages[stage]).toBeTruthy();
+ expect(config.stages['pipeline-prose']).toEqual({ name: 'Prose' });
+ expect(config.stages[STAGES[0]]).toEqual({ name: 'CUSTOM', model: 'my-model' });
+ for (const stage of STAGES.slice(1)) expect(config.stages[stage]).toBeTruthy();
});
it('is idempotent and preserves a user-customized installed prompt', async () => {
diff --git a/scripts/migrations/174-series-voice-discover-stage.test.js b/scripts/migrations/174-series-voice-discover-stage.test.js
index a766a1567a..acf9120a81 100644
--- a/scripts/migrations/174-series-voice-discover-stage.test.js
+++ b/scripts/migrations/174-series-voice-discover-stage.test.js
@@ -50,11 +50,12 @@ describe('migration 174 — seed series voice-discovery stage', () => {
it('merges into an existing stage-config without clobbering other stages', async () => {
mkdirSync(installedStagesDir, { recursive: true });
- writeFileSync(installedConfigPath, JSON.stringify({ stages: { 'pipeline-prose': { name: 'Prose' } } }, null, 2) + '\n');
+ writeFileSync(installedConfigPath, JSON.stringify({ stages: { 'pipeline-prose': { name: 'Prose' }, [STAGES[0]]: { name: 'CUSTOM', model: 'my-model' } } }, null, 2) + '\n');
await migration.up({ rootDir });
const config = readJson(installedConfigPath);
- expect(config.stages['pipeline-prose']).toBeTruthy();
- for (const key of STAGES) {
+ expect(config.stages['pipeline-prose']).toEqual({ name: 'Prose' });
+ expect(config.stages[STAGES[0]]).toEqual({ name: 'CUSTOM', model: 'my-model' });
+ for (const key of STAGES.slice(1)) {
expect(config.stages[key]).toBeTruthy();
}
});