Skip to content

docs: move the OpenAPI lowering rules out of ir-design into a lowering spec beside the compiler, one rule per entry #963

Closed

Description

@OmarAlJarrah

Problem

docs/ir-design.md is the normative, format-agnostic description of the IR, and much of it is the OpenAPI compiler's lowering rules. At c387e25c, read section by section:

  • 56% of its 208,670 characters is format-agnostic IR design;
  • 33.9% is OpenAPI lowering;
  • 5.9% covers the other six formats together.

Most of the OpenAPI share is one line: the §14 OpenAPI row, line 2608, is 18,902 bytes and holds about 71 rules. It was 2,345 bytes on 2026-07-20.

The cost shows up in review and in reading:

  • Edits. ir-design changed in 44 of the last 150 PRs. Every edit to that row shows the whole row as changed.
  • Restatement. Of ten rules sampled from the row, five are stated in ir-design nowhere else, and each is stated in a median of 7 places across docs, code and tests.
  • Reading. The documents a newcomer is asked to read before a first change come to 74,854 words, about 5.4 hours at 230 words a minute. ir-design alone is about 2.2 hours, and a third of it is OpenAPI rules a contributor to another layer does not need.

The other formats' rows are 586 to 2,060 bytes each.

Direction

A proposal:

  • A lowering spec for the OpenAPI compiler (for example docs/compilers/openapi.md), with one heading or list item per rule. Each rule names its conformance case and diagnostic code where it has one.
  • ir-design keeps the format-agnostic shapes and a one-line summary per format, linking to that spec.
  • The reading list in the root guidance names the lowering spec for compiler work only.

The first step is mechanical: split the row into a list without changing a word, so the move itself carries no content change.

Done when ir-design has no line over a few hundred characters and every OpenAPI rule has a single home.

Out of scope

Rewording any rule.

Related: #64

Priority: P4, rule 1 (a docs task that changes no behaviour). awk 'NR==2608{print length($0)}' docs/ir-design.md → 18902 (morphic @c387e25c).

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority:P4Refactors, tests, CI, hostile-input hardening, cosmetic diagnostics, other formatstype:docsDocumentation only

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions