mirror of
https://github.com/rustfs/rustfs.git
synced 2026-07-27 16:48:58 +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>
27 lines
1.4 KiB
Makefile
27 lines
1.4 KiB
Makefile
## —— Pre Commit Checks ----------------------------------------------------------------------------
|
|
|
|
.NOTPARALLEL: pre-commit pre-pr dev-check
|
|
|
|
.PHONY: setup-hooks
|
|
setup-hooks: ## Set up git hooks
|
|
@echo "🔧 Setting up git hooks..."
|
|
chmod +x .git/hooks/pre-commit
|
|
@echo "✅ Git hooks setup complete!"
|
|
|
|
.PHONY: doc-paths-check
|
|
doc-paths-check: ## Check that instruction/architecture docs reference existing file paths
|
|
@echo "📄 Checking doc path references..."
|
|
./scripts/check_doc_paths.sh
|
|
|
|
.PHONY: pre-commit
|
|
pre-commit: fmt-check unsafe-code-check architecture-migration-check logging-guardrails-check tokio-io-uring-check extension-schema-check body-cache-whitelist-check doc-paths-check quick-check ## Run fast pre-commit checks without clippy/full tests
|
|
@echo "✅ All pre-commit checks passed!"
|
|
|
|
.PHONY: pre-pr
|
|
pre-pr: fmt-check unsafe-code-check architecture-migration-check logging-guardrails-check tokio-io-uring-check extension-schema-check body-cache-whitelist-check doc-paths-check clippy-check test ## Run full pre-PR checks with clippy and tests
|
|
@echo "✅ All pre-PR checks passed!"
|
|
|
|
.PHONY: dev-check
|
|
dev-check: fmt-check unsafe-code-check architecture-migration-check logging-guardrails-check tokio-io-uring-check extension-schema-check body-cache-whitelist-check doc-paths-check quick-check ## Run fast local development checks
|
|
@echo "✅ Fast development checks passed!"
|