Skip to content

Knowledge checks ​

The checker reports every failing check of a file. A file whose frontmatter does not parse is not checked further, and does not stop the checks of the other files. The checker fails on:

  • missing or malformed frontmatter, or a missing type (OKF v0.3 skips such files with a warning; XYZ fails, since every file here is meant as a concept)
  • a root index without okf_version: "0.3", and frontmatter in other indexes or logs
  • log dates which are invalid or not newest first
  • missing local link and path field targets (resource, sources[].resource, superseded_by, computation, executor.resource, attester.resource, a bundle license path), and paths escaping the repository
  • path-like path field values without a ./, ../ or / prefix
  • malformed x-xyz-keys entries, a workspace key owned by two concepts, a requires or required key which no concept owns, a required rule naming a key which is not a sibling, and a formats value which is not a key of the MAPP format registry (apps/mapp/lib/layer/format/_format.mjs)
  • an x-xyz-variables value which is not a list of NAME or PREFIX_* strings
  • a json code block under Examples which does not parse, or an example which fails the strict schema: a value of the wrong type, outside its enum, pattern or range, a missing required key, or a key no concept owns
  • a workspace schema which is out of date with the concepts. The schema checks run even when other checks fail.
  • malformed generated or verified frontmatter, an agent actor in verified, and status: stable without a human: verification at or after generated.at; see the actor convention
  • environment variables read by name in the XYZ API (apps/xyz/mod, router.js, apps/saml) which no concept lists in x-xyz-variables. Only xyzEnv.NAME, process.env.NAME and a quoted ['NAME'] count; computed keys and destructuring are not found. Platform variables such as VERCEL_* and NODE_ENV are ignored.

It warns on:

  • missing concept or bundle titles and descriptions, and malformed optional metadata
  • stale_after values which are not an RFC 3339 date or date-time with offset, and expired stale_after dates
  • a directory without an index, and a concept or subdirectory its index omits
  • a concept over 150 lines, a Workspace Key concept without a JSON example, and a Feature concept missing one of its headings
  • keys used in the repository test workspaces (apps/mapp/tests/workspaces, apps/ui/tests/workspaces, packages/testhost/workspaces, public/workspace.json) which no concept owns, and values of the wrong type in them. Template contents are not checked.

Unknown types and metadata are accepted. External URLs, heading anchors and raw HTML links are not checked.

pnpm knowledge:changed --base <ref> compares a branch with its merge base: it fails when a concept's resource changed but the concept did not, and warns when a module in its sources changed. A directory resource covers the files inside it. Deleting a resource counts as a change. It also compares the concepts at the merge base with those on the branch: when a concept or its resource is deleted, a module which it described and which still exists must be described by another concept, or the check fails. A changed module which a concept cited and no concept cites any more warns. A concept whose frontmatter does not parse fails on the branch and warns at the merge base, since the modules it links cannot be compared. The knowledge-freshness.yml workflow runs it on pull requests which do not target main, with --warn-only when the pull request has the knowledge-unaffected label, and runs again when the label is added or removed. The label is for changes which leave every statement of the concept true, or modules which no longer need a concept; review-pr checks that claim.

pnpm knowledge:examples runs every example in the testhost with the devdb: each example must load as a locale, its wkt and geojson layers must return rows, location_get must return the first row of each layer with infoj, with a column for each infoj field, each dataview query must return a nonempty result, the gazetteer must find a match, and each filter.default must return fewer rows than the same layer without it. A check which does not apply to an example, eg. a gazetteer search without a gazetteer, is reported as skipped. CI runs it in the knowledge workflow, followed by pnpm knowledge:site:build, which fails on dead links in the portal.

The examples are API smoke tests. They run as an anonymous user, do not query mvt, cluster or tile layers, render nothing, and do not test roles, editing or dataview plugins. The schemas check a workspace before template composition, and formats and requires are not enforced.

The examples are combined into one workspace, so the combiner composes the locale defaults of an example into each of its named locales as XYZ does: the defaults precede the template of a named locale, which precedes its own properties. That template must be defined in the example. The layers of the unfiltered twin set filter.default to null, which precedes a default filter inherited from locale.layer or a layer template. An entry of a layer templates array precedes the layer itself, so the combiner fails when a layer inherits a default filter from one. The checker validates the combined workspace, twins included, against the strict schema. Source paths existing on disk does not mean their behavior still matches the prose. Review both when code changes. See migration inventory and authoring.

XYZ v5.1.0. Generated from knowledge/ at dd7a6fa27736502733499c1bf485f15659b10338. Concepts marked draft are not reviewed.