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(dev): omit assembler env when the assembler app isn't selected

Sidwebworks63e13b0623fa
diff --git a/packages/dev/src/commands/up.ts b/packages/dev/src/commands/up.ts
index 04426f95c9..f3ab1b0ea6 100644
--- a/packages/dev/src/commands/up.ts
+++ b/packages/dev/src/commands/up.ts
@@ -204,7 +204,13 @@ export async function up(opts: UpOpts = {}) {
await ensureDepsInstalled(root);
await ensureSkillsInstalled(root);
- const ctx = await provisionSlot(root, slug, portless, borrowedEntry);
+ const ctx = await provisionSlot(
+ root,
+ slug,
+ portless,
+ selectedApps.includes("assembler"),
+ borrowedEntry
+ );
if (borrowedEntry) {
await waitForServices(ctx);
} else {
@@ -336,6 +342,7 @@ async function provisionSlot(
root: string,
slug: string,
portless: boolean,
+ includeAssembler: boolean,
borrowedEntry?: { ports: PortMap; redisDb: number; jwt: JwtCreds }
): Promise<Ctx> {
let ctx!: Ctx;
@@ -373,7 +380,16 @@ async function provisionSlot(
ctx = { root, slug, branchPrefix, ...slot };
- writeEnv(root, renderEnv({ slug, portless, branchPrefix, ...slot }));
+ writeEnv(
+ root,
+ renderEnv({
+ slug,
+ portless,
+ branchPrefix,
+ includeAssembler,
+ ...slot
+ })
+ );
syncAppPortlessConfigs(root);
// Use override: true so freshly written .env.local values replace any
// stale values already in process.env from the initial load at startup.
diff --git a/packages/dev/src/env.test.ts b/packages/dev/src/env.test.ts
index 56705296e3..58d1dab84e 100644
--- a/packages/dev/src/env.test.ts
+++ b/packages/dev/src/env.test.ts
@@ -35,6 +35,21 @@ describe("renderEnv (portless disabled)", () => {
expect(out).not.toContain("PORTLESS_TLD");
});
+ it("writes the assembler URL by default, omits it when deselected", () => {
+ const base = { slug: "s", ports, redisDb: 0, jwt, portless: false };
+ const withAssembler = renderEnv(base);
+ expect(withAssembler).toContain(
+ "ASSEMBLER_SERVICE_URL=http://localhost:54007"
+ );
+ expect(withAssembler).toContain("ASSEMBLER_SERVICE_API_KEY=dev-local-key");
+ // ASSEMBLER_SERVICE_URL is the pipeline's feature flag — when the app
+ // wasn't selected, the URL must be absent so jobs skip cleanly instead of
+ // failing against a dead endpoint.
+ const without = renderEnv({ ...base, includeAssembler: false });
+ expect(without).not.toContain("ASSEMBLER_SERVICE_URL=");
+ expect(without).not.toContain("ASSEMBLER_SERVICE_API_KEY=");
+ });
+
it("wires every port into env vars", () => {
const out = renderEnv({
slug: "s",
diff --git a/packages/dev/src/env.ts b/packages/dev/src/env.ts
index a9ccad902c..b051205d16 100644
--- a/packages/dev/src/env.ts
+++ b/packages/dev/src/env.ts
@@ -12,8 +12,25 @@ export function renderEnv(opts: {
portless: boolean;
/** Required when portless is true. e.g. "dev" for branch "dev". */
branchPrefix?: string;
+ /**
+ * Whether the assembler was selected to run. `ASSEMBLER_SERVICE_URL` IS the
+ * pipeline's feature flag (`assemblerEnabled()` in @carbon/jobs) — writing it
+ * with no service behind it turns clean job skips into dead-URL failures that
+ * stamp model rows Failed. Omitted → written (migrate regenerates the env
+ * without knowing the selection; only `up` passes false). A remote assembler
+ * pinned in `.env` via `#force` wins regardless.
+ */
+ includeAssembler?: boolean;
}): string {
- const { slug, ports, redisDb, jwt, portless, branchPrefix } = opts;
+ const {
+ slug,
+ ports,
+ redisDb,
+ jwt,
+ portless,
+ branchPrefix,
+ includeAssembler = true
+ } = opts;
const host = (sub: string) => `${sub}.${branchPrefix}.dev`;
const local = (port: number) => `http://localhost:${port}`;
@@ -96,11 +113,16 @@ export function renderEnv(opts: {
// `erp.main.dev` host the SDK URL points at).
lines.push(`INNGEST_TLS_HOST=${portless ? host("erp") : "localhost"}`);
lines.push("");
- lines.push("# Assembler service (CAD conversion + motion planning)");
- lines.push(
- `ASSEMBLER_SERVICE_URL=${portless ? `https://${host("assembler")}` : local(ports.PORT_ASSEMBLER)}`
- );
- lines.push("ASSEMBLER_SERVICE_API_KEY=dev-local-key");
+ if (includeAssembler) {
+ lines.push("# Assembler service (CAD conversion + motion planning)");
+ lines.push(
+ `ASSEMBLER_SERVICE_URL=${portless ? `https://${host("assembler")}` : local(ports.PORT_ASSEMBLER)}`
+ );
+ lines.push("ASSEMBLER_SERVICE_API_KEY=dev-local-key");
+ } else {
+ lines.push("# Assembler not selected this run — URL omitted so the CAD");
+ lines.push("# pipeline skips cleanly (assemblerEnabled() gates on it).");
+ }
lines.push("");
lines.push("# Dev auth bypass");
lines.push("[email protected]");