Relationships
#3133 Model types: decide whether names like @/@x/y or a+b/c should be legal (type grammar)
Opened by skunk-ape · 10/7/2026
Summary
Model types have no grammar. ModelType.create (src/domain/models/model_type.ts) rejects only input that is blank after normalization: lowercase, :: / . / whitespace folded to /, repeated slashes collapsed, leading and trailing / trimmed. Anything else is accepted, including @/@exp/probe, @@x/y and names containing + or other punctuation.
Should these be legal?
What exists today
- Published extension names must match
^@[a-z0-9_-]+/[a-z0-9_-]+(/[a-z0-9_-]+)*$(extension_manifest.ts), and every model type in an extension must start with its@collective/prefix. - Local extension model types only need at least two segments (
validateUserCollectiveinmodel_kind_adapter.ts); characters are not checked. - All 9 built-in model types match
^@?[a-z0-9][a-z0-9_-]*(/[a-z0-9][a-z0-9_-]*)+$.
Why it matters
Several spellings can name, or almost name, the same type. Every comparison that makes a security or identity decision has to canonicalize defensively. swamp-club#3129 hit this: a leading-whitespace or doubled-@ spelling can differ from the stored type after a naive strip. A grammar would make one spelling canonical and reject the rest at the boundary.
Open questions
- Is any punctuation beyond
-and_intended in model type names? Is@intended anywhere but the first character? - Enforce in
ModelType.create(affects stored definitions and local extensions across the CLI), or only for new definitions and extensions, with a warning for existing ones? - Migration: how to find and handle existing local types and stored definitions that would no longer parse.
Until this is decided, #3129 canonicalizes rather than rejects, so no existing local type is blocked.
Open
No activity in this phase yet.
Sign in to post a ripple.