status

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 3, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package status computes the ladders of a node (spec 04.8): H for the human proof, L for Lean, I for each language, V for the visualization and W for the writing.

Nobody writes a level by hand. Each level comes with the reasons that it is not higher, so that a page can say what it needs next.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Hash

func Hash(path string) (string, error)

Hash is the hash that a review binds to: sha256 of the file, in hex.

func Lead

func Lead(body string) string

Lead returns the text before the first heading.

func LoadResults

func LoadResults(dir string) (map[string]map[string]Test, error)

LoadResults reads every build/results/*.json under dir. A missing dir gives no results.

func Section

func Section(body, h string) string

Section returns the text of the level 2 section with the heading h, without the heading.

func Sections

func Sections(body string) []string

Sections returns the level 2 headings of the body, in order.

Types

type Env

type Env struct {
	Corpus  *node.Corpus
	Results map[string]map[string]Test // slug, then lang
	// VizChecked holds the scenes that passed `algo viz check` in this build, by slug, with the failures of the others.
	VizChecked map[string][]string
}

Env is what the ladders read besides the node.

type Results

type Results struct {
	Lang    string `json:"lang"`
	Version string `json:"version,omitempty"`
	Tests   []Test `json:"tests"`
}

Results is the content of one file build/results/<lang>.json.

type Review

type Review struct {
	Part     string `yaml:"part"`
	Hash     string `yaml:"hash"`
	Reviewer string `yaml:"reviewer"`
	Date     string `yaml:"date"`
	Verdict  string `yaml:"verdict"`
}

Review is a review record, reviews/<tag>/<part>.yaml (spec 13.2).

type Rung

type Rung struct {
	Level int      `json:"level"`
	Max   int      `json:"max"`
	Label string   `json:"label"` // for example "H2"
	Name  string   `json:"name"`  // for example "full proof"
	Next  []string `json:"next,omitempty"`
}

Rung is the level of one ladder, with the reasons that it is not higher.

func Writing

func Writing(n *node.Node, env Env) Rung

Writing computes the W ladder from the sections, their content and the links (spec 06.8).

type Status

type Status struct {
	Slug  string          `json:"slug"`
	H     Rung            `json:"h"`
	L     Rung            `json:"l"`
	I     map[string]Rung `json:"i"`
	V     Rung            `json:"v"`
	W     Rung            `json:"w"`
	Tests map[string]Test `json:"tests,omitempty"`
}

Status is the set of ladders of one node.

func Of

func Of(n *node.Node, env Env) Status

Of computes the ladders of n.

type Test

type Test struct {
	Slug   string `json:"slug"`
	Lang   string `json:"lang"`
	Pass   bool   `json:"pass"`
	Output string `json:"output,omitempty"`
	Ms     int64  `json:"ms"`
}

Test is the result of the native tests of one implementation, as `algo test` writes it.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL