spinframework / spinframework/spin
Config error ergonomics
Open
Nobody has claimed this yet.
config
- Dominant language
- Rust
- Stars
- 6.5k
- Forks
- 310
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 24
Description
The current spin-config interface declares the following errors:
variant error {
provider(string),
invalid-key(string),
invalid-schema(string),
other(string),
}
Working with this I ran into a couple of issues:
- It's ambiguous what's "invalid" about an
invalid-key. Looking at the code it seems to mean that the key is malformed according to the syntax rules. But many people (well, one person at least) will guess that this means the key wasn't defined. Could we rename this tomalformed-keyor something? Failing that, could we document it in the WIT file? - There's no distinguished error for the key not being found. It looks like this is detected internally as
InvalidPathbut this gets mapped tootherat the interface. It would be great if we could identify this case in the WIT so it can be mapped to (e.g.) aKeyNotFoundException, ornull, orNoneaccording to the local customs of the language. invalid-schemaappears to occur when a slot has is not required but does not have a default value. I may be misunderstanding but this seems like something we should catch at manifest validation time, rather than being a runtime error.otheralso includes the case where a template is syntactically invalid or we need to recurse through too many templates to resolve it. Again, would it be possible to catch this at manifest validation time? If not, would it make sense to map it toinvalid-schema, as both of these are effectively manifest authoring issues rather than run-time errors?
Thanks!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the spin-config WIT error declaration and trace how InvalidPath, invalid-schema, and template failures are mapped to the interface variants. Define the intended distinctions and validation-time behavior with maintainers, then add coverage showing the agreed error cases and their final interface representation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- api, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100