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(demo-data): leave seeded make methods editable (#1744)

Brad Barbinb256c035a5a6
diff --git a/.claude/rules/onboarding-company-templates.md b/.claude/rules/onboarding-company-templates.md
index 0195f03b9c..b8de5cf33d 100644
--- a/.claude/rules/onboarding-company-templates.md
+++ b/.claude/rules/onboarding-company-templates.md
@@ -321,6 +321,23 @@ employee every people screen shows. Volume: `validate.ts` requires `MIN_JOBS` (1
dataset, every open job due within `OPEN_JOB_DUE_WINDOW` (−3…+21 days), open operations on
every plant work center and running work on several.
+## Make methods stay Draft
+
+Every seeded make method is left `Draft` — the item interceptor's default — so a demo user can
+open any BOM/BOP and edit it; an `Active` method is read-only in the app. Nothing downstream
+needs `Active`: `activeMakeMethods` falls back to the highest-version Draft, so quotes, jobs,
+get-method and MRP read the same method. The one exception is a **Version** change notice
+(tier 08): it promotes its base to `Active` before cutting the notice's Draft v2, exactly as
+`createChangeNoticeDraftMethod` does — otherwise the notice's unreleased v2 outranks the base in
+`activeMakeMethods` and reaches production. Do not reintroduce a blanket release in tier 02.
+
+**Open change notices lock more than their affected item.** `findChangeNoticesForItem` treats
+every component of a notice's Draft method as "in" that notice, and the part page locks it. So
+an open Version or Revision notice on a top-level assembly locks every sub-assembly beneath it.
+The open notices' affected items are therefore LEAF make parts (BOMs of purchased components
+only), and a Revision's `add` edits name purchased components: each dataset locks exactly two
+make parts. Keep it that way when authoring a new notice or a new dataset.
+
## Posted documents carry their downstream rows
Posted receipts and shipments, completed returns / transfers / picking lists / counts,
@@ -398,8 +415,8 @@ path before the storage proxy is ever reached. So there is **no bucket object, n
assembler run at seed time** — `seedAssembly` in `tiers/02-items.ts` writes a `modelUpload`
row whose `modelPath`/`glbPath`/`graphPath` are those bundled paths, `processingStatus` already
`Success`, then an `assemblyInstruction` + its `assemblyInstructionStep` rows, points
-`item.modelUploadId` at it, and links the item's Assembly `methodOperation` — before the method
-is released, so quote lines (tier 04) and jobs (tier 06) both copy the link.
+`item.modelUploadId` at it, and links the item's Assembly `methodOperation`, so quote lines
+(tier 04) and jobs (tier 06) both copy the link.
The data is `ItemsData.assembly` (`AssemblySpec`), authored in `data/<key>/assembly.ts`. It
is **optional** — a dataset with a null `industryId` has nowhere to resolve a model from and is
diff --git a/apps/erp/app/styles/tailwind.css b/apps/erp/app/styles/tailwind.css
index 61192395f0..d783304c33 100644
--- a/apps/erp/app/styles/tailwind.css
+++ b/apps/erp/app/styles/tailwind.css
@@ -1,7 +1,6 @@
@import "tailwindcss";
@import "non.geist";
@import "non.geist/mono";
-@import "@fontsource-variable/hedvig-letters-serif";
@import "../../../../packages/config/tailwind/theme.css";
::view-transition-old(root),
diff --git a/apps/erp/package.json b/apps/erp/package.json
index d2d87e24c2..c4136d8e66 100644
--- a/apps/erp/package.json
+++ b/apps/erp/package.json
@@ -41,7 +41,6 @@
"@emoji-mart/data": "catalog:",
"@emoji-mart/react": "catalog:",
"@epic-web/remember": "1.1.0",
- "@fontsource-variable/hedvig-letters-serif": "catalog:",
"@internationalized/date": "catalog:",
"@lingui/core": "catalog:",
"@lingui/react": "catalog:",
diff --git a/apps/mes/app/styles/tailwind.css b/apps/mes/app/styles/tailwind.css
index 5955ed4c08..2e63a80394 100644
--- a/apps/mes/app/styles/tailwind.css
+++ b/apps/mes/app/styles/tailwind.css
@@ -1,7 +1,6 @@
@import "tailwindcss";
@import "non.geist";
@import "non.geist/mono";
-@import "@fontsource-variable/hedvig-letters-serif";
@import "../../../../packages/config/tailwind/theme.css";
@layer base {
diff --git a/apps/mes/package.json b/apps/mes/package.json
index b3a1bbd4f7..2be5db2117 100644
--- a/apps/mes/package.json
+++ b/apps/mes/package.json
@@ -25,7 +25,6 @@
"@dnd-kit/utilities": "catalog:",
"@emoji-mart/data": "catalog:",
"@emoji-mart/react": "catalog:",
- "@fontsource-variable/hedvig-letters-serif": "catalog:",
"@internationalized/date": "catalog:",
"@lingui/core": "catalog:",
"@lingui/macro": "catalog:",
diff --git a/apps/starter/app/styles/tailwind.css b/apps/starter/app/styles/tailwind.css
index 77e2dfa987..b76f8664de 100644
--- a/apps/starter/app/styles/tailwind.css
+++ b/apps/starter/app/styles/tailwind.css
@@ -1,7 +1,6 @@
@import "tailwindcss";
@import "non.geist";
@import "non.geist/mono";
-@import "@fontsource-variable/hedvig-letters-serif";
@import "../../../../packages/config/tailwind/theme.css";
@layer base {
diff --git a/apps/starter/package.json b/apps/starter/package.json
index 8c60aa7e89..7209b878bc 100644
--- a/apps/starter/package.json
+++ b/apps/starter/package.json
@@ -10,7 +10,6 @@
"@carbon/logger": "workspace:*",
"@carbon/react": "workspace:*",
"@carbon/utils": "workspace:*",
- "@fontsource-variable/hedvig-letters-serif": "catalog:",
"@internationalized/date": "catalog:",
"@react-aria/i18n": "catalog:",
"@react-router/dev": "catalog:",
diff --git a/packages/config/tailwind/theme.css b/packages/config/tailwind/theme.css
index 65864d026a..d67050bae4 100644
--- a/packages/config/tailwind/theme.css
+++ b/packages/config/tailwind/theme.css
@@ -250,7 +250,7 @@
"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
--font-mono: "Geist Mono Variable", ui-monospace, SFMono-Regular, Menlo,
Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
- --font-headline: "Hedvig Letters Serif Variable", ui-serif, Georgia, serif,
+ --font-headline: "Geist Variable", ui-sans-serif, system-ui, sans-serif,
"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
--tracking-normal: -0.02em;
diff --git a/packages/database/src/datasets/data/motor/change-orders.ts b/packages/database/src/datasets/data/motor/change-orders.ts
index 459feaa71e..c8fd53ba48 100644
--- a/packages/database/src/datasets/data/motor/change-orders.ts
+++ b/packages/database/src/datasets/data/motor/change-orders.ts
@@ -3,13 +3,13 @@ import type { ChangeOrderData, ChangeOrderSpec } from "../../types.ts";
export const CHANGE_ORDERS: ChangeOrderSpec[] = [
{
ref: "co:draft",
- name: "MTR-9000 Rev A — encoder mount and cable gland relocation",
+ name: "TRM-BOX-9000 — cable gland relocation",
type: "Engineering",
status: "Draft",
openDateOffset: -346,
affectedItems: [
{
- item: "MTR-9000",
+ item: "TRM-BOX-9000",
changeType: "Version",
sortOrder: 1
}
@@ -17,13 +17,13 @@ export const CHANGE_ORDERS: ChangeOrderSpec[] = [
},
{
ref: "co:impl",
- name: "STA-9000 revision — Class H insulation system upgrade",
+ name: "COIL-9000 revision — Class H insulation system upgrade",
type: "Engineering",
status: "Implementation",
openDateOffset: -307,
affectedItems: [
{
- item: "STA-9000",
+ item: "COIL-9000",
changeType: "Revision",
sortOrder: 1,
supersessionMode: "Consume First",
@@ -31,20 +31,19 @@ export const CHANGE_ORDERS: ChangeOrderSpec[] = [
successorEffectivityOffset: 49,
revision: {
revision: "A",
- unitSalePrice: 1265,
+ unitSalePrice: 505,
description:
- "Rev A — heavier varnish fill and phase separators replace the loose slot liner, lifting the winding to a full Class H system",
+ "Rev A — coils are trickle-varnished in Class H resin before insertion, replacing the loose Nomex slot liner",
bomEdits: [
{ op: "delete", component: "MAT-INS-NOMEX" },
- { op: "setQuantity", component: "MAT-VARNISH", quantity: 0.375 },
- { op: "add", component: "MAT-CU-18AWG", quantity: 1.5, order: 5 }
+ { op: "setQuantity", component: "MAT-CU-18AWG", quantity: 7 },
+ { op: "add", component: "MAT-VARNISH", quantity: 0.25, order: 3 }
],
operationEdits: [
{
- order: 2,
- description:
- "Vacuum-pressure impregnate and bake Class H varnish",
- laborTime: 8
+ order: 1,
+ description: "Wind, form and trickle-varnish the coil set",
+ laborTime: 3
}
]
}
diff --git a/packages/database/src/datasets/data/precision/change-orders.ts b/packages/database/src/datasets/data/precision/change-orders.ts
index 630676cb5c..977ad9ccb5 100644
--- a/packages/database/src/datasets/data/precision/change-orders.ts
+++ b/packages/database/src/datasets/data/precision/change-orders.ts
@@ -3,13 +3,13 @@ import type { ChangeOrderData, ChangeOrderSpec } from "../../types.ts";
export const CHANGE_ORDERS: ChangeOrderSpec[] = [
{
ref: "co:draft",
- name: "HMA-4000 Rev A — customer print revision, port relocation",
+ name: "MCH-MANI-BLK — customer print revision, port relocation",
type: "Engineering",
status: "Draft",
openDateOffset: -220,
affectedItems: [
{
- item: "HMA-4000",
+ item: "MCH-MANI-BLK",
changeType: "Version",
sortOrder: 1
}
diff --git a/packages/database/src/datasets/data/robotics/change-orders.ts b/packages/database/src/datasets/data/robotics/change-orders.ts
index ed8b45bb9c..dc5895ef23 100644
--- a/packages/database/src/datasets/data/robotics/change-orders.ts
+++ b/packages/database/src/datasets/data/robotics/change-orders.ts
@@ -3,13 +3,13 @@ import type { ChangeOrderData, ChangeOrderSpec } from "../../types.ts";
export const CHANGE_ORDERS: ChangeOrderSpec[] = [
{
ref: "co:draft",
- name: "ROB-2000 Rev A — wrist harness routing update",
+ name: "HRN-ARM-001 — wrist harness routing update",
type: "Engineering",
status: "Draft",
openDateOffset: -346,
affectedItems: [
{
- item: "ROB-2000",
+ item: "HRN-ARM-001",
changeType: "Version",
sortOrder: 1
}
@@ -17,13 +17,13 @@ export const CHANGE_ORDERS: ChangeOrderSpec[] = [
},
{
ref: "co:impl",
- name: "CTRL-100 cabinet revision — EMI mitigation on the backplane",
+ name: "PCB-CTRL-R1 revision — EMI mitigation on the motion controller",
type: "Engineering",
status: "Implementation",
openDateOffset: -307,
affectedItems: [
{
- item: "CTRL-100",
+ item: "PCB-CTRL-R1",
changeType: "Revision",
sortOrder: 1,
supersessionMode: "Consume First",
@@ -31,20 +31,19 @@ export const CHANGE_ORDERS: ChangeOrderSpec[] = [
successorEffectivityOffset: 49,
revision: {
revision: "A",
- unitSalePrice: 12200,
+ unitSalePrice: 1030,
description:
- "Rev A — a purchased shielded enclosure, shielded backplane wiring and one consolidated safety I/O board remove the EMI fault path",
+ "Rev A — one consolidated M23 connector and a UV-cured conformal coat stop drive noise coupling onto the encoder lines",
bomEdits: [
- { op: "delete", component: "MAT-STEEL-SHT" },
- { op: "setQuantity", component: "PCB-IO-R1", quantity: 1 },
- { op: "add", component: "MAT-CBL-16AWG", quantity: 18, order: 5 }
+ { op: "setQuantity", component: "MAT-CONN-M23", quantity: 1 },
+ { op: "add", component: "MAT-COAT-UV", quantity: 0.125, order: 4 }
],
operationEdits: [
{
order: 2,
description:
- "Mount drives, boards and wire the shielded backplane",
- laborTime: 6
+ "Hand-solder the shielded connector, conformal coat and UV cure",
+ laborTime: 0.75
}
]
}
diff --git a/packages/database/src/datasets/data/satellite/change-orders.ts b/packages/database/src/datasets/data/satellite/change-orders.ts
index df1dbbd0a0..9d86526efd 100644
--- a/packages/database/src/datasets/data/satellite/change-orders.ts
+++ b/packages/database/src/datasets/data/satellite/change-orders.ts
@@ -3,13 +3,13 @@ import type { ChangeOrderData, ChangeOrderSpec } from "../../types.ts";
export const CHANGE_ORDERS: ChangeOrderSpec[] = [
{
ref: "co:draft",
- name: "SAT-1000 Rev A — antenna pointing mechanism update",
+ name: "SAW-001 — cell string layout for higher-efficiency cells",
type: "Engineering",
status: "Draft",
openDateOffset: -346,
affectedItems: [
{
- item: "SAT-1000",
+ item: "SAW-001",
changeType: "Version",
sortOrder: 1
}
@@ -17,13 +17,13 @@ export const CHANGE_ORDERS: ChangeOrderSpec[] = [
},
{
ref: "co:impl",
- name: "EPS-001 harness connector revision — short circuit mitigation",
+ name: "HARNESS-001 connector revision — short circuit mitigation",
type: "Engineering",
status: "Implementation",
openDateOffset: -307,
affectedItems: [
{
- item: "EPS-001",
+ item: "HARNESS-001",
changeType: "Revision",
sortOrder: 1,
supersessionMode: "Consume First",
@@ -31,18 +31,18 @@ export const CHANGE_ORDERS: ChangeOrderSpec[] = [
successorEffectivityOffset: 49,
revision: {
revision: "A",
- unitSalePrice: 120000,
+ unitSalePrice: 12600,
description:
- "Rev A — potted connector backshells and a revised harness remove the short-circuit path",
+ "Rev A — potted connector backshells replace the screw-clamp strain relief and remove the short-circuit path",
bomEdits: [
- { op: "delete", component: "MAT-KAPTON" },
- { op: "setQuantity", component: "BAT-LIION-48V", quantity: 2 },
- { op: "add", component: "HARNESS-001", quantity: 1, order: 5 }
+ { op: "delete", component: "FST-M4-TI" },
+ { op: "setQuantity", component: "MAT-KAPTON", quantity: 6 },
+ { op: "add", component: "MAT-SYLGARD", quantity: 0.25, order: 3 }
],
operationEdits: [
{
order: 2,
- description: "EPS functional & hipot test",
+ description: "Continuity, insulation resistance & hipot test",
laborTime: 3
}
]
diff --git a/packages/database/src/datasets/tiers/02-items.ts b/packages/database/src/datasets/tiers/02-items.ts
index 06485b8bbc..28e39f80f6 100644
--- a/packages/database/src/datasets/tiers/02-items.ts
+++ b/packages/database/src/datasets/tiers/02-items.ts
@@ -115,7 +115,7 @@ async function seedAssembly(ctx: Ctx, spec: AssemblySpec): Promise<void> {
}
// The method's Assembly operation plays this instruction in the MES. Linked
- // before release, so quote lines (tier 04) and jobs (tier 06) copy it.
+ // here, so quote lines (tier 04) and jobs (tier 06) copy it.
if (!item?.makeMethodId) {
throw new Error(
`Seed: assembly "${spec.name}" needs an item with a make method to link operation ${spec.operation} to`
@@ -270,17 +270,11 @@ export async function runTier2(ctx: Ctx): Promise<void> {
await seedAssembly(ctx, data.assembly);
}
- // Authored methods are released: Active is what job creation copies and what
- // the change notices (tier 08) cut their Draft versions from.
- await ctx.client.query(
- `UPDATE "makeMethod" SET status = 'Active', "updatedBy" = $3
- WHERE id = ANY($1) AND "companyId" = $2`,
- [
- data.methods.map((method) => needMM(i, method.readableId)),
- ctx.companyId,
- ctx.userId
- ]
- );
+ // Authored methods stay Draft (the interceptor's default), so a demo user can
+ // open any BOM/BOP and edit it — an Active method is read-only. With no Active
+ // version, `activeMakeMethods` falls back to the Draft, so quotes, jobs and MRP
+ // read it all the same. Only a Version change notice (tier 08) promotes its
+ // base to Active, as the app does.
// ── Supplier parts (which supplier can supply what) ────────────────────────
ctx.log("supplier parts");
diff --git a/packages/database/src/datasets/tiers/08-change-orders.ts b/packages/database/src/datasets/tiers/08-change-orders.ts
index 1e5c9901a0..4766ace35c 100644
--- a/packages/database/src/datasets/tiers/08-change-orders.ts
+++ b/packages/database/src/datasets/tiers/08-change-orders.ts
@@ -93,7 +93,15 @@ export async function runTier8(ctx: Ctx): Promise<void> {
case "Version": {
// A Version stays on the same item: the notice owns a new Draft method
// version cloned from the active one, and the affected item points at
- // both ends.
+ // both ends. A still-Draft base is promoted to Active first, as
+ // createChangeNoticeDraftMethod does — otherwise the notice's higher
+ // version outranks it in `activeMakeMethods` and its unreleased edits
+ // reach quotes, jobs and MRP.
+ await ctx.client.query(
+ `UPDATE "makeMethod" SET status = 'Active', "updatedBy" = $3
+ WHERE id = $1 AND "companyId" = $2 AND status = 'Draft'`,
+ [base.id, ctx.companyId, ctx.userId]
+ );
const draftVersion = Number(base.version) + 1;
const draft = await insertId(ctx, "makeMethod", {
itemId: item.id,
@@ -109,7 +117,7 @@ export async function runTier8(ctx: Ctx): Promise<void> {
}
case "Revision": {
- // A Revision mints a new revision of the item (EPS-001.A) and edits ITS
+ // A Revision mints a new revision of the item (HARNESS-001.A) and edits ITS
// method. The revision stays hidden — inactive, notice-owned — until release.
const revisionSpec = affected.revision;
if (!revisionSpec) {
diff --git a/packages/react/src/Heading.tsx b/packages/react/src/Heading.tsx
index 09bdae0a49..e03bf160b4 100644
--- a/packages/react/src/Heading.tsx
+++ b/packages/react/src/Heading.tsx
@@ -5,9 +5,9 @@ import { forwardRef } from "react";
import { cn } from "./utils/cn";
-// The serif headline face is for page-level titles only. h4 is the compact size
+// The headline face is for page-level titles only. h4 is the compact size
// record headers (job, picking list, orders) and in-app cards use, so it stays
-// in the body sans alongside the UI chrome around it.
+// in the body font alongside the UI chrome around it.
const headingVariants = cva(
"font-medium leading-[1.1] tracking-tight text-foreground text-balance",
{
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index f5099c9bf6..2945249ce3 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -24,9 +24,6 @@ catalogs:
'@emoji-mart/react':
specifier: 1.1.1
version: 1.1.1
- '@fontsource-variable/hedvig-letters-serif':
- specifier: 5.3.0
- version: 5.3.0
'@internationalized/date':
specifier: 3.12.0
version: 3.12.0
@@ -744,9 +741,6 @@ importers:
'@epic-web/remember':
specifier: 1.1.0
version: 1.1.0
- '@fontsource-variable/hedvig-letters-serif':
- specifier: 'catalog:'
- version: 5.3.0
'@internationalized/date':
specifier: 'catalog:'
version: 3.12.0
@@ -1210,9 +1204,6 @@ importers:
'@emoji-mart/react':
specifier: 'catalog:'
- '@fontsource-variable/hedvig-letters-serif':
- specifier: 'catalog:'
- version: 5.3.0
'@internationalized/date':
specifier: 'catalog:'
version: 3.12.0
@@ -1478,9 +1469,6 @@ importers:
'@carbon/utils':
specifier: workspace:*
version: link:../../packages/utils
- '@fontsource-variable/hedvig-letters-serif':
- specifier: 'catalog:'
- version: 5.3.0
'@internationalized/date':
specifier: 'catalog:'
version: 3.12.0
@@ -5225,9 +5213,6 @@ packages:
'@floating-ui/[email protected]':
resolution: {integrity: sha512-RiB/yIh78pcIxl6lLMG0CgBXAZ2Y0eVHqMPYugu+9U0AeT6YBeiJpf7lbdJNIugFP5SIjwNRgo4DhR1Qxi26Gg==}
- '@fontsource-variable/[email protected]':
- resolution: {integrity: sha512-MN6cYKUUb3o1tEECg02+IY6HK9fGHpZOnG+YhJaqU9TEp2FVo2dw8bFrwnxBVJCvnrC0F3xYF2OlXEZMWXZ0Jw==}
-
'@fontsource/[email protected]':
resolution: {integrity: sha512-P6r5WnJoKiNVV+zvW2xM13gNdFhAEpQ9dQJHt3naLvfg+LkF2ldgSLiF4T41lf1SQCM9QmkqPTn4TH568IRagg==}
@@ -18263,8 +18248,6 @@ snapshots:
'@floating-ui/[email protected]': {}
- '@fontsource-variable/[email protected]': {}
-
'@fontsource/[email protected]': {}
'@fontsource/[email protected]': {}
diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml
index 20d700ff1e..251d5bc697 100644
--- a/pnpm-workspace.yaml
+++ b/pnpm-workspace.yaml
@@ -59,7 +59,6 @@ catalog:
'@dnd-kit/utilities': 3.2.2
'@emoji-mart/data': 1.2.1
'@emoji-mart/react': 1.1.1
- '@fontsource-variable/hedvig-letters-serif': 5.3.0
'@internationalized/date': 3.12.0
'@lingui/cli': 5.9.4
'@lingui/core': 5.9.4