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

docs: check off catalog-detail-batched-endpoint + changelog

[._.]/ Adam Eivydc1667405c10
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index 4cba7385d1..9db16e59a3 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -2,6 +2,7 @@
## Changed
+- **[catalog-detail-batched-endpoint] Catalog ingredient detail page loads in one request.** The detail page used to fire five separate requests on mount (the ingredient, its relations, revision history, media attachments, and the missing-media integrity overlay). A new `GET /api/catalog/ingredients/:id/details` hydrates all of them in a single round-trip, and the page consumes it on initial load. Post-mutation updates (attach media, restore a revision, add a relation) still use the granular endpoints so a single edit doesn't re-pull the whole record. No visible change beyond a faster, less flickery detail load.
- **[catalog-import-sync-hardening] Catalog bulk-import keeps scraps; legacy universe tags self-heal across peers.** Bulk-importing markdown that carries a `### Scraps` subsection now persists those scraps as `catalog_scraps` rows + source links inside the same transaction (previously the round-tripped scraps were silently dropped on import); the response reports a `scrapsCreated` count. Separately, an ingredient synced from an older or offline peer *after* the one-time boot tag-repair ran would reintroduce raw `from-universe` / `universe:<uuid>` machine tags via last-writer-wins — those are now friendlified to the universe NAME on inbound sync — re-applying the repair whenever an ingredient is (re)synced and its universe is resolvable locally, instead of only at boot (a catalog row that arrives before its universe keeps its machine tags and is cleaned up on the next sync or by the boot repair). Internal: the seven near-identical per-kind apply loops in `catalogSync.applyRemoteChanges` collapse into a single `applyKind` helper (pure refactor, behavior-identical), and `createScrap` gains a `{ client }` transaction option. Adds route-level Postgres integration tests for `/bulk-import` and revision `/restore`.
- **[federated-media-sync-followups] Sync integrity, local LLM, voice, and service hardening.** Federated sync badges now distinguish offline peers from peers that need a PortOS update, series integrity checks include child-issue assets, and records with images missing prompt sidecars show a dedicated "Metadata missing" status. Tombstone pushes now bypass the schema-version cooldown so deletes converge immediately. Internal cleanup: the AI toolkit receives Ollama readiness through an injected hook, Linux Ollama startup uses persistent `systemctl enable --now` / `disable --now`, migration 037 streams history conversion instead of materializing the union in memory, Local LLM backend switching writes `.env` atomically, the Voice settings UI can pin a vision model, and the LTX2 negative-prompt patch only targets namespaced constants modules.
diff --git a/PLAN.md b/PLAN.md
index 48cfe1da73..689ca1eeef 100644
--- a/PLAN.md
+++ b/PLAN.md
@@ -17,7 +17,7 @@ New follow-ups surfaced during the 2026-05-30 review pass:
- [x] [catalog-bulk-import-route-db-tests] **Route-level DB integration tests for `/bulk-import` and `/ingredients/:id/revisions/:revisionId/restore`.** Both establish producer↔consumer contracts pinned only at the parser/unit layer today (bundle-ref → refLink recreation + role precedence; restore preserves the revision's `payload.schemaVersion`). Needs the Postgres test fixture the `catalog-tests` PR establishes. Surfaced by claude review of #554 + #558.
- [x] [catalog-bulk-import-scrap-persistence] **Persist scraps on markdown bulk-import.** `parseMarkdownBulk` now round-trips `### Scraps` into a non-enumerable `entry.scraps[]`, but the bulk-import route does NOT create `catalog_scraps`/`catalog_ingredient_sources` rows from them (lossy-but-not-corrupt per the PLAN). Wire scrap creation into the bulk-import transaction (createScrap needs a `{ client }` option). Surfaced by codex review of #554.
- [x] [catalog-sync-apply-kind-helper] **Extract an `applyKindEnvelope(kind, items, upsertFn, statsTally)` helper in `server/services/catalogSync.js`.** The 7 per-kind apply loops (scraps/ingredients/sources/refs/relations/tags/media) share a try/catch + stats-tally shape. Deferred from #558 to avoid churning tested sync code in an already-large PR. Surfaced by codex review.
-- [ ] [catalog-detail-batched-endpoint] **`GET /api/catalog/ingredients/:id/details` to collapse the detail page's 4 round-trips** (relations + revisions + media + missing-media) into one hydrated response. Nice-to-have; surfaced by simplify review of #558.
+- [x] [catalog-detail-batched-endpoint] **`GET /api/catalog/ingredients/:id/details` to collapse the detail page's 4 round-trips** (relations + revisions + media + missing-media) into one hydrated response. Nice-to-have; surfaced by simplify review of #558.
- [x] [browser-navigate-ssrf-guard] **Apply the catalog-ingest SSRF guard to the pre-existing `POST /api/browser/navigate` route.** `server/lib/catalogValidation.js:isSafeIngestUrl` + the DNS-resolution + post-redirect re-check from #559 should be reused by `server/routes/browser.js` (it has the same bare-`z.string().url()` gap — `file://`/loopback/link-local reachable). Surfaced by claude review of #559.
- [x] [catalog-friendlify-universe-tags-on-sync] **Friendlify late-synced legacy universe tags.** The one-time boot repair (`repairUniverseTags.js`) is marker-gated, so a catalog ingredient synced from an older/offline peer AFTER the marker is written keeps its raw `from-universe`/`universe:<uuid>` machine tags. Either run `friendlifyUniverseTags` on inbound catalog rows in the sync-apply path, or replace the one-shot marker with a periodic/high-water repair. Surfaced by codex review of #560.