mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-12 08:06:54 +00:00
e742a540a4
`full_object_plaintext_len` decides whether a body-cache hook hit may serve bytes in place of the erasure read. It is a fail-closed allow-list: it excludes every read whose `ReadPlan::build` applies some other transform (ranged/part, raw/data-movement, restore, encrypted, remote) with an early `return None`, then returns a `Some(..)` length only for the whole-plaintext cases. A newly added `ReadPlan` branch that nobody teaches this gate about falls through to `None` and safely bypasses the cache. Flip it to a deny-list and the same new branch silently serves bytes in the wrong representation — the backlog#1108 / #1109 / #1146 class of bug. The existing unit and e2e tests only cover the branches that exist today. This adds `scripts/check_body_cache_whitelist.sh`, a structural guard wired into pre-commit / pre-pr / dev-check and CI, that asserts every exclusion predicate and a `return None` still precede the first `Some(..)`. Reordering a predicate, dropping one, moving the positive return ahead of the gate, or renaming/removing the function all fail; wording, formatting, and adding a new exclusion in the same gate do not. Mutation-tested against all four regression shapes. This machine-enforces the structural invariant that backlog#1146 was kept open to guard by hand. Co-authored-by: heihutu <heihutu@gmail.com>
67 lines
2.3 KiB
Makefile
67 lines
2.3 KiB
Makefile
## —— Code quality and Formatting ------------------------------------------------------------------
|
|
|
|
.NOTPARALLEL: fix
|
|
|
|
.PHONY: fmt
|
|
fmt: core-deps fmt-deps ## Format code
|
|
@echo "🔧 Formatting code..."
|
|
cargo fmt --all
|
|
|
|
.PHONY: fmt-check
|
|
fmt-check: core-deps fmt-deps ## Check code formatting
|
|
@echo "📝 Checking code formatting..."
|
|
cargo fmt --all --check
|
|
|
|
.PHONY: clippy-check
|
|
clippy-check: core-deps ## Run clippy checks
|
|
@echo "🔍 Running clippy checks..."
|
|
cargo clippy --all-targets -- -D warnings
|
|
|
|
.PHONY: clippy-fix
|
|
clippy-fix: core-deps ## Apply clippy fixes
|
|
@echo "🔧 Applying clippy fixes..."
|
|
cargo clippy --fix --allow-dirty
|
|
|
|
.PHONY: fix
|
|
fix: fmt clippy-fix ## Format code and apply clippy fixes
|
|
|
|
.PHONY: quick-check
|
|
quick-check: core-deps ## Run fast workspace compilation check
|
|
@echo "🔨 Running fast compilation check..."
|
|
cargo check --workspace --exclude e2e_test
|
|
|
|
.PHONY: unsafe-code-check
|
|
unsafe-code-check: ## Check unsafe_code allowances have SAFETY comments
|
|
@echo "🔒 Checking unsafe_code allowances..."
|
|
./scripts/check_unsafe_code_allowances.sh
|
|
|
|
.PHONY: architecture-migration-check
|
|
architecture-migration-check: ## Check architecture migration guardrails
|
|
@echo "🏗️ Checking architecture migration guardrails..."
|
|
./scripts/check_architecture_migration_rules.sh
|
|
|
|
.PHONY: logging-guardrails-check
|
|
logging-guardrails-check: ## Check logging guardrails for redaction and noise regressions
|
|
@echo "🪵 Checking logging guardrails..."
|
|
./scripts/check_logging_guardrails.sh
|
|
|
|
.PHONY: tokio-io-uring-check
|
|
tokio-io-uring-check: ## Check tokio io-uring runtime feature stays removed
|
|
@echo "🚫 Checking tokio io-uring feature guard..."
|
|
./scripts/check_no_tokio_io_uring.sh
|
|
|
|
.PHONY: extension-schema-check
|
|
extension-schema-check: ## Check extension-schema stays a lightweight contract crate
|
|
@echo "🧩 Checking extension schema boundaries..."
|
|
./scripts/check_extension_schema_boundaries.sh
|
|
|
|
.PHONY: body-cache-whitelist-check
|
|
body-cache-whitelist-check: ## Check the body-cache eligibility gate stays a fail-closed allow-list
|
|
@echo "🧱 Checking body-cache whitelist guard..."
|
|
./scripts/check_body_cache_whitelist.sh
|
|
|
|
.PHONY: compilation-check
|
|
compilation-check: core-deps ## Run compilation check
|
|
@echo "🔨 Running compilation check..."
|
|
cargo check --all-targets
|