Skip to content

Read where derived state disagrees with its source.

API version mission-status unreleased

GET
/drift

Scans the Missions of the project, or the one named by missionId, and reports each place where a derived file disagrees with the record that decides it. Three kinds are reported: the status snapshot disagrees with the status event log, one of the two status files is missing, and an expected lane branch, or the Mission branch (the coordination branch that meta.json names, else the Mission branch of the lane manifest), has no local branch. A scan reads and never repairs; Rescan is a second call, and scannedAt is the time of this scan. Findings are sorted and at most 1000, with truncated true only when MORE than 1000 existed (exactly 1000 is false), and findings: [] means the scan ran and found none. A Mission whose declared coordination branch no longer exists is scanned from its own directory, which can lag the coordination surface. The stock coordination resolver may query remotes, so the outcome depends on the network. An unreachable remote leaves the Mission read from its own directory, and the answer is still a 200; a reachable remote that lacks the declared branch is likewise read from its own directory; any other resolver error is a 500 drift_scan_unreadable. The scan is refused as a whole, never partly answered: a missionId that names no Mission is a 404, and a Mission the scan cannot read is a 500.

Parameters

Query Parameters

missionId
MissionId

The canonical machine identity of a Mission: a 26-character Crockford ULID minted when the Mission is created and never changed. Never confuse it with displayNumber, which is display-only and repeats.

string
/^[0-9A-HJKMNP-TV-Z]{26}$/

Restricts the scan to one Mission, by its 26-character ULID. Without it every Mission of the project is scanned. A value that is not a ULID is refused with 400, and a ULID that names no Mission with 404. The display number is never accepted.

Responses

200

The drift report. It is never cached.

Media type application/json
DriftReport

The result of one scan of the Missions of the project for drift: where a derived file disagrees with the record that decides it. At most 1000 findings are returned, sorted by Mission identity, kind and artifact path in the byte order of the UTF-8 encoding, and truncated is true only when more than 1000 existed (exactly 1000 is not truncated). findings is empty when the scan ran and found none. The scan reads and never repairs, and the 200 answer is sent with Cache-Control no-store, so a rescan is a second call. A Mission whose declared coordination branch no longer exists is scanned from its own directory, which can lag the coordination surface. The stock coordination resolver may query remotes, so the outcome depends on the network. An unreachable remote leaves the Mission read from its own directory, and the answer is still a 200; a reachable remote that lacks the declared branch is likewise read from its own directory; any other resolver error is a 500 drift_scan_unreadable.

object
findings
required

The findings of the scan, sorted by missionId, kind and artifactPath in byte order, at most 1000. The key is unique, because a Mission has at most one finding of a kind for a file, so the order is total. The list is empty when the scan ran and found none.

Array<object>
<= 1000 items
DriftFinding

One place where a derived file of a Mission disagrees with the record that decides it. A Mission has at most one finding of a kind for a file. For the kind snapshot_disagrees_with_event_log the disagreement is with the reducer replay of the event log at the snapshot’s own generation, not with the true event log: events appended after that generation are not part of the comparison. A finding never carries a host path, a branch name, an exception text or the text of a doctor message; its summary is one of six fixed sentences. missionId and artifactPath are never null, because every shipped kind belongs to one Mission and names one file.

object
artifactPath
required
ArtifactPath

The file of the Mission directory the finding is about, relative to it: status.json, status.events.jsonl or lanes.json. Never null.

string
>= 1 characters <= 512 characters /^(?![\s\S]*[\n\r\x0B\x0C\x1C-\x1E\x85\u2028\u2029])(?!~/)(?![A-Za-z]:)(?!\.\.?(?:/|$))[^/\\\x00]+(?:/(?!\.\.?(?:/|$))[^/\\\x00]+)*$/
authority
required
DriftAuthority

Which record decides the finding. Fixed by the kind.

string
Allowed values: event_log git
derivedSide
required
DriftSide

Which derived file holds the value that disagrees. Fixed by the kind.

string
Allowed values: status_json lanes_json
kind
required
DriftKind

What kind of drift the finding reports. This property is provisional, like the schema that carries it.

string
Allowed values: snapshot_disagrees_with_event_log snapshot_or_event_log_missing lane_branch_missing
laneComparison
required

One row for each work package whose status lane differs between the status snapshot and the replay of the event log, sorted by wpId in byte order. A work package on one side only has the other side null. Empty unless the kind is snapshot_disagrees_with_event_log and the files differ in a lane, and empty for a status.json that is not a valid JSON object. This property is provisional.

Array<object>
LaneComparison

One work package whose status lane differs between the status snapshot and the replay of the status event log. Both sides are status lanes, never a code lane. A work package on one side only has the other side null, and a lane outside the nine display lanes (genesis, uninitialized) reads as null.

object
derivedStatusLane
required
One of:
StatusLane

The display state of a work package in the status model. Exactly nine values. The runtime enum also carries genesis and uninitialized, which are not display values: a work package with no events reads as a null status lane, never as one of those two. This is the status lane, not a code lane or the repo-root lane; the contract never groups these values into board columns.

string
Allowed values: planned claimed in_progress for_review in_review approved done blocked canceled
persistedStatusLane
required
One of:
StatusLane

The display state of a work package in the status model. Exactly nine values. The runtime enum also carries genesis and uninitialized, which are not display values: a work package with no events reads as a null status lane, never as one of those two. This is the status lane, not a code lane or the repo-root lane; the contract never groups these values into board columns.

