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.
Surface unschedulable operations on the Forecast
Date: 2026-08-18 Branch: naveen/capacity-planning Problem: an operation that can't be placed (no qualified operator for its ability, no feasible slot, horizon-exhausted) leaves NO
capacityReservationrow. The Forecast Gantt is built entirely from reservations, so the job "hangs" after the last placeable op — no bar, not counted in the conflict badge, andjob.projectedCompletionAtwrongly reports an early finish. On the ops Kanban the same conflict IS visible (that path readsjobOperation.hasConflictdirectly).
Root cause (verified)
work-center-selector.ts:536-538short-circuits the no-qualified-operator case; the op falls into thebest === nullbranch (:778-801) which stampshasConflict/conflictReason+ a fallback work center but emits noplannedReservation.persistChanges(scheduling-engine.ts:1018) only insertscapacityReservationrows fromplannedReservations, so nothing represents the op.projectedCompletionAt(scheduling-engine.ts:731-742) is the max over placed ends + planned reservations → excludes the unplaced op.- Forecast (
forecast.tsx→getCapacityReservationsForResources→buildResourceTimeline) and itsconflictCount(forecast.tsx:394-396) are 100% reservation-driven → the op is invisible. - Bonus bug: an unplaced op sets no
placedEndByOperation, so its successors schedule fromnowas if it finished instantly.
Approach: Option A — engine emits a flagged placeholder reservation
When an op can't be placed, emit a placeholder capacityReservation at the
earliest feasible start (earliestStart, after predecessors) for the op's
work-content duration in calendar time, on the fallback work center, flagged
isPlaceholder = true. It:
- renders on the Forecast (distinct "blocked" bar) and folds into the conflict count,
- pushes
job.projectedCompletionAtto (at least) this op — honest, - chains successors after it (
placedEndByOperation), - but must NOT hold capacity against other jobs →
getLiveReservationsexcludesisPlaceholder = true, and it is NOT pushed into the in-runcapacity.reservationsblocking set.
Why a column (not derive from hasConflict)
A late-but-placed op is ALSO hasConflict yet is a REAL capacity hold. Only a
dedicated marker can distinguish "shown but non-binding." Cheapest correct marker:
one boolean on capacityReservation.
Tasks
- Migration
…_capacity-reservation-placeholder.sql:ALTER TABLE "capacityReservation" ADD COLUMN "isPlaceholder" BOOLEAN NOT NULL DEFAULT false;+ COMMENT. Apply +pnpm run generate:types. - Engine types (
functions/lib/scheduling/types.ts): addPlannedReservation.isPlaceholder?: boolean. work-center-selector.tsbest === nullbranch: whendurationHours > 0and a fallback work center exists, computeend = earliestStart + durationHours(calendar ms, like outside-processing at:380), push a placeholderPlannedReservation(isPlaceholder: true,resourceKind: "WorkCenter",resourceId: fallbackWc,scheduleNote= the conflict), andplacedEndByOperation.set(op.id, end). Do NOT touchcapacity.reservations. Keep the existing selection (conflict + fallback WC, no placed dates).scheduling-engine.tspersistChanges: mapisPlaceholderon the insert. (TheendAt > startAtfilter already lets it through.)master-data-provider.tsgetLiveReservations: add.where("cr.isPlaceholder", "is not", true)so placeholders never occupy capacity for other jobs / next regen.- Deno tests (
work-center-selector.test.ts/determinism.test.ts): no-qualified-operator op → a placeholder reservation is emitted, is NOT in the capacity blocking set, and successors chain after it. Placement of OTHER jobs is byte-identical with/without the placeholder present. - Service (
production.service.tsgetCapacityReservationsForResources): selectisPlaceholder. resourceTimeline.ts: threadisPlaceholderontoResourceTimelineReservation→ the bar keepsisErrorred but gets a distinctstyle.icon(blocked/ban) so "can't be scheduled" reads differently from "scheduled but late"; passisPlaceholderinto the reservationdetail.timeline.ts/TimelineDetail.tsx: addunschedulableto the detail type; a placeholder reservation shows an "Unschedulable" status chip (red), renders date-only (no fictional booked clock time / relative time), and an explanatory line: "This operation can't be scheduled — {reason}. The bar shows where it would run once resolved."forecast.tsx: mapisPlaceholderthrough; conflict badge already counts it (the reservation now exists). Add a one-line header summary "{n} can't be scheduled" next to the conflicts badge (distinct wording).- i18n:
pnpm lingui:extractfor the new strings (then/translateat commit).
UI mechanism (the "figure out a mechanism" ask)
Three layers, cheapest-first, all riding the existing pipeline:
- Bar: distinct icon (blocked) + red — visually separates unschedulable from late.
- Detail panel: dedicated "Unschedulable" chip + the reason + "where it would run" explanation, date-only (the span is a placeholder, not a booking).
- Header: a small "{n} can't be scheduled" count beside the existing conflict badge.
Verification
deno test lib/scheduling/from the functions dir (new + determinism cases green).pnpm exec turbo run typecheck --filter=@carbon/erp --filter=@carbon/database.- Browser (
/auth+/test): a job whose last op needs an ability nobody holds now shows a distinct blocked bar right after its previous op, the conflict/"can't be scheduled" counts fire, and the detail panel explains it.
Out of scope (noted for later)
- Whether
projectedCompletionAtshould become a "never" sentinel when a job has an unschedulable op (vs. the placeholder end). Current change makes it honest-er (extends to the placeholder), which is strictly better than today.