Skip to the content.

0015: Extension keys in coverage.yaml (x- keys that lean-pkg ignores)

Status: accepted. Author: drafted by the AI operations agent at Le Chen’s request, from a field report. Created: 2026-11-11. Revised: 2026-11-11, after one field review. Decided: 2026-11-11, accepted by Le Chen (maintainer of record), as written, after one field review. Implemented in: (release).

Summary

Let coverage/1 accept keys whose name starts with x-, at the top level and on rows (paper and library). lean-pkg checks only their shape: the name, the value’s type and size, and how many there are. It never reads, renders or judges them. Other tools that generate documents from coverage.yaml, such as a book appendix, a slide deck or a site of their own, can then keep their per-row data on the row it belongs to, not in a sidecar keyed by row label. Every other unknown key is refused as today, so a misspelled real key such as conclusion_scop is still caught. This is for package authors and for tools that read coverage files.

Motivation

A field report from a paper companion with 40 coverage rows. Its book appendix generator needed a LaTeX form of each row’s conclusion_scope, which is one plain-text line (proposal 0010). The author added it to the row (illustrative values):

rows:
  - paper: {number: "Theorem 2", title: "A moment bound"}
    class: same-assumptions
    claims: [demo/moment-bound]
    conclusion: weaker
    conclusion_scope: the bound holds for t <= 1 only
    conclusion_scope_tex: 'the bound holds for $t \le 1$ only'

coverage check refused the file: rows[3]: unknown key(s) conclusion_scope_tex (allowed: paper, class, claims, inputs, note, conclusion, conclusion_scope, witness). So the TeX went into a sidecar, docs/coverage-scope-tex.yaml, keyed by row label. Each entry repeats the plain-text sentence so that a script can notice when the two files drift apart. The data is about one row, but it lives in another file, and two files have to be kept in step by hand.

coverage/1 refuses unknown keys on purpose. A misspelled key would otherwise be silently ignored, and the page would say something other than what the author meant. That reason stands. What is missing is a declared place for data that lean-pkg does not own.

Design

Where an extension key may appear

Nowhere else: not in manuscript, rows[].paper, rows[].inputs[], compute, nothing_excluded or lean_pkg_version. An x- key there is refused: rows[3].paper: extension keys (x-...) are allowed only at the top level and on rows. A later proposal can widen this if a real need appears.

Name

^x-[a-z0-9][a-z0-9_-]*$, at most 64 characters. Examples: x-appendix-scope-tex, x-conclusion_scope_tex. Prefixing the tool’s name (x-<tool>-<field>) is recommended so that two tools do not collide; it is not enforced. lean-pkg itself never defines a key that starts with x-, so an extension key can never collide with a future lean-pkg key.

Value

A string, a number, a boolean or null, or a list or a mapping (with string keys) of these, nested at most two levels. The value’s JSON serialisation is at most 4000 bytes. A string may span several lines. There are at most 16 extension keys on one object. A value outside these bounds is refused, and the error names the key and the bound.

What lean-pkg does with them

Documentation

page.md gains an Extension keys section that states the rules above, and says in one sentence that lean-pkg checks nothing inside an extension key and never shows it, so a reader must not take its content as checked. formats.md lists the rule beside the other coverage keys.

The field report’s case

    conclusion_scope: the bound holds for t <= 1 only
    x-appendix-scope-tex: 'the bound holds for $t \le 1$ only'

The sidecar and its repeated sentence can go: the plain and the TeX forms now sit side by side on the same row, where a diff shows them together.

Compatibility and migration

Trust model

Nothing that a receipt proves, or that gate, promote, publish or index check accept, changes. lean-pkg never reads an extension value, so a value cannot make a check pass or a page say more.

What could mislead:

The tests that pin this:

Alternatives

Open questions

The field reviewer, the author of the reporting package (59 rows; its sidecar carries TeX scope sentences for 7 rows, the longest 390 bytes), answered the draft’s four questions:

  1. Scope. Top level plus rows is enough. Per-result rendering text belongs to the row, so rows[].paper needs none. Settled as designed.
  2. Prefix or mapping. The flat x- prefix: it is greppable, it follows the usual vendor-key convention, and x-appendix-scope-tex reads naturally next to conclusion_scope. Settled as designed.
  3. Bounds. 4000 bytes per value, 16 keys per object and two levels of nesting fit comfortably. Settled as designed.
  4. claims/1. Useful later (a book label, a display name), not needed now, and the same rules would do. Left for a later proposal.

The review also asked for three additions, all folded into the design above:

Nothing is open.

AI assistance

Drafted by Claude Code (the AI operations agent) at Le Chen’s request, from the field report quoted above and the current coverage/1 validator (coverage.py, _keys). The maintainer reviews and decides.