48 lines
3.0 KiB
Python
Executable File
48 lines
3.0 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
"""Source-only guardrails for the uncompiled 0.34.0 hot-path candidate."""
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[2]
|
|
def src(path):
|
|
return (ROOT / path).read_text()
|
|
|
|
snapshot = src("src/config/snapshot.rs")
|
|
assert "fn host_patterns(host: &str) -> impl Iterator" in snapshot
|
|
assert "pub fn select_on_arc(" in snapshot
|
|
assert "self.select_on_arc(host, path, local, tls).map(Arc::as_ref)" in snapshot
|
|
assert "Vec<Arc<CompiledRoute>>" in src("src/config/model.rs")
|
|
assert "route: Option<Arc<crate::config::CompiledRoute>>" in src("src/proxy/types.rs")
|
|
assert "request.extensions_mut().insert(SelectedRouteContext" in src("src/proxy/upstream_helpers.rs")
|
|
assert "selection.route.as_deref()" in src("src/proxy/forward_entry.rs")
|
|
assert "let fallback_request = selected" in src("src/proxy/forward_entry.rs")
|
|
assert "filter(|route| route.error_fallback.is_some())" in src("src/proxy/forward_entry.rs")
|
|
assert "let Some(next_request) = replay_headers" in src("src/proxy/forward/upstream.rs") or "replay_headers.as_ref().and_then" in src("src/proxy/forward/upstream.rs")
|
|
assert "let replay_headers = ((pool_retry_possible || h2_replay_possible)" in src("src/proxy/forward/upstream.rs")
|
|
pool = src("src/balance/pool_core.rs")
|
|
assert "if self.members.len() == 1 && !self.cookie_affinity()" in pool
|
|
assert "let mut scheduling = lock(&self.scheduling);" in pool
|
|
assert "fn candidates_excluding" in pool
|
|
assert "health: member.health_settings.clone()" in pool
|
|
assert "health: selected.health_settings.clone()" in pool
|
|
assert "health_settings: Arc<HealthCheck>" in src("src/balance/health.rs")
|
|
assert "healthy_cached: AtomicBool" in src("src/balance/model.rs")
|
|
assert "self.healthy_cached.store(h.healthy, Ordering::Release)" in src("src/balance/health.rs")
|
|
exchange = src("src/proxy/body.rs")
|
|
for field in ("source", "cache_effective_enabled", "transform_effective_enabled"):
|
|
assert f"pub {field}: AtomicU8" in exchange
|
|
assert f"pub {field}: Mutex" not in exchange
|
|
assert "exchange.set_source(" in src("src/proxy/forward/route_cache.rs")
|
|
assert "exchange.set_cache_enabled(" in src("src/proxy/forward/web_source.rs")
|
|
assert "self.live.receiver_count() != 0" in src("src/logging/format.rs")
|
|
assert "fn route_handles_reuse_snapshot_ownership_without_cloning_compiled_routes" in src("src/config/tests.rs")
|
|
assert "fn single_backend_fast_path_observes_capacity_and_health_without_affinity_cookie" in src("src/balance/tests.rs")
|
|
assert "fn atomic_exchange_tags_keep_original_observability_fields" in src("src/proxy/body/tests.rs")
|
|
for path in (ROOT / "src").rglob("*.rs"):
|
|
if "/tests/" in path.as_posix() or path.name == "tests.rs" or path.is_relative_to(ROOT / "tests"):
|
|
continue
|
|
assert len(path.read_text().splitlines()) <= 500, path
|
|
assert 'version = "0.34.0"' in src("Cargo.toml")
|
|
assert "max_idle_per_host: 64" in src("src/balance/model.rs")
|
|
assert "pool_recycle_requests: 25_000" in src("src/balance/model.rs")
|
|
print("PASS 0.34.0 proxy hot-path wiring, observability, bounded tuned defaults and source-size limits (STATIC ONLY)")
|