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.
TypeScript ai-agentsbill-of-materialserpinventory-managementleanmanufacturingmanufacturing-execution-systemmcp-servermesmrpopen-source-erppostgresqlproduction-planningqmsquality-management-systemreact-routerself-hostedsupabasetraceabilitytypescript
Model raw retention: decoupled compact + xbf mode + orphan-only prune
Problem: STEP raws >50MB get lost. Compact (raw → .zst) only runs inside the
optimize success path (best-effort), and the nightly prune deletes any
non-.zst temp-staging raw >50MB older than 7 days — including raws whose
optimize failed/was skipped, legacy pre-pipeline raws, and compact-failed raws.
Result: modelUpload.modelPath points at a deleted object → assemblies say
"no model".
Decisions (user-approved 2026-07-22):
- Compact STEP raws to xbf (
STEP → OCCT BinXCAF → zstd, modexbf) — far smaller than zstd'd ASCII STEP. Mesh raws keep modezstd. - xbf raws are not downloadable (OCCT-internal format) — hide the download action in the files lists.
- Compact is decoupled from optimize success; prune becomes orphan-only.
Tasks
-
packages/lib/src/events.ts— addcarbon/model-compactevent{ modelUploadId, companyId }.
-
packages/utils/src/file.ts— addisModelRawDownloadable(modelPath): false when the.zst-peeled path ends.xbf. Export via utils barrel.
-
- New
packages/jobs/src/inngest/functions/tasks/model-compact.ts— standalone Inngest function (retries 3): load row; skip if already.zst, non-temp-stagingbucket, no optimizable format, or assembler disabled; modexbfforstep(output{id}.xbf.zst) elsezstd(output{id}.{format}.zst); persist repoint (freezeoriginalSize, rewritesize), delete fat original.
- New
-
model-optimize.ts— remove inline compact block; firecarbon/model-compacton success, on alreadyOptimized (heals legacy fat raws), and inonFailure.
-
- Register function in
tasks/index.ts+inngest/index.ts.
- Register function in
-
cleanup.tsprune — exclude any candidate still referenced by amodelUpload.modelPath(orphan-only delete).
-
production.models.tsgetAssemblyModelState— accept.xbf.
-
- Hide download for non-downloadable raws in
Documents.tsx,OpportunityLineDocuments.tsx,JobDocuments.tsx,ItemDocuments.tsx.
- Hide download for non-downloadable raws in
-
- Update stale comments (
const.tsprune note, model-optimize header).
- Update stale comments (
Verification
pnpm exec turbo run typecheck --filter=@carbon/utils --filter=@carbon/jobs --filter=erp- Existing behavior preserved: already-compacted
.step.zstrows still read (assembler content-sniffs; state check peels.zst).