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.
Rename the workflow entity node ("Record") → compute ("Compute")
Date: 2026-08-17 · Branch: fix/workflow-improvements
What and why
The workflow node type stored as type: "entity" is shown in the builder palette as
"Record", described as "Writes to a record in Carbon". Both are wrong: the node is
read-only — it runs one catalog operation and returns a computed value (an order
total, a job's scrap percentage, an item's quantity on hand). Everything that writes
is an Action step. The docs already carry a warning callout apologising for the name
(docs/content/docs/reference/workflows.mdx:64).
So this is a full internal rename, not just a label swap:
- node type discriminant
entity→compute - palette label
Record→Compute, with an accurate description - the stale "Despite the name…" docs callout goes away
Scope boundary — entity is overloaded
Rename only the node type. Leave every other entity alone:
| Not renamed | Where |
|---|---|
the value-type kind { kind: "entity", of } |
definition/types.ts, runtime/values.ts, entityValue() |
| catalog entities (record-type registry) | catalog/entities.ts, CatalogEntity, getEntity, entity.<name> label keys |
the lookup node's data.entity field |
lookupNode schema, NODE_KINDS.lookup |
EntityLoader (record-reading port) |
runtime/types.ts, engine/loader.ts |
MomentEntityRef, entityRefs.ts, EntityRecordLink.tsx |
catalog / runs UI |
the trigger output named "record" |
run-trigger.ts, OUTPUT_LABELS.record |
| the runs-table "Record" column | WorkflowRunsTable.tsx, workflow-runs.mdx |
Stored-data facts (verified)
workflowVersion.nodesis JSONB (20260810100100_workflows-foundation.sql:61) — live definitions hold{"type":"entity"}.workflowStepRun.nodeTypeis a plain TEXT column (same migration, line 155) with no enum and no CHECK. Historical run rows keep the string"entity"forever.- No migration, view, RPC or constraint references
'entity'in a workflow context.
→ No SQL migration. Stored definitions are upgraded on read by migrateDefinition;
historical step rows are handled by a display alias.
Steps
1. packages/workflows — the contract
-
definition/schema.ts:entityNode→computeNode,z.literal("entity")→z.literal("compute"), union member,EntityNode→ComputeNode. -
definition/schema.ts:CURRENT_DEFINITION_FORMAT_VERSION3 → 4. -
definition/normalize.ts: add the v3 → v4 block after the v2 → v3 name backfill (so a v2 document still gets theentity_0names it already carries), rewriting onlytype === "entity"nodes totype: "compute". -
definition/nodes.ts:NODE_KINDS.entity→.compute,entityBatchInput→computeBatchInput, import + doc comment. -
runtime/entity.ts→runtime/compute.ts;entityExecutor→computeExecutor. -
runtime/executors.ts,runtime/index.ts,src/index.ts: keys/imports/exports. -
definition/validate.ts:480comment wording.
2. packages/workflows tests
-
runtime/entity.test.ts→compute.test.ts;runtime/executors.test.ts;definition/validate.test.ts:673;seed-workflows.test.ts:29(sort order). -
definition/normalize.test.ts: everyformatVersion3 → 4 and 4 → 5 (future-format rejection), plus a new "v3 → v4 renames entity to compute" case that also pins that the node'snameis left untouched.
3. packages/database seeds
-
seed-dev/tiers/workflow-definitions.ts:FORMAT_VERSION3 → 4; nodeentity_total→compute_total(type, id, theref(...)and bothedge(...)).
4. packages/jobs
-
engine/end-to-end.test.ts:161,596— the twotype: "entity"nodes. - Nothing else: dispatch is
executorFor(node), andnodeType: node.typefollows.
5. apps/erp builder
-
nodes/meta.ts: keyentity→compute;name: "Compute"; iconLuPencilRuler→LuCalculator; description → "Works out a value from a record";defaultTitle→ "Compute a value"; bothnode.typenarrowings;NODE_KIND_ORDER. -
nodes/kinds.ts(3 maps),nodes/index.ts(nodeTypes). -
graph.ts:178case "entity"(leave line 194 — that's lookup'sdata.entity). -
config/forms/EntityForm.tsx→ComputeForm.tsx(git mv), component name,NodeFormProps<"compute">;config/forms/index.tsimport +NODE_FORMSkey. -
useDefinition.ts:useEntityBatchInput→useComputeBatchInput. -
Runs/WorkflowRunSteps.tsx:110narrowing + comment;Runs/useNodeLabel.ts:11.
6. Back-compat (the two places it actually bites)
-
labelKeys.tsDEFAULT_NODE_NAME: addcompute, keepentity. Saved workflows carry node names likeentity_0; drop it and every existing card, step row and outcome sentence starts rendering the literal "Entity 0". Test pins both. - Historical
workflowStepRun.nodeType === "entity"rows: add one resolver (metaForNodeType) innodes/meta.tsmapping the legacy string to the compute meta, and use it atWorkflowRunSteps.tsx:286andrunOutcome.ts:26. Without it an old run's step renders the raw word "entity" as its title.
7. Docs and rules
-
docs/content/docs/reference/workflows.mdx:60table row → Compute; delete the now-moot line-64 callout and rewrite line 65 as a plain sentence. Leaveworkflow-runs.mdxalone (its "Record" is the trigger-record column). -
.claude/rules/workflow-engine.md:24andpackages/workflows/AGENTS.md:110(entity.ts→compute.ts);AGENTS.md:29version 3 → 4 and the "one upgrade today" line (already stale — there are two, becoming three). -
apps/erp/app/modules/workflows/AGENTS.md:3node-kind list.
8. Verify
-
pnpm exec turbo run typecheck --filter=@carbon/workflows --filter=@carbon/jobs --filter=@carbon/database --filter=erp -
pnpm run test(workflows, jobs, erp workflow tests) -
pnpm exec biome checkon touched files
Deliberately not doing
- No SQL migration and no JSONB backfill of
workflowVersion.nodes—readWorkflowVersionmigrates on read, which is the package's stated seam for exactly this. - No
.pochanges.NODE_KIND_METAstrings are plain JS literals that Lingui never extracted; the existingmsgid "Record"comes from unrelatedt\Record`call sites. Wrapping these inmsg` descriptors is a separate, larger change.