Skip to content
Beskid Platform specification

Beskid

Jump to a Beskid service

Beskid

Jump to a Beskid service

Design model

Spec standingStandard

Owner
Piotr Mikstacki
Submitter
Piotr Mikstacki

The registry model is intentionally centralized:

  • diagnostic_kinds.rs owns code identities and semantic categories.
  • Rule modules reference kinds, not hard-coded code strings.
  • Delivery adapters (CLI/LSP) preserve code identity while formatting messages.

This avoids drift between compiler internals and platform documentation, and it makes diagnostics easier to consume in editors and CI tooling.

Mod, manifest, and mod-host band (E1801–E1899)

Section titled “Mod, manifest, and mod-host band (E1801–E1899)”

The inclusive range E1801–E1899 is owned by compiler-mod manifest validation and mod-host failures. Ordinary semantic rules must not allocate inside this band. Register each allocated code in compiler/crates/beskid_analysis/src/analysis/diagnostic_kinds.rs and extend this table in the same change.

Code rangeOwnerIntended failures (examples)
E1801–E1810beskid_analysis::projects manifest parseUnknown mod key, invalid maxGeneratorRounds, malformed capabilities list, Meta→Mod migration (see table below).
E1811–E1820Workspace / graph resolutionInvalid Mod dependency topology, unresolved mod package, incompatible host/mod graph constraints.
E1821–E1835Mod host / capabilitiesDenied capability, exceeded maxGeneratorRounds, sandbox violation, AOT artifact load/bootstrap failure (see AOT artifact contract).
E1836–E1850Typed merge / rewriteConflicting generator edits, illegal typed contribution, invalid typed rewrite, merge rollback.
E1851–E1870Contract discovery / executionMissing required contracts, invalid contract signatures, collector scope violations, analyzer/rewriter registration errors.
E1871–E1899ReservedBuffer for staged rollout; allocate in order and extend this table when used.

Meta→Mod migration and manifest parse (E1801–E1810, normative)

Section titled “Meta→Mod migration and manifest parse (E1801–E1810, normative)”
CodeWhen emitted
E1801Unknown key inside project.mod.
E1802maxGeneratorRounds missing, non-positive, or not an integer.
E1803capabilities entry not in the closed vocabulary.
E1804artifactPolicy value not in reuse / rebuild / clean_rebuild.
E1805type: Mod project declares a target block (forbidden).
E1806Compiler-mod contract item declared outside a type: Mod project.
E1807Deprecated type: Meta or nested meta { } manifest section (use Mod / mod { }).
E1808Removed attachTo key on mod/manifest (use Collector scope).
E1809Removed entryModules key (use contract discovery).
E1810Legacy max_meta_rounds or other removed mod keys.

Mod artifact load (E1821–E1835, normative)

Section titled “Mod artifact load (E1821–E1835, normative)”

Individual codes are defined in Mod host bridge / AOT artifact contract (E1821 missing artifact through E1835 bootstrap catch-all). Hosts must prefer the most specific code before E1835.

CodeWhen emitted
E1836Two generators target the same declaration identity in one generation round.
E1837Typed contribution fails well-formedness / parser re-check after merge.
E1838Rewriter returned an illegal target node kind.
E1839Merge rolled back — syntax tree unchanged after failure.
E1840–E1850Reserved for additional merge/rewrite failures.

Contract discovery (E1851–E1870, normative)

Section titled “Contract discovery (E1851–E1870, normative)”
CodeWhen emitted
E1851Module-level meta item or other forbidden grammar in a Mod/host compilation unit.
E1852Required Collector contract missing from artifact registrations.
E1853contractId in descriptor not recognized by host.
E1854Public type does not implement declared contractId.
E1855entrySymbol missing from native export table.
E1856Collector scope references unresolved compilation member.
E1857Analyzer registration conflicts with capability set.
E1858Rewriter generic instantiation does not match source node kind.
E1859–E1870Reserved for contract execution failures.

The inclusive range E1901–E1999 is owned by macro.expand and macro definition validation. Ordinary semantic rules must not allocate inside this band.

CodeWhen emitted
E1901name! invocation with no resolving macro binding in scope.
E1902Argument count does not match macro parameter list.
E1903Actual argument shape does not match declared fragment kind.
E1904$param reference in a non-macro body or unknown parameter name.
E1905maxMacroExpansionDepth exceeded (default 32).
E1906Expanded tree fails well-formedness / structural validation.
E1907Ambiguous macro name (multiple macro bindings in scope).
E1908macro definition with duplicate parameter names.
E1909Invalid or unknown fragment kind keyword in macro parameter list.
E1910–E1999Reserved for macro hygiene and item-splice failures.

See Language macros.

Documentation comment diagnostics (W1610–W1619, W1620–W1625)

Section titled “Documentation comment diagnostics (W1610–W1619, W1620–W1625)”

The inclusive ranges W1610–W1619 and W1620–W1625 are reserved for leading documentation body validation (triple-slash mini-language: @ref, @arg, @returns, @variant, @par, and unknown directives). These warnings are produced from the document-analysis snapshot after name resolution succeeds; they must not use ad hoc string codes outside SemanticIssueKind. Hard errors for documentation are not allocated in v1; if a future policy introduces blocking documentation failures, allocate E1610–E1629 in this document and in diagnostic_kinds.rs before use.

CodeMeaning (summary)
W1610@arg names a parameter that does not exist on the documented callable.
W1611Duplicate @arg(name) for the same item.
W1612@arg / @returns on an item that is not a supported callable.
W1613@returns on a unit return (redundant).
W1614Unknown documentation directive (@foo not in the supported registry).
W1615Unresolved @ref(...) path.
W1616–W1619Reserved for documentation-quality rules.
W1620@variant(...) used outside an enum declaration’s leading documentation.
W1621@variant(name) does not match any enum variant.
W1622Duplicate @variant(name) in the same block.
W1623@par(...) where the declaration has no generic type parameters.
W1624@par(name) does not match a generic type parameter on the item.
W1625Duplicate @par(name) in the same block.

Codes must be stable across patch releases once shipped; breaking message text is allowed only with a migration note in Rules and diagnostics catalog.

User FFI diagnostics (E1520–E1539, v0.3)

Section titled “User FFI diagnostics (E1520–E1539, v0.3)”

The inclusive range E1520–E1539 is owned by FFI and extern and Export and callbacks validation. These codes are normative in platform-spec v0.3; the reference compiler may still emit legacy T0901–T0904 until migration completes—tests must accept either code during the transition, then only E152x once diagnostic_kinds.rs maps TypeError::Extern* to SemanticIssueKind.

CodeWhen emittedReference compiler (transition)
E1520Extern Abi is not "C"T0901
E1521Extern contract missing non-empty LibraryT0902
E1522Disallowed parameter type on extern methodT0903
E1523Disallowed return type on extern methodT0904
E1524Export on non-pub function or disallowed item(planned)
E1525Export signature uses disallowed FFI type(planned)
E1526Unknown Symbol override or duplicate export symbol(planned)
E1527Transfer / interop view misuse at boundary(planned)
E1528CLayout violation (v0.3.1)(planned)
E1529Callback type is not a permitted function-pointer shape(planned)
E1530–E1539ReservedBuffer for link manifest and import CLI failures

Attribute placement errors remain in the E1508–E1510 band (E1510 = Extern on non-contract).