Maintenance API

These endpoints read the patterns of corrections on a team's lines, and file or dismiss them, as the Patterns tab does. They answer JSON, and errors are application/problem+json as on the resource API. See How maintenance works.

Method and pathReturns
GET /api/teams/{teamId}/lines/{lineId}/maintenance/patternsThe line's maintenance settings, measures and patterns. See Line.
GET /api/teams/{teamId}/maintenance/patterns/{patternId}A pattern and the corrections behind it. See Pattern.
POST /api/teams/{teamId}/maintenance/patterns/{patternId}/file200, with the pattern: files it. See File and dismiss.
POST /api/teams/{teamId}/maintenance/patterns/{patternId}/dismiss200, with the pattern: dismisses it. See File and dismiss.
GET /api/teams/{teamId}/tasks/{taskId}/maintenance{ fixes }: the pattern a maintenance task was filed to fix, with its corrections, or null.

They take a person's session. A person outside the team's workspace is answered 404. Workspace tokens are not taken.

Line

FieldTypeDescription
lineIdstring
enabledbooleanWhether patterns surface on the line: maintenance.enabled. Without the block, true only for a line with exactly one work station.
automaticbooleanWhether codebase patterns are filed without asking: maintenance.file is automatic.
maxOpennumbermaintenance.max_open.
opennumberMaintenance tasks open now.
stationstring or nullThe station maintenance tasks are filed at.
needsStationbooleanWhether maintenance is off because the line has more than one work station and no maintenance block names one.
spendobject{ month, spentUsd, capUsd, unpriced, estimated }: what grouping corrections spent this calendar month, in UTC, against the cap of 5 USD. unpriced counts the sessions that reported no price in dollars, and estimated the sessions that never reported their cost. Each of them is charged 0.25 USD.
correctionRateobject{ before, after, verdict }: corrections per run on the line's stations in the last 30 days, and in the 30 days before. verdict is better, worse, unchanged, or insufficient while either side has fewer than 5 runs.
measuresobject{ filed, dismissed, merged, closed, caught, checked }: patterns people filed and dismissed, maintenance tasks whose pull request merged and that closed or completed without a merge, and corrections a history check caught, of those it could check.
patterns[]objectThe line's patterns, ranked. See Pattern.

Pattern

FieldTypeDescription
id, lineIdstring
keystringA short key for the mistake.
summarystringWhat was wrong, in one line.
typestringcodebase, station or process.
statestringwatching, surfaced, filed, fixing, resolved or dismissed.
ranknumberIts corrections times its tasks within the last 14 days.
corrections, tasksnumberAll its corrections, and the tasks they are on.
recentCorrections, recentTasksnumberThe same within the last 14 days.
lastCorrectedAtstringWhen its newest correction was made.
surfacedAt, fixingSince, dismissedUntilstring or nullWhen it last surfaced, when its fix merged, and until when it stays dismissed.
routeobject or null{ kind, taskId, memoryId }: where filing sent it. kind is task, search or memory.
historyCheckobject or null{ command, at, caught, missed, tooWide, notCheckable }: the newest result of spotlight maintenance check.
fixobject or null{ before, after, verdict }: corrections per run like correctionRate, 30 days before and after its fix merged.

The pattern endpoint and a task's fixes give { pattern, corrections, filingBlock }. filingBlock is null when the pattern can be filed now, else why it cannot:

filingBlockCause
not-waitingThe pattern does not wait for the team.
search-askedA station search for the pattern is being asked for.
no-stationA codebase pattern, and the line has no maintenance.station.
slots-fullA codebase pattern, and the line has max_open open maintenance tasks.

Each correction:

FieldTypeDescription
id, taskIdstring
sourcestringmessage, sent-back, held, review-comment, push or revert.
textstring or nullWhat the person wrote, at most 4,000 characters.
repository, pathstring or nullWhere the correction is, when known.
lineStart, lineEndnumber or nullThe lines of path it is about.
before, afterstring or nullFor a push: the agent's commit the person pushed over, and the person's commit.
atstringWhen it was made.
checkedstring or nullWhat the newest history check found for it: caught, missed, too-wide or not-checkable.

File and dismiss

Both take no body, and act only on a pattern in the surfaced state.

Pattern typeFiling
codebaseFiles a maintenance task at the line's maintenance station. The pattern becomes filed.
stationStarts a search of the station with the most of its corrections, requested by the caller. The pattern becomes fixing.
processProposes a team memory from its newest correction that cites a person's message, for review in the inbox. The pattern becomes fixing.

Dismissing sets the pattern to dismissed for 90 days. It surfaces again after that once it is ready, or sooner when it gets twice the corrections that make it ready.

StatusMessageCause
404No team <teamId> for this caller.The caller cannot see the team.
404No correction pattern <patternId> on this team.No such pattern on the team.
409The line already has <n> open maintenance tasks. Finish one first, or raise maintenance.max_open.Every slot on the line is taken.
409The pattern cannot be filed: <reason>.The pattern cannot be routed, as in the line has no work station to file it at or a memory cites a person’s message, and none of its corrections is one, or the station search was refused.
422A correction pattern is filed only once it surfaced, and this one is <state>.Filing a pattern that does not wait for the team.
422A correction pattern is filed only once, and a station search for this one is being asked for.Filing a pattern while someone else's filing asks for its station search.
422A correction pattern is dismissed only while it waits for the team, and this one is <state>.Dismissing a pattern that does not wait for the team.

From a maintenance task's run

A run on a maintenance task calls two endpoints, through spotlight maintenance check. Only the runner with the lease on the run may call them, with its runner token.

Method and pathReturns
GET /api/runs/{runId}/maintenance/corrections{ patternId, summary, setups, corrections }: the corrections behind the task's pattern, and each repository's setup command, by owner/name.
POST /api/runs/{runId}/maintenance/checksTakes { command, results }, each result { correctionId, outcome, paths, pathsOmitted }, with at most 100 paths of at most 1,000 characters each. pathsOmitted is how many more paths the check flagged and left out. Answers { caught, missed, tooWide, notCheckable }.

A run whose task fixes no pattern is answered 404: No run <runId> held by this runner, or it fixes no correction pattern. A body with no command, no results, or a result about another pattern is answered 422.

On this page