IF Commons GitHub

ci/parsers

Written to: 1 requirement: 1 proved, 0 partly, 0 failing, 0 with no test recorded. 0002-libraries-ci-findings FR-003

The parsers that read what a tool printed into findings (commons 0038-build-policy FR-013): one function for each tool of the closed table, pure over the text the tool wrote, so that each is tested on real output kept in the test's fixtures. A parser reads what is there and makes nothing up; where a tool failed and printed nothing a parser can read, the wrapper makes the finding no-output of that tool, and a parser says nothing.

The key of a finding is the text that tells it from another of the same code in the same file and is never a line or a time, so that a finding that moves is the same finding (findingId). The tools' own formats: tsc (file(line,col): error TSnnnn: message), bun test ((fail) name [time], under a header line naming the file), the linter (<error|warning file= line= column= rule=> and the message), the formatter (a path for each file it would change), repoctl check ([x] where: message [E-CODE]), the checks of Mizan and Kanon (file:line: message, file:line: code: message) and the generator's check (file is not what the model makes).

import { parseOutput } from "./parsers.ts";
parseOutput("tsc", "a.ts(1,7): error TS2322: no", { module: "core", run: "1", commit: "c", step: "s", at: "2026-11-22T00:00:00Z" }).length; // 1

Source: commons/libraries/src/ci/parsers.ts

2 of 3 exports are imported by a test of the run. A test that imports an export may not call it or check what it returns.

ParseContexttype
type ParseContext = { readonly module: string; readonly run: string; readonly commit: string; readonly step: string; readonly at: string };

What a parser needs to know of the run and the step it reads.

Imported by 8 tests of the run (8 passed, 0 failed): the library's results

parseOutputfunction
function parseOutput(tool: "bun-test" | "checks" | "exit-status" | "format" | "generated-files" | "install" | "kanon-check" | "lint" | "mizan-check" | "policy" | "repoctl-check" | "tsc" | "verify", output: string, ctx: ParseContext): readonly Finding[]

The findings a tool's output holds, with their ids and their evidence (the SHA-256 of the output), in the order the tool printed them and without a finding twice.

Imported by 8 tests of the run (8 passed, 0 failed): the library's results

outcomeFindingfunctionno test imports it
function outcomeFinding(tool: "bun-test" | "checks" | "exit-status" | "format" | "generated-files" | "install" | "kanon-check" | "lint" | "mizan-check" | "policy" | "repoctl-check" | "tsc" | "verify", code: "no-output" | "timeout" | "tool-error", message: string, ctx: ParseContext, output: string): Finding

The finding of a step that did not end as a tool does: it could not be started, it exited non-zero with nothing a parser reads, or the time limit stopped it (tool-error, no-output, timeout).

Titles, headings, exports, tables, columns and requirements. Esc closes.