IF Commons GitHub

query/mod

Written to: 3 requirements: 3 proved, 0 partly, 0 failing, 0 with no test recorded. 0002-quality-query FR-001, 0002-quality-query FR-002, 0002-quality-query FR-003

Questions of the runs kept as evidence in SQL (commons quality 0002-quality-query): the runs and the cases of the records, made into relations, and a read-only SQL answered over them with the SQL language library (its guard judges that the text is one read and binds it to the catalog, its engine answers). Pure: it is given the records it reads, so that the flaky test, the slowest suite and the requirement with no passing case are each one line of SQL.

import { queryRuns } from "@intellectual-frontiers/quality/query";
// queryRuns(runs, "SELECT name, count(*) AS n FROM cases WHERE outcome = 'failed' GROUP BY name ORDER BY n DESC LIMIT 5");

Source: commons/quality/src/query/mod.ts

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

KeptRuntype
type KeptRun = { readonly record: QualityRecord; readonly day: string; readonly grade: string };

A run as it is kept: its record, the day of its file and the grade the branch gives it.

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

QueryOptionstypeno test imports it
type QueryOptions = { readonly limit?: number; readonly params?: readonly Value[] };

What may be given to a question.

Answertypeno test imports it
type Answer = { readonly columns: readonly string[]; readonly rows: readonly (readonly Value[])[]; readonly truncated: boolean };

What a question gives.

qualityCatalogfunction
function qualityCatalog(): Catalog

The catalog of the relations.

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

qualityRelationsfunction
function qualityRelations(runs: readonly KeptRun[]): Readonly<Record<string, Table>>

The relations of the runs: a case lasts from its start to its end (nanoseconds in the record), in milliseconds.

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

queryRunsfunction
function queryRuns(runs: readonly KeptRun[], sql: string, options?: QueryOptions): Result<Answer, string>

The answer to one read-only question over the runs, or why it is refused (with its place) or cannot be answered.

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

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