Skip to content

Read guarantees, facts and spellings from the specification's catalog - #236

Merged
Kinflou merged 2 commits into
masterfrom
catalog/read-catalog
Nov 9, 2026
Merged

Kinflou merged 2 commits into
masterfrom
catalog/read-catalog

Conversation

@Kinflou

@Kinflou Kinflou commented Nov 9, 2026

Copy link
Copy Markdown
Member

Stage 2 of the #219 rollout: core reads the catalog instead of keeping its own copies.

Depends on ComlineProject/specification#2 (the comline-catalog crate). It is pinned to that PR's head for now. Once that merges, I'll repin to the merge commit before merging this.

What now comes from the catalog

  • Guarantee:
    • name() maps each variant to the catalog's id constant. describe() and the new description() and entry() read the catalog.
    • The enum stays hand-written. It is frozen into the IR, and each guarantee needs core's own logic for when it's given up.
    • guarantees_are_the_catalogs requires exactly the catalog's set, in its order, with each variant's frozen spelling equal to its catalog name in CamelCase. A guarantee added to the spec therefore fails core's tests until core implements it.
  • Facts:
    • ProfileKind::facts() now returns the catalog's facts (an iterator of comline_catalog::Fact) instead of a hand-kept table. Nothing outside core called it.
    • Profile::parse, grammar and establishes follow. establishes reads each fact's establishes relation, and skips one core doesn't know, which fails closed.
    • The fact names in diff, compat, unverified and freezing are now the catalog's fact::* constants.
    • the_values_core_acts_on_are_the_catalogs checks that every value that logic compares with is allowed by the catalog.
    • a_profile_is_held_to_the_catalogs_facts covers parse's errors.
  • Spellings: official::spellings builds each name's aliases and canonical (frozen) spelling from the catalog, replacing SPELLINGS. every_name_and_alias_resolves_as_before still passes unchanged.
  • Encoding constants: FORMAT_*, FRAMING_DATAGRAM2/3, DEFAULT_HANDSHAKE, IMPLICIT_HANDSHAKE and HANDSHAKE_NONE are the catalog's constants. FRAMING_DATAGRAM and FRAMING_JSONRPC stay literal, because they're the frozen spellings; the_frozen_spellings_are_the_catalogs checks them.
  • Official declarations: the_declarations_are_the_catalogs checks that the stdlib's config.idp declares exactly the catalog's encodings that have a profile, in order and with matching kinds, with has_vectors where the catalog names a feature, and that none is the one encoding not declared.

Frozen IR is unchanged: the same names and the same serde form, and the_snapshot_is_what_freezes passes.

Not in this PR: refusing unknown annotation names, settings keys and diagnostic codes (#171, #178). The catalog doesn't hold those yet.

Tested locally:

  • cargo test --workspace: 633 integration and 326 lib tests pass.
  • The IR-only build (--no-default-features) builds.
  • No new warnings.

Kinflou added 2 commits November 9, 2026 22:35
core depends on comline-catalog, the specification's catalog as a no_std
Rust crate, and reads from it what it kept its own copies of:

- Guarantee's names, titles and new descriptions. The enum stays
  hand-written (it's frozen into the IR, and each guarantee needs core's
  logic for when it's given up); a test holds it to the catalog exactly,
  in order and by its frozen spelling.
- ProfileKind::facts: each kind's facts and their values. Profile::parse,
  grammar and establishes follow, and the fact names core's logic acts on
  (diff, compat, unverified, freezing) are the catalog's constants. A test
  checks every value that logic compares with is one the catalog allows.
- The official encodings' aliases and frozen spellings, in place of
  SPELLINGS, and the encoding name constants. A test holds the official
  package's declarations to the catalog's encodings.
@Kinflou
Kinflou merged commit ead0d7b into master Nov 9, 2026
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant