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

refactor([med-pipeline-server-routes-pipeline-js-1416-1452]): address /simplify findings

[._.]/ Adam Eivy8fc6e2b2baa5
diff --git a/PLAN.md b/PLAN.md
index 95a82302be..14e2bcd132 100644
--- a/PLAN.md
+++ b/PLAN.md
@@ -12,6 +12,8 @@ _Nothing currently parked — pick the next item from the Backlog._
### Code quality / dedup (from `/simplify` passes)
+- [ ] [extract-cover-render-handler-factory] **Collapse the four cover-render route handlers into one factory.** `server/routes/pipeline.js` has four sibling cover-render routes (`/series/:id/seasons/:seasonId/cover/render`, `/back-cover/render`, `/issues/:id/stages/comicPages/cover/render`, `/back-cover/render`) whose bodies are 95% identical — they differ only in { schema, enqueue fn, slot field (`cover` vs `backCover`), service-write helper (`updateSeasonOnSeries` vs `updateStageWithLatest`), script field name (`coverScript` vs `backCoverScript`), and response shape }. `makeCoverRenderSchema` already factored the schema (line ~376); a parallel `makeCoverRenderHandler({ schema, enqueueFn, slotField, writeFn, scriptField, responseShape })` factory would fold ~80 LOC into ~25. Surfaced by /simplify on `[med-pipeline-server-routes-pipeline-js-1416-1452]`; deferred to keep that PR scoped to the script-write bugfix.
+
### v2.1.0 pre-release review residue (deferred from main→release multi-agent review, 2026-05-16)
- [ ] [med-sharing-server-services-sharing-version-js] **[MED][SHARING]** `server/services/sharing/version.js` — `SHARING_SCHEMA_VERSION` not bumped despite series-schema canon-field removal. Cross-peer share-bucket import from a pre-B.4 install silently loses series-side canon. Either bump the version (force refusal) or mirror migration logic in the importer for legacy canon fields.
diff --git a/server/routes/pipeline.js b/server/routes/pipeline.js
index e88ad821fd..42e8c05739 100644
--- a/server/routes/pipeline.js
+++ b/server/routes/pipeline.js
@@ -1166,6 +1166,7 @@ router.post('/series/:id/seasons/:seasonId/back-cover/render', asyncHandler(asyn
slotKey, jobId: result.jobId, prompt: result.prompt,
width: body.width, height: body.height, fromProof: result.fromProof,
});
+ // Same script-gate rationale as the front-cover route above.
const series = await seriesSvc.updateSeasonOnSeries(
req.params.id,
req.params.seasonId,
@@ -1570,6 +1571,7 @@ router.post('/issues/:id/stages/comicPages/back-cover/render', asyncHandler(asyn
slotKey, jobId: result.jobId, prompt: result.prompt,
width: body.width, height: body.height, fromProof: result.fromProof,
});
+ // Same script-gate rationale as the front-cover route above.
const { issue: updatedIssue, stage } = await issuesSvc.updateStageWithLatest(
req.params.id,
'comicPages',