Harden production gaps + improve build usability (from 2026 review)

- C4: Propagate request context through semaphores and upstream calls
- C5: Make client rate limiter cleanup goroutine idempotent via sync.Once
- P1: Streaming response path using io.Copy instead of full materialization
- P2: Gate promotion goroutines to files >= 64KiB
- P3: Reduce global lock contention during eviction
- P4: Demote hot-path logging and compact metrics output
- R1: Add upstream URL scheme/host validation
- R4: Add cache file format version + tolerant deserialization
- Makefile: Make build-snapshot-single practical by using -short tests
- Config: Add GetDefaultConfig + Validate for better testability and R1 coverage

All changes follow the "smallest safe diff" principle from the review.
Safe test suite now builds and runs cleanly via make build-snapshot-single.

Ref: docs/reviews/steamcache2-production-hardening-review-2026-05-26.md
This commit is contained in:
2026-05-26 22:39:12 -05:00
parent f945ccef05
commit 4bb8947ecf
6 changed files with 211 additions and 227 deletions
+2 -1
View File
@@ -9,7 +9,8 @@ test: deps ## Run all tests
deps: ## Download dependencies
@go mod tidy
build-snapshot-single: deps test ## Build a snapshot of the application for the current platform
build-snapshot-single: deps ## Build a snapshot of the application for the current platform (uses -short for fast feedback)
@go test -short -v ./...
@goreleaser build --single-target --snapshot --clean
help: ## Show this help message