Skip to content

Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.

fix(items): align slide annotation pins to the image in BoP preview (#1671)

Sid9073c21227e0
diff --git a/.ai/playbooks/bop-preview-slide-pin-alignment.md b/.ai/playbooks/bop-preview-slide-pin-alignment.md
new file mode 100644
index 0000000000..846c1dc94b
--- /dev/null
+++ b/.ai/playbooks/bop-preview-slide-pin-alignment.md
@@ -0,0 +1,35 @@
+# BoP Preview — slide annotation pin alignment
+
+Last tested: 2026-09-18
+Route: /x/part/{itemUuid}/manufacturing → operation drawer → Preview tab
+Component: apps/erp/app/modules/items/ui/Item/BillOfProcess.tsx (OperationPreview)
+
+## What it verifies
+Annotation pins in the read-only Preview map to the RENDERED image box (not a
+letterboxed aspect-video frame). Regression guard for the fix that wraps the
+preview image in `relative inline-block` (mirrors SlideAnnotator).
+
+## Prerequisites
+- A make-method operation with a step that has an IMAGE slide carrying pins.
+- Demo DBs often have operations but no steps/slides — seed one:
+ - insert methodOperationStep (type 'Task') on an existing methodOperation
+ - insert methodOperationStepSlide with imagePath + annotations (pins at known
+ fractions, e.g. corners 0.05/0.95 + center 0.5). A bundled dataset asset
+ path like `_templates/aerospace_satellite/ADCS-001.svg` renders via
+ getPrivateUrl with NO storage object needed.
+ - clean up both rows afterwards.
+
+## Steps
+1. Open the part, Manufacturing tab, click the operation → Preview tab.
+2. Measure pins vs image box with agent-browser eval: for each absolute pin
+ span, compare its center as a fraction of the sibling <img> getBoundingClientRect
+ to its style.left/top. PASS = actual % equals stored % (within ~0.5%).
+
+## Result (2026-09-18)
+img 520x520; pins 5%/95%/50% expected == actual exactly. PASS.
+
+## Notes
+- Screenshots via agent-browser hang on dev HMR; the eval-based numeric check is
+ the reliable verification here.
+- The company with operations may differ from the login-default company; check
+ methodOperation.companyId and switch if needed.
diff --git a/apps/erp/app/modules/items/ui/Item/BillOfProcess.tsx b/apps/erp/app/modules/items/ui/Item/BillOfProcess.tsx
index 8eb17df11c..5114f4e615 100644
--- a/apps/erp/app/modules/items/ui/Item/BillOfProcess.tsx
+++ b/apps/erp/app/modules/items/ui/Item/BillOfProcess.tsx
@@ -3608,7 +3608,10 @@ function OperationPreview({
</div>
</div>
- <div className="relative flex aspect-video items-center justify-center overflow-hidden rounded-md border bg-muted/40">
+ {/* Center content in a bounded frame. The image slide wraps the picture in
+ an inline-block sized to the RENDERED image so the pin overlay maps to the
+ image box, not a letterboxed aspect-video frame (which drifted the pins). */}
+ <div className="relative flex min-h-[240px] items-center justify-center rounded-md border bg-muted/40 p-2">
{!slide ? (
<span className="text-xs text-muted-foreground">
<Trans>No reference image</Trans>
@@ -3619,7 +3622,7 @@ function OperationPreview({
<img
src={slideModelThumb}
alt={slide.caption ?? slideModel?.name ?? "3D model"}
- className="max-h-full max-w-full object-contain"
+ className="max-h-[520px] max-w-full object-contain"
/>
) : (
<LuBox className="size-10 text-muted-foreground" />
@@ -3629,11 +3632,11 @@ function OperationPreview({
</span>
</>
) : slideImage ? (
- <div className="relative h-full w-full">
+ <div className="relative inline-block">
<img
src={slideImage}
alt={slide.caption ?? ""}
- className="h-full w-full object-contain"
+ className="block max-h-[520px] w-auto max-w-full rounded-md"
/>
<SlidePinOverlay pins={slide.annotations ?? []} />
</div>
diff --git a/apps/erp/app/modules/resources/resources.service.ts b/apps/erp/app/modules/resources/resources.service.ts
index bbd596f830..c2583e582a 100644
--- a/apps/erp/app/modules/resources/resources.service.ts
+++ b/apps/erp/app/modules/resources/resources.service.ts
@@ -1257,9 +1257,10 @@ export async function updateAbility(
id: string,
ability: {
// Name is not stored — it derives from the linked process. Only the
- // recertification cadence is editable on an ability.
+ // recertification cadence is editable on an ability, and it is always
+ // sent (as null to clear), so it is a required field of the update.
name?: string;
- recertifyEveryDays?: number | null;
+ recertifyEveryDays: number | null;
}
) {
return client.from("ability").update(ability).eq("id", id);
diff --git a/apps/erp/app/routes/api+/mcp+/lib/tool-manifest.digest.json b/apps/erp/app/routes/api+/mcp+/lib/tool-manifest.digest.json
index f72297facc..9124c2bbac 100644
--- a/apps/erp/app/routes/api+/mcp+/lib/tool-manifest.digest.json
+++ b/apps/erp/app/routes/api+/mcp+/lib/tool-manifest.digest.json
@@ -1162,7 +1162,7 @@
{"name":"resources_insertMaintenanceDispatch","classification":"WRITE","paramCount":14,"schema":"b192bab74c65","response":"ede36af7307d","injectAuth":"companyId+createdBy+updatedBy","permission":"resources:create","paginates":false},
{"name":"resources_processDeactivate","classification":"WRITE","paramCount":1,"schema":"01edb53077b2","response":"bcde375ebd4c","injectAuth":"companyId","permission":"resources:update","paginates":false},
{"name":"resources_resolveEmployeeAbilityExpiresAt","classification":"WRITE","paramCount":3,"schema":"ec5fc6dfaa43","response":"174e29b899b9","injectAuth":"companyId","permission":"resources:update","paginates":false},
- {"name":"resources_updateAbility","classification":"WRITE","paramCount":2,"schema":"331c98a989f9","response":"bcde375ebd4c","injectAuth":"companyId+updatedBy","permission":"resources:update","paginates":false},
+ {"name":"resources_updateAbility","classification":"WRITE","paramCount":2,"schema":"b92248235d76","response":"bcde375ebd4c","injectAuth":"companyId+updatedBy","permission":"resources:update","paginates":false},
{"name":"resources_updateMaintenanceDispatch","classification":"WRITE","paramCount":18,"schema":"02877e9f1f8d","response":"3797626bd17e","injectAuth":"companyId+updatedBy","permission":"resources:update","paginates":false},
{"name":"resources_updateSuggestionEmoji","classification":"WRITE","paramCount":2,"schema":"dc61bce0f764","response":"bcde375ebd4c","injectAuth":"companyId+updatedBy","permission":"resources:update","paginates":false},
{"name":"resources_updateSuggestionTags","classification":"WRITE","paramCount":2,"schema":"ab3b2e298cdb","response":"bcde375ebd4c","injectAuth":"companyId+updatedBy","permission":"resources:update","paginates":false},