string
Allowed values: planned claimed in_progress for_review in_review approved done blocked canceled
wpId
required
WpId

The identifier of the work package inside the Mission of the finding.

string
>= 1 characters <= 64 characters /^WP[0-9]{2,}$/
missionId
required
MissionId

The canonical machine identity of the Mission the finding belongs to. Never null.

string
/^[0-9A-HJKMNP-TV-Z]{26}$/
remedy
required
One of:
DriftRemedy

The one action that repairs a finding, as a name and not as text. materialize_status stands for the command spec-kitty agent status materialize --mission <slug> (not spec-kitty materialize, which writes only derived views). The client builds the text and takes the slug from MissionHead.slug of the finding’s missionId. The service never runs it: a scan reads and never repairs. This enum is provisional.

string
Allowed values: materialize_status
severity
required
DriftSeverity

How serious the finding is: error for SNAPSHOT_DRIFT and CORRUPT_JSON, warning for the two variants of the disagreement (SNAPSHOT_DRIFT_PROVENANCE, SNAPSHOT_DRIFT_TERMINAL), for a missing status file and for a missing lane branch.

string
Allowed values: error warning
sourceCode
required

The audit code behind a snapshot_disagrees_with_event_log finding: SNAPSHOT_DRIFT, SNAPSHOT_DRIFT_PROVENANCE, SNAPSHOT_DRIFT_TERMINAL or CORRUPT_JSON. Null for the two other kinds, which the audit has no code for. A string of capital letters, digits and underscores, never free text.

string | null
/^[A-Z][A-Z0-9_]*$/
summary
required

Fixed text, one sentence for each pair of kind and sourceCode, and no other text. The six sentences are: “The status snapshot disagrees with the event log.” for snapshot_disagrees_with_event_log with SNAPSHOT_DRIFT; “The status snapshot differs from the event log only in provenance fields.” for that kind with SNAPSHOT_DRIFT_PROVENANCE; “The status snapshot differs from the event log and every work package is done.” for that kind with SNAPSHOT_DRIFT_TERMINAL; “The status snapshot is not a valid JSON object.” for that kind with CORRUPT_JSON; “One of the status snapshot and the event log is missing.” for snapshot_or_event_log_missing with a null sourceCode; and “An expected lane or Mission branch has no local branch.” for lane_branch_missing with a null sourceCode. A pair outside this set is never produced.

string
>= 1 characters
scannedAt
required

The time of this scan, as an RFC 3339 date-time. Every call reads again, so a second call has a later value.

string format: date-time
truncated
required

True when more than 1000 findings existed and the list holds the first 1000 of them; false for exactly 1000.

boolean

Headers

Cache-Control
string
Allowed value: no-store

Always no-store, because every call scans again and the report is only as old as its scan.

404

The missionId names no Mission, refused with 404. The body is a problem details object whose code is mission_not_found.

Media type application/problem+json
DriftRefusal

The problem details body of a refused drift read. It is a Problem whose code is one of two values, and the status follows from the code: 404 for mission_not_found and 500 for drift_scan_unreadable. The body carries no host path, no Mission directory and no file content. Consumers branch on code, never on title.

object
code
required

A stable machine-readable code for the problem, such as the name of a refusal reason. Consumers branch on it, never on the title.

string
detail

A human-readable explanation specific to this occurrence of the problem.

string
instance

A URI reference that identifies this occurrence of the problem.

string
status
required

The HTTP status code of this occurrence.

integer
>= 400 <= 599
title
required

A short, human-readable summary of the kind of problem. It does not change between occurrences.

string
type

A URI reference that identifies the kind of problem. Absent means about:blank.

string
code
required
DriftRefusalCode

The reason of the refusal. The status is fixed by it: 404 and 500 in the order of the values.

string
Allowed values: mission_not_found drift_scan_unreadable

500

The scan could not read a Mission it had to read, refused with 500 and never answered as a partial report. The body is a problem details object whose code is drift_scan_unreadable.

Media type application/problem+json
DriftRefusal

The problem details body of a refused drift read. It is a Problem whose code is one of two values, and the status follows from the code: 404 for mission_not_found and 500 for drift_scan_unreadable. The body carries no host path, no Mission directory and no file content. Consumers branch on code, never on title.

object
code
required

A stable machine-readable code for the problem, such as the name of a refusal reason. Consumers branch on it, never on the title.

string
detail

A human-readable explanation specific to this occurrence of the problem.

string
instance

A URI reference that identifies this occurrence of the problem.

string
status
required

The HTTP status code of this occurrence.

integer
>= 400 <= 599
title
required

A short, human-readable summary of the kind of problem. It does not change between occurrences.

string
type

A URI reference that identifies the kind of problem. Absent means about:blank.

string
code
required
DriftRefusalCode

The reason of the refusal. The status is fixed by it: 404 and 500 in the order of the values.

string
Allowed values: mission_not_found drift_scan_unreadable

default

The request failed. The body is a problem details object.

Media type application/problem+json
Problem

The only non-2xx body of any module. A problem details object in the sense of RFC 9457, served as application/problem+json.

object
code

A stable machine-readable code for the problem, such as the name of a refusal reason. Consumers branch on it, never on the title.

string
detail

A human-readable explanation specific to this occurrence of the problem.

string
instance

A URI reference that identifies this occurrence of the problem.

string
status
required

The HTTP status code of this occurrence.

integer
>= 400 <= 599
title
required

A short, human-readable summary of the kind of problem. It does not change between occurrences.

string
type

A URI reference that identifies the kind of problem. Absent means about:blank.

string