Data Model: origin freshness

FreshnessState (enum, foundation-agnostic values)

up_to_date, behind, ahead, diverged, local_missing, remote_missing, unreachable, no_remote.

Divergence (kernel value object)

FieldTypeMeaning
behindintcommits on the remote-tracking ref not on local (optionally path-scoped)
aheadintcommits on local not on the remote-tracking ref

FreshnessVerdict (application value object)

FieldTypeMeaning
branchstrlocal branch name
remotestr \None
stateFreshnessStateclassification
behind / aheadintcounts (0 when not applicable)
scopestr \None
detailstr \None
remote_shastr \None

Invariants: up_to_date and remote_missing only when the remote answered in this invocation; behind > 0 and ahead > 0 ⇔ diverged.

OriginCheckMode

enforce (default) | warn; carries source ∈ {default, flag, environment, read-only} (read-only = accept --no-commit / --diagnose). Unknown env value ⇒ enforce with a warning.

Refusal codes

ORIGIN_STATUS_STALE, ORIGIN_LANE_STALE, ORIGIN_LANE_DIVERGED, ORIGIN_UNREACHABLE.

Review lane action (application)

keep | fast_forward(to_sha) | create_from(remote_ref) | refuse(code) | warn(state).