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
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
address review (claude): role-precise busyId, validate bundleRef against REF_KINDS, drop vestigial section write
[._.]/ Adam Eivy144b2511aa87
diff --git a/client/src/components/CatalogCastPanel.jsx b/client/src/components/CatalogCastPanel.jsxindex 2a9af384d8..965a224118 100644--- a/client/src/components/CatalogCastPanel.jsx+++ b/client/src/components/CatalogCastPanel.jsx@@ -93,7 +93,9 @@ export default function CatalogCastPanel({ refKind, refId, refLabel }) {const handleUnlink = async (row) => {const { ingredient, role } = row;- setBusyId(ingredient.id);+ // Busy key matches the row identity (id+role), so unlinking one role's+ // row doesn't spin/disable a sibling row for the same ingredient.+ setBusyId(`${ingredient.id}:${role || ''}`);await unlinkCatalogIngredient(ingredient.id, { refKind, refId, role }, { silent: true }).then(() => {// Ref rows are keyed by (ingredient_id, ref_kind, ref_id, role), so an@@ -145,6 +147,7 @@ export default function CatalogCastPanel({ refKind, refId, refLabel }) {const { ingredient, role } = row;const badge = TYPE_BADGE[ingredient.type] || 'bg-gray-500/20 text-gray-300 border-gray-500/40';const text = snippet(ingredient.payload);+ const rowBusy = busyId === `${ingredient.id}:${role || ''}`;return (<likey={`${ingredient.id}:${role || ''}`}@@ -171,12 +174,12 @@ export default function CatalogCastPanel({ refKind, refId, refLabel }) {<buttontype="button"onClick={() => handleUnlink(row)}- disabled={busyId === ingredient.id}+ disabled={rowBusy}aria-label={`Unlink ${ingredient.name || ingredient.id}`}className="p-1.5 rounded text-gray-500 hover:text-port-error hover:bg-port-bg disabled:opacity-50"title="Unlink from this record">- {busyId === ingredient.id+ {rowBusy? <Loader2 size={14} className="animate-spin" aria-hidden="true" />: <Trash2 size={14} aria-hidden="true" />}</button>diff --git a/server/lib/catalogBulkParsers.js b/server/lib/catalogBulkParsers.jsindex 82e3b46dc3..8ddc6555c8 100644--- a/server/lib/catalogBulkParsers.js+++ b/server/lib/catalogBulkParsers.js@@ -336,8 +336,9 @@ export function parseMarkdownBulk(payload) {// Open a ```json (or bare ```) fence — terminates the body section.const fenceOpen = /^```(\w*)\s*$/.exec(line);if (fenceOpen) {+ // Fence state is driven by `current.fence`; `section` only gates the+ // scraps branch, so the body resumes (section stays 'body') after close.current.fence = { lang: fenceOpen[1] || '', lines: [] };- current.section = 'fence';continue;}// `### Scraps` switches us into the scraps subsection — body is done.diff --git a/server/routes/catalog.js b/server/routes/catalog.jsindex 04f65c1fe3..60fc53b18d 100644--- a/server/routes/catalog.js+++ b/server/routes/catalog.js@@ -21,6 +21,7 @@ import {catalogMigrationRerunSchema,catalogBulkImportSchema,catalogExportQuerySchema,+ REF_KINDS,} from '../lib/catalogValidation.js';import { parseBulkPayload, bundleToMarkdown, toYamlString } from '../lib/catalogBulkParsers.js';import { embedIngredient, embedBatch, ingredientEmbedSeed } from '../services/embeddings.js';@@ -257,7 +258,14 @@ router.post('/bulk-import', asyncHandler(async (req, res) => {for (const [field, kind] of Object.entries(REF_FIELD_TO_KIND)) {if (defaults[field]) refTargets.push({ refKind: kind, refId: defaults[field] });}- if (refTargets.length === 0 && parsed.bundleRef && parsed.bundleRef.kind && parsed.bundleRef.id) {+ // Validate the bundle's own ref against the same allow-list + id cap the+ // /link route enforces (z.enum(REF_KINDS), refId max 120), so a hand-edited+ // or foreign export bundle can't insert a dead ref row whose kind no+ // listIngredientsForRef ever reads.+ if (refTargets.length === 0 && parsed.bundleRef+ && REF_KINDS.includes(parsed.bundleRef.kind)+ && String(parsed.bundleRef.id).length > 0+ && String(parsed.bundleRef.id).length <= 120) {refTargets.push({ refKind: parsed.bundleRef.kind, refId: parsed.bundleRef.id });}