Line

You are reading the unreleased docs (next). See latest (v0.9)

ui/server/src/reviewAnalyses

an analysis is a Process: one plan, one step, flow review.analyze (src/plan.mjs).

Cockpit server, next. Source: ui/server/src/reviewAnalyses.mjs.

Variables#

ANALYSIS_FLOW#

const ANALYSIS_FLOW: "review.analyze" = 'review.analyze'

Defined in: ui/server/src/reviewAnalyses.mjs:29


ANALYSIS_STEP#

const ANALYSIS_STEP: "analyse" = 'analyse'

Defined in: ui/server/src/reviewAnalyses.mjs:30


KEEP_FINISHED#

const KEEP_FINISHED: 30 = 30

Defined in: ui/server/src/reviewAnalyses.mjs:32

Finished analysis records kept in the store (and so in the drawer); older ones are removed.

Functions#

analysisPlan()#

analysisPlan(__namedParameters): object

Defined in: ui/server/src/reviewAnalyses.mjs:44

The plan an analysis is. expected is {features, files} or absent.

Parameters#

__namedParameters
baseName

any

baseSha

any

expected

any

headName

any

headSha

any

Returns#

object

steps

steps: object[]

ticket

ticket: object

ticket.source

source: string = 'text'

ticket.title

title: string

version

version: number = 1


composeExecutors()#

composeExecutors(__namedParameters): (ctx) => any

Defined in: ui/server/src/reviewAnalyses.mjs:127

Route a step by its flow. Only the read-only flows avoid the bot runner: review.analyze and test.run. A test.run step with no test executor is refused rather than handed to the bot runner, which would give it a branch and a worktree it has no use for.

Parameters#

__namedParameters
bot

any

review

any

testRun?

any = null

Returns#

(ctx) => any


createAnalyses()#

createAnalyses(deps): object

Defined in: ui/server/src/reviewAnalyses.mjs:138

Parameters#

deps
results

{ delete: (id) => boolean; get: (id) => any; set: void; }

results.delete

(id) => boolean = ...

results.get

(id) => any = ...

results.set
service

{ control: Function; startPlan: Function; store: Function; }

service.control

Function

service.startPlan

Function

service.store

Function

Returns#

cancel

cancel: (processId) => any

The machine's own CANCEL, through the same service the drawer's button uses.

Parameters
processId

any

Returns

any

start()

start(spec): { error?: undefined; ok: boolean; processId: any; } | { error: any; ok: boolean; processId?: undefined; }

Create and start the process. -> {ok:true, processId} | {ok:false, error}

Parameters
spec

any

Returns

{ error?: undefined; ok: boolean; processId: any; } | { error: any; ok: boolean; processId?: undefined; }

stateOf()

stateOf(processId): { state: string; } | { processId: any; result: any; state: string; } | { processId: any; state: string; } | { error: any; processId: any; state: string; }

The analysis's row state, read from the process record (the single source of truth). A done/failed record whose in-memory result was lost (a server restart, ) falls back to the sidecar saveAside('result', ...) wrote when the step finished, so a report that cost real minutes is not silently forgotten.

Parameters
processId

any

Returns

{ state: string; } | { processId: any; result: any; state: string; } | { processId: any; state: string; } | { error: any; processId: any; state: string; }


createResults()#

createResults(): object

Defined in: ui/server/src/reviewAnalyses.mjs:61

Finished analyses' reports, by process id, bounded. Never persisted: a report is derived, so a restart simply asks again.

Returns#

object

delete

delete: (id) => boolean

Parameters
id

any

Returns

boolean

get

get: (id) => any

Parameters
id

any

Returns

any

set()

set(id, value): void

Parameters
id

any

value

any

Returns

void


createReviewExecutor()#

createReviewExecutor(opts?): object

Defined in: ui/server/src/reviewAnalyses.mjs:90

Parameters#

opts?

run(job, {signal, onProgress}) is the test seam; the default forks the read-only worker. In a project whose project.execution.mode is cli the same job goes to runCli instead (default: the real construct review subprocess, reviewCli.mjs); modeOf reads the mode (default: architecture.yml). persist, when given, is called with the finished report right after results.set(): the default (index.mjs) writes it through processStore.saveAside(id, 'result', ...), so a restart's in-memory Map miss is not the only place stateOf can find it (see createAnalyses below). Best-effort: a failure here never fails the step itself.

modeOf?

(projectRoot) => string = projectModeOf

persist?

(projectRoot, id, value) => void = null

results?

{ delete: (id) => boolean; get: (id) => any; set: void; } = ...

results.delete

(id) => boolean = ...

results.get

(id) => any = ...

results.set
run?

Function = forkRunner

runCli?

Function = cliReviewRunner

runOptions?

any = {}

Returns#

object

executeStep

executeStep: (__namedParameters) => Promise<{ artifacts: any[]; error: any; llm: any; ok: boolean; } | { artifacts: any[]; llm: any; ok: boolean; }>

Parameters
__namedParameters
log

any

process

any

signal

any

step

any

Returns

Promise<{ artifacts: any[]; error: any; llm: any; ok: boolean; } | { artifacts: any[]; llm: any; ok: boolean; }>

results

results: object

results.delete

delete: (id) => boolean

Parameters
id

any

Returns

boolean

results.get

get: (id) => any

Parameters
id

any

Returns

any

results.set()

set(id, value): void

Parameters
id

any

value

any

Returns

void


isAnalysisPlan()#

isAnalysisPlan(plan): boolean

Defined in: ui/server/src/reviewAnalyses.mjs:38

Is this stored plan an analysis (and so not a plan the Review screen may offer as an expected scope)?

Parameters#

plan

any

Returns#

boolean


projectModeOf()#

projectModeOf(projectRoot): "engine" | "cli"

Defined in: ui/server/src/reviewAnalyses.mjs:76

The execution mode of the project an analysis belongs to (project.execution.mode, ); 'engine' when the folder has no architecture.yml. Throws the config's own error for an unknown value.

Parameters#

projectRoot

any

Returns#

"engine" | "cli"