From 371a813df6afc08c317adebf0bd573396a1783f3 Mon Sep 17 00:00:00 2001 From: Ryan Goodfellow Date: Mon, 6 May 2024 08:25:11 -0700 Subject: [PATCH 01/17] provide default for enforce_first_as (#5704) --- nexus/db-model/src/schema_versions.rs | 3 ++- schema/crdb/dbinit.sql | 4 ++-- schema/crdb/enforce-first-as-default/up01.sql | 1 + schema/crdb/enforce-first-as-default/up02.sql | 5 +++++ schema/crdb/enforce-first-as-default/up03.sql | 1 + 5 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 schema/crdb/enforce-first-as-default/up01.sql create mode 100644 schema/crdb/enforce-first-as-default/up02.sql create mode 100644 schema/crdb/enforce-first-as-default/up03.sql diff --git a/nexus/db-model/src/schema_versions.rs b/nexus/db-model/src/schema_versions.rs index 9ec1c6b7b3..c4510c02be 100644 --- a/nexus/db-model/src/schema_versions.rs +++ b/nexus/db-model/src/schema_versions.rs @@ -17,7 +17,7 @@ use std::collections::BTreeMap; /// /// This must be updated when you change the database schema. Refer to /// schema/crdb/README.adoc in the root of this repository for details. -pub const SCHEMA_VERSION: SemverVersion = SemverVersion::new(58, 0, 0); +pub const SCHEMA_VERSION: SemverVersion = SemverVersion::new(59, 0, 0); /// List of all past database schema versions, in *reverse* order /// @@ -29,6 +29,7 @@ static KNOWN_VERSIONS: Lazy> = Lazy::new(|| { // | leaving the first copy as an example for the next person. // v // KnownVersion::new(next_int, "unique-dirname-with-the-sql-files"), + KnownVersion::new(59, "enforce-first-as-default"), KnownVersion::new(58, "insert-default-allowlist"), KnownVersion::new(57, "add-allowed-source-ips"), KnownVersion::new(56, "bgp-oxpop-features"), diff --git a/schema/crdb/dbinit.sql b/schema/crdb/dbinit.sql index 0c5b557a58..e77b7b81ef 100644 --- a/schema/crdb/dbinit.sql +++ b/schema/crdb/dbinit.sql @@ -2637,7 +2637,7 @@ CREATE TABLE IF NOT EXISTS omicron.public.switch_port_settings_bgp_peer_config ( md5_auth_key TEXT, multi_exit_discriminator INT8, local_pref INT8, - enforce_first_as BOOLEAN, + enforce_first_as BOOLEAN NOT NULL DEFAULT false, allow_import_list_active BOOLEAN NOT NULL DEFAULT false, allow_export_list_active BOOLEAN NOT NULL DEFAULT false, vlan_id INT4, @@ -3842,7 +3842,7 @@ INSERT INTO omicron.public.db_metadata ( version, target_version ) VALUES - (TRUE, NOW(), NOW(), '58.0.0', NULL) + (TRUE, NOW(), NOW(), '59.0.0', NULL) ON CONFLICT DO NOTHING; COMMIT; diff --git a/schema/crdb/enforce-first-as-default/up01.sql b/schema/crdb/enforce-first-as-default/up01.sql new file mode 100644 index 0000000000..c1952a2df6 --- /dev/null +++ b/schema/crdb/enforce-first-as-default/up01.sql @@ -0,0 +1 @@ +ALTER TABLE omicron.public.switch_port_settings_bgp_peer_config ALTER COLUMN enforce_first_as SET DEFAULT false; diff --git a/schema/crdb/enforce-first-as-default/up02.sql b/schema/crdb/enforce-first-as-default/up02.sql new file mode 100644 index 0000000000..ff6e96ba0f --- /dev/null +++ b/schema/crdb/enforce-first-as-default/up02.sql @@ -0,0 +1,5 @@ +set local disallow_full_table_scans = off; + +UPDATE omicron.public.switch_port_settings_bgp_peer_config + SET enforce_first_as = false + WHERE enforce_first_as IS NULL; diff --git a/schema/crdb/enforce-first-as-default/up03.sql b/schema/crdb/enforce-first-as-default/up03.sql new file mode 100644 index 0000000000..2ccd0220df --- /dev/null +++ b/schema/crdb/enforce-first-as-default/up03.sql @@ -0,0 +1 @@ +ALTER TABLE omicron.public.switch_port_settings_bgp_peer_config ALTER COLUMN enforce_first_as SET NOT NULL; From 62c85a7ce30d30bd12b8258daf7b5f3ac11fcb7d Mon Sep 17 00:00:00 2001 From: Adam Leventhal Date: Mon, 6 May 2024 12:37:48 -0700 Subject: [PATCH 02/17] API typos (#5709) --- common/src/api/external/mod.rs | 6 +++--- openapi/nexus.json | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/common/src/api/external/mod.rs b/common/src/api/external/mod.rs index fffea4321b..9e0966f949 100644 --- a/common/src/api/external/mod.rs +++ b/common/src/api/external/mod.rs @@ -2579,7 +2579,7 @@ pub enum LinkSpeed { #[derive(Copy, Clone, Debug, Deserialize, Serialize, JsonSchema, PartialEq)] #[serde(rename_all = "snake_case")] pub enum LinkFec { - /// Firecode foward error correction. + /// Firecode forward error correction. Firecode, /// No forward error correction. None, @@ -2931,7 +2931,7 @@ impl JsonSchema for SwitchLinkState { #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize, PartialEq)] #[serde(rename_all = "snake_case")] pub enum BgpPeerState { - /// Initial state. Refuse all incomming BGP connections. No resources + /// Initial state. Refuse all incoming BGP connections. No resources /// allocated to peer. Idle, @@ -2950,7 +2950,7 @@ pub enum BgpPeerState { /// Synchronizing with peer. SessionSetup, - /// Session established. Able to exchange update, notification and keepliave + /// Session established. Able to exchange update, notification and keepalive /// messages with peers. Established, } diff --git a/openapi/nexus.json b/openapi/nexus.json index 27157e5759..4a24eb7f79 100644 --- a/openapi/nexus.json +++ b/openapi/nexus.json @@ -9936,7 +9936,7 @@ "description": "The current state of a BGP peer.", "oneOf": [ { - "description": "Initial state. Refuse all incomming BGP connections. No resources allocated to peer.", + "description": "Initial state. Refuse all incoming BGP connections. No resources allocated to peer.", "type": "string", "enum": [ "idle" @@ -9978,7 +9978,7 @@ ] }, { - "description": "Session established. Able to exchange update, notification and keepliave messages with peers.", + "description": "Session established. Able to exchange update, notification and keepalive messages with peers.", "type": "string", "enum": [ "established" @@ -14730,7 +14730,7 @@ "description": "The forward error correction mode of a link.", "oneOf": [ { - "description": "Firecode foward error correction.", + "description": "Firecode forward error correction.", "type": "string", "enum": [ "firecode" From 6eaa417c39bde47b89e0f64e4f9e5179cba90729 Mon Sep 17 00:00:00 2001 From: John Gallagher Date: Tue, 7 May 2024 09:28:21 -0400 Subject: [PATCH 03/17] Warn on `clippy::declare_interior_mutable_const` (#5688) It seems dubious that this is classified as a `style` warning, since it could lead to incorrectness. (No incorrectness around `Lazy`, just completely destroying the whole point of `Lazy` in the first place.) --------- Co-authored-by: Rain --- dev-tools/xtask/src/clippy.rs | 8 ++++++++ wicketd/src/rss_config.rs | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/dev-tools/xtask/src/clippy.rs b/dev-tools/xtask/src/clippy.rs index a89aaa9cc6..ec89707e06 100644 --- a/dev-tools/xtask/src/clippy.rs +++ b/dev-tools/xtask/src/clippy.rs @@ -68,6 +68,14 @@ pub fn run_cmd(args: ClippyArgs) -> Result<()> { .arg("clippy::len_zero") .arg("--warn") .arg("clippy::redundant_field_names") + // `declare_interior_mutable_const` is classified as a style lint, but + // it can identify real bugs (e.g., declarying a `const Atomic` and + // using it like a `static Atomic`). However, it is also subject to + // false positives (e.g., idiomatically declaring a static array of + // atomics uses `const Atomic`). We warn on this to catch the former, + // and expect any uses of the latter to allow this locally. + .arg("--warn") + .arg("clippy::declare_interior_mutable_const") // Also warn on casts, preferring explicit conversions instead. // // We'd like to warn on lossy casts in the future, but lossless casts diff --git a/wicketd/src/rss_config.rs b/wicketd/src/rss_config.rs index 6eaa89d65c..0160aa7c77 100644 --- a/wicketd/src/rss_config.rs +++ b/wicketd/src/rss_config.rs @@ -54,7 +54,7 @@ use wicket_common::rack_setup::UserSpecifiedRackNetworkConfig; // TODO-correctness For now, we always use the same rack subnet when running // RSS. When we get to multirack, this will be wrong, but there are many other // RSS-related things that need to change then too. -const RACK_SUBNET: Lazy> = Lazy::new(|| { +static RACK_SUBNET: Lazy> = Lazy::new(|| { let ip = Ipv6Addr::new(0xfd00, 0x1122, 0x3344, 0x0100, 0, 0, 0, 0); Ipv6Subnet::new(ip) }); From 2bf7211b41ebbe19c058d13120d612c4bf190e0f Mon Sep 17 00:00:00 2001 From: Sean Klein Date: Tue, 7 May 2024 11:08:02 -0700 Subject: [PATCH 04/17] [xtask] Make virtual-hardware destroy idempotent (#5707) Tested on atrium: re-running `cargo xtask virtual-hardware destroy` no longer throws errors Fixes https://github.com/oxidecomputer/omicron/issues/5566 --- dev-tools/xtask/src/virtual_hardware.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/dev-tools/xtask/src/virtual_hardware.rs b/dev-tools/xtask/src/virtual_hardware.rs index c2525a719f..d013ff6505 100644 --- a/dev-tools/xtask/src/virtual_hardware.rs +++ b/dev-tools/xtask/src/virtual_hardware.rs @@ -270,7 +270,15 @@ fn remove_softnpu_zone(npu_zone: &Utf8Path) -> Result<()> { "--ports", "sc0_1,tfportqsfp0_0", ]); - execute(cmd)?; + if let Err(output) = execute(cmd) { + // Don't throw an error if the zone was already removed + if output.to_string().contains("No such zone configured") { + println!("zone {npu_zone} already destroyed"); + return Ok(()); + } else { + return Err(output); + } + } Ok(()) } From c1f9e8fde9284d9e0ee5ccb9d228c3bf3cec199c Mon Sep 17 00:00:00 2001 From: Laura Abbott Date: Tue, 7 May 2024 14:12:15 -0400 Subject: [PATCH 05/17] Automatic bump of permslip manifest to gimlet-v1.0.17 (#5713) Automated bump --- tools/permslip_staging | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/permslip_staging b/tools/permslip_staging index 40edb57974..9ddec55a21 100644 --- a/tools/permslip_staging +++ b/tools/permslip_staging @@ -1,4 +1,4 @@ -99019c5fb6ab6e259f0c25daf90e118e48817472bbfb807b6490f43b5285bfab manifest-gimlet-v1.0.16.toml +2138737caec2c771692389c7cc6f45110aefc7d86c49ea872d5090549d6e59c7 manifest-gimlet-v1.0.17.toml e34b2f363ed0e1399e175bfae9e5e50217255c7984154697180d8a2d4611f65d manifest-oxide-rot-1-v1.0.10.toml b56e35fae0f4ed9e84e4e4d40f6cc576ceb52e4fba400b83841eb47d35cbbf8b manifest-psc-v1.0.16.toml 9bd043382ad5c7cdb8f00a66e401a6c4b88e8d588915f304d2c261ea7df4d1b5 manifest-sidecar-v1.0.16.toml From 7569549594e3cea7454cf49d9e16786d3f82d7c8 Mon Sep 17 00:00:00 2001 From: Nils Nieuwejaar Date: Wed, 8 May 2024 17:53:00 -0400 Subject: [PATCH 06/17] update pumpkind to disable dpd resets (#5720) --- package-manifest.toml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package-manifest.toml b/package-manifest.toml index b8c8bfc934..55e6f78221 100644 --- a/package-manifest.toml +++ b/package-manifest.toml @@ -584,8 +584,8 @@ output.intermediate_only = true service_name = "pumpkind" source.type = "prebuilt" source.repo = "pumpkind" -source.commit = "b648f61cb1cc23ec3c850349a5db49c980580ead" -source.sha256 = "d20d877ca42eb6207a870802e7cec8a9c7143348c22ed9271646b3d6bfcc2b85" +source.commit = "3fe9c306590fb2f28f54ace7fd18b3c126323683" +source.sha256 = "97eff3265bd6d2aee1b543d621187a11f6bf84bcfe0752c456ab33e312900125" output.type = "zone" output.intermediate_only = true only_for_targets.image = "standard" @@ -595,8 +595,8 @@ only_for_targets.switch = "asic" service_name = "pumpkind-gz" source.type = "prebuilt" source.repo = "pumpkind" -source.commit = "b648f61cb1cc23ec3c850349a5db49c980580ead" -source.sha256 = "83b29f0694c1750296d3c52698ca284980efd779bd1ef635b014931e5083d630" +source.commit = "3fe9c306590fb2f28f54ace7fd18b3c126323683" +source.sha256 = "21ba6926761ef2365046b5d90d725cea2ba5ce9d5059700eeb48406c1950fbc0" output.type = "tarball" only_for_targets.image = "standard" From 148697144c2bc28f930294df44828fe6129fcc03 Mon Sep 17 00:00:00 2001 From: Eliza Weisman Date: Wed, 8 May 2024 15:02:18 -0700 Subject: [PATCH 07/17] [oximeter] use `Cow<'static, str>` for `FieldValue::String` (#5670) Fixes #5664. Currently, Oximeter `FieldValue::String` fields are always represented by a `String` value. This is somewhat unfortunate, as it requires allocating a new `String` for every string field value that's emitted to Oximeter, even when the string value is fixed at compile-time --- for example, when an enum is used to generate a metric label with `&'static str` values, they must be alloced into new `String`s to record the metric. This commit changes `FieldValue::String` from holding a `String` to holding a `Cow<'static, str>`, so that static string constants need not be heap-allocated. Additionally, I've changed Oximeter's `self_stats` module to use `Cow<'static, str>` to represent the field value generated by the `FailureReason` enum. This way, a heap-allocated string is only necessary for dynamically formatted variants (the `FailureReason::Other` variant, which owns an HTTP `StatusCode`). For the `FailureReason::Unreachable` and `FailureReason::Deserialization` variants, we can just emit a `&'static str` without allocating. Hopefully, this reduces resident memory for the collector process somewhat when encountering a lot of failures. --- nexus/db-queries/src/transaction_retry.rs | 4 ++- oximeter/collector/src/self_stats.rs | 24 ++++++++++++---- oximeter/db/src/lib.rs | 3 +- oximeter/db/src/model.rs | 3 +- oximeter/db/src/oxql/ast/literal.rs | 34 +++++++++++++---------- oximeter/oximeter/src/types.rs | 19 ++++++++++--- 6 files changed, 61 insertions(+), 26 deletions(-) diff --git a/nexus/db-queries/src/transaction_retry.rs b/nexus/db-queries/src/transaction_retry.rs index 74a94a0b8f..558bb574c9 100644 --- a/nexus/db-queries/src/transaction_retry.rs +++ b/nexus/db-queries/src/transaction_retry.rs @@ -353,7 +353,9 @@ mod test { assert_eq!( target_fields["name"].value, FieldValue::String( - "test_transaction_retry_produces_samples".to_string() + "test_transaction_retry_produces_samples" + .to_string() + .into() ) ); diff --git a/oximeter/collector/src/self_stats.rs b/oximeter/collector/src/self_stats.rs index 8d39e6e282..b72c21d0e3 100644 --- a/oximeter/collector/src/self_stats.rs +++ b/oximeter/collector/src/self_stats.rs @@ -14,6 +14,7 @@ use oximeter::MetricsError; use oximeter::Sample; use oximeter::Target; use reqwest::StatusCode; +use std::borrow::Cow; use std::collections::BTreeMap; use std::net::IpAddr; use std::time::Duration; @@ -65,13 +66,26 @@ pub enum FailureReason { impl std::fmt::Display for FailureReason { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { match self { - Self::Unreachable => write!(f, "unreachable"), - Self::Deserialization => write!(f, "deserialization"), + Self::Unreachable => f.write_str(Self::UNREACHABLE), + Self::Deserialization => f.write_str(Self::DESERIALIZATION), Self::Other(c) => write!(f, "{}", c.as_u16()), } } } +impl FailureReason { + const UNREACHABLE: &'static str = "unreachable"; + const DESERIALIZATION: &'static str = "deserialization"; + + fn as_string(&self) -> Cow<'static, str> { + match self { + Self::Unreachable => Cow::Borrowed(Self::UNREACHABLE), + Self::Deserialization => Cow::Borrowed(Self::DESERIALIZATION), + Self::Other(c) => Cow::Owned(c.as_u16().to_string()), + } + } +} + /// The number of failed collections from a single producer. #[derive(Clone, Debug, Metric)] pub struct FailedCollections { @@ -88,7 +102,7 @@ pub struct FailedCollections { /// The reason we could not collect. // // NOTE: This should always be generated through a `FailureReason`. - pub reason: String, + pub reason: Cow<'static, str>, pub datum: Cumulative, } @@ -128,7 +142,7 @@ impl CollectionTaskStats { producer_ip: self.collections.producer_ip, producer_port: self.collections.producer_port, base_route: self.collections.base_route.clone(), - reason: reason.to_string(), + reason: reason.as_string(), datum: Cumulative::new(0), } }) @@ -200,7 +214,7 @@ mod tests { producer_ip: IpAddr::V6(Ipv6Addr::LOCALHOST), producer_port: 12345, base_route: String::from("/"), - reason: FailureReason::Unreachable.to_string(), + reason: FailureReason::Unreachable.as_string(), datum: Cumulative::new(0), } } diff --git a/oximeter/db/src/lib.rs b/oximeter/db/src/lib.rs index 642612b8db..e1570ee0c3 100644 --- a/oximeter/db/src/lib.rs +++ b/oximeter/db/src/lib.rs @@ -296,6 +296,7 @@ mod tests { use super::*; use crate::model::DbFieldList; use crate::model::DbTimeseriesSchema; + use std::borrow::Cow; use uuid::Uuid; // Validates that the timeseries_key stability for a sample is stable. @@ -332,7 +333,7 @@ mod tests { use strum::EnumCount; let values = [ - ("string", FieldValue::String(String::default())), + ("string", FieldValue::String(Cow::Owned(String::default()))), ("i8", FieldValue::I8(-0x0A)), ("u8", FieldValue::U8(0x0A)), ("i16", FieldValue::I16(-0x0ABC)), diff --git a/oximeter/db/src/model.rs b/oximeter/db/src/model.rs index ef2a7ad422..106c347ef6 100644 --- a/oximeter/db/src/model.rs +++ b/oximeter/db/src/model.rs @@ -391,7 +391,7 @@ declare_field_row! {I32FieldRow, i32, "i32"} declare_field_row! {U32FieldRow, u32, "u32"} declare_field_row! {I64FieldRow, i64, "i64"} declare_field_row! {U64FieldRow, u64, "u64"} -declare_field_row! {StringFieldRow, String, "string"} +declare_field_row! {StringFieldRow, std::borrow::Cow<'static, str>, "string"} declare_field_row! {IpAddrFieldRow, Ipv6Addr, "ipaddr"} declare_field_row! {UuidFieldRow, Uuid, "uuid"} @@ -1716,6 +1716,7 @@ pub(crate) fn parse_field_select_row( .as_str() .expect("Expected a UUID string for a Uuid field from the database") .to_string() + .into() ) } }; diff --git a/oximeter/db/src/oxql/ast/literal.rs b/oximeter/db/src/oxql/ast/literal.rs index 33f3d81485..d80977fe49 100644 --- a/oximeter/db/src/oxql/ast/literal.rs +++ b/oximeter/db/src/oxql/ast/literal.rs @@ -14,6 +14,7 @@ use chrono::Utc; use oximeter::FieldType; use oximeter::FieldValue; use regex::Regex; +use std::borrow::Borrow; use std::fmt; use std::net::IpAddr; use std::time::Duration; @@ -127,20 +128,24 @@ impl Literal { (FieldValue::Bool(lhs), Literal::Boolean(rhs)) => { generate_cmp_match!(rhs, lhs) } - (FieldValue::String(lhs), Literal::String(rhs)) => match cmp { - Comparison::Eq => Ok(Some(lhs == rhs)), - Comparison::Ne => Ok(Some(lhs != rhs)), - Comparison::Gt => Ok(Some(lhs > rhs)), - Comparison::Ge => Ok(Some(lhs >= rhs)), - Comparison::Lt => Ok(Some(lhs < rhs)), - Comparison::Le => Ok(Some(lhs <= rhs)), - Comparison::Like => { - let re = Regex::new(rhs).context( - "failed to create regex for string matching", - )?; - Ok(Some(re.is_match(lhs))) + (FieldValue::String(lhs), Literal::String(rhs)) => { + let lhs = lhs.borrow(); + let rhs = rhs.as_ref(); + match cmp { + Comparison::Eq => Ok(Some(lhs == rhs)), + Comparison::Ne => Ok(Some(lhs != rhs)), + Comparison::Gt => Ok(Some(lhs > rhs)), + Comparison::Ge => Ok(Some(lhs >= rhs)), + Comparison::Lt => Ok(Some(lhs < rhs)), + Comparison::Le => Ok(Some(lhs <= rhs)), + Comparison::Like => { + let re = Regex::new(rhs).context( + "failed to create regex for string matching", + )?; + Ok(Some(re.is_match(lhs))) + } } - }, + } (FieldValue::IpAddr(lhs), Literal::IpAddr(rhs)) => { generate_cmp_match!(rhs, lhs) } @@ -377,7 +382,8 @@ mod tests { #[test] fn test_literal_compare_field_wrong_type() { - let value = FieldValue::String(String::from("foo")); + let value = + FieldValue::String(std::borrow::Cow::Owned(String::from("foo"))); let lit = Literal::Integer(4); assert!(lit.compare_field(&value, Comparison::Eq).is_err()); } diff --git a/oximeter/oximeter/src/types.rs b/oximeter/oximeter/src/types.rs index 04289a7297..3e6ffc5442 100644 --- a/oximeter/oximeter/src/types.rs +++ b/oximeter/oximeter/src/types.rs @@ -17,6 +17,7 @@ use num::traits::Zero; use schemars::JsonSchema; use serde::Deserialize; use serde::Serialize; +use std::borrow::Cow; use std::boxed::Box; use std::collections::BTreeMap; use std::fmt; @@ -77,6 +78,8 @@ macro_rules! impl_field_type_from { } impl_field_type_from! { String, FieldType::String } +impl_field_type_from! { &'static str, FieldType::String } +impl_field_type_from! { Cow<'static, str>, FieldType::String } impl_field_type_from! { i8, FieldType::I8 } impl_field_type_from! { u8, FieldType::U8 } impl_field_type_from! { i16, FieldType::I16 } @@ -103,7 +106,7 @@ impl_field_type_from! { bool, FieldType::Bool } )] #[serde(tag = "type", content = "value", rename_all = "snake_case")] pub enum FieldValue { - String(String), + String(Cow<'static, str>), I8(i8), U8(u8), I16(i16), @@ -147,7 +150,9 @@ impl FieldValue { typ: field_type.to_string(), }; match field_type { - FieldType::String => Ok(FieldValue::String(s.to_string())), + FieldType::String => { + Ok(FieldValue::String(Cow::Owned(s.to_string()))) + } FieldType::I8 => { Ok(FieldValue::I8(s.parse().map_err(|_| make_err())?)) } @@ -222,14 +227,20 @@ impl_field_value_from! { i32, FieldValue::I32 } impl_field_value_from! { u32, FieldValue::U32 } impl_field_value_from! { i64, FieldValue::I64 } impl_field_value_from! { u64, FieldValue::U64 } -impl_field_value_from! { String, FieldValue::String } +impl_field_value_from! { Cow<'static, str>, FieldValue::String } impl_field_value_from! { IpAddr, FieldValue::IpAddr } impl_field_value_from! { Uuid, FieldValue::Uuid } impl_field_value_from! { bool, FieldValue::Bool } impl From<&str> for FieldValue { fn from(value: &str) -> Self { - FieldValue::String(String::from(value)) + FieldValue::String(Cow::Owned(String::from(value))) + } +} + +impl From for FieldValue { + fn from(value: String) -> Self { + FieldValue::String(Cow::Owned(value)) } } From 3ebded84ae30e77062e7bef6cd90468714682e35 Mon Sep 17 00:00:00 2001 From: Andy Fiddaman Date: Wed, 8 May 2024 23:16:48 +0100 Subject: [PATCH 08/17] Prevent chrony from authoritatively advertising times from the 1980s. (#5610) --- zone-setup/src/bin/zone-setup.rs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/zone-setup/src/bin/zone-setup.rs b/zone-setup/src/bin/zone-setup.rs index 333f479721..d4f31c548c 100644 --- a/zone-setup/src/bin/zone-setup.rs +++ b/zone-setup/src/bin/zone-setup.rs @@ -333,8 +333,20 @@ allow @ALLOW@ # Enable local reference mode, which keeps us operating as an NTP server that # appears synchronised even if there are currently no active upstreams. When -# in this mode, we report as stratum 10 to clients. -local stratum 10 +# in this mode, we report as stratum 10 to clients. The `distance' parameter +# controls when we will decide to abandon the upstreams and switch to the local +# reference. By setting `activate`, we prevent the server from ever activating +# its local reference until it has synchronised with upstream at least once and +# the root distance has dropped below the provided threshold. This prevents +# a boundary server in a cold booted rack from authoritatively advertising a +# time from the 1980s prior to gaining external connectivity. +# +# distance: Distance from root above which we use the local reference, opting +# to ignore the upstream. +# activate: Distance from root below which we must fall once to ever consider +# the local reference. +# +local stratum 10 distance 0.4 activate 0.5 # makestep # We allow chrony to step the system clock during the first three time updates From e9cde17cb40872cb318e5d205b74079129258765 Mon Sep 17 00:00:00 2001 From: iliana etaoin Date: Wed, 8 May 2024 15:59:03 -0700 Subject: [PATCH 09/17] move clippy args to `[workspace.lints.clippy]` (#5715) This moves our Clippy configuration out of xtask and into Cargo's relatively-new lint configuration functionality. https://blog.rust-lang.org/2023/11/16/Rust-1.74.0.html#lint-configuration-through-cargo Unfortunately this requires littering `[lints] workspace = true` in every Cargo.toml, at least until implicit workspace inheritance is figured out. This adds a check to `cargo xtask check-workspace-deps` to ensure this is the case in CI. As part of this I removed the `#![allow(clippy::style)]` attributes from nexus and sled-agent, which revealed that this was overriding any style lints we re-enabled in the xtask code. One issue is that workspace crates can't override these lints yet (https://github.com/rust-lang/cargo/issues/13157), but they can continue to override them with `#![allow(clippy::whatever)]` attributes. --- Cargo.toml | 42 ++++++++++++++++ api_identity/Cargo.toml | 3 ++ bootstore/Cargo.toml | 3 ++ caboose-util/Cargo.toml | 3 ++ certificates/Cargo.toml | 3 ++ clients/bootstrap-agent-client/Cargo.toml | 3 ++ clients/ddm-admin-client/Cargo.toml | 3 ++ clients/dns-service-client/Cargo.toml | 3 ++ clients/dpd-client/Cargo.toml | 3 ++ clients/gateway-client/Cargo.toml | 3 ++ .../installinator-artifact-client/Cargo.toml | 3 ++ clients/nexus-client/Cargo.toml | 3 ++ clients/oxide-client/Cargo.toml | 3 ++ clients/oximeter-client/Cargo.toml | 3 ++ clients/sled-agent-client/Cargo.toml | 3 ++ clients/wicketd-client/Cargo.toml | 3 ++ common/Cargo.toml | 3 ++ dev-tools/crdb-seed/Cargo.toml | 3 ++ dev-tools/omdb/Cargo.toml | 3 ++ dev-tools/omicron-dev/Cargo.toml | 3 ++ dev-tools/oxlog/Cargo.toml | 3 ++ dev-tools/reconfigurator-cli/Cargo.toml | 3 ++ dev-tools/xtask/Cargo.toml | 3 ++ dev-tools/xtask/src/check_workspace_deps.rs | 14 +++++- dev-tools/xtask/src/clippy.rs | 49 +------------------ dns-server/Cargo.toml | 3 ++ end-to-end-tests/Cargo.toml | 3 ++ gateway-cli/Cargo.toml | 3 ++ gateway-test-utils/Cargo.toml | 3 ++ gateway/Cargo.toml | 3 ++ illumos-utils/Cargo.toml | 3 ++ installinator-artifactd/Cargo.toml | 3 ++ installinator-common/Cargo.toml | 3 ++ installinator/Cargo.toml | 3 ++ internal-dns-cli/Cargo.toml | 3 ++ internal-dns/Cargo.toml | 3 ++ ipcc/Cargo.toml | 3 ++ key-manager/Cargo.toml | 3 ++ nexus-config/Cargo.toml | 3 ++ nexus/Cargo.toml | 3 ++ nexus/authz-macros/Cargo.toml | 3 ++ nexus/db-macros/Cargo.toml | 3 ++ nexus/db-model/Cargo.toml | 3 ++ nexus/db-queries/Cargo.toml | 3 ++ nexus/defaults/Cargo.toml | 3 ++ nexus/inventory/Cargo.toml | 3 ++ nexus/macros-common/Cargo.toml | 3 ++ nexus/metrics-producer-gc/Cargo.toml | 3 ++ nexus/networking/Cargo.toml | 3 ++ nexus/reconfigurator/execution/Cargo.toml | 3 ++ nexus/reconfigurator/planning/Cargo.toml | 3 ++ nexus/reconfigurator/preparation/Cargo.toml | 3 ++ nexus/src/app/background/common.rs | 2 +- nexus/src/app/instance_network.rs | 2 +- nexus/src/external_api/console_api.rs | 13 +++++ nexus/src/lib.rs | 2 - nexus/test-interface/Cargo.toml | 3 ++ nexus/test-utils-macros/Cargo.toml | 3 ++ nexus/test-utils/Cargo.toml | 3 ++ nexus/types/Cargo.toml | 3 ++ oximeter/collector/Cargo.toml | 3 ++ oximeter/db/Cargo.toml | 3 ++ oximeter/instruments/Cargo.toml | 3 ++ oximeter/oximeter-macro-impl/Cargo.toml | 3 ++ oximeter/oximeter/Cargo.toml | 3 ++ oximeter/producer/Cargo.toml | 3 ++ package/Cargo.toml | 3 ++ passwords/Cargo.toml | 3 ++ rpaths/Cargo.toml | 3 ++ sled-agent/Cargo.toml | 3 ++ sled-agent/src/lib.rs | 2 - sled-agent/src/params.rs | 6 +-- sled-agent/src/rack_setup/config.rs | 2 +- sled-agent/src/rack_setup/service.rs | 2 +- sled-agent/src/swap_device.rs | 12 ++--- sled-hardware/Cargo.toml | 3 ++ sled-hardware/types/Cargo.toml | 3 ++ sled-storage/Cargo.toml | 3 ++ sp-sim/Cargo.toml | 3 ++ test-utils/Cargo.toml | 3 ++ tufaceous-lib/Cargo.toml | 3 ++ tufaceous/Cargo.toml | 3 ++ typed-rng/Cargo.toml | 3 ++ update-common/Cargo.toml | 3 ++ update-engine/Cargo.toml | 3 ++ uuid-kinds/Cargo.toml | 3 ++ wicket-common/Cargo.toml | 3 ++ wicket-dbg/Cargo.toml | 3 ++ wicket/Cargo.toml | 3 ++ wicketd/Cargo.toml | 3 ++ workspace-hack/Cargo.toml | 3 ++ zone-setup/Cargo.toml | 3 ++ 92 files changed, 321 insertions(+), 67 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 12d2e954be..db5060184b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -162,6 +162,48 @@ default-members = [ ] resolver = "2" +# +# Tree-wide lint configuration. +# https://doc.rust-lang.org/stable/cargo/reference/manifest.html#the-lints-section +# +# For a list of Clippy lints, see +# https://rust-lang.github.io/rust-clippy/master. +# +[workspace.lints.clippy] +# Clippy's style nits are useful, but not worth keeping in CI. +style = { level = "allow", priority = -1 } +# But continue to warn on anything in the "disallowed_" namespace. +disallowed_macros = "warn" +disallowed_methods = "warn" +disallowed_names = "warn" +disallowed_script_idents = "warn" +disallowed_types = "warn" +# Warn on some more style lints that are relatively stable and make sense. +iter_cloned_collect = "warn" +iter_next_slice = "warn" +iter_nth = "warn" +iter_nth_zero = "warn" +iter_skip_next = "warn" +len_zero = "warn" +redundant_field_names = "warn" +# `declare_interior_mutable_const` is classified as a style lint, but it can +# identify real bugs (e.g., declarying a `const Atomic` and using it like +# a `static Atomic`). However, it is also subject to false positives (e.g., +# idiomatically declaring a static array of atomics uses `const Atomic`). We +# warn on this to catch the former, and expect any uses of the latter to allow +# this locally. +# +# Note: any const value with a type containing a `bytes::Bytes` hits this lint, +# and you should `#![allow]` it for now. This is most likely to be seen with +# `http::header::{HeaderName, HeaderValue}`. This is a Clippy bug which will be +# fixed in the Rust 1.80 toolchain (rust-lang/rust-clippy#12691). +declare_interior_mutable_const = "warn" +# Also warn on casts, preferring explicit conversions instead. +# +# We'd like to warn on lossy casts in the future, but lossless casts are the +# easiest ones to convert over. +cast_lossless = "warn" + [workspace.dependencies] anyhow = "1.0" anstyle = "1.0.6" diff --git a/api_identity/Cargo.toml b/api_identity/Cargo.toml index 547defa7c5..6d53ee12c9 100644 --- a/api_identity/Cargo.toml +++ b/api_identity/Cargo.toml @@ -10,6 +10,9 @@ license = "MPL-2.0" [lib] proc-macro = true +[lints] +workspace = true + [dependencies] proc-macro2.workspace = true quote.workspace = true diff --git a/bootstore/Cargo.toml b/bootstore/Cargo.toml index 5e9bcd1ef4..6d1ca97e44 100644 --- a/bootstore/Cargo.toml +++ b/bootstore/Cargo.toml @@ -8,6 +8,9 @@ license = "MPL-2.0" [build-dependencies] omicron-rpaths.workspace = true +[lints] +workspace = true + [dependencies] bytes.workspace = true camino.workspace = true diff --git a/caboose-util/Cargo.toml b/caboose-util/Cargo.toml index 91bf00741e..ceff70b41d 100644 --- a/caboose-util/Cargo.toml +++ b/caboose-util/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] anyhow.workspace = true hubtools.workspace = true diff --git a/certificates/Cargo.toml b/certificates/Cargo.toml index 87b12fd167..51e4a2e421 100644 --- a/certificates/Cargo.toml +++ b/certificates/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] display-error-chain.workspace = true foreign-types.workspace = true diff --git a/clients/bootstrap-agent-client/Cargo.toml b/clients/bootstrap-agent-client/Cargo.toml index ce97789fb2..272abdedae 100644 --- a/clients/bootstrap-agent-client/Cargo.toml +++ b/clients/bootstrap-agent-client/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] omicron-common.workspace = true progenitor.workspace = true diff --git a/clients/ddm-admin-client/Cargo.toml b/clients/ddm-admin-client/Cargo.toml index 1b0fca2951..bd99492f30 100644 --- a/clients/ddm-admin-client/Cargo.toml +++ b/clients/ddm-admin-client/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] either.workspace = true progenitor-client.workspace = true diff --git a/clients/dns-service-client/Cargo.toml b/clients/dns-service-client/Cargo.toml index fb393d77b1..cdaef701bd 100644 --- a/clients/dns-service-client/Cargo.toml +++ b/clients/dns-service-client/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] anyhow.workspace = true chrono.workspace = true diff --git a/clients/dpd-client/Cargo.toml b/clients/dpd-client/Cargo.toml index 0239c6d9b0..477435d8bb 100644 --- a/clients/dpd-client/Cargo.toml +++ b/clients/dpd-client/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] futures.workspace = true progenitor-client.workspace = true diff --git a/clients/gateway-client/Cargo.toml b/clients/gateway-client/Cargo.toml index 9e1118cf59..96f6484122 100644 --- a/clients/gateway-client/Cargo.toml +++ b/clients/gateway-client/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] base64.workspace = true chrono.workspace = true diff --git a/clients/installinator-artifact-client/Cargo.toml b/clients/installinator-artifact-client/Cargo.toml index c3ddc529d9..f1e896864f 100644 --- a/clients/installinator-artifact-client/Cargo.toml +++ b/clients/installinator-artifact-client/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] installinator-common.workspace = true progenitor.workspace = true diff --git a/clients/nexus-client/Cargo.toml b/clients/nexus-client/Cargo.toml index fd6df6919f..1d5cced21c 100644 --- a/clients/nexus-client/Cargo.toml +++ b/clients/nexus-client/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] chrono.workspace = true futures.workspace = true diff --git a/clients/oxide-client/Cargo.toml b/clients/oxide-client/Cargo.toml index 3cb411729d..f2adcacb1b 100644 --- a/clients/oxide-client/Cargo.toml +++ b/clients/oxide-client/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] anyhow.workspace = true base64.workspace = true diff --git a/clients/oximeter-client/Cargo.toml b/clients/oximeter-client/Cargo.toml index e54b152415..dadf6d8c4d 100644 --- a/clients/oximeter-client/Cargo.toml +++ b/clients/oximeter-client/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] chrono.workspace = true futures.workspace = true diff --git a/clients/sled-agent-client/Cargo.toml b/clients/sled-agent-client/Cargo.toml index 1f5453d298..3f3d82bf80 100644 --- a/clients/sled-agent-client/Cargo.toml +++ b/clients/sled-agent-client/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] anyhow.workspace = true async-trait.workspace = true diff --git a/clients/wicketd-client/Cargo.toml b/clients/wicketd-client/Cargo.toml index 6da60b3a61..364cb5ec86 100644 --- a/clients/wicketd-client/Cargo.toml +++ b/clients/wicketd-client/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] chrono.workspace = true installinator-common.workspace = true diff --git a/common/Cargo.toml b/common/Cargo.toml index 23499039e6..39508ac6f0 100644 --- a/common/Cargo.toml +++ b/common/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + # NOTE: # # This crate is depended on by several other workspaces! Be careful of adding diff --git a/dev-tools/crdb-seed/Cargo.toml b/dev-tools/crdb-seed/Cargo.toml index aff26995dc..778a65b4b5 100644 --- a/dev-tools/crdb-seed/Cargo.toml +++ b/dev-tools/crdb-seed/Cargo.toml @@ -5,6 +5,9 @@ edition = "2021" license = "MPL-2.0" readme = "README.md" +[lints] +workspace = true + [dependencies] anyhow.workspace = true dropshot.workspace = true diff --git a/dev-tools/omdb/Cargo.toml b/dev-tools/omdb/Cargo.toml index a0c4e2fe56..3c466b1683 100644 --- a/dev-tools/omdb/Cargo.toml +++ b/dev-tools/omdb/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [build-dependencies] omicron-rpaths.workspace = true diff --git a/dev-tools/omicron-dev/Cargo.toml b/dev-tools/omicron-dev/Cargo.toml index 6aa480b2c6..1dcc4eada7 100644 --- a/dev-tools/omicron-dev/Cargo.toml +++ b/dev-tools/omicron-dev/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [build-dependencies] omicron-rpaths.workspace = true diff --git a/dev-tools/oxlog/Cargo.toml b/dev-tools/oxlog/Cargo.toml index 3c3d983d09..9b59647691 100644 --- a/dev-tools/oxlog/Cargo.toml +++ b/dev-tools/oxlog/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] anyhow.workspace = true camino.workspace = true diff --git a/dev-tools/reconfigurator-cli/Cargo.toml b/dev-tools/reconfigurator-cli/Cargo.toml index ad3cdf61f1..5edf9d0ef8 100644 --- a/dev-tools/reconfigurator-cli/Cargo.toml +++ b/dev-tools/reconfigurator-cli/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [build-dependencies] omicron-rpaths.workspace = true diff --git a/dev-tools/xtask/Cargo.toml b/dev-tools/xtask/Cargo.toml index e6ec16fbfb..11fcf405bd 100644 --- a/dev-tools/xtask/Cargo.toml +++ b/dev-tools/xtask/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] anyhow.workspace = true camino.workspace = true diff --git a/dev-tools/xtask/src/check_workspace_deps.rs b/dev-tools/xtask/src/check_workspace_deps.rs index 6e84380c69..76e405ce1a 100644 --- a/dev-tools/xtask/src/check_workspace_deps.rs +++ b/dev-tools/xtask/src/check_workspace_deps.rs @@ -31,14 +31,24 @@ pub fn run_cmd() -> Result<()> { // Iterate the workspace packages and fill out the maps above. for pkg_info in workspace.workspace_packages() { + let manifest_path = &pkg_info.manifest_path; + let manifest = read_cargo_toml(manifest_path)?; + + // Check that `[lints] workspace = true` is set. + if !manifest.lints.map(|lints| lints.workspace).unwrap_or(false) { + eprintln!( + "error: package {:?} does not have `[lints] workspace = true` set", + pkg_info.name + ); + nerrors += 1; + } + if pkg_info.name == WORKSPACE_HACK_PACKAGE_NAME { // Skip over workspace-hack because hakari doesn't yet support // workspace deps: https://github.com/guppy-rs/guppy/issues/7 continue; } - let manifest_path = &pkg_info.manifest_path; - let manifest = read_cargo_toml(manifest_path)?; for tree in [ &manifest.dependencies, &manifest.dev_dependencies, diff --git a/dev-tools/xtask/src/clippy.rs b/dev-tools/xtask/src/clippy.rs index ec89707e06..8eb1659da7 100644 --- a/dev-tools/xtask/src/clippy.rs +++ b/dev-tools/xtask/src/clippy.rs @@ -34,54 +34,7 @@ pub fn run_cmd(args: ClippyArgs) -> Result<()> { // // We disallow warnings by default. .arg("--deny") - .arg("warnings") - // Clippy's style nits are useful, but not worth keeping in CI. This - // override belongs in src/lib.rs, and it is there, but that doesn't - // reliably work due to rust-lang/rust-clippy#6610. - .arg("--allow") - .arg("clippy::style") - // But continue to warn on anything in the "disallowed_" namespace. - // (These will be turned into errors by `--deny warnings` above.) - .arg("--warn") - .arg("clippy::disallowed_macros") - .arg("--warn") - .arg("clippy::disallowed_methods") - .arg("--warn") - .arg("clippy::disallowed_names") - .arg("--warn") - .arg("clippy::disallowed_script_idents") - .arg("--warn") - .arg("clippy::disallowed_types") - // Warn on some more style lints that are relatively stable and make - // sense. - .arg("--warn") - .arg("clippy::iter_cloned_collect") - .arg("--warn") - .arg("clippy::iter_next_slice") - .arg("--warn") - .arg("clippy::iter_nth") - .arg("--warn") - .arg("clippy::iter_nth_zero") - .arg("--warn") - .arg("clippy::iter_skip_next") - .arg("--warn") - .arg("clippy::len_zero") - .arg("--warn") - .arg("clippy::redundant_field_names") - // `declare_interior_mutable_const` is classified as a style lint, but - // it can identify real bugs (e.g., declarying a `const Atomic` and - // using it like a `static Atomic`). However, it is also subject to - // false positives (e.g., idiomatically declaring a static array of - // atomics uses `const Atomic`). We warn on this to catch the former, - // and expect any uses of the latter to allow this locally. - .arg("--warn") - .arg("clippy::declare_interior_mutable_const") - // Also warn on casts, preferring explicit conversions instead. - // - // We'd like to warn on lossy casts in the future, but lossless casts - // are the easiest ones to convert over. - .arg("--warn") - .arg("clippy::cast_lossless"); + .arg("warnings"); eprintln!( "running: {:?} {}", diff --git a/dns-server/Cargo.toml b/dns-server/Cargo.toml index 3440ebcfe8..237d2a2fbb 100644 --- a/dns-server/Cargo.toml +++ b/dns-server/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] anyhow.workspace = true camino.workspace = true diff --git a/end-to-end-tests/Cargo.toml b/end-to-end-tests/Cargo.toml index 754d85512c..1102094b61 100644 --- a/end-to-end-tests/Cargo.toml +++ b/end-to-end-tests/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] anyhow = { workspace = true, features = ["backtrace"] } async-trait.workspace = true diff --git a/gateway-cli/Cargo.toml b/gateway-cli/Cargo.toml index 2412bf950f..22aa09fe92 100644 --- a/gateway-cli/Cargo.toml +++ b/gateway-cli/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] anyhow.workspace = true clap.workspace = true diff --git a/gateway-test-utils/Cargo.toml b/gateway-test-utils/Cargo.toml index 81b7686eb2..08e22228fe 100644 --- a/gateway-test-utils/Cargo.toml +++ b/gateway-test-utils/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] camino.workspace = true dropshot.workspace = true diff --git a/gateway/Cargo.toml b/gateway/Cargo.toml index 450c4b445e..2ddd9421b7 100644 --- a/gateway/Cargo.toml +++ b/gateway/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] anyhow.workspace = true base64.workspace = true diff --git a/illumos-utils/Cargo.toml b/illumos-utils/Cargo.toml index cd13e4a8a6..fa50dd2822 100644 --- a/illumos-utils/Cargo.toml +++ b/illumos-utils/Cargo.toml @@ -5,6 +5,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] anyhow.workspace = true async-trait.workspace = true diff --git a/installinator-artifactd/Cargo.toml b/installinator-artifactd/Cargo.toml index e9ddc222cd..236ea7a51c 100644 --- a/installinator-artifactd/Cargo.toml +++ b/installinator-artifactd/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] anyhow.workspace = true async-trait.workspace = true diff --git a/installinator-common/Cargo.toml b/installinator-common/Cargo.toml index dd8540c6f8..4c5560148f 100644 --- a/installinator-common/Cargo.toml +++ b/installinator-common/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] anyhow.workspace = true camino.workspace = true diff --git a/installinator/Cargo.toml b/installinator/Cargo.toml index abfcc5e892..ebdb6269b7 100644 --- a/installinator/Cargo.toml +++ b/installinator/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] anyhow.workspace = true async-trait.workspace = true diff --git a/internal-dns-cli/Cargo.toml b/internal-dns-cli/Cargo.toml index dab92c6d7c..dae0af0280 100644 --- a/internal-dns-cli/Cargo.toml +++ b/internal-dns-cli/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] anyhow.workspace = true clap.workspace = true diff --git a/internal-dns/Cargo.toml b/internal-dns/Cargo.toml index 4f504c5b49..c08cc012c1 100644 --- a/internal-dns/Cargo.toml +++ b/internal-dns/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] anyhow.workspace = true chrono.workspace = true diff --git a/ipcc/Cargo.toml b/ipcc/Cargo.toml index 98a781ab86..a9278349e1 100644 --- a/ipcc/Cargo.toml +++ b/ipcc/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] ciborium.workspace = true libc.workspace = true diff --git a/key-manager/Cargo.toml b/key-manager/Cargo.toml index c44ec61ea4..3e00758c9e 100644 --- a/key-manager/Cargo.toml +++ b/key-manager/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] async-trait.workspace = true hkdf.workspace = true diff --git a/nexus-config/Cargo.toml b/nexus-config/Cargo.toml index af7eb70f62..9d23be302f 100644 --- a/nexus-config/Cargo.toml +++ b/nexus-config/Cargo.toml @@ -3,6 +3,9 @@ name = "nexus-config" version = "0.1.0" edition = "2021" +[lints] +workspace = true + [dependencies] anyhow.workspace = true camino.workspace = true diff --git a/nexus/Cargo.toml b/nexus/Cargo.toml index 5222d104c3..2c1a3b21fe 100644 --- a/nexus/Cargo.toml +++ b/nexus/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [build-dependencies] omicron-rpaths.workspace = true diff --git a/nexus/authz-macros/Cargo.toml b/nexus/authz-macros/Cargo.toml index 4d2640abee..beba0a3cf6 100644 --- a/nexus/authz-macros/Cargo.toml +++ b/nexus/authz-macros/Cargo.toml @@ -7,6 +7,9 @@ license = "MPL-2.0" [lib] proc-macro = true +[lints] +workspace = true + [dependencies] heck.workspace = true nexus-macros-common.workspace = true diff --git a/nexus/db-macros/Cargo.toml b/nexus/db-macros/Cargo.toml index 8032ba814d..fa477c1f00 100644 --- a/nexus/db-macros/Cargo.toml +++ b/nexus/db-macros/Cargo.toml @@ -8,6 +8,9 @@ license = "MPL-2.0" [lib] proc-macro = true +[lints] +workspace = true + [dependencies] heck.workspace = true nexus-macros-common.workspace = true diff --git a/nexus/db-model/Cargo.toml b/nexus/db-model/Cargo.toml index bfe75377c5..1118b7c9bd 100644 --- a/nexus/db-model/Cargo.toml +++ b/nexus/db-model/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [build-dependencies] omicron-rpaths.workspace = true diff --git a/nexus/db-queries/Cargo.toml b/nexus/db-queries/Cargo.toml index 354a2b0ac0..0754f7389f 100644 --- a/nexus/db-queries/Cargo.toml +++ b/nexus/db-queries/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [build-dependencies] omicron-rpaths.workspace = true diff --git a/nexus/defaults/Cargo.toml b/nexus/defaults/Cargo.toml index 535b78054b..d6f8e54220 100644 --- a/nexus/defaults/Cargo.toml +++ b/nexus/defaults/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] ipnetwork.workspace = true once_cell.workspace = true diff --git a/nexus/inventory/Cargo.toml b/nexus/inventory/Cargo.toml index 52c7b6975b..e185808caa 100644 --- a/nexus/inventory/Cargo.toml +++ b/nexus/inventory/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] anyhow.workspace = true base64.workspace = true diff --git a/nexus/macros-common/Cargo.toml b/nexus/macros-common/Cargo.toml index 9d4390a6d2..6f7266a5a6 100644 --- a/nexus/macros-common/Cargo.toml +++ b/nexus/macros-common/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] proc-macro2.workspace = true syn = { workspace = true, features = ["extra-traits"] } diff --git a/nexus/metrics-producer-gc/Cargo.toml b/nexus/metrics-producer-gc/Cargo.toml index 9daa52b543..74d94e8d95 100644 --- a/nexus/metrics-producer-gc/Cargo.toml +++ b/nexus/metrics-producer-gc/Cargo.toml @@ -3,6 +3,9 @@ name = "nexus-metrics-producer-gc" version = "0.1.0" edition = "2021" +[lints] +workspace = true + [build-dependencies] omicron-rpaths.workspace = true diff --git a/nexus/networking/Cargo.toml b/nexus/networking/Cargo.toml index 11f6d83993..db163d5aa6 100644 --- a/nexus/networking/Cargo.toml +++ b/nexus/networking/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] futures.workspace = true ipnetwork.workspace = true diff --git a/nexus/reconfigurator/execution/Cargo.toml b/nexus/reconfigurator/execution/Cargo.toml index 2ea39d5a3e..137cde9255 100644 --- a/nexus/reconfigurator/execution/Cargo.toml +++ b/nexus/reconfigurator/execution/Cargo.toml @@ -3,6 +3,9 @@ name = "nexus-reconfigurator-execution" version = "0.1.0" edition = "2021" +[lints] +workspace = true + [build-dependencies] omicron-rpaths.workspace = true diff --git a/nexus/reconfigurator/planning/Cargo.toml b/nexus/reconfigurator/planning/Cargo.toml index d31832482d..ba935bdba0 100644 --- a/nexus/reconfigurator/planning/Cargo.toml +++ b/nexus/reconfigurator/planning/Cargo.toml @@ -3,6 +3,9 @@ name = "nexus-reconfigurator-planning" version = "0.1.0" edition = "2021" +[lints] +workspace = true + [dependencies] anyhow.workspace = true chrono.workspace = true diff --git a/nexus/reconfigurator/preparation/Cargo.toml b/nexus/reconfigurator/preparation/Cargo.toml index 4d9c087240..d7a6d07a5d 100644 --- a/nexus/reconfigurator/preparation/Cargo.toml +++ b/nexus/reconfigurator/preparation/Cargo.toml @@ -3,6 +3,9 @@ name = "nexus-reconfigurator-preparation" version = "0.1.0" edition = "2021" +[lints] +workspace = true + [dependencies] anyhow.workspace = true futures.workspace = true diff --git a/nexus/src/app/background/common.rs b/nexus/src/app/background/common.rs index e0d8f32316..0fbfa9938d 100644 --- a/nexus/src/app/background/common.rs +++ b/nexus/src/app/background/common.rs @@ -376,7 +376,7 @@ impl TaskExec { self.activate(ActivationReason::Signaled).await; } - _ = dependencies.next(), if dependencies.len() > 0 => { + _ = dependencies.next(), if !dependencies.is_empty() => { self.activate(ActivationReason::Dependency).await; } } diff --git a/nexus/src/app/instance_network.rs b/nexus/src/app/instance_network.rs index 2c258c8064..30bea98cc6 100644 --- a/nexus/src/app/instance_network.rs +++ b/nexus/src/app/instance_network.rs @@ -1147,7 +1147,7 @@ pub(crate) async fn probe_delete_dpd_config( }; } - if let Some(e) = errors.into_iter().nth(0) { + if let Some(e) = errors.into_iter().next() { return Err(e); } diff --git a/nexus/src/external_api/console_api.rs b/nexus/src/external_api/console_api.rs index daaf6a986d..d49e7f3be4 100644 --- a/nexus/src/external_api/console_api.rs +++ b/nexus/src/external_api/console_api.rs @@ -8,6 +8,19 @@ //! external API, but in order to avoid CORS issues for now, we are serving //! these routes directly from the external API. +// `HeaderName` and `HeaderValue` contain `bytes::Bytes`, which trips +// the `declare_interior_mutable_const` lint. But in a `const fn` +// context, the `AtomicPtr` that is used in `Bytes` only ever points +// to a `&'static str`, so does not have interior mutability in that +// context. +// +// A Clippy bug means that even if you ignore interior mutability of +// `Bytes` (the default behavior), it will still not ignore it for types +// where the only interior mutability is through `Bytes`. This is fixed +// in rust-lang/rust-clippy#12691, which should land in the Rust 1.80 +// toolchain; we can remove this attribute then. +#![allow(clippy::declare_interior_mutable_const)] + use crate::ServerContext; use anyhow::Context; use camino::{Utf8Path, Utf8PathBuf}; diff --git a/nexus/src/lib.rs b/nexus/src/lib.rs index 4dfb91c4e0..e34b694e52 100644 --- a/nexus/src/lib.rs +++ b/nexus/src/lib.rs @@ -9,8 +9,6 @@ #![allow(rustdoc::private_intra_doc_links)] // TODO(#40): Remove this exception once resolved. #![allow(clippy::unnecessary_wraps)] -// Clippy's style lints are useful, but not worth running automatically. -#![allow(clippy::style)] pub mod app; // Public for documentation examples mod cidata; diff --git a/nexus/test-interface/Cargo.toml b/nexus/test-interface/Cargo.toml index 004ce28545..03e38d3687 100644 --- a/nexus/test-interface/Cargo.toml +++ b/nexus/test-interface/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] async-trait.workspace = true nexus-config.workspace = true diff --git a/nexus/test-utils-macros/Cargo.toml b/nexus/test-utils-macros/Cargo.toml index 5ed57b9c4a..d5094f84eb 100644 --- a/nexus/test-utils-macros/Cargo.toml +++ b/nexus/test-utils-macros/Cargo.toml @@ -7,6 +7,9 @@ license = "MPL-2.0" [lib] proc-macro = true +[lints] +workspace = true + [dependencies] quote.workspace = true syn = { workspace = true, features = [ "fold", "parsing" ] } diff --git a/nexus/test-utils/Cargo.toml b/nexus/test-utils/Cargo.toml index bd066cc4df..0eab038f91 100644 --- a/nexus/test-utils/Cargo.toml +++ b/nexus/test-utils/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] anyhow.workspace = true bytes.workspace = true diff --git a/nexus/types/Cargo.toml b/nexus/types/Cargo.toml index a67b639197..372cee858a 100644 --- a/nexus/types/Cargo.toml +++ b/nexus/types/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] anyhow.workspace = true chrono.workspace = true diff --git a/oximeter/collector/Cargo.toml b/oximeter/collector/Cargo.toml index b7dac716c6..01f484f5f4 100644 --- a/oximeter/collector/Cargo.toml +++ b/oximeter/collector/Cargo.toml @@ -5,6 +5,9 @@ edition = "2021" description = "The oximeter metric collection server" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] anyhow.workspace = true camino.workspace = true diff --git a/oximeter/db/Cargo.toml b/oximeter/db/Cargo.toml index c86060b909..b1c394b219 100644 --- a/oximeter/db/Cargo.toml +++ b/oximeter/db/Cargo.toml @@ -5,6 +5,9 @@ edition = "2021" description = "Tools for interacting with the Oxide control plane telemetry database" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] anyhow.workspace = true async-recursion = "1.1.0" diff --git a/oximeter/instruments/Cargo.toml b/oximeter/instruments/Cargo.toml index c49d3b976e..a04e26fdaa 100644 --- a/oximeter/instruments/Cargo.toml +++ b/oximeter/instruments/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] cfg-if = { workspace = true, optional = true } chrono = { workspace = true, optional = true } diff --git a/oximeter/oximeter-macro-impl/Cargo.toml b/oximeter/oximeter-macro-impl/Cargo.toml index df9ed547ed..d0a8c5f566 100644 --- a/oximeter/oximeter-macro-impl/Cargo.toml +++ b/oximeter/oximeter-macro-impl/Cargo.toml @@ -8,6 +8,9 @@ license = "MPL-2.0" [lib] proc-macro = true +[lints] +workspace = true + [dependencies] proc-macro2.workspace = true quote.workspace = true diff --git a/oximeter/oximeter/Cargo.toml b/oximeter/oximeter/Cargo.toml index b545c697de..2445e0483a 100644 --- a/oximeter/oximeter/Cargo.toml +++ b/oximeter/oximeter/Cargo.toml @@ -5,6 +5,9 @@ authors = ["Benjamin Naecker "] edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] bytes = { workspace = true, features = [ "serde" ] } chrono.workspace = true diff --git a/oximeter/producer/Cargo.toml b/oximeter/producer/Cargo.toml index b0df929c3b..dfac555a49 100644 --- a/oximeter/producer/Cargo.toml +++ b/oximeter/producer/Cargo.toml @@ -5,6 +5,9 @@ edition = "2021" description = "Crate for producing metric data to be collected by the Oxide control plane" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] chrono.workspace = true dropshot.workspace = true diff --git a/package/Cargo.toml b/package/Cargo.toml index 8067473aa0..4632e66731 100644 --- a/package/Cargo.toml +++ b/package/Cargo.toml @@ -5,6 +5,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] anyhow.workspace = true camino.workspace = true diff --git a/passwords/Cargo.toml b/passwords/Cargo.toml index bb411a9449..eda3a020dc 100644 --- a/passwords/Cargo.toml +++ b/passwords/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] argon2 = { version = "0.5.3", features = ["alloc", "password-hash", "rand", "std"] } rand.workspace = true diff --git a/rpaths/Cargo.toml b/rpaths/Cargo.toml index 45e6c9b925..5e54e9e87b 100644 --- a/rpaths/Cargo.toml +++ b/rpaths/Cargo.toml @@ -4,5 +4,8 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] omicron-workspace-hack.workspace = true diff --git a/sled-agent/Cargo.toml b/sled-agent/Cargo.toml index 998d83725a..52533016dc 100644 --- a/sled-agent/Cargo.toml +++ b/sled-agent/Cargo.toml @@ -5,6 +5,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] anyhow.workspace = true async-trait.workspace = true diff --git a/sled-agent/src/lib.rs b/sled-agent/src/lib.rs index a4686bdb88..989f011ed8 100644 --- a/sled-agent/src/lib.rs +++ b/sled-agent/src/lib.rs @@ -7,8 +7,6 @@ // We only use rustdoc for internal documentation, including private items, so // it's expected that we'll have links to private items in the docs. #![allow(rustdoc::private_intra_doc_links)] -// Clippy's style lints are useful, but not worth running automatically. -#![allow(clippy::style)] // Module for executing the simulated sled agent. pub mod sim; diff --git a/sled-agent/src/params.rs b/sled-agent/src/params.rs index a51443af70..2ed7ca5528 100644 --- a/sled-agent/src/params.rs +++ b/sled-agent/src/params.rs @@ -610,7 +610,7 @@ impl From for sled_agent_client::types::OmicronZoneType { domain, ntp_servers, snat_cfg, - nic: nic, + nic, }, OmicronZoneType::Clickhouse { address, dataset } => { Other::Clickhouse { @@ -646,7 +646,7 @@ impl From for sled_agent_client::types::OmicronZoneType { dataset: dataset.into(), http_address: http_address.to_string(), dns_address: dns_address.to_string(), - nic: nic, + nic, }, OmicronZoneType::InternalDns { dataset, @@ -683,7 +683,7 @@ impl From for sled_agent_client::types::OmicronZoneType { external_ip, external_tls, internal_address: internal_address.to_string(), - nic: nic, + nic, }, OmicronZoneType::Oximeter { address } => { Other::Oximeter { address: address.to_string() } diff --git a/sled-agent/src/rack_setup/config.rs b/sled-agent/src/rack_setup/config.rs index 91cdc5c9b5..9fe62d3582 100644 --- a/sled-agent/src/rack_setup/config.rs +++ b/sled-agent/src/rack_setup/config.rs @@ -233,7 +233,7 @@ mod test { let read_cfg = SetupServiceConfig::from_file(&cfg_path) .expect("failed to read generated config with certificate"); assert_eq!(read_cfg.external_certificates.len(), 1); - let cert = read_cfg.external_certificates.iter().next().unwrap(); + let cert = read_cfg.external_certificates.first().unwrap(); let _ = rcgen::KeyPair::from_pem(&cert.key) .expect("generated PEM did not parse as KeyPair"); } diff --git a/sled-agent/src/rack_setup/service.rs b/sled-agent/src/rack_setup/service.rs index 2a3e7b2de8..529fe833ff 100644 --- a/sled-agent/src/rack_setup/service.rs +++ b/sled-agent/src/rack_setup/service.rs @@ -531,7 +531,7 @@ impl ServiceInner { } }) .collect(); - if dns_addrs.len() > 0 { + if !dns_addrs.is_empty() { Some(dns_addrs) } else { None diff --git a/sled-agent/src/swap_device.rs b/sled-agent/src/swap_device.rs index 6a00b42672..7dadf62434 100644 --- a/sled-agent/src/swap_device.rs +++ b/sled-agent/src/swap_device.rs @@ -62,7 +62,7 @@ pub(crate) fn ensure_swap_device( assert!(size_gb > 0); let devs = swapctl::list_swap_devices()?; - if devs.len() > 0 { + if !devs.is_empty() { if devs.len() > 1 { // This should really never happen unless we've made a mistake, but it's // probably fine to have more than one swap device. Thus, don't panic @@ -450,7 +450,7 @@ mod swapctl { let path = String::from_utf8_lossy(p.to_bytes()).to_string(); devices.push(SwapDevice { - path: path, + path, start: e.ste_start as u64, length: e.ste_length as u64, total_pages: e.ste_pages as u64, @@ -473,8 +473,8 @@ mod swapctl { SwapDeviceError::AddDevice { msg: format!("could not convert path to CString: {}", e,), path: path_cp.clone(), - start: start, - length: length, + start, + length, } })?; @@ -490,8 +490,8 @@ mod swapctl { SwapDeviceError::AddDevice { msg: e.to_string(), path: path_cp, - start: start, - length: length, + start, + length, } })? }; diff --git a/sled-hardware/Cargo.toml b/sled-hardware/Cargo.toml index e36f1f0914..df2eb36071 100644 --- a/sled-hardware/Cargo.toml +++ b/sled-hardware/Cargo.toml @@ -5,6 +5,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] anyhow.workspace = true camino.workspace = true diff --git a/sled-hardware/types/Cargo.toml b/sled-hardware/types/Cargo.toml index d6eefa49ac..3b73728ca5 100644 --- a/sled-hardware/types/Cargo.toml +++ b/sled-hardware/types/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] illumos-utils.workspace = true omicron-common.workspace = true diff --git a/sled-storage/Cargo.toml b/sled-storage/Cargo.toml index e0e4712330..2439c52aa7 100644 --- a/sled-storage/Cargo.toml +++ b/sled-storage/Cargo.toml @@ -3,6 +3,9 @@ name = "sled-storage" version = "0.1.0" edition = "2021" +[lints] +workspace = true + [dependencies] anyhow.workspace = true async-trait.workspace = true diff --git a/sp-sim/Cargo.toml b/sp-sim/Cargo.toml index 07d956e41e..35cb791f4c 100644 --- a/sp-sim/Cargo.toml +++ b/sp-sim/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] anyhow.workspace = true async-trait.workspace = true diff --git a/test-utils/Cargo.toml b/test-utils/Cargo.toml index 56e3be2efd..f63de32e2e 100644 --- a/test-utils/Cargo.toml +++ b/test-utils/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] anyhow.workspace = true atomicwrites.workspace = true diff --git a/tufaceous-lib/Cargo.toml b/tufaceous-lib/Cargo.toml index 7f67d21f35..e448ed6db5 100644 --- a/tufaceous-lib/Cargo.toml +++ b/tufaceous-lib/Cargo.toml @@ -5,6 +5,9 @@ edition = "2021" license = "MPL-2.0" publish = false +[lints] +workspace = true + [dependencies] anyhow = { workspace = true, features = ["backtrace"] } async-trait.workspace = true diff --git a/tufaceous/Cargo.toml b/tufaceous/Cargo.toml index b911c85b81..5b36daf113 100644 --- a/tufaceous/Cargo.toml +++ b/tufaceous/Cargo.toml @@ -5,6 +5,9 @@ edition = "2021" license = "MPL-2.0" publish = false +[lints] +workspace = true + [dependencies] anyhow = { workspace = true, features = ["backtrace"] } camino.workspace = true diff --git a/typed-rng/Cargo.toml b/typed-rng/Cargo.toml index c6f5270489..ee0a292116 100644 --- a/typed-rng/Cargo.toml +++ b/typed-rng/Cargo.toml @@ -3,6 +3,9 @@ name = "typed-rng" version = "0.1.0" edition = "2021" +[lints] +workspace = true + [dependencies] newtype-uuid.workspace = true omicron-workspace-hack.workspace = true diff --git a/update-common/Cargo.toml b/update-common/Cargo.toml index 37542baa8f..96675d47d7 100644 --- a/update-common/Cargo.toml +++ b/update-common/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] anyhow.workspace = true bytes.workspace = true diff --git a/update-engine/Cargo.toml b/update-engine/Cargo.toml index 5bc3672f54..5c8343a432 100644 --- a/update-engine/Cargo.toml +++ b/update-engine/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] anyhow.workspace = true cancel-safe-futures.workspace = true diff --git a/uuid-kinds/Cargo.toml b/uuid-kinds/Cargo.toml index bbe3fd3eea..e39017c2bf 100644 --- a/uuid-kinds/Cargo.toml +++ b/uuid-kinds/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + # The dependencies and features are written so as to make it easy for no-std # code to import omicron-uuid-kinds. All the features below are turned on # within omicron. diff --git a/wicket-common/Cargo.toml b/wicket-common/Cargo.toml index 385cd5ab0a..39efc2ce20 100644 --- a/wicket-common/Cargo.toml +++ b/wicket-common/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] anyhow.workspace = true omicron-common.workspace = true diff --git a/wicket-dbg/Cargo.toml b/wicket-dbg/Cargo.toml index f42ed335c8..5ea39dab37 100644 --- a/wicket-dbg/Cargo.toml +++ b/wicket-dbg/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] anyhow.workspace = true bytes.workspace = true diff --git a/wicket/Cargo.toml b/wicket/Cargo.toml index 96689e359a..a443232aeb 100644 --- a/wicket/Cargo.toml +++ b/wicket/Cargo.toml @@ -6,6 +6,9 @@ edition = "2021" license = "MPL-2.0" default-run = "wicket" +[lints] +workspace = true + [dependencies] anyhow.workspace = true buf-list.workspace = true diff --git a/wicketd/Cargo.toml b/wicketd/Cargo.toml index c440a73397..fe0fa27e15 100644 --- a/wicketd/Cargo.toml +++ b/wicketd/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] anyhow.workspace = true async-trait.workspace = true diff --git a/workspace-hack/Cargo.toml b/workspace-hack/Cargo.toml index 4222d6141a..d15a2242be 100644 --- a/workspace-hack/Cargo.toml +++ b/workspace-hack/Cargo.toml @@ -9,6 +9,9 @@ description = "workspace-hack package, managed by hakari" # You can choose to publish this crate: see https://docs.rs/cargo-hakari/latest/cargo_hakari/publishing. publish = false +[lints] +workspace = true + # The parts of the file between the BEGIN HAKARI SECTION and END HAKARI SECTION comments # are managed by hakari. diff --git a/zone-setup/Cargo.toml b/zone-setup/Cargo.toml index 6ee89e5302..dec4f87900 100644 --- a/zone-setup/Cargo.toml +++ b/zone-setup/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] anyhow.workspace = true clap.workspace = true From 25bcfecdc1c5b7f655dbc28b669fecbe6dddb9a4 Mon Sep 17 00:00:00 2001 From: Luqman Aden Date: Wed, 8 May 2024 18:00:52 -0700 Subject: [PATCH 10/17] [ci] undo workaround for amd-host-image-builder breakage (#5712) Remove workaround for https://github.com/oxidecomputer/amd-host-image-builder/issues/181 added in https://github.com/oxidecomputer/omicron/pull/5649. --- .github/buildomat/jobs/host-image.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/buildomat/jobs/host-image.sh b/.github/buildomat/jobs/host-image.sh index 584214681a..2f4d146a48 100755 --- a/.github/buildomat/jobs/host-image.sh +++ b/.github/buildomat/jobs/host-image.sh @@ -49,7 +49,6 @@ source "$TOP/tools/include/force-git-over-https.sh" HELIOSDIR=/work/helios git clone https://github.com/oxidecomputer/helios.git "$HELIOSDIR" cd "$HELIOSDIR" -git checkout pin-amd-host-image-builder # Record the branch and commit in the output git status --branch --porcelain=2 # Setting BUILD_OS to no makes setup skip repositories we don't need for From 18710cda880a9d794d9867ad0a39c0e5ec03f0cd Mon Sep 17 00:00:00 2001 From: "oxide-renovate[bot]" <146848827+oxide-renovate[bot]@users.noreply.github.com> Date: Thu, 9 May 2024 05:50:12 +0000 Subject: [PATCH 11/17] Update actions/checkout digest to 44c2b7a (#5630) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [actions/checkout](https://togithub.com/actions/checkout) | action | digest | [`1d96c77` -> `44c2b7a`](https://togithub.com/actions/checkout/compare/1d96c77...44c2b7a) | --- ### Configuration 📅 **Schedule**: Branch creation - "after 8pm,before 6am" in timezone America/Los_Angeles, Automerge - "after 8pm,before 6am" in timezone America/Los_Angeles. 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://togithub.com/renovatebot/renovate). Co-authored-by: oxide-renovate[bot] <146848827+oxide-renovate[bot]@users.noreply.github.com> --- .github/workflows/hakari.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/hakari.yml b/.github/workflows/hakari.yml index 8624c5ee99..6202990dc1 100644 --- a/.github/workflows/hakari.yml +++ b/.github/workflows/hakari.yml @@ -17,7 +17,7 @@ jobs: env: RUSTFLAGS: -D warnings steps: - - uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4 + - uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4 with: ref: ${{ github.event.pull_request.head.sha }} # see omicron#4461 - uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1 From 4dda5cbba6c7bd4d47df79cf0001a7873abd21b8 Mon Sep 17 00:00:00 2001 From: "oxide-renovate[bot]" <146848827+oxide-renovate[bot]@users.noreply.github.com> Date: Thu, 9 May 2024 07:22:52 +0000 Subject: [PATCH 12/17] Update taiki-e/install-action digest to 3342907 (#5723) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [taiki-e/install-action](https://togithub.com/taiki-e/install-action) | action | digest | [`00a6732` -> `3342907`](https://togithub.com/taiki-e/install-action/compare/00a6732...3342907) | --- ### Configuration 📅 **Schedule**: Branch creation - "after 8pm,before 6am" in timezone America/Los_Angeles, Automerge - "after 8pm,before 6am" in timezone America/Los_Angeles. 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://togithub.com/renovatebot/renovate). Co-authored-by: oxide-renovate[bot] <146848827+oxide-renovate[bot]@users.noreply.github.com> --- .github/workflows/hakari.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/hakari.yml b/.github/workflows/hakari.yml index 6202990dc1..723cdef92a 100644 --- a/.github/workflows/hakari.yml +++ b/.github/workflows/hakari.yml @@ -24,7 +24,7 @@ jobs: with: toolchain: stable - name: Install cargo-hakari - uses: taiki-e/install-action@00a67321d66e038602baf558d366a594a7019ea2 # v2 + uses: taiki-e/install-action@33429073072b7cebf2bbb9807209561b3d1decf7 # v2 with: tool: cargo-hakari - name: Check workspace-hack Cargo.toml is up-to-date From 4c9f2832bd29c9aa52b438923f5f5970369a7df3 Mon Sep 17 00:00:00 2001 From: bnaecker Date: Fri, 10 May 2024 09:25:54 -0700 Subject: [PATCH 13/17] Check full source IP allow-list, not just the last entry (#5729) - Add regression test for #5727 - Fix the test --- nexus/src/app/allow_list.rs | 2 +- nexus/tests/integration_tests/allow_list.rs | 122 ++++++++++++++++++++ nexus/tests/integration_tests/mod.rs | 1 + 3 files changed, 124 insertions(+), 1 deletion(-) create mode 100644 nexus/tests/integration_tests/allow_list.rs diff --git a/nexus/src/app/allow_list.rs b/nexus/src/app/allow_list.rs index b113ed886b..8f53db68a2 100644 --- a/nexus/src/app/allow_list.rs +++ b/nexus/src/app/allow_list.rs @@ -52,7 +52,7 @@ impl super::Nexus { // the rack! let mut contains_remote = false; for entry in list.iter() { - contains_remote = entry.contains(remote_addr); + contains_remote |= entry.contains(remote_addr); if entry.ip().is_unspecified() { return Err(Error::invalid_request( "Source IP allowlist may not contain the \ diff --git a/nexus/tests/integration_tests/allow_list.rs b/nexus/tests/integration_tests/allow_list.rs new file mode 100644 index 0000000000..319696b5f5 --- /dev/null +++ b/nexus/tests/integration_tests/allow_list.rs @@ -0,0 +1,122 @@ +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. + +//! Integration tests for IP allow list endpoints. + +use dropshot::test_util::ClientTestContext; +use nexus_test_utils::http_testing::{AuthnMode, NexusRequest}; +use nexus_test_utils_macros::nexus_test; +use nexus_types::external_api::{params, views}; +use omicron_common::api::external::AllowedSourceIps; +use std::net::IpAddr; +use std::net::Ipv4Addr; + +type ControlPlaneTestContext = + nexus_test_utils::ControlPlaneTestContext; + +const URL: &str = "/v1/system/networking/allow-list"; + +#[nexus_test] +async fn test_allow_list(cptestctx: &ControlPlaneTestContext) { + let client = &cptestctx.external_client; + // We should start with the default of any. + let list: views::AllowList = NexusRequest::object_get(client, URL) + .authn_as(AuthnMode::PrivilegedUser) + .execute() + .await + .expect("failed to make GET request") + .parsed_body() + .unwrap(); + assert_eq!( + list.allowed_ips, + AllowedSourceIps::Any, + "Should start with the default allow list of Any" + ); + + // All these requests use localhost, which makes things pretty easy. + let our_addr = IpAddr::V4(Ipv4Addr::LOCALHOST); + + // Set the allowlist, and assert it's equal to what we set. + async fn update_list_and_compare( + client: &ClientTestContext, + allowed_ips: AllowedSourceIps, + ) { + let new_list = + params::AllowListUpdate { allowed_ips: allowed_ips.clone() }; + + // PUT the list, which returns it, and ensure we get back what we set. + let list: views::AllowList = + NexusRequest::object_put(client, URL, Some(&new_list)) + .authn_as(AuthnMode::PrivilegedUser) + .execute() + .await + .expect("failed to make PUT request") + .parsed_body() + .unwrap(); + assert_eq!( + list.allowed_ips, allowed_ips, + "Failed to update the allow list", + ); + + // GET it as well. + let get_list: views::AllowList = NexusRequest::object_get(client, URL) + .authn_as(AuthnMode::PrivilegedUser) + .execute() + .await + .expect("failed to make GET request") + .parsed_body() + .unwrap(); + assert_eq!( + list.allowed_ips, get_list.allowed_ips, + "List returned from PUT and GET should be the same", + ); + } + + // Set the list with exactly one IP, make sure it's the same. + let allowed_ips = AllowedSourceIps::try_from(vec![our_addr.into()]) + .expect("Expected a valid IP list"); + update_list_and_compare(client, allowed_ips).await; + + // Add our IP in the front and end, and still make sure that works. + // + // This is a regression for + // https://github.com/oxidecomputer/omicron/issues/5727. + let addrs = + vec![our_addr.into(), IpAddr::V4(Ipv4Addr::new(10, 0, 0, 1)).into()]; + let allowed_ips = AllowedSourceIps::try_from(addrs.clone()) + .expect("Expected a valid IP list"); + update_list_and_compare(client, allowed_ips).await; + + let addrs = addrs.into_iter().rev().collect::>(); + let allowed_ips = + AllowedSourceIps::try_from(addrs).expect("Expected a valid IP list"); + update_list_and_compare(client, allowed_ips).await; + + // Set back to any + update_list_and_compare(client, AllowedSourceIps::Any).await; + + // Check that we cannot make the request with a list that doesn't include + // us. + let addrs = vec![IpAddr::V4(Ipv4Addr::new(1, 1, 1, 1)).into()]; + let allowed_ips = AllowedSourceIps::try_from(addrs.clone()) + .expect("Expected a valid IP list"); + let new_list = params::AllowListUpdate { allowed_ips }; + let err: dropshot::HttpErrorResponseBody = + NexusRequest::expect_failure_with_body( + client, + http::StatusCode::BAD_REQUEST, + http::Method::PUT, + URL, + &new_list, + ) + .authn_as(AuthnMode::PrivilegedUser) + .execute() + .await + .expect("failed to make PUT request") + .parsed_body() + .expect("failed to parse error response"); + assert!(err + .message + .contains("would prevent access from the current client")); +} diff --git a/nexus/tests/integration_tests/mod.rs b/nexus/tests/integration_tests/mod.rs index 80a5534790..5054527c63 100644 --- a/nexus/tests/integration_tests/mod.rs +++ b/nexus/tests/integration_tests/mod.rs @@ -4,6 +4,7 @@ //! the way it is. mod address_lots; +mod allow_list; mod authn_http; mod authz; mod basic; From de09dec19b30cb288f2d890127b08d667e7d7a4c Mon Sep 17 00:00:00 2001 From: "oxide-renovate[bot]" <146848827+oxide-renovate[bot]@users.noreply.github.com> Date: Fri, 10 May 2024 10:03:42 -0700 Subject: [PATCH 14/17] Update Rust crate anstyle to 1.0.7 (#5724) --- Cargo.lock | 7 +++---- Cargo.toml | 2 +- workspace-hack/Cargo.toml | 2 -- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a362c64eef..450bacbdd4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -117,9 +117,9 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.6" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8901269c6307e8d93993578286ac0edf7f195079ffff5ebdeea6a59ffb7e36bc" +checksum = "038dfcf04a5feb68e9c60b21c9625a54c2c0616e79b72b0fd87075a056ae1d1b" [[package]] name = "anstyle-parse" @@ -3296,7 +3296,7 @@ dependencies = [ "httpdate", "itoa", "pin-project-lite", - "socket2 0.4.9", + "socket2 0.5.6", "tokio", "tower-service", "tracing", @@ -5822,7 +5822,6 @@ dependencies = [ "sha2", "similar", "slog", - "socket2 0.5.6", "spin 0.9.8", "string_cache", "subtle", diff --git a/Cargo.toml b/Cargo.toml index db5060184b..4a9fae293e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -206,7 +206,7 @@ cast_lossless = "warn" [workspace.dependencies] anyhow = "1.0" -anstyle = "1.0.6" +anstyle = "1.0.7" api_identity = { path = "api_identity" } approx = "0.5.1" assert_matches = "1.5.0" diff --git a/workspace-hack/Cargo.toml b/workspace-hack/Cargo.toml index d15a2242be..891595551a 100644 --- a/workspace-hack/Cargo.toml +++ b/workspace-hack/Cargo.toml @@ -99,7 +99,6 @@ serde_json = { version = "1.0.116", features = ["raw_value", "unbounded_depth"] sha2 = { version = "0.10.8", features = ["oid"] } similar = { version = "2.4.0", features = ["inline", "unicode"] } slog = { version = "2.7.0", features = ["dynamic-keys", "max_level_trace", "release_max_level_debug", "release_max_level_trace"] } -socket2 = { version = "0.5.6", default-features = false, features = ["all"] } spin = { version = "0.9.8" } string_cache = { version = "0.8.7" } subtle = { version = "2.5.0" } @@ -207,7 +206,6 @@ serde_json = { version = "1.0.116", features = ["raw_value", "unbounded_depth"] sha2 = { version = "0.10.8", features = ["oid"] } similar = { version = "2.4.0", features = ["inline", "unicode"] } slog = { version = "2.7.0", features = ["dynamic-keys", "max_level_trace", "release_max_level_debug", "release_max_level_trace"] } -socket2 = { version = "0.5.6", default-features = false, features = ["all"] } spin = { version = "0.9.8" } string_cache = { version = "0.8.7" } subtle = { version = "2.5.0" } From ebf883b8b6a1487fe16f5cecbd354a1e67c7e9a9 Mon Sep 17 00:00:00 2001 From: "oxide-renovate[bot]" <146848827+oxide-renovate[bot]@users.noreply.github.com> Date: Fri, 10 May 2024 10:05:40 -0700 Subject: [PATCH 15/17] Update Rust crate peg to 0.8.3 (#5650) --- Cargo.lock | 12 ++++++------ Cargo.toml | 2 +- workspace-hack/Cargo.toml | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 450bacbdd4..44c676bb37 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6499,9 +6499,9 @@ checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" [[package]] name = "peg" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "400bcab7d219c38abf8bd7cc2054eb9bbbd4312d66f6a5557d572a203f646f61" +checksum = "8a625d12ad770914cbf7eff6f9314c3ef803bfe364a1b20bc36ddf56673e71e5" dependencies = [ "peg-macros", "peg-runtime", @@ -6509,9 +6509,9 @@ dependencies = [ [[package]] name = "peg-macros" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46e61cce859b76d19090f62da50a9fe92bab7c2a5f09e183763559a2ac392c90" +checksum = "f241d42067ed3ab6a4fece1db720838e1418f36d868585a27931f95d6bc03582" dependencies = [ "peg-runtime", "proc-macro2", @@ -6520,9 +6520,9 @@ dependencies = [ [[package]] name = "peg-runtime" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36bae92c60fa2398ce4678b98b2c4b5a7c61099961ca1fa305aec04a9ad28922" +checksum = "e3aeb8f54c078314c2065ee649a7241f46b9d8e418e1a9581ba0546657d7aa3a" [[package]] name = "pem" diff --git a/Cargo.toml b/Cargo.toml index 4a9fae293e..7f778c0197 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -369,7 +369,7 @@ partial-io = { version = "0.5.4", features = ["proptest1", "tokio1"] } parse-size = "1.0.0" paste = "1.0.14" percent-encoding = "2.3.1" -peg = "0.8.2" +peg = "0.8.3" pem = "3.0" petgraph = "0.6.4" postgres-protocol = "0.6.6" diff --git a/workspace-hack/Cargo.toml b/workspace-hack/Cargo.toml index 891595551a..21e7779efe 100644 --- a/workspace-hack/Cargo.toml +++ b/workspace-hack/Cargo.toml @@ -78,7 +78,7 @@ num-integer = { version = "0.1.46", features = ["i128"] } num-iter = { version = "0.1.44", default-features = false, features = ["i128"] } num-traits = { version = "0.2.18", features = ["i128", "libm"] } openapiv3 = { version = "2.0.0", default-features = false, features = ["skip_serializing_defaults"] } -peg-runtime = { version = "0.8.2", default-features = false, features = ["std"] } +peg-runtime = { version = "0.8.3", default-features = false, features = ["std"] } pem-rfc7468 = { version = "0.7.0", default-features = false, features = ["std"] } petgraph = { version = "0.6.4", features = ["serde-1"] } postgres-types = { version = "0.2.6", default-features = false, features = ["with-chrono-0_4", "with-serde_json-1", "with-uuid-1"] } @@ -185,7 +185,7 @@ num-integer = { version = "0.1.46", features = ["i128"] } num-iter = { version = "0.1.44", default-features = false, features = ["i128"] } num-traits = { version = "0.2.18", features = ["i128", "libm"] } openapiv3 = { version = "2.0.0", default-features = false, features = ["skip_serializing_defaults"] } -peg-runtime = { version = "0.8.2", default-features = false, features = ["std"] } +peg-runtime = { version = "0.8.3", default-features = false, features = ["std"] } pem-rfc7468 = { version = "0.7.0", default-features = false, features = ["std"] } petgraph = { version = "0.6.4", features = ["serde-1"] } postgres-types = { version = "0.2.6", default-features = false, features = ["with-chrono-0_4", "with-serde_json-1", "with-uuid-1"] } From 60bea400f03740e6fff359e55e10d3543ecf7807 Mon Sep 17 00:00:00 2001 From: Adam Leventhal Date: Fri, 10 May 2024 10:07:14 -0700 Subject: [PATCH 16/17] update dropshot / typify / progenitor (#5721) --- Cargo.lock | 113 ++++++++++++++++++++++------------- openapi/bootstrap-agent.json | 3 + openapi/nexus-internal.json | 3 + openapi/sled-agent.json | 3 + openapi/wicketd.json | 3 + workspace-hack/Cargo.toml | 12 ++-- 6 files changed, 89 insertions(+), 48 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 44c676bb37..852dc29ba2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -416,9 +416,9 @@ checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" [[package]] name = "base64" -version = "0.22.0" +version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9475866fec1451be56a3c2400fd081ff546538961565ccb5b7142cbd22bc7a51" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] name = "base64ct" @@ -2044,12 +2044,12 @@ dependencies = [ [[package]] name = "dropshot" -version = "0.9.1-dev" -source = "git+https://github.com/oxidecomputer/dropshot?branch=main#29ae98d1f909c6832661408a4c03f929e8afa6e9" +version = "0.10.1-dev" +source = "git+https://github.com/oxidecomputer/dropshot?branch=main#283d8978abfcfa9b720a155b18cc124c82cb29c9" dependencies = [ "async-stream", "async-trait", - "base64 0.21.7", + "base64 0.22.1", "bytes", "camino", "chrono", @@ -2057,7 +2057,7 @@ dependencies = [ "dropshot_endpoint", "form_urlencoded", "futures", - "hostname", + "hostname 0.4.0", "http 0.2.12", "hyper 0.14.28", "indexmap 2.2.6", @@ -2065,10 +2065,10 @@ dependencies = [ "openapiv3", "paste", "percent-encoding", - "proc-macro2", "rustls 0.22.4", "rustls-pemfile 2.1.2", "schemars", + "scopeguard", "serde", "serde_json", "serde_path_to_error", @@ -2082,7 +2082,7 @@ dependencies = [ "tokio", "tokio-rustls 0.25.0", "toml 0.8.12", - "usdt 0.3.5", + "usdt 0.5.0", "uuid", "version_check", "waitgroup", @@ -2090,8 +2090,8 @@ dependencies = [ [[package]] name = "dropshot_endpoint" -version = "0.9.1-dev" -source = "git+https://github.com/oxidecomputer/dropshot?branch=main#29ae98d1f909c6832661408a4c03f929e8afa6e9" +version = "0.10.1-dev" +source = "git+https://github.com/oxidecomputer/dropshot?branch=main#283d8978abfcfa9b720a155b18cc124c82cb29c9" dependencies = [ "proc-macro2", "quote", @@ -2239,7 +2239,7 @@ dependencies = [ "anstyle", "anyhow", "async-trait", - "base64 0.22.0", + "base64 0.22.1", "chrono", "clap", "colored", @@ -2696,7 +2696,7 @@ dependencies = [ name = "gateway-client" version = "0.1.0" dependencies = [ - "base64 0.22.0", + "base64 0.22.1", "chrono", "gateway-messages", "omicron-workspace-hack", @@ -3131,6 +3131,17 @@ dependencies = [ "winapi", ] +[[package]] +name = "hostname" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9c7c7c8ac16c798734b8a24560c1362120597c40d5e1459f09498f8f6c8f2ba" +dependencies = [ + "cfg-if", + "libc", + "windows 0.52.0", +] + [[package]] name = "http" version = "0.2.12" @@ -3417,7 +3428,7 @@ dependencies = [ "iana-time-zone-haiku", "js-sys", "wasm-bindgen", - "windows", + "windows 0.48.0", ] [[package]] @@ -4372,16 +4383,15 @@ dependencies = [ [[package]] name = "multer" -version = "3.0.0" +version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a15d522be0a9c3e46fd2632e272d178f56387bdb5c9fbb3a36c649062e9b5219" +checksum = "83e87776546dc87511aa5ee218730c92b666d7264ab6ed41f9d215af9cd5224b" dependencies = [ "bytes", "encoding_rs", "futures-util", "http 1.0.0", "httparse", - "log", "memchr", "mime", "spin 0.9.8", @@ -4560,7 +4570,7 @@ dependencies = [ "async-bb8-diesel", "async-trait", "authz-macros", - "base64 0.22.0", + "base64 0.22.1", "bb8", "camino", "camino-tempfile", @@ -4652,7 +4662,7 @@ name = "nexus-inventory" version = "0.1.0" dependencies = [ "anyhow", - "base64 0.22.0", + "base64 0.22.1", "chrono", "expectorate", "futures", @@ -4886,7 +4896,7 @@ version = "0.1.0" dependencies = [ "anyhow", "api_identity", - "base64 0.22.0", + "base64 0.22.1", "chrono", "clap", "dns-service-client", @@ -5310,7 +5320,7 @@ name = "omicron-gateway" version = "0.1.0" dependencies = [ "anyhow", - "base64 0.22.0", + "base64 0.22.1", "camino", "clap", "dropshot", @@ -5356,7 +5366,7 @@ dependencies = [ "assert_matches", "async-bb8-diesel", "async-trait", - "base64 0.22.0", + "base64 0.22.1", "buf-list", "bytes", "camino", @@ -5594,7 +5604,7 @@ dependencies = [ "anyhow", "assert_matches", "async-trait", - "base64 0.22.0", + "base64 0.22.1", "bootstore", "bootstrap-agent-client", "bytes", @@ -5740,7 +5750,6 @@ dependencies = [ "aho-corasick", "anyhow", "base16ct", - "base64 0.22.0", "bit-set", "bit-vec", "bitflags 1.3.2", @@ -5816,6 +5825,7 @@ dependencies = [ "ring 0.17.8", "rustix", "schemars", + "scopeguard", "semver 1.0.22", "serde", "serde_json", @@ -5839,7 +5849,7 @@ dependencies = [ "trust-dns-proto", "unicode-bidi", "unicode-normalization", - "usdt 0.3.5", + "usdt 0.5.0", "usdt-impl 0.5.0", "uuid", "yasna", @@ -6051,7 +6061,7 @@ name = "oxide-client" version = "0.1.0" dependencies = [ "anyhow", - "base64 0.22.0", + "base64 0.22.1", "chrono", "futures", "http 0.2.12", @@ -6530,7 +6540,7 @@ version = "3.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e459365e590736a54c3fa561947c84837534b8e9af6fc5bf781307e82658fae" dependencies = [ - "base64 0.22.0", + "base64 0.22.1", "serde", ] @@ -6978,7 +6988,7 @@ dependencies = [ [[package]] name = "progenitor" version = "0.6.0" -source = "git+https://github.com/oxidecomputer/progenitor?branch=main#0f0b1062f471f33d4d42273c03c4079f6ebf4ad9" +source = "git+https://github.com/oxidecomputer/progenitor?branch=main#0aeb3a723ec515561a93ab38ae4da5cbf071306f" dependencies = [ "progenitor-client", "progenitor-impl", @@ -6989,7 +6999,7 @@ dependencies = [ [[package]] name = "progenitor-client" version = "0.6.0" -source = "git+https://github.com/oxidecomputer/progenitor?branch=main#0f0b1062f471f33d4d42273c03c4079f6ebf4ad9" +source = "git+https://github.com/oxidecomputer/progenitor?branch=main#0aeb3a723ec515561a93ab38ae4da5cbf071306f" dependencies = [ "bytes", "futures-core", @@ -7003,7 +7013,7 @@ dependencies = [ [[package]] name = "progenitor-impl" version = "0.6.0" -source = "git+https://github.com/oxidecomputer/progenitor?branch=main#0f0b1062f471f33d4d42273c03c4079f6ebf4ad9" +source = "git+https://github.com/oxidecomputer/progenitor?branch=main#0aeb3a723ec515561a93ab38ae4da5cbf071306f" dependencies = [ "getopts", "heck 0.5.0", @@ -7025,7 +7035,7 @@ dependencies = [ [[package]] name = "progenitor-macro" version = "0.6.0" -source = "git+https://github.com/oxidecomputer/progenitor?branch=main#0f0b1062f471f33d4d42273c03c4079f6ebf4ad9" +source = "git+https://github.com/oxidecomputer/progenitor?branch=main#0aeb3a723ec515561a93ab38ae4da5cbf071306f" dependencies = [ "openapiv3", "proc-macro2", @@ -7630,7 +7640,7 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "52e44394d2086d010551b14b53b1f24e31647570cd1deb0379e2c21b329aba00" dependencies = [ - "hostname", + "hostname 0.3.1", "quick-error", ] @@ -7991,7 +8001,7 @@ version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "29993a25686778eb88d4189742cd713c9bce943bc54251a33509dc63cbacf73d" dependencies = [ - "base64 0.22.0", + "base64 0.22.1", "rustls-pki-types", ] @@ -8103,7 +8113,7 @@ version = "0.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5da862a2115c0767681e28309a367dbd0a2366026948aae0272787e582d71eaf" dependencies = [ - "base64 0.22.0", + "base64 0.22.1", "bindgen", "chrono", "data-encoding", @@ -8277,9 +8287,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.199" +version = "1.0.201" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c9f6e76df036c77cd94996771fb40db98187f096dd0b9af39c6c6e452ba966a" +checksum = "780f1cebed1629e4753a1a38a3c72d30b97ec044f0aef68cb26650a3c5cf363c" dependencies = [ "serde_derive", ] @@ -8324,9 +8334,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.199" +version = "1.0.201" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11bd257a6541e141e42ca6d24ae26f7714887b47e89aa739099104c7e4d3b7fc" +checksum = "c5e405930b9796f1c00bee880d03fc7e0bb4b9a11afc776885ffe84320da2865" dependencies = [ "proc-macro2", "quote", @@ -8762,7 +8772,7 @@ version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dcaaf6e68789d3f0411f1e72bc443214ef252a1038b6e344836e50442541f190" dependencies = [ - "hostname", + "hostname 0.3.1", "slog", "slog-json", "time", @@ -10240,7 +10250,7 @@ checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" [[package]] name = "typify" version = "0.0.16" -source = "git+https://github.com/oxidecomputer/typify#f7442947ca90eb97af6446a90e73600a7adc191b" +source = "git+https://github.com/oxidecomputer/typify#336a042b8242587f57c5e8ec3ac0e54d3610e59c" dependencies = [ "typify-impl", "typify-macro", @@ -10249,7 +10259,7 @@ dependencies = [ [[package]] name = "typify-impl" version = "0.0.16" -source = "git+https://github.com/oxidecomputer/typify#f7442947ca90eb97af6446a90e73600a7adc191b" +source = "git+https://github.com/oxidecomputer/typify#336a042b8242587f57c5e8ec3ac0e54d3610e59c" dependencies = [ "heck 0.5.0", "log", @@ -10266,7 +10276,7 @@ dependencies = [ [[package]] name = "typify-macro" version = "0.0.16" -source = "git+https://github.com/oxidecomputer/typify#f7442947ca90eb97af6446a90e73600a7adc191b" +source = "git+https://github.com/oxidecomputer/typify#336a042b8242587f57c5e8ec3ac0e54d3610e59c" dependencies = [ "proc-macro2", "quote", @@ -10949,7 +10959,7 @@ version = "0.1.0" dependencies = [ "anyhow", "async-trait", - "base64 0.22.0", + "base64 0.22.1", "bootstrap-agent-client", "buf-list", "bytes", @@ -11087,6 +11097,25 @@ dependencies = [ "windows-targets 0.48.5", ] +[[package]] +name = "windows" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be" +dependencies = [ + "windows-core", + "windows-targets 0.52.0", +] + +[[package]] +name = "windows-core" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" +dependencies = [ + "windows-targets 0.52.0", +] + [[package]] name = "windows-sys" version = "0.48.0" diff --git a/openapi/bootstrap-agent.json b/openapi/bootstrap-agent.json index 01811a0969..6ac9c034e2 100644 --- a/openapi/bootstrap-agent.json +++ b/openapi/bootstrap-agent.json @@ -648,6 +648,7 @@ ] }, "IpNetwork": { + "x-rust-type": "ipnetwork::IpNetwork", "oneOf": [ { "title": "v4", @@ -695,6 +696,7 @@ "pattern": "^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/([0-9]|1[0-9]|2[0-9]|3[0-2])$" }, "Ipv4Network": { + "x-rust-type": "ipnetwork::Ipv4Network", "type": "string", "pattern": "^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\/(3[0-2]|[0-2]?[0-9])$" }, @@ -724,6 +726,7 @@ "pattern": "^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\\/([0-9]|[1-9][0-9]|1[0-1][0-9]|12[0-8])$" }, "Ipv6Network": { + "x-rust-type": "ipnetwork::Ipv6Network", "type": "string", "pattern": "^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\")[/](12[0-8]|1[0-1][0-9]|[0-9]?[0-9])$" }, diff --git a/openapi/nexus-internal.json b/openapi/nexus-internal.json index 2fb0622266..82027aa90e 100644 --- a/openapi/nexus-internal.json +++ b/openapi/nexus-internal.json @@ -3194,6 +3194,7 @@ ] }, "IpNetwork": { + "x-rust-type": "ipnetwork::IpNetwork", "oneOf": [ { "title": "v4", @@ -3288,6 +3289,7 @@ "pattern": "^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/([0-9]|1[0-9]|2[0-9]|3[0-2])$" }, "Ipv4Network": { + "x-rust-type": "ipnetwork::Ipv4Network", "type": "string", "pattern": "^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\/(3[0-2]|[0-2]?[0-9])$" }, @@ -3317,6 +3319,7 @@ "pattern": "^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\\/([0-9]|[1-9][0-9]|1[0-1][0-9]|12[0-8])$" }, "Ipv6Network": { + "x-rust-type": "ipnetwork::Ipv6Network", "type": "string", "pattern": "^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\")[/](12[0-8]|1[0-1][0-9]|[0-9]?[0-9])$" }, diff --git a/openapi/sled-agent.json b/openapi/sled-agent.json index d4b625805d..77c4dd4170 100644 --- a/openapi/sled-agent.json +++ b/openapi/sled-agent.json @@ -3403,6 +3403,7 @@ ] }, "IpNetwork": { + "x-rust-type": "ipnetwork::IpNetwork", "oneOf": [ { "title": "v4", @@ -3430,6 +3431,7 @@ "pattern": "^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/([0-9]|1[0-9]|2[0-9]|3[0-2])$" }, "Ipv4Network": { + "x-rust-type": "ipnetwork::Ipv4Network", "type": "string", "pattern": "^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\/(3[0-2]|[0-2]?[0-9])$" }, @@ -3441,6 +3443,7 @@ "pattern": "^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\\/([0-9]|[1-9][0-9]|1[0-1][0-9]|12[0-8])$" }, "Ipv6Network": { + "x-rust-type": "ipnetwork::Ipv6Network", "type": "string", "pattern": "^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\")[/](12[0-8]|1[0-1][0-9]|[0-9]?[0-9])$" }, diff --git a/openapi/wicketd.json b/openapi/wicketd.json index 7444030595..934069fb54 100644 --- a/openapi/wicketd.json +++ b/openapi/wicketd.json @@ -1688,6 +1688,7 @@ ] }, "IpNetwork": { + "x-rust-type": "ipnetwork::IpNetwork", "oneOf": [ { "title": "v4", @@ -1735,6 +1736,7 @@ "pattern": "^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/([0-9]|1[0-9]|2[0-9]|3[0-2])$" }, "Ipv4Network": { + "x-rust-type": "ipnetwork::Ipv4Network", "type": "string", "pattern": "^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\/(3[0-2]|[0-2]?[0-9])$" }, @@ -1764,6 +1766,7 @@ "pattern": "^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\\/([0-9]|[1-9][0-9]|1[0-1][0-9]|12[0-8])$" }, "Ipv6Network": { + "x-rust-type": "ipnetwork::Ipv6Network", "type": "string", "pattern": "^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\")[/](12[0-8]|1[0-1][0-9]|[0-9]?[0-9])$" }, diff --git a/workspace-hack/Cargo.toml b/workspace-hack/Cargo.toml index 21e7779efe..2fecfa3a75 100644 --- a/workspace-hack/Cargo.toml +++ b/workspace-hack/Cargo.toml @@ -21,7 +21,6 @@ ahash = { version = "0.8.8" } aho-corasick = { version = "1.1.2" } anyhow = { version = "1.0.82", features = ["backtrace"] } base16ct = { version = "0.2.0", default-features = false, features = ["alloc"] } -base64 = { version = "0.22.0" } bit-set = { version = "0.5.3" } bit-vec = { version = "0.6.3" } bitflags-dff4ba8e3ae991db = { package = "bitflags", version = "1.3.2" } @@ -93,8 +92,9 @@ regex-syntax = { version = "0.8.2" } reqwest = { version = "0.11.27", features = ["blocking", "cookies", "json", "rustls-tls", "stream"] } ring = { version = "0.17.8", features = ["std"] } schemars = { version = "0.8.17", features = ["bytes", "chrono", "uuid1"] } +scopeguard = { version = "1.2.0" } semver = { version = "1.0.22", features = ["serde"] } -serde = { version = "1.0.199", features = ["alloc", "derive", "rc"] } +serde = { version = "1.0.201", features = ["alloc", "derive", "rc"] } serde_json = { version = "1.0.116", features = ["raw_value", "unbounded_depth"] } sha2 = { version = "0.10.8", features = ["oid"] } similar = { version = "2.4.0", features = ["inline", "unicode"] } @@ -115,7 +115,7 @@ tracing = { version = "0.1.40", features = ["log"] } trust-dns-proto = { version = "0.22.0" } unicode-bidi = { version = "0.3.15" } unicode-normalization = { version = "0.1.22" } -usdt = { version = "0.3.5" } +usdt = { version = "0.5.0" } usdt-impl = { version = "0.5.0", default-features = false, features = ["asm", "des"] } uuid = { version = "1.8.0", features = ["serde", "v4"] } yasna = { version = "0.5.2", features = ["bit-vec", "num-bigint", "std", "time"] } @@ -128,7 +128,6 @@ ahash = { version = "0.8.8" } aho-corasick = { version = "1.1.2" } anyhow = { version = "1.0.82", features = ["backtrace"] } base16ct = { version = "0.2.0", default-features = false, features = ["alloc"] } -base64 = { version = "0.22.0" } bit-set = { version = "0.5.3" } bit-vec = { version = "0.6.3" } bitflags-dff4ba8e3ae991db = { package = "bitflags", version = "1.3.2" } @@ -200,8 +199,9 @@ regex-syntax = { version = "0.8.2" } reqwest = { version = "0.11.27", features = ["blocking", "cookies", "json", "rustls-tls", "stream"] } ring = { version = "0.17.8", features = ["std"] } schemars = { version = "0.8.17", features = ["bytes", "chrono", "uuid1"] } +scopeguard = { version = "1.2.0" } semver = { version = "1.0.22", features = ["serde"] } -serde = { version = "1.0.199", features = ["alloc", "derive", "rc"] } +serde = { version = "1.0.201", features = ["alloc", "derive", "rc"] } serde_json = { version = "1.0.116", features = ["raw_value", "unbounded_depth"] } sha2 = { version = "0.10.8", features = ["oid"] } similar = { version = "2.4.0", features = ["inline", "unicode"] } @@ -223,7 +223,7 @@ tracing = { version = "0.1.40", features = ["log"] } trust-dns-proto = { version = "0.22.0" } unicode-bidi = { version = "0.3.15" } unicode-normalization = { version = "0.1.22" } -usdt = { version = "0.3.5" } +usdt = { version = "0.5.0" } usdt-impl = { version = "0.5.0", default-features = false, features = ["asm", "des"] } uuid = { version = "1.8.0", features = ["serde", "v4"] } yasna = { version = "0.5.2", features = ["bit-vec", "num-bigint", "std", "time"] } From 13163d19bd30b39b3646c4bb4227b1803691410d Mon Sep 17 00:00:00 2001 From: Eliza Weisman Date: Fri, 10 May 2024 11:54:45 -0700 Subject: [PATCH 17/17] [xtask] allow overriding `clippy` message format (#5714) Currently, I've configured VS Code to run checks on save using the same list of lints checked by `cargo xtask clippy` with a `.vscode/settings.json` like this: ```json { "rust-analyzer.check.overrideCommand": [ "cargo", "clippy", "--all-targets", "--message-format=json", "--", "--allow", "clippy::style", "--warn", "clippy::disallowed_macros", "--warn", "clippy::disallowed_methods", "--warn", "clippy::disallowed_names", "--warn", "clippy::disallowed_script_idents", "--warn", "clippy::disallowed_types", "--warn", "clippy::iter_cloned_collect", "--warn", "clippy::iter_next_slice", "--warn", "clippy::iter_nth", "--warn", "clippy::iter_nth_zero", "--warn", "clippy::iter_skip_next", "--warn", "clippy::len_zero", "--warn", "clippy::redundant_field_names", "--warn", "clippy::cast_lossless" ] } ``` Having to reproduce the list of lints in the `settings.json` is a bit unfortunate, though, because if a developer wishes to keep their list of enabled lints in sync with those run by `cargo xtask clippy`, they must manually update the VS Code config when new lints are added. It would be nicer if the VS Code config could just run `cargo xtask clippy` on save. However, this isn't currently possible, as rust-analyzer relies on the JSON output format for `cargo check`/`cargo clippy`, so it needs to pass the `--message-format=json` flag to `cargo clippy`. This flag is not currently propagated by `cargo xtask clippy`. Therefore, I've updated the xtask to accept a `--message-format` argument that can be passed through to the underlying `cargo clippy` command. Now, the VS Code config can be changed to just: ```json { "rust-analyzer.check.overrideCommand": [ "cargo", "xtask", "clippy", "--message-format=json", ] } ``` --- dev-tools/xtask/src/clippy.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/dev-tools/xtask/src/clippy.rs b/dev-tools/xtask/src/clippy.rs index 8eb1659da7..8c454fdebf 100644 --- a/dev-tools/xtask/src/clippy.rs +++ b/dev-tools/xtask/src/clippy.rs @@ -13,6 +13,9 @@ pub struct ClippyArgs { /// Automatically apply lint suggestions. #[clap(long)] fix: bool, + /// Error format passed to `cargo clippy`. + #[clap(long, value_name = "FMT")] + message_format: Option, } pub fn run_cmd(args: ClippyArgs) -> Result<()> { @@ -25,6 +28,17 @@ pub fn run_cmd(args: ClippyArgs) -> Result<()> { command.arg("--fix"); } + // Pass along the `--message-format` flag if it was provided. + // + // We don't really care about validating that it's a valid argument to + // `cargo check --message-format`, because `cargo check` will error out if + // it's unrecognized, and repeating the validation here just presents an + // opportunity to get out of sync with what Cargo actually accepts should a + // new message format be added. + if let Some(fmt) = args.message_format { + command.args(["--message-format", &fmt]); + } + command // Make sure we check everything. .arg("--all-targets")