Skip to content

Task 31: Malformed Error Taxonomy TOML Files Can Be Merged Without Validation #344

Description

@grantfox-oss

The core error taxonomy relies on TOML files (e.g., contract.toml, auth.toml) curated by developers and contributors. Because these are plain text files, they are highly susceptible to human error. A contributor might accidentally type a string where an integer is expected, forget a required description field, or accidentally duplicate an error code. If a corrupted TOML file is merged into the grat core repository, it will poison the entire decoding pipeline, causing runtime crashes or mislabeled diagnostics across all IDE and Web platforms relying on the data. Currently, there is no automated defense mechanism preventing malformed data from being introduced.

Issues/what to fix

A rigorous, build time TaxonomyLinter must be engineered in Rust. This linter will act as a strict schema validator. It must utilize the serde framework to strictly deserialize the TOML files against a strongly typed Rust struct (TaxonomySchema). The linter must implement custom validation hooks to enforce strict business logic rules: Every error code must be a unique integer; no two errors can share the same numeric value within a category. Descriptions must exceed a minimum character length to prevent useless entries like "Error occurred". If any rule is violated, the linter must immediately panic with a highly detailed, line specific error message. This linter must be integrated into the #[test] suite so that the Continuous Integration (CI) pipeline instantly fails any Pull Request containing invalid TOML modifications.

Files to create / modify

Create: crates/core/src/taxonomy/linter.rs

Expected result

The Grat repository will be permanently safeguarded against human error and data corruption. Contributors will receive immediate, automated feedback if they format an error entry incorrectly, ensuring the core taxonomy remains mathematically pristine and 100% reliable for downstream consumers.

Contributor telegram group

https://t.me/+sII7WPhll2liMGNk

Metadata

Metadata

Assignees

Labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions