fix(pipeline): register pipeline-volume-cover-concepts stage#262
Merged
Conversation
The per-season volume cover-concept LLM step shipped in d802eb1 added the prompt template but missed the stage-config entry and a migration for existing installs, so upgraded installs hit "Stage pipeline-volume-cover-concepts not found" when arc planner tries to generate covers. - Add the stage-config entry to data.sample/prompts/stage-config.json - Add migration 017 that seeds the template + config entry on upgrade
Contributor
There was a problem hiding this comment.
Pull request overview
Registers the missing pipeline-volume-cover-concepts LLM stage for upgraded installs by adding the stage entry to the sample stage-config.json and introducing a migration that seeds both the prompt template and the config entry when absent.
Changes:
- Add
pipeline-volume-cover-conceptstodata.sample/prompts/stage-config.json. - Add migration
017-volume-cover-concepts-stage.jsto seed the stage prompt template and stage-config entry on existing installs. - Update
.changelog/NEXT.mdto document the fix.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| scripts/migrations/017-volume-cover-concepts-stage.js | New migration to copy the prompt template (if missing) and merge the stage-config entry (if missing). |
| data.sample/prompts/stage-config.json | Registers the pipeline-volume-cover-concepts stage definition for new installs and as a source for migrations. |
| .changelog/NEXT.md | Adds a “Fixed” entry describing the upgraded-install 500 fix. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
4 tasks
atomantic
added a commit
that referenced
this pull request
May 17, 2026
* fix(boot): run pending data migrations on every server start The migration runner was only invoked from update.sh — plain pull-and-restart (or pm2 restart after a manual git pull) left shipped migrations unapplied, so new prompt stages, settings renames, and seeded data sat in the queue until the user ran 'npm run update' or 'npm run migrations'. Existing installs hit cryptic 'Stage X not found' errors despite the fix shipping in main (see PR #262 / pipeline-volume-cover-concepts). Refactored scripts/run-migrations.js to export a runMigrations() function and kept the CLI shim. server/index.js now awaits the runner before the AI toolkit reads stage-config.json. Idempotent and cheap when the applied list is current; logs and continues on failure rather than refusing to boot. * address review: resolve CLI argv path before pathToFileURL `pathToFileURL()` throws on relative paths, which can happen when the script is launched as `node scripts/run-migrations.js`. Resolve argv[1] to an absolute path first, then realpath both sides to follow npm bin shims / symlinks reliably. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * address review: synchronous CLI guard + full-stack error logs - scripts/run-migrations.js: drop the async realpath-based isInvokedAsScript helper that turned the module into an async module and forced filesystem I/O at evaluation time. Switch to a synchronous pathToFileURL(resolve(argv[1])) compare against import.meta.url, which still handles the relative-argv case the original review flagged. - scripts/run-migrations.js + server/index.js: log err?.stack ?? err on migration failures so boot diagnostics include the full trace and tolerate non-Error throws. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * address review: recover from corrupt migrations.applied.json A crash mid-write to data/migrations.applied.json can leave the file truncated or malformed, which previously caused every subsequent boot to hard-fail. Detect bad JSON or non-array shapes, rename the corrupt file aside (.corrupt-<ISO timestamp>) for forensics, and rebuild from scratch — migrations are idempotent so re-running them is safe. Also parameterize migrationsDir so runMigrations is testable against a fixture migrations directory, and broaden the vitest include glob to pick up scripts/*.test.js alongside scripts/migrations/*.test.js. --------- Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
data.sample/prompts/stages/pipeline-volume-cover-concepts.mdbut forgot to register the stage instage-config.jsonand forgot to add an upgrade migration.❌ Route error: Stage pipeline-volume-cover-concepts not foundfromarcPlanner.generateVolumeCoverConcepts→runStagedLLM('pipeline-volume-cover-concepts', …)→prompts.buildPrompt().017-volume-cover-concepts-stage.js) that seeds both the .md template and the stage-config entry on existing installs.Why fresh installs weren't affected
setup-data.js'sensureSampleContentalready copies missing prompt files fromdata.sample/on fresh setup — so the .md template landed correctly.JSON_MERGE_TARGETSon first-time setup, never on upgrade. That's the hole this migration plugs.Changes
data.sample/prompts/stage-config.json— addpipeline-volume-cover-conceptsentry (model: "default",returnsJson: true, no shared variables — matches sibling per-season prompts likepipeline-season-episodes).scripts/migrations/017-volume-cover-concepts-stage.js— new migration; idempotent; mirrors the structure of015-importer-stage-prompts.js. Seeds the .md template if missing, then merges the stage-config entry if missing..changelog/NEXT.md— Fixed entry.Test plan
data/dir (seeds both .md and config entry)data.sample/prompts/stage-config.jsonstill parses as valid JSONnpm run install:all(which invokesscripts/run-migrations.js); migration 017 applies;generateVolumeCoverConceptsroute no longer 500s🤖 Generated with Claude Code