Line

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

ui/server/src/requirementProofApi

(part of ) -- the proof of a generated screen, on the Requirement screen.

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

Variables#

MAX_PROOF_REQUEST_BYTES#

const MAX_PROOF_REQUEST_BYTES: number

Defined in: ui/server/src/requirementProofApi.mjs:34

A plan is bigger than a sentence; the proof routes take more than the read route (16 KB) and no more than this (under the 100 KB of express.json).


PROOF_REASON#

const PROOF_REASON: Readonly<{ max: 200; min: 8; }>

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

The reason of a skip: a sentence, not a shrug. Mirrored by the client's domain/ProofCard.ts.


PROOF_RUN_TIMEOUT_MS#

const PROOF_RUN_TIMEOUT_MS: 90000 = 90_000

Defined in: ui/server/src/requirementProofApi.mjs:35

Functions#

checkReason()#

checkReason(reason): { error: string; ok: boolean; reason?: undefined; } | { error?: undefined; ok: boolean; reason: string; }

Defined in: ui/server/src/requirementProofApi.mjs:110

Normalise a skip reason: one trimmed line of PROOF_REASON.min..max characters, or the refusal.

Parameters#

reason

any

Returns#

{ error: string; ok: boolean; reason?: undefined; } | { error?: undefined; ok: boolean; reason: string; }


createProofHandlers()#

createProofHandlers(deps?): object

Defined in: ui/server/src/requirementProofApi.mjs:125

The three handlers, each (body, root) => Promise<{ status, body }>. runProofs and timeoutMs are test seams.

Parameters#

deps?

The runner and the time a request waits for it.

runProofs?

(root, feature, opts?) => Promise<any> = defaultRunProofs

timeoutMs?

number = PROOF_RUN_TIMEOUT_MS

Returns#

object

The handlers.

run

run: Function

skip

skip: Function

status

status: Function


proofTarget()#

proofTarget(body, root): { applied: boolean; feature: string; genRel: string; names: string[]; ok: true; } | { body: any; status: number; }

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

What the plan the client sent says about the proof of feature: the proof files its test.proof steps name, checked against the project on disk. Pure over (body, root) plus reads of the project's folder listing.

Parameters#

body

The request body.

feature?

unknown

plan?

unknown

root

string

The open project's root.

Returns#

{ applied: boolean; feature: string; genRel: string; names: string[]; ok: true; } | { body: any; status: number; }

The target, or the refusal.


shapeRun()#

shapeRun(result): { complete: boolean; counts: { failed: number; passed: number; total: number; }; durationMs: number; error: { code: any; message: string; }; failures: any[]; state: "pending" | "failed" | "green" | "skipped"; summary: { complete: boolean; counts: { failed: number; passed: number; total: number; }; failures: object[]; options: object[]; state: string; version: string; }; } | { complete: boolean; counts: any; durationMs: any; error: any; failures: any; state: "pending" | "failed" | "green" | "skipped"; summary: { complete: boolean; counts: { failed: number; passed: number; total: number; }; failures: object[]; options: object[]; state: string; version: string; }; }

Defined in: ui/server/src/requirementProofApi.mjs:99

A runProofs result as the answer of the run route: the chain state, the counts, each failed test classified, the fixed summary.

Parameters#

result

any

Returns#

{ complete: boolean; counts: { failed: number; passed: number; total: number; }; durationMs: number; error: { code: any; message: string; }; failures: any[]; state: "pending" | "failed" | "green" | "skipped"; summary: { complete: boolean; counts: { failed: number; passed: number; total: number; }; failures: object[]; options: object[]; state: string; version: string; }; } | { complete: boolean; counts: any; durationMs: any; error: any; failures: any; state: "pending" | "failed" | "green" | "skipped"; summary: { complete: boolean; counts: { failed: number; passed: number; total: number; }; failures: object[]; options: object[]; state: string; version: string; }; }