Skip to content

Conversation

@sunshowers
Copy link
Contributor

No description provided.

Created using spr 1.3.6-beta.1
@sunshowers sunshowers changed the title [gateway-types] reorganize per RFD 619 [RFC] [gateway-types] reorganize per RFD 619 Dec 7, 2025
Created using spr 1.3.6-beta.1
Created using spr 1.3.6-beta.1
path: Path<PathSp>,
) -> Result<HttpResponseOk<HostStartupOptions>, HttpError>;
path: Path<v1::params::PathSp>,
) -> Result<HttpResponseOk<v1::host::HostStartupOptions>, HttpError>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm surprised to see explicit versions in these types. I thought:

  • The *-versions crate would have a pub use latest::*
  • All the "current" endpoints would reference the top-level (latest) types, and only endpoints from older versions would reference explicitly-versioned types

Copy link
Contributor Author

@sunshowers sunshowers Dec 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've discussed and addressed this -- latest versions now use floating identifiers.

Created using spr 1.3.6-beta.1
Copy link
Contributor

@jgallagher jgallagher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I like how this is all shaping up quite a lot. Just some small style notes/preferences.

use serde::{Deserialize, Serialize};

use crate::component::SpIdentifier;
use crate::v1::component::SpIdentifier;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems a little weird that from inside what looks like the initial module, I have to refer to other submodules of myself as v1. Not a huge deal, but a downside of our #[path = "..."] plan.

Would this be less confusing as use super::component::SpIdentifier?

//! Types are organized based on the rules outlined in [RFD
//! 619](https://rfd.shared.oxide.computer/rfd/0619).
pub mod latest;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be worth adding comments in each of the *-versions crates' lib.rs giving a brief summary of guidance, similar to

/// List of all past database schema versions, in *reverse* order
///
/// If you want to change the Omicron database schema, you must update this.
static KNOWN_VERSIONS: LazyLock<Vec<KnownVersion>> = LazyLock::new(|| {
vec![
// +- The next version goes here! Duplicate this line, uncomment
// | the *second* copy, then update that copy for your version,
// | leaving the first copy as an example for the next person.
// v
// KnownVersion::new(next_int, "unique-dirname-with-the-sql-files"),
KnownVersion::new(212, "local-storage-disk-type"),

Kinda sucks that this would be copy-pasted a bunch of times since we have a bunch of crates, but I think that might be worth it? Any given change is likely to only touch a small number of them, and it'd be nice to have the guidance right there in line.

path: Path<PathSp>,
) -> Result<HttpResponseOk<SpState>, HttpError> {
path: Path<latest::component::PathSp>,
) -> Result<HttpResponseOk<latest::component::SpState>, HttpError> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is purely a style choice, but I think I would have imported all of the latest types so that this remained

    async fn sp_get(
        rqctx: RequestContext<Self::Context>,
        path: Path<PathSp>,
    ) -> Result<HttpResponseOk<SpState>, HttpError> {

and maybe would have done the same even in the *-api crate? And then only use explicit (non-latest) versions on the endpoints that need them.

I think this is mostly because adding latest::submodule:: to every type referenced in this file causes a lot of pretty long lines and makes this diff noisier than it would be otherwise. It seems fine to me for an unadorned type to implicitly be "the latest". But I don't feel as strongly about this as I did other things we've already discussed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have mixed opinions here. For new hires, and people not in the code a bunch, the types explicitly being marked latest could be informative at a glance. On the other hand I sympathize pretty heavily with eliminating the repetition and long lines.

I think I prefer John's suggestion, and would just add a comment to the import about unversioned types being latest.

One slight wrinkle is that some type names may conflict on their own. In that case though, the module can still be the prefix or we can use an alias. Nothing really changes how that currently works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants