mirror of
https://github.com/rustfs/rustfs.git
synced 2026-07-26 16:28:15 +00:00
26 KiB
26 KiB
Architecture Migration Progress
Status values: [ ] not started, [~] in progress, [x] complete, [!] blocked.
Current Context
- Issue:
rustfs/backlog#660 - Branch:
overtrue/arch-background-controller-harness-and-status - Baseline:
origin/mainat624de3114398338c80b87c9b452fc70b1d76fa8a - PR type for this branch:
behavior-change - Runtime behavior changes: none; the allocator reclaim controller/status surface only returns read-only snapshot/reconcile data and never starts, stops, resizes, or wakes workers.
- Rust code changes: add allocator reclaim status/controller snapshots, reconcile plans with explicit no-op worker mutation, and controller harness tests for memory observability plus allocator reclaim.
- CI/script changes: none.
- Docs changes: record
TEST-BGC-001harness coverage and the allocator reclaim controller/status slice.
Phase 0 Tasks
G-001Refreshmainand record baseline.- Acceptance: baseline commit, title, and branch are recorded.
- Verification:
git fetch upstream main --prune;git rev-parse upstream/main.
G-002Create migration tracking checklist.- Acceptance: this file records task state, context, verification, and handoff.
G-003Classify PR types.- Acceptance:
crate-boundaries.mdlists exactly one allowed PR type per PR.
- Acceptance:
G-004Define re-export and wrapper policy.- Acceptance: temporary compatibility code must use
RUSTFS_COMPAT_TODO.
- Acceptance: temporary compatibility code must use
G-005Add dependency direction guard.- Acceptance:
./scripts/check_layer_dependencies.shpasses on currentupstream/mainwhile still rejecting new unaccepted layer dependencies.
- Acceptance:
- [~]
G-006Create migration loss-prevention checks.- Current branch: add a mechanical admin route matrix guard from
admin-route-action-snapshot.mdandrustfs/src/admin/route_registration_test.rs. - Remaining follow-up: add checks for public re-export and storage trait coverage before pure moves.
- Current branch: add a mechanical admin route matrix guard from
G-007Create startup timeline table.- Acceptance:
startup-timeline.mdrecords current binary startup order, side effects, fatal boundaries, and readiness stages.
- Acceptance:
G-008Capture admin route-action snapshot.- Acceptance:
admin-route-action-snapshot.mdrecords current route families, handler ownership, authorization actions, public exceptions, table-catalog routes, and/minio/admincompatibility alias behavior.
- Acceptance:
G-009Enforce pre-push three-expert review.- Acceptance:
crate-boundaries.mdrequires quality/architecture, migration-preservation, and testing/verification review before push.
- Acceptance:
G-010Inventoryecstore::config::{Config, KV, KVS}consumers.- Acceptance:
ecstore-config-consumer-inventory.mdrecords the current model definitions, global accessors, persistence helpers, consumer groups, migration risks, and do-not-change contract.
- Acceptance:
TEST-PRTYPE-001Check PR type enum consistency.- Acceptance:
./scripts/check_architecture_migration_rules.shparses the allowed PR types fromcrate-boundaries.mdand fails whenARCHITECTURE.mdor architecture docs reference an unknown PR type.
- Acceptance:
COMPAT-REG-001Check temporary compatibility cleanup consistency.- Acceptance:
./scripts/check_architecture_migration_rules.shfails when a sourceRUSTFS_COMPAT_TODO(<task-id>)marker lacks a cleanup-register entry, when a register entry lacks a source marker, or when a source marker omits a removal condition.
- Acceptance:
Phase 1a Config Model Tasks
CFG-001Inventoryecstore::config::{Config, KV, KVS}consumers.- Acceptance:
ecstore-config-consumer-inventory.mdrecords the current definitions, persistence helpers, global accessors, consumer groups, migration risks, and do-not-change contract.
- Acceptance:
CFG-002Decide model boundary.- Acceptance:
config-model-boundary-adr.mdrecordsrustfs-configas the target package,server_configas the future model module, allowed dependencies, forbidden dependencies, preserved shape, and extraction verification gates.
- Acceptance:
CFG-003Move pure model definitions.- Completed slice:
rustfs/rustfs#3351moved onlyConfig,KV,KVS, and default-registration surface intorustfs-config; persistence helpers and global server-config state remain inecstore. - Must preserve: tuple struct shapes, serde alias behavior, default application, internal JSON shape, and existing persisted config semantics.
- Completed slice:
CFG-004Keep and clean up oldecstore::config::*compatibility path.- Completed slice:
rustfs/rustfs#3351re-exported moved model types and default-registration surface fromrustfs_ecstore::configwithRUSTFS_COMPAT_TODO(CFG-004)and cleanup-register coverage. - Cleanup slice: remove the temporary model re-export and smoke test after
CFG-005/CFG-006/CFG-007 migrated all in-repo consumers to
rustfs_config::server_config.
- Completed slice:
CFG-005Migrate external server-config model consumers.- Current branch: migrate admin handlers, admin services, runtime context,
server audit/event setup, and the audit/notify/targets/iam crates from the
temporary
rustfs_ecstore::config::{Config, KV, KVS}model path torustfs_config::server_config. - Acceptance: external consumers use the model crate for pure config types while still using ECStore for persistence helpers, global server-config accessors, storage-class helpers, and startup initialization.
- Current branch: migrate admin handlers, admin services, runtime context,
server audit/event setup, and the audit/notify/targets/iam crates from the
temporary
CFG-006Migrate ECStore service/default model consumers.- Current branch: migrate ECStore config default modules, shared config
helpers, and store accessor signatures to the
rustfs_configmodel type while preserving ECStore-owned persistence and runtime state. - Acceptance: ECStore internals no longer depend on the old compatibility model import path except the deliberate compatibility smoke test; the old public re-export remains available for downstream callers until CFG-004 is cleaned up.
- Current branch: migrate ECStore config default modules, shared config
helpers, and store accessor signatures to the
CFG-007Migrate scanner runtime-config model consumer.- Current branch: migrate scanner runtime-config parsing and validation from
the temporary
rustfs_ecstore::config::{Config, KVS}model path torustfs_config::server_config. - Acceptance: scanner uses the model crate for pure server-config types while still using ECStore for the global server-config accessor; scanner defaults, env overrides, persisted-config validation, cycle scheduling, bitrot-cycle compatibility, cache timeout, and alert threshold semantics remain unchanged.
- Current branch: migrate scanner runtime-config parsing and validation from
the temporary
CFG-008Move global server-config accessors.- Current branch: move
GLOBAL_SERVER_CONFIG,get_global_server_config, andset_global_server_configtorustfs_config::server_config; migrate in-repo runtime consumers to the new owner. - Compatibility: keep
rustfs_ecstore::config::{get_global_server_config, set_global_server_config}as a temporary re-export withRUSTFS_COMPAT_TODO(CFG-008). - Cleanup slice: remove the temporary accessor re-export after code scans
showed in-repo consumers import accessors from
rustfs_config::server_config. - Acceptance: ECStore still owns
ConfigSys, config persistence helpers, storage-class global state, default registration wiring, and startup initialization; global server-config reads and writes keep the samestd::sync::RwLock<Option<Config>>clone semantics.
- Current branch: move
Phase 1 Security Governance Tasks
S-001Addcrates/security-governance.- Acceptance: the crate is a workspace member and has no dependency on
rustfs,ecstore, admin handlers, Axum, or runtime state. - Verification:
cargo check -p rustfs-security-governance.
- Acceptance: the crate is a workspace member and has no dependency on
S-002Add admin route matrix core types.- Acceptance:
AdminRouteSpec,AdminRouteAccess,AdminActionRef,PublicRouteKind,RouteRiskLevel, and validation errors model route governance metadata without registering routes or enforcing auth. - Verification:
cargo test -p rustfs-security-governance.
- Acceptance:
S-003Add redaction contract types.- Acceptance:
RedactionRule,RedactionLevel, and validation errors model sensitive field handling without logging, masking, or runtime integration. - Verification:
cargo test -p rustfs-security-governance.
- Acceptance:
S-004Add serde policy marker types.- Acceptance:
SerdePolicy,SerdePolicyKind,UnknownFieldPolicy, and validation errors model strict ingress and compatibility serde contracts without changing deserialization behavior. - Verification:
cargo test -p rustfs-security-governance.
- Acceptance:
S-005Add supply-chain policy contract types.- Acceptance:
ArtifactIntegrityPolicy,ArtifactSourceKind, and validation errors model digest, signature, and provenance requirements without changing release or CI behavior. - Verification:
cargo test -p rustfs-security-governance.
- Acceptance:
S-006Addrustfs/src/admin/route_policy.rsbacked by these contract types, without changing route registration or auth behavior.- Acceptance: direct
AdminRouteSpecentries cover routes with a single stable admin policy action, deferred inventory records routes that need richer contract support, and tests prove the combined inventory covers every registered admin route.
- Acceptance: direct
S-011Add KMS action taxonomy.- Acceptance:
KmsActioncan parse and serialize dedicated configure, service-control, clear-cache, generate-data-key, delete, rotate, list, and describe actions; wildcard matching still works. - Verification:
cargo test -p rustfs-policy action --no-fail-fast.
- Acceptance:
S-012Migrate KMS handlers to dedicated actions.- Acceptance: KMS data-key, delete/cancel-delete, cache, configure,
service-control, list, and describe handlers use dedicated
kms:*actions. - Compatibility: legacy KMS create/status admin actions are retained only as
temporary compatibility paths and registered in
compat-cleanup-register.md. - Verification: focused handler and route policy tests, migration rules,
formatting, and
make pre-commit.
- Acceptance: KMS data-key, delete/cancel-delete, cache, configure,
service-control, list, and describe handlers use dedicated
S-013Apply KMS redaction.- Acceptance: KMS Debug output and admin status response summaries contain no Vault token, AppRole secret ID, or local master key values.
- Must preserve: internal KMS config values remain available to runtime code and persisted config serialization still writes the original secret values.
- Verification: focused KMS redaction/status tests, full KMS tests, migration
guards, Rust quality scan, clippy, and
make pre-commitpassed.
KMSD-001Inventory KMS development defaults.- Acceptance:
kms-development-defaults-inventory.mdrecords Local and Vault defaults for missing master keys, temp key dirs, HTTP Vault addresses, default dev-token credentials, and skip-TLS behavior. - Must preserve: no KMS runtime behavior, config serialization, authorization, startup order, storage path, or crate boundary changes.
- Verification: docs diff review, migration guards, metrics reference guard,
and
git diff --check.
- Acceptance:
KMSD-002Make Local KMS unsafe defaults explicit dev opt-in.- Acceptance: Local KMS now rejects missing master keys and process-temp key
directories unless
allow_insecure_dev_defaultsis explicitly set. - Compatibility: server CLI/config now accepts
RUSTFS_KMS_LOCAL_MASTER_KEYfor production local encryption andRUSTFS_KMS_ALLOW_INSECURE_DEV_DEFAULTS=truefor development-only local setups.
- Acceptance: Local KMS now rejects missing master keys and process-temp key
directories unless
KMSD-003Make Vault unsafe defaults explicit dev opt-in.- Acceptance: Vault KV2 and Vault Transit now reject HTTP addresses,
dev-token, andskip_tls_verifyunless explicit development opt-in is set. - Compatibility: the KMS env loader and admin configure requests support the same explicit development opt-in.
- Acceptance: Vault KV2 and Vault Transit now reject HTTP addresses,
KMSD-004Add production KMS default tests.- Acceptance: focused tests cover Local and Vault production rejection plus explicit development opt-in paths across config, env loading, admin request conversion, and service-manager validation.
KMSD-005Write KMS compatibility notes.- Acceptance:
kms-development-defaults-inventory.mdnow records the production-safe alternatives and explicit development opt-in behavior for deployments that relied on old defaults.
- Acceptance:
Phase 2 Storage API Tasks
-
API-001Addcrates/storage-api.- Acceptance:
rustfs-storage-apiis a workspace member and remains a dependency-free contract crate. - Verification:
cargo check -p rustfs-storage-api.
- Acceptance:
-
API-002Move public storage error/result contracts.- Current PR:
rustfs/rustfs#3313merged. - Completed slice: add public
StorageErrorCodeandStorageResultcontracts inrustfs-storage-api, then make ECStoreStorageError::to_u32/from_u32consume the shared code table. - Deferred: keep the full ECStore
StorageErrorenum and ECStore-specific conversions inrustfs-ecstoreuntil theDiskError, filemeta, lock, andstd::io::Errordowncast boundary is proven safe. - Acceptance: storage-api contract tests pass, ECStore compatibility tests
prove numeric codes match the new contract, and
cargo check -p rustfs-storage-api -p rustfs-ecstorepasses. - Must preserve: storage error display, conversions, object error mapping,
quorum classification, and reserved code gaps
0x2B/0x2C. - Risk defense: no storage hot-path enum move in this PR; only numeric code mapping uses the new contract.
- Current PR:
-
API-003Move DTOs.- Current PR:
rustfs/rustfs#3314merged. - Cleanup branch:
overtrue/arch-storage-api-dto-compat-cleanup. - Completed slice: move the pure bucket/options DTO subset:
MakeBucketOptions,SRBucketDeleteOp,DeleteBucketOptions,BucketOptions, andBucketInfo. - Cleanup slice: migrate in-repo external consumers to
rustfs_storage_api, keep ECStore implementation use crate-private, and remove the old publicecstore::store_apibucket DTO re-export. - Acceptance:
rustfs-storage-apiexports these DTOs, in-repo external consumers no longer use the oldrustfs_ecstore::store_apiDTO path, andRUSTFS_COMPAT_TODO(API-003)is removed from source and cleanup register. - Must preserve: no
ObjectOptions,ObjectInfo, reader, compression, encryption, filemeta conversion, multipart conversion, route, storage, or runtime behavior changes in this PR.
- Current PR:
-
API-006Add disk inventory/admin trait.- Current PR:
rustfs/rustfs#3330merged. - Completed slice: add
StorageAdminApiandDiskSetSelectortorustfs-storage-api. - Acceptance:
StorageAdminApiexposes backend info, global storage info, local storage info, disk-set inventory, and drive-count surfaces without depending on ECStore implementation types. - Must preserve: no
StorageAPI::get_disksremoval, no ECStore implementation change, no admin/readiness/capacity behavior change. - Risk defense: use associated types for backend/storage/disk DTOs so this
contract slice does not pull
rustfs-madminorrustfs-ecstoreintorustfs-storage-api. - Verification: focused storage-api tests, dependency tree, migration guards, formatting, and diff hygiene.
- Current PR:
-
API-007Dual-routeget_disksconsumers.- Completed first slice:
rustfs/rustfs#3331boundECStoretoStorageAdminApiwhile keeping all consumers unchanged. - Completed second slice:
rustfs/rustfs#3332migrated the admin storage-class config drive-count consumer toStorageAdminApi::set_drive_counts. - Completed third slice:
rustfs/rustfs#3333migratedDefaultAdminUsecasestorage-info reads toStorageAdminApi::storage_info. - Completed fourth slice:
rustfs/rustfs#3334migrated account-infobackend_info, rebalance statusstorage_info, and runtime readinessstorage_info. - Completed fifth slice:
rustfs/rustfs#3335migrated grouped observability, RPC health, server-info, realtime metrics, and notification read-side consumers. - Completed sixth slice:
rustfs/rustfs#3336migrated ECStore internal decommission space, local-storage-info, backend-info, drive-count, and disk-inventory admin handlers away from oldStorageAPImethod calls. - Completed seventh slice:
rustfs/rustfs#3337migrated maintenance and background read-side storage inventory consumers in rebalance metadata initialization, heal resume disk lookup, and scanner local disk scan lookup. - Completion acceptance: admin inventory consumers no longer use old
StorageAPIcalls for backend info, storage info, local storage info, drive-count, or disk-set inventory when the inventory-facingStorageAdminApicontract represents the same read-only operation.
- Completed first slice:
-
API-008Remove duplicate old-path admin surfaces.- Completed slice:
rustfs/rustfs#3340removed duplicate admin-read methods from the oldStorageAPItrait and its ECStore/Sets/SetDisks/test implementations after API-007 migrated their consumers. - Acceptance: old
StorageAPIkeeps storage operation traits while admin inventory surfaces live only onStorageAdminApi.
- Completed slice:
-
API-009Narrow metadata helper storage bounds.- Completed slice:
rustfs/rustfs#3343narrowed server config, tier config, rebalance metadata, and startup metadata migration helper bounds away from fullStorageAPIwhen the helper only needsObjectIO,ObjectOperations,BucketOperations,ListOperations, orStorageAdminApi. - Acceptance: metadata helper contracts express the actual operation group they need, while callers and persistence behavior remain unchanged.
- Completed slice:
-
API-010Narrow replication resync metadata bounds.- Completed slice:
rustfs/rustfs#3345narrowed replication resync status load/save/mark/persist helper bounds away from fullStorageAPIwhen the helper only needsObjectIO. - Acceptance: resync metadata helpers express object-I/O-only persistence
requirements, while replication execution, delete replication, multipart
replication, object lookups, and scheduling behavior remain on full
StorageAPIwhere needed.
- Completed slice:
-
API-011Narrow scanner cache helper storage bounds.- Completed slice:
rustfs/rustfs#3348narrowed scanner data-usage cache load/save and cache snapshot persistence helper bounds away from fullStorageAPIwhen the helper only needsObjectIO. - Acceptance: scanner cache persistence helpers express object-I/O-only requirements, while scanner cycle orchestration, bucket scanning, local disk selection, cache publication, and storage hot paths remain unchanged.
- Must preserve: data-usage cache wire format, cache object paths, backup cache paths, retry and timeout behavior, cache-save metrics, publish/update channel behavior, scanner cycle scheduling, disk scan concurrency, bucket scan semantics, lifecycle/replication decisions, and storage hot paths.
- Risk defense: do not move traits to
rustfs-storage-api, do not removeStorageAPI, do not alter helper bodies, and do not narrow scanner paths that need bucket operations, disk inventory, or full storage orchestration. - Verification: focused compile/tests, migration guards, Rust risk scan, and required quality/architecture, migration-preservation, and testing/verification review passed.
- Completed slice:
-
API-012Narrow table catalog object backend bounds.- Completed slice:
rustfs/rustfs#3350added a narrowNamespaceLockingoperation-group trait as a compatibility facade, then narrowedEcStoreTableCatalogObjectBackendfrom fullStorageAPItoObjectIO,ObjectOperations,ListOperations, andNamespaceLocking. - Cleanup slice: migrate the remaining scanner leader-lock and self-copy
object use-case namespace-lock consumers to
NamespaceLocking, implement namespace locking directly on ECStore storage types, and remove the temporary namespace-lock compatibility method from the full storage trait and cleanup register entry. - Acceptance: table catalog object backend contracts express the actual
object read/write, metadata/delete, list, and namespace-lock capabilities
they need; namespace-lock consumers depend on
NamespaceLockinginstead of fullStorageAPI; and storage lock behavior remains unchanged. - Must preserve: table catalog object paths, metadata pointer semantics, optimistic write preconditions, object listing pagination, missing-object handling, namespace write-lock acquisition, object APIs, scanner/heal/replication/config persistence, and storage hot paths.
- Risk defense: do not move traits into
rustfs-storage-api, do not change lock implementation code, do not alter table catalog method bodies, and do not retain stale API-012 compatibility markers after the oldStorageAPIlock method is removed. - Verification: focused compile/tests, migration guards, Rust risk scan, and required quality/architecture, migration-preservation, and testing/verification review passed.
- Completed slice:
Phase 8 Background Controller Tasks
BGC-001Inventory background services.- Acceptance:
background-services-inventory.mdrecords scanner, heal, lifecycle, replication, config reload, metrics, shutdown, cancellation, and side-effect surfaces before controller work. - Must preserve: no code behavior change and no new controller contract in this PR.
- Verification: docs-only architecture checks and diff hygiene.
- Acceptance:
BGC-002Define minimal controller contract.- Acceptance:
background-controller-contract.mddefines desired/current/status/reconcile vocabulary, status state semantics, service boundaries, and side-effect rules without starting workers or changing scheduling. - Must preserve: no Rust trait, scheduler, service registry, worker start/stop path, storage write, readiness change, peer signal, or runtime behavior change.
- Verification: docs-only architecture checks and diff hygiene.
- Acceptance:
BGC-003Add read-only status snapshot.- Acceptance: memory observability exposes a typed status snapshot that reports service state, metrics enablement, configured interval, cancellation source, and shutdown handle shape.
- Must preserve: no controller framework, admin route, worker lifecycle change, storage write, readiness change, peer signal, or metrics emission behavior change.
- Verification: focused memory observability tests, compile checks, migration guards, formatting, and pre-commit quality gate.
BGC-004Pilot one controller.- Acceptance: memory observability exposes a typed controller snapshot and reconcile plan that compare desired state with current status.
- Must preserve: no admin route, scheduler, service registry, worker lifecycle mutation, storage write, readiness signal, peer signal, or metrics emission behavior change.
- Verification: focused controller tests prove repeated reconcile is idempotent, cancellation state is preserved, and worker mutation remains none.
TEST-BGC-001Add controller harness coverage.- Acceptance: controller tests cover cancellation state, repeated reconcile, paused-time stability, and no worker mutation for the low-risk controller surfaces.
- Must preserve: no worker spawn, start, stop, resize, wakeup, storage write, readiness signal, peer signal, or metrics emission behavior change.
- Verification: focused memory observability and allocator reclaim controller tests.
BGC-005Add allocator reclaim controller/status surface.- Acceptance: allocator reclaim exposes typed desired/status/controller snapshots and a typed reconcile plan that reports backend, effective force, idle interval, runtime cancellation, shutdown handle shape, and no-op worker mutation.
- Must preserve: existing allocator reclaim enablement, backend-specific force handling, idle-streak logic, metrics emission, runtime-token cancellation, and startup call shape.
- Verification: focused allocator reclaim tests, compile checks, formatting, migration guards, Rust risk scan, and pre-commit quality gate.
Next PRs
behavior-change: add the next low-risk background status surface before broader reconcile work.test-only: add config-reload preservation coverage for scanner/heal/ lifecycle/replication inTEST-BGC-002.
Pre-Push Review Log
| Expert | Status | Notes |
|---|---|---|
| Quality/architecture | pass | Confirmed allocator reclaim follows the established typed desired/status/reconcile shape without adding a generic scheduler, registry, or admin route. |
| Migration preservation | pass | Confirmed reconcile reports worker_mutation: none, preserving enablement, force handling, idle-streak logic, cancellation, and metrics emission behavior. |
| Testing/verification | pass | Focused tests, compile checks, formatting, diff hygiene, migration guards, Rust risk scan, and make pre-commit passed. |
Verification Notes
Passed on 624de3114398338c80b87c9b452fc70b1d76fa8a:
cargo test -p rustfs allocator_reclaim --lib; 9 passed.cargo test -p rustfs memory_observability --lib; 9 passed.cargo check -p rustfs --lib.cargo fmt --all.cargo fmt --all --check.git diff --check../scripts/check_architecture_migration_rules.sh../scripts/check_layer_dependencies.sh../scripts/check_metrics_migration_refs.sh.- Rust risk scan for changed Rust files; only test
expectcalls and existing internal allocator reclaimResult<(), String>helpers matched. make pre-commit; all checks passed, including nextest 5874 passed and 111 skipped.
Notes:
- This slice adds reconcile/status data only. It does not apply reconcile output to the running allocator reclaim loop or memory observability sampler.
- There is no admin/API exposure in this PR; future controller harness work should stay isolated from scanner, heal, lifecycle, and replication.
Handoff Notes
- Next migration slice can start another read-only low-risk status surface or
TEST-BGC-002config-reload preservation coverage. - Keep scanner, heal, lifecycle, replication, disk health, and config reload out of broad controller movement until dedicated preservation tests exist.