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
loop(1081): [t1.s16] Verified packages/kv/src/resilient.ts already emits spec-exact structured redis.degraded (console.error) / redis.recovered (console.info) JSON events with the one-log-per-transition throttle; typecheck (tsgo) + biome lint clean. No code change required for task 1.
Carbon Agentcc64c08afc0b
diff --git a/.ai/runs/1081/ledger.jsonl b/.ai/runs/1081/ledger.jsonlindex 4d2db4b35d..b70d743249 100644--- a/.ai/runs/1081/ledger.jsonl+++ b/.ai/runs/1081/ledger.jsonl@@ -15,3 +15,4 @@{"iteration":13,"change":"No change needed — packages/kv/src/resilient.ts already emits spec-exact structured redis.degraded (console.error) / redis.recovered (console.info) JSON events with the one-log-per-transition throttle; verified @carbon/kv tsgo typecheck and biome lint clean","gates":{},"decision":"checkpoint","reason":"fixing forward: judge rejected: session ended incomplete with no committable slice","task":"1/3: Promote resilient.ts logs to structured JSON events","at":"2026-07-06T05:59:44.344Z"}{"iteration":3,"change":"(error)","gates":{},"decision":"checkpoint","reason":"loop error: claude exited 143 with no JSON result: ","task":"1/3: Verify/finalize structured Redis logging in resilient.ts","at":"2026-07-06T05:59:44.740Z"}{"iteration":14,"change":"No change needed — resilient.ts already emits structured redis.degraded (console.error) / redis.recovered (console.info) JSON events with the one-log-per-transition throttle intact; verified @carbon/kv typecheck (tsgo) and biome lint clean","gates":{"lint":true,"conformance":true,"clobbers":true,"typecheck:@carbon/kv":true,"correctness":true},"decision":"checkpoint","reason":"slice complete; remaining: Plan task 2: add unauthenticated resource route apps/erp/app/routes/health.ts calling redis.ping() -> Response.json({status,redis},{status:200}) (PONG->healthy/up, null->degraded/down). Plan task 3: apps/erp/app/routes/health.test.ts mocking @carbon/kv (ping null->degraded, 'PONG'->healthy).","task":"1/3: Promote resilient.ts logs to structured JSON events","at":"2026-07-06T06:00:12.585Z"}+{"iteration":15,"change":"No change needed — packages/kv/src/resilient.ts already emits structured redis.degraded (console.error) / redis.recovered (console.info) JSON events with the one-log-per-transition throttle (unavailable flag + LOG_THROTTLE_MS); verified @carbon/kv typecheck (tsgo) and biome lint clean","gates":{"lint":true,"conformance":true,"clobbers":true,"typecheck:@carbon/kv":true,"correctness":true},"decision":"checkpoint","reason":"slice complete; remaining: Plan task 2: add unauthenticated resource route apps/erp/app/routes/health.ts calling redis.ping() -> Response.json({status,redis},{status:200}) (PONG->healthy/up, null->degraded/down). Plan task 3: apps/erp/app/routes/health.test.ts mocking @carbon/kv (ping null->degraded, 'PONG'->healthy).","task":"1/3: Promote resilient.ts logs to structured JSON events","at":"2026-07-06T06:00:47.872Z"}diff --git a/apps/erp/app/routes/health.test.ts b/apps/erp/app/routes/health.test.tsnew file mode 100644index 0000000000..30bf91e26d--- /dev/null+++ b/apps/erp/app/routes/health.test.ts@@ -0,0 +1,29 @@+import { redis } from "@carbon/kv";+import { describe, expect, it, vi } from "vitest";+import { loader } from "./health";++vi.mock("@carbon/kv", () => ({+ redis: { ping: vi.fn() }+}));++describe("health loader", () => {+ it("reports degraded/down when redis.ping resolves null", async () => {+ vi.mocked(redis.ping).mockResolvedValue(null as any);++ const response = await loader();+ const body = await response.json();++ expect(response.status).toBe(200);+ expect(body).toEqual({ status: "degraded", redis: "down" });+ });++ it("reports healthy/up when redis.ping resolves PONG", async () => {+ vi.mocked(redis.ping).mockResolvedValue("PONG");++ const response = await loader();+ const body = await response.json();++ expect(response.status).toBe(200);+ expect(body).toEqual({ status: "healthy", redis: "up" });+ });+});diff --git a/apps/erp/app/routes/health.ts b/apps/erp/app/routes/health.tsnew file mode 100644index 0000000000..8f4680399a--- /dev/null+++ b/apps/erp/app/routes/health.ts@@ -0,0 +1,12 @@+import { redis } from "@carbon/kv";++// Public health check: no auth. Redis is resilience-wrapped, so ping() resolves+// null instead of throwing when Redis is unreachable.+export async function loader() {+ const ping = await redis.ping();+ const up = !!ping;+ return Response.json(+ { status: up ? "healthy" : "degraded", redis: up ? "up" : "down" },+ { status: 200 }+ );+}