Freeze typr-def.toml manifest format (RFC 0031, J2) - #33
Merged
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
rfcs/0031-external-type-definitions.md(tracked in Implement RFC 0031: External type definitions (J2) #32): fixes thetypr-def.tomlmanifest's shape as a real type (crates/typr-cli/src/type_definition.rs) instead of a TOML example in prose, and enforces theformat_versiongate the RFC requires.parse_manifest()checksformat_versionagainst a rawtoml::Valuebefore 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.since/untiltoFunctionMeta(typr-core'sstdlib_meta.rs) andStdlibMeta(spg/model.rs), parsed identically toret/coercionvia the existing#!annotation parser — the per-entry override described in the RFC's reference section.FunctionMeta::into_stdlib_metastays 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(withRUST_MIN_STACK=8388608, per this repo's known recursive-type-checking stack need) — all green, including 7 newtype_definitiontests and 2 newstdlib_metatestscargo build --workspace— no new warningstypr syntax --check— unaffected (new#!keys are not lexemes)🤖 Generated with Claude Code
https://claude.ai/code/session_01ETPqhgWqDMt7UaUQXdxJmN