A two-minute production story

Plans are easy.
Reality moving underneath them is not.

One distributed application rollout. Five moments. The exact scenario is backed by the runnable Forge.ServiceProvisioning.Sample and its tests.

01
Current state ≠ desired state

The request looks simple until you make the transition explicit.

The application already has an database, API and legacy worker. The new desired state keeps the database, updates the API, removes the legacy worker and introduces a policy engine plus telemetry.

CURRENTwhat exists now
databaseDatabase · schema-v3
apiApiService · rev 1 · stable
legacy-workerWorker · legacy-v1
DESIREDwhat should exist
databaseDatabase · schema-v3
apiApiService · rev 2 · optimized
policy-enginePolicyEngine · standard
telemetryTelemetry · enhanced
THE FIRST FORGE QUESTION What changed—and why? ServiceComponentSync.Plan(current, desired)
02
Delta + Sync

Forge turns the gap into a typed plan.

Instead of one opaque “update service” instruction, the transition becomes inspectable. The api update also carries its generated Delta, so the reason for the update remains available.

UNCHANGEDdatabasesame logical state
UPDATEapiRevision: 1 → 2 · Configuration: stable → optimized
ADDpolicy-enginenew desired component
ADDtelemetrynew desired component
REMOVElegacy-workerabsent from complete desired state
IMPORTANT BOUNDARY

The plan still is not execution.

The sample's RolloutPlanBuilder is application code. It translates structural Forge results into the operation model this fictional distributed application understands.

Forge SyncPlan→application classification→RolloutOperation
03
Dependency-aware planning

Knowing the operations is not enough. Order can be part of correctness.

The policy-engine depends on the api operation. Telemetry depends on the policy-engine. Forge calculates deterministic execution waves without performing any operation.

WAVE 1
Update apican start immediately
Remove legacy-workerindependent in this application plan
→
WAVE 2
Add policy-engineafter api operation
→
WAVE 3
Add telemetryafter policy-engine operation
THE PLAN CROSSES A BOUNDARY

Turn it into data before execution.

SyncManifest creates a versioned portable description. ManifestDigest gives that exact plan a canonical SHA-256 identity for approval, storage or delayed execution.

manifest 4 operations update · add · add · remove sha256: …
04
Time passes

The dangerous assumption is that the world still looks like it did during planning.

Before the stored plan executes, another process applies an emergency api change. The old plan is structurally valid—but it is no longer valid against current reality.

PLANNED AGAINST
apirev 1stable
time→another actor changes state
ACTUAL NOW
apirev 7emergency-hotfix
!
MANIFEST PRECONDITION

Reject the stale plan.

ManifestPreconditions.Validate(...) reports api as changed since planning.

DO NOT EXECUTE

Forge does not make an old plan safe by optimism. It gives the application evidence that the assumptions behind the plan no longer hold.

05
Execution already started

Replanning gets harder once work has crossed the execution boundary.

Now imagine the first plan already started. A second desired state arrives. Simply discarding the old plan would lie about reality, because completed and running work still exists.

COMPLETEDUpdate apicannot be silently un-executed
RUNNINGAdd policy-engine · standardnew desired state now wants strict
WAITINGAdd telemetryno longer desired
WAITINGRemove legacy-workerlegacy worker is desired again
new desired state arrives↓ExecutedReplanner.Replan(...)
LOCKED api

Completed equivalent work remains part of reality.

INTERVENTION policy-engine

The running operation's semantics changed. Application policy must decide what happens next.

SAFE CHANGE telemetry

Waiting operation can be cancelled before it starts.

SAFE CHANGE legacy-worker

Pending removal can be cancelled because the item is desired again.

NEW queue

A newly required operation enters the next plan.

That is the point of Forge

Make the transition explicit before side effects make it irreversible.

Delta explains the semantic change. Sync reconciles desired state. Dependencies make order explicit. Manifests preserve plan identity. Preconditions catch drift. Execution-aware replanning respects work already in motion.

Run this exact sample Install Forge
NOT A MOCK MARKETING SCENARIO

The story is executable.

The repository sample and dedicated test project assert the structural plan, dependency waves, manifest round-trip, stale-state rejection and execution-aware replan outcomes.

SEE THE TESTSForge.ServiceProvisioning.Sample.Tests↗