diff --git a/docs/architecture/migration-progress.md b/docs/architecture/migration-progress.md index 5d3312fe3..cbf1a2124 100644 --- a/docs/architecture/migration-progress.md +++ b/docs/architecture/migration-progress.md @@ -5,16 +5,15 @@ Status values: `[ ]` not started, `[~]` in progress, `[x]` complete, `[!]` block ## Current Context - Issue: [`rustfs/backlog#660`](https://github.com/rustfs/backlog/issues/660) -- Branch: `overtrue/arch-embedded-startup-result-shell` -- Baseline: completed `R-046/R-047`. -- Stacked on: embedded startup identity slice. +- Branch: `overtrue/arch-embedded-startup-config-identity` +- Baseline: completed `R-048/R-049`. +- Stacked on: embedded startup result shell slice. - PR type for this branch: `pure-move` - Runtime behavior changes: none. -- Rust code changes: consume embedded builder startup arguments directly and - keep startup-result-to-public-handle mapping plus ready logging at clear - ownership boundaries. +- Rust code changes: keep embedded startup identity with prepared startup + config and remove the residual startup-argument clone contract. - CI/script changes: none. -- Docs changes: record the embedded startup result shell slices. +- Docs changes: record the embedded startup config identity slices. ## Phase 0 Tasks @@ -2411,6 +2410,31 @@ Status values: `[ ]` not started, `[~]` in progress, `[x]` complete, `[!]` block check, migration/layer guards, formatting, diff hygiene, Rust risk scan, branch freshness check, pre-commit quality gate, and three-expert review. +- [x] `R-050` Keep embedded identity with prepared startup config. + - Do: return the embedded access key, secret key, and region alongside the + prepared startup config so startup result assembly uses one prepared owner. + - Acceptance: public server identity accessors still return configured + credentials and region for default, explicit, and generated-volume builds. + - Must preserve: credential initialization inputs, region initialization, + startup config ownership, startup error mapping, and no public API + signature changes. + - Verification: focused startup-server/startup-embedded/embedded checks, + RustFS lib check, migration/layer guards, formatting, diff hygiene, Rust + risk scan, branch freshness check, pre-commit quality gate, and + three-expert review. + +- [x] `R-051` Remove residual embedded startup argument clone contract. + - Do: drop the `Clone` derivation from embedded startup arguments now that + the public builder consumes startup state directly. + - Acceptance: builder chaining, configured volumes, retry-before-global-init + behavior, and startup ownership remain unchanged. + - Must preserve: public builder method chaining, prepared config contents, + temporary directory cleanup ownership, and no public API signature changes. + - Verification: focused startup-server/startup-embedded/embedded checks, + RustFS lib check, migration/layer guards, formatting, diff hygiene, Rust + risk scan, branch freshness check, pre-commit quality gate, and + three-expert review. + - [x] `E-001/E-SET-001` Add ECStore layout skeleton and set-layout boundary. - Do: create the ECStore internal layout ownership buckets and pin static set layout versus runtime `Sets`/`SetDisks` orchestration boundaries before any @@ -2660,14 +2684,29 @@ Status values: `[ ]` not started, `[~]` in progress, `[x]` complete, `[!]` block | Expert | Status | Notes | |---|---|---| -| Quality/architecture | passed | R-048 and R-049 keep the public embedded builder as a shell over the startup owner and localize ready logging with startup completion. | -| Migration preservation | passed | Builder chaining, defaults, configured identity, endpoint normalization, readiness publication order, and shutdown ownership stay unchanged. | -| Testing/verification | passed | Focused startup-embedded/embedded checks, RustFS lib check, architecture/layer/unsafe guards, formatting, diff hygiene, Rust risk scan, and pre-commit gate passed. | +| Quality/architecture | passed | R-050 and R-051 keep embedded identity with prepared startup config and remove the residual startup-argument clone contract without widening the public API. | +| Migration preservation | passed | Builder chaining, configured identity, region setup, temporary volume ownership, startup error mapping, and shutdown ownership stay unchanged. | +| Testing/verification | passed | Focused startup-server/startup-embedded/embedded checks, RustFS lib check, architecture/layer/unsafe guards, formatting, diff hygiene, Rust risk scan, and pre-commit gate passed. | ## Verification Notes Passed before push: +- Issue #660 R-050/R-051 current slice: + - `cargo test -p rustfs --lib startup_server -- --nocapture`: passed. + - `cargo test -p rustfs --lib startup_embedded -- --nocapture`: passed. + - `cargo test -p rustfs --lib embedded -- --nocapture`: passed. + - `cargo check -p rustfs --lib`: passed. + - `cargo fmt --all --check`: passed. + - `git diff --check`: passed. + - `./scripts/check_architecture_migration_rules.sh`: passed. + - `./scripts/check_layer_dependencies.sh`: passed. + - `./scripts/check_unsafe_code_allowances.sh`: passed. + - Rust risk scan on changed Rust files: passed; only test-only `expect` + calls were present. + - `make pre-commit`: passed; nextest ran 6329 tests with 6329 passed and + 111 skipped, and doctests passed. + - Issue #660 R-048/R-049 current slice: - `cargo test -p rustfs --lib startup_embedded -- --nocapture`: passed. - `cargo test -p rustfs --lib embedded -- --nocapture`: passed. diff --git a/rustfs/src/startup_embedded.rs b/rustfs/src/startup_embedded.rs index c8f891370..cae6bf5e4 100644 --- a/rustfs/src/startup_embedded.rs +++ b/rustfs/src/startup_embedded.rs @@ -28,7 +28,6 @@ use crate::{ use std::{io, net::SocketAddr, path::PathBuf}; use tokio_util::sync::CancellationToken; -#[derive(Clone)] pub(crate) struct EmbeddedStartupArgs { address: String, access_key: String, @@ -104,19 +103,18 @@ pub(crate) async fn run_embedded_startup(args: EmbeddedStartupArgs) -> Result Result, } +pub(crate) struct EmbeddedServerIdentity { + pub access_key: String, + pub secret_key: String, + pub region: String, +} + pub(crate) struct EmbeddedHttpServer { pub shutdown_handle: ShutdownHandle, pub bound_addr: SocketAddr, @@ -141,12 +148,20 @@ pub(crate) async fn prepare_embedded_startup_config( } let mut config = Config::new(&address, volumes); - config.access_key = access_key; - config.secret_key = secret_key; - config.region = Some(region); + config.access_key = access_key.clone(); + config.secret_key = secret_key.clone(); + config.region = Some(region.clone()); config.console_enable = false; - Ok(EmbeddedStartupConfig { config, temp_dir_guard }) + Ok(EmbeddedStartupConfig { + config, + identity: EmbeddedServerIdentity { + access_key, + secret_key, + region, + }, + temp_dir_guard, + }) } pub(crate) fn find_embedded_available_port() -> Result { @@ -380,6 +395,9 @@ mod tests { assert_eq!(prepared.config.access_key, "access"); assert_eq!(prepared.config.secret_key, "secret"); assert_eq!(prepared.config.region.as_deref(), Some("us-west-2")); + assert_eq!(prepared.identity.access_key, "access"); + assert_eq!(prepared.identity.secret_key, "secret"); + assert_eq!(prepared.identity.region, "us-west-2"); assert!(!prepared.config.console_enable); assert_eq!(prepared.config.volumes.len(), 1); assert!(std::path::Path::new(&prepared.config.volumes[0]).exists());