refactor: narrow test harness compatibility surfaces (#3592)

This commit is contained in:
安正超
2026-06-19 07:10:52 +08:00
committed by GitHub
parent b14e49e84e
commit b1c6578df1
27 changed files with 384 additions and 105 deletions
@@ -103,9 +103,9 @@ through router canonicalization unless the row explicitly says otherwise.
| Site replication | `PUT /v3/site-replication/add`; `PUT /v3/site-replication/remove`; `GET /v3/site-replication/info`; `GET /v3/site-replication/metainfo`; `GET /v3/site-replication/status`; `POST /v3/site-replication/devnull`; `POST /v3/site-replication/netperf`; `PUT /v3/site-replication/edit`; `PUT /v3/site-replication/peer/join`; `PUT /v3/site-replication/peer/bucket-ops`; `PUT /v3/site-replication/peer/iam-item`; `PUT /v3/site-replication/peer/bucket-meta`; `GET /v3/site-replication/peer/idp-settings`; `PUT /v3/site-replication/peer/edit`; `PUT /v3/site-replication/peer/remove`; `PUT /v3/site-replication/resync/op`; `PUT /v3/site-replication/state/edit` | `site_replication.rs` | add/remove/info/operation/resync actions selected per handler |
| Admin profiling | `GET /rustfs/admin/debug/pprof/profile`; `GET /rustfs/admin/debug/pprof/status` | `profile_admin.rs`, `profile.rs` | `ProfilingAdminAction` |
| TLS debug | `GET /rustfs/admin/debug/tls/status` | `tls_debug.rs`, `profile.rs` | `ProfilingAdminAction` via shared profile authorization |
| KMS legacy management | `POST /v3/kms/create-key`; `POST /v3/kms/key/create`; `GET /v3/kms/describe-key`; `GET /v3/kms/key/status`; `GET /v3/kms/list-keys`; `POST /v3/kms/generate-data-key`; `GET|POST /v3/kms/status`; `GET /v3/kms/config`; `POST /v3/kms/clear-cache` | `kms_management.rs`, `kms_keys.rs` | create/status/server-info KMS admin actions as checked per handler |
| KMS legacy management | `POST /v3/kms/create-key`; `POST /v3/kms/key/create`; `GET /v3/kms/describe-key`; `GET /v3/kms/key/status`; `GET /v3/kms/list-keys`; `POST /v3/kms/generate-data-key`; `GET|POST /v3/kms/status`; `GET /v3/kms/config`; `POST /v3/kms/clear-cache` | `kms_management.rs`, `kms_keys.rs` | dedicated `kms:*` actions for key create/status/list/data-key/cache paths; `ServerInfoAdminAction` where preserved by handler |
| KMS dynamic control | `POST /v3/kms/configure`; `POST /v3/kms/start`; `POST /v3/kms/stop`; `GET /v3/kms/service-status`; `POST /v3/kms/reconfigure` | `kms_dynamic.rs` | `ServerInfoAdminAction` |
| KMS keys | `POST /v3/kms/keys`; `DELETE /v3/kms/keys/delete`; `POST /v3/kms/keys/cancel-deletion`; `GET /v3/kms/keys`; `GET /v3/kms/keys/{key_id}` | `kms_keys.rs` | `KMSCreateKeyAdminAction`, `KMSKeyStatusAdminAction`, `ServerInfoAdminAction` per handler |
| KMS keys | `POST /v3/kms/keys`; `DELETE /v3/kms/keys/delete`; `POST /v3/kms/keys/cancel-deletion`; `GET /v3/kms/keys`; `GET /v3/kms/keys/{key_id}` | `kms_keys.rs` | dedicated `kms:*` actions per handler |
| OIDC public | `GET /v3/oidc/providers`; `GET /v3/oidc/authorize/{provider_id}`; `GET /v3/oidc/callback/{provider_id}`; `GET /v3/oidc/logout` | `oidc.rs` | Public OIDC exception in `is_oidc_path` |
| OIDC config | `GET /v3/oidc/config`; `PUT|DELETE /v3/oidc/config/{provider_id}`; `POST /v3/oidc/validate` | `oidc.rs` | `ServerInfoAdminAction` for read/validate; `ConfigUpdateAdminAction` for mutation |
+1 -6
View File
@@ -12,12 +12,7 @@ for later deletion.
## Open Items
- `RUSTFS_COMPAT_TODO(S-012)`
- Task: `S-012`
- File: `rustfs/src/admin/handlers/kms_keys.rs`
- Why: legacy KMS create-key and key-status admin grants must keep working during the dedicated KMS policy migration.
- Removal condition: remove after KMS admin clients and built-in policies use `kms:Configure`, `kms:DescribeKey`, and `kms:ListKeys`.
- Status: planned cleanup.
No compatibility code is currently registered.
## Review Checklist
+5
View File
@@ -95,6 +95,7 @@ Required `rustfs-storage-api` public re-exports:
- `pub use error::{StorageErrorCode, StorageResult};`
- `pub use multipart::{CompletePart, ListMultipartsInfo, ListPartsInfo, MultipartInfo, MultipartUploadResult, PartInfo};`
- `pub use object::{HTTPPreconditions, HTTPRangeError, HTTPRangeSpec, ObjectLockRetentionOptions};`
- `pub use object::{ExpirationOptions, TransitionedObject};`
- `pub use object::{HealOperations, MultipartOperations, NamespaceLocking, ObjectIO, ObjectOperations};`
- `pub use object::{ListObjectVersionsInfo, ListObjectsInfo, ListObjectsV2Info, ListOperations, ObjectInfoOrErr};`
- `pub use object::{ObjectPreconditionError, ObjectPreconditionPart, ObjectPreconditionState};`
@@ -117,3 +118,7 @@ directly for `ObjectIO`, `ObjectOperations`, `ListOperations`,
`MultipartOperations`, `HealOperations`, and `NamespaceLocking`; ECStore keeps
the concrete compatibility traits only for internal implementation and
downstream compatibility.
ECStore internal consumers must use `rustfs-storage-api` lifecycle helper DTOs
directly for `ExpirationOptions` and `TransitionedObject`; ECStore keeps the
old lifecycle paths only as downstream compatibility re-exports.
+135 -14
View File
@@ -5,18 +5,17 @@ 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-delete-object-contracts`
- Baseline: stacked on `rustfs/rustfs#3579` head
(`903aff047d2faffaec907637d64440c84053f62e`).
- PR type for this branch: `consumer-migration`
- Branch: `overtrue/arch-storage-api-lifecycle-contracts`
- Baseline: stacked on `rustfs/rustfs#3594` head
(`6fc05b84e2cd22a0482adfbc042184b03f8fdfa6`).
- PR type for this branch: `pure-move`
- Runtime behavior changes: no migration behavior change expected.
- Rust code changes: move delete-object DTO contracts from ECStore store_api to
rustfs-storage-api, keep ECStore old-path type aliases, and migrate RustFS,
scanner, and ECStore internal consumers to the storage-api contracts.
- CI/script changes: add a migration guard rejecting reintroduced ECStore
delete DTO definitions, public re-exports, or internal old-path consumers.
- Docs changes: record the delete-object contract move and consumer cleanup
slices.
- Rust code changes: move lifecycle helper DTO contracts for expiration and
transitioned object metadata into rustfs-storage-api, switch ECStore internal
consumers to direct storage-api imports, and keep ECStore old-path re-exports.
- CI/script changes: add migration guards rejecting reintroduced ECStore
lifecycle helper DTO definitions and old internal consumer imports.
- Docs changes: record the lifecycle helper pure-move slice.
## Phase 0 Tasks
@@ -304,6 +303,22 @@ Status values: `[ ]` not started, `[~]` in progress, `[x]` complete, `[!]` block
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-commit` passed.
- [x] `S-014` Remove legacy KMS admin action fallbacks.
- Acceptance: KMS create, describe, and list-key handlers authorize only the
dedicated `kms:*` actions and no longer retain legacy admin grant fallbacks.
- Must preserve: legacy KMS endpoint URLs, query aliases, request bodies, and
response contracts remain unchanged.
- Verification: focused KMS auth and route-policy tests, migration guards,
formatting, diff hygiene, risk scan, full pre-commit, and required
three-expert review passed before push.
- [x] `S-015` Remove legacy KMS admin policy action taxonomy.
- Acceptance: `admin:KMSCreateKey` and `admin:KMSKeyStatus` no longer parse as
valid policy actions; KMS key handlers keep using dedicated `kms:*` actions.
- Must preserve: legacy KMS endpoint URLs, query aliases, request bodies, and
response contracts remain unchanged.
- Verification: focused policy and KMS auth tests, route-policy tests,
migration guards, formatting, diff hygiene, risk scan, full pre-commit, and
required three-expert review passed before push.
- [x] `KMSD-001` Inventory KMS development defaults.
- Acceptance:
[`kms-development-defaults-inventory.md`](kms-development-defaults-inventory.md)
@@ -1240,6 +1255,47 @@ Status values: `[ ]` not started, `[~]` in progress, `[x]` complete, `[!]` block
formatting check, diff hygiene, risk scan, full pre-commit, and required
three-expert review passed before push.
- [x] `API-049` Remove test and fuzz ECStore module passthroughs.
- Current branch: `overtrue/arch-test-fuzz-compat-boundaries`.
- Current slice: replace the remaining e2e, heal-test, scanner-test, and
fuzz-target ECStore module passthroughs with explicit local compatibility
aliases, split fuzz storage compatibility by target, and empty the
passthrough guard snapshot.
- Acceptance: no `storage_compat.rs` file may expose broad
`rustfs_ecstore` module passthroughs; the migration guard now rejects any
new passthrough unless a later slice deliberately adds a reviewed
allowlist entry.
- Must preserve: e2e bucket target and RPC helper imports, heal test disk and
store setup imports, scanner test lifecycle/tier/disk/storage imports,
fuzz bucket validation behavior, and fuzz path containment behavior.
- Risk defense: this is test-harness and fuzz-harness import ownership
cleanup only; ECStore remains the owner of the same concrete APIs and no
production runtime path is changed.
- Verification: focused test/fuzz compiles, migration and layer guards,
formatting check, diff hygiene, risk scan, full pre-commit, and required
three-expert review passed before push.
- [x] `API-050` Move lifecycle helper DTO contracts.
- Current branch: `overtrue/arch-storage-api-lifecycle-contracts`.
- Current slice: move `ExpirationOptions` and `TransitionedObject` into
rustfs-storage-api, update ECStore internal consumers plus notify test
coverage to import them directly, and keep ECStore old-path re-exports for
downstream compatibility callers.
- Acceptance: rustfs-storage-api exports both lifecycle helper DTOs, ECStore
no longer owns their concrete struct definitions, ECStore internal
consumers and notify coverage use the storage-api contracts directly, old
ECStore lifecycle paths remain available as re-exports, and migration rules
reject restoring the ECStore definitions or old internal imports.
- Must preserve: lifecycle expiration flags, transitioned object journal
metadata, object info construction, notify event conversion, and all old
ECStore import paths used by existing callers.
- Risk defense: this is a pure DTO move; no lifecycle scheduling, object I/O,
transition journal, replication, or reader behavior is changed.
- Verification: storage-api lifecycle helper unit test, ECStore transitioned
lifecycle tests, notify event conversion test, focused compile checks,
migration and layer guards, formatting check, diff hygiene, risk scan, full
pre-commit, and required three-expert review passed before push.
## Phase 8 Background Controller Tasks
- [x] `BGC-001` Inventory background services.
@@ -1510,20 +1566,85 @@ Status values: `[ ]` not started, `[~]` in progress, `[x]` complete, `[!]` block
1. `pure-move`/`consumer-migration`: continue larger cleanup slices with the
loss-prevention guards active for remaining ECStore compatibility contracts
outside the production compatibility boundaries already cleaned.
now that broad compatibility passthroughs are fully closed.
## Pre-Push Review Log
| Expert | Status | Notes |
|---|---|---|
| Quality/architecture | passed | API-042/API-043/API-044/API-045/API-046/API-047/API-048 narrow notify, S3 Select, OBS, IAM, Swift, heal, scanner, and RustFS runtime compatibility contracts without moving ECStore storage metadata ownership. |
| Migration preservation | passed | Event builder call sites, ECStore event bridge conversion, restore event data, version IDs, metadata filtering, config read/save semantics, S3 Select store/error/buffer semantics, OBS metrics state reads, IAM config/notification/error semantics, Swift bucket metadata access, heal disk/resume/task behavior, scanner lifecycle/replication/data-usage behavior, RustFS startup/admin/app/storage runtime access, unchanged no-op handling, and remove-event behavior are preserved. |
| Quality/architecture | passed | S-015 removes obsolete KMS admin policy action variants after the handler fallback cleanup; API-042/API-043/API-044/API-045/API-046/API-047/API-048/API-049/API-050 narrow notify, S3 Select, OBS, IAM, Swift, heal, scanner, RustFS runtime, test, fuzz, and lifecycle helper compatibility contracts without moving ECStore storage metadata ownership. |
| Migration preservation | passed | KMS endpoint URLs, query aliases, request bodies, response contracts, and dedicated `kms:*` authorization behavior are preserved; event builder call sites, ECStore event bridge conversion, restore event data, version IDs, metadata filtering, config read/save semantics, S3 Select store/error/buffer semantics, OBS metrics state reads, IAM config/notification/error semantics, Swift bucket metadata access, heal disk/resume/task behavior, scanner lifecycle/replication/data-usage behavior, RustFS startup/admin/app/storage runtime access, e2e/test/fuzz import behavior, lifecycle expiration/transition helper DTO field contracts, unchanged no-op handling, and remove-event behavior are preserved. |
| Testing/verification | passed | Focused compiles/tests, guards, formatting, diff hygiene, risk scan, and full `make pre-commit` passed for the current slice. |
## Verification Notes
Passed before push:
- API-050 current slice:
- `cargo test -p rustfs-storage-api lifecycle_helper_defaults_preserve_existing_contracts --no-fail-fast`:
passed.
- `cargo check --tests -p rustfs-storage-api -p rustfs-ecstore -p rustfs-notify`:
passed.
- `cargo test -p rustfs-ecstore transitioned --no-fail-fast`: passed.
- `cargo test -p rustfs-notify ecstore_object_info_conversion_preserves_notify_event_fields --no-fail-fast`:
passed.
- `cargo check --tests -p rustfs`: passed.
- `./scripts/check_architecture_migration_rules.sh`: passed.
- `./scripts/check_layer_dependencies.sh`: passed.
- `cargo fmt --all --check`: passed.
- `git diff --check`: passed.
- Rust risk scan: passed; no new unwrap/expect, panic/todo/unsafe, risky
casts, ad-hoc error construction, or sensitive-token handling in added
lines.
- `make pre-commit`: passed.
- S-015 current slice:
- `cargo test -p rustfs-policy test_legacy_kms_admin_actions_are_rejected --no-fail-fast`:
passed.
- `cargo test -p rustfs kms_key_auth_actions_use_dedicated_kms_actions --no-fail-fast`:
passed.
- `cargo test -p rustfs route_policy_records_dedicated_kms_actions --no-fail-fast`:
passed.
- `cargo test -p rustfs route_policy_rejects_server_info_for_sensitive_kms_actions --no-fail-fast`:
passed.
- `cargo check --tests -p rustfs-policy -p rustfs`: passed.
- `./scripts/check_architecture_migration_rules.sh`: passed.
- `./scripts/check_layer_dependencies.sh`: passed.
- `cargo fmt --all --check`: passed.
- `git diff --check`: passed.
- `make pre-commit`: passed.
- S-014 previous slice:
- `cargo test -p rustfs kms_key_auth_actions_use_dedicated_kms_actions --no-fail-fast`:
passed.
- `cargo test -p rustfs route_policy_records_dedicated_kms_actions --no-fail-fast`:
passed.
- `cargo test -p rustfs route_policy_rejects_server_info_for_sensitive_kms_actions --no-fail-fast`:
passed.
- `cargo check --tests -p rustfs`: passed.
- `./scripts/check_architecture_migration_rules.sh`: passed.
- `./scripts/check_layer_dependencies.sh`: passed.
- `cargo fmt --all --check`: passed.
- `git diff --check`: passed.
- Source marker scan: passed; no non-doc `RUSTFS_COMPAT_TODO` markers remain.
- Rust risk scan: passed; no new unwrap/expect, panic/todo/unsafe, risky
casts, ad-hoc error construction, or sensitive-token handling in added
lines.
- `make pre-commit`: passed.
- API-049 current slice:
- `cargo check --tests -p rustfs-heal -p rustfs-scanner -p e2e_test`:
passed.
- `cargo check --manifest-path fuzz/Cargo.toml --all-targets`: passed.
- `./scripts/check_architecture_migration_rules.sh`: passed.
- `./scripts/check_layer_dependencies.sh`: passed.
- `cargo fmt --all --check`: passed.
- `git diff --check`: passed.
- Rust risk scan: passed; no new unwrap/expect, panic/todo/unsafe, risky
casts, ad-hoc error construction, or sensitive-token handling in added
lines.
- `make pre-commit`: passed.
- API-048 current slice:
- `cargo check --tests -p rustfs`: passed.
- `./scripts/check_architecture_migration_rules.sh`: passed.