oxidecomputer / oxidecomputer/omicron
Store instance hostnames as validated strings in the DB
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 572
- Forks
- 97
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 96
Description
As part of #4938, we converted the InstanceCreate type to use a validated hostname. This ensures that all new instances have valid hostnames. However, to handle any existing instances which might have had invalid hostnames, we kept the hostname in the DB model type as a generic string:
It's also a string in the publicly returned instance view type, as well as in the sled-agent's API. This issue tracks converting all those code paths to use a validated hostname newtype, so that we only ever work with valid hostnames for this field. This will require a small SQL wrapper type like we have for the various unsigned integers, that impls {To,From}Sql.
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 nexus/db-model/src/instance.rs around the referenced hostname field, then trace the publicly returned instance view and the sled-agent API types. Compare the existing SQL wrapper types for unsigned integers and their ToSql/FromSql implementations. Done means the database model, returned view, and sled-agent paths all use the validated hostname newtype while existing invalid values remain handled.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust, sql
- Domain
- api, backend, databases
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100