bottlerocket-os / bottlerocket-os/bottlerocket-settings-sdk
No error messages when accessing undefined variables in config templating
- Dominant language
- Rust
- Stars
- 5
- Forks
- 36
- Avg merge
- 4d 12h
- Merged PRs (30d)
- 2
Description
So, poking around in your settings system I noticed that the templates, both on the input from the user-data.toml and to the output in the templates, you use kebab-case, but in rust you use snake_case (few programming languages allow you to use kebab-case, I guess).
This took me an embarrassingly long time to figure out (I just assumed that since it was decoded into rust structs with snake_case, that the templating would use snake_case also).
Ultimately, what was not ergonomic in this was that I got no real error when trying to access template variables that does not exist and is not set. You do take great care to validate it in Rust, etc - perhaps there is a way to make sure that when accessing variables in the templating stage, that you check that the variable exists? Would have saved me a lot of time!
Contributor guide
Research direction
Start by tracing the settings system's template-rendering path and how user-data.toml values become Rust structs and template variables. Confirm how kebab-case names are resolved, then make accesses to undefined variables report an error; done means missing template variables are no longer silently accepted.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- backend-api-design
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100