Skip to content

Freeze typr-def.toml manifest format (RFC 0031, J2) - #33

Merged
fabriceHategekimana merged 1 commit into
developfrom
implement-rfc-0031-manifest-format
Sep 12, 2026
Merged

fabriceHategekimana merged 1 commit into
developfrom
implement-rfc-0031-manifest-format

Conversation

@fabriceHategekimana

Copy link
Copy Markdown
Collaborator

Summary

  • First checklist item of rfcs/0031-external-type-definitions.md (tracked in Implement RFC 0031: External type definitions (J2) #32): fixes the typr-def.toml manifest's shape as a real type (crates/typr-cli/src/type_definition.rs) instead of a TOML example in prose, and enforces the format_version gate the RFC requires.
  • parse_manifest() checks format_version against a raw toml::Value before attempting the typed parse, so an unsupported version is reported as exactly that, not as a confusing missing-field error from a future schema this build doesn't know.
  • Adds since/until to FunctionMeta (typr-core's stdlib_meta.rs) and StdlibMeta (spg/model.rs), parsed identically to ret/coercion via the existing #! annotation parser — the per-entry override described in the RFC's reference section. FunctionMeta::into_stdlib_meta stays a lossless mapping.

Nothing here fetches a repository, resolves typr.lock, or loads a definition into the type checker yet — those remain open in #32.

Test plan

  • cargo test --workspace (with RUST_MIN_STACK=8388608, per this repo's known recursive-type-checking stack need) — all green, including 7 new type_definition tests and 2 new stdlib_meta tests
  • cargo build --workspace — no new warnings
  • typr syntax --check — unaffected (new #! keys are not lexemes)

🤖 Generated with Claude Code

https://claude.ai/code/session_01ETPqhgWqDMt7UaUQXdxJmN

First checklist item of rfcs/0031-external-type-definitions.md (J2,
#32): fix the manifest's shape as a real type instead of
a TOML example in prose, and enforce the format_version gate the RFC
requires ("the compiler reads old manifests it recognizes or refuses
the ones it doesn't — it never silently misparses one").

- crates/typr-cli/src/type_definition.rs: DefinitionManifest and its
  sections (package/definition/provider/capabilities), parse_manifest()
  checking format_version against a raw toml::Value before attempting
  the typed parse, so an unsupported version is reported as exactly
  that rather than as a confusing missing-field error.
- since/until added to FunctionMeta (typr-core's stdlib_meta.rs) and
  StdlibMeta (spg/model.rs), parsed identically to `ret`/`coercion` via
  the existing #! annotation parser — the per-entry override the RFC's
  reference section describes, kept a lossless mapping between the two
  structs.

Nothing here fetches a repository, resolves typr.lock, or loads a
definition into the type checker yet — those remain in #32.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ETPqhgWqDMt7UaUQXdxJmN
@fabriceHategekimana
fabriceHategekimana merged commit de421a0 into develop Sep 12, 2026
4 of 5 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