Bounded WEB HTTP conveyor with replay-safe streaming downlink added

Co-Authored-By: brekotis <93345790+brekotis@users.noreply.github.com>
This commit is contained in:
Alexey
2026-10-03 16:02:18 +03:00
parent c4555e25f3
commit 823c6cbc7f
39 changed files with 2186 additions and 237 deletions
+4
View File
@@ -453,3 +453,7 @@ mod base_path_tests;
#[cfg(test)]
#[path = "config_edit/tests.rs"]
mod tests;
#[cfg(test)]
#[path = "config_edit/conveyor_tests.rs"]
mod conveyor_tests;
+27
View File
@@ -0,0 +1,27 @@
use super::*;
#[tokio::test]
async fn conveyor_api_is_boolean_hot_and_rejects_invalid_patch_atomically() {
let directory = tempfile::tempdir().unwrap();
let path = directory.path().join("config.toml");
std::fs::write(&path, "[web]\nconveyor = true\n").unwrap();
for enabled in [false, true] {
let active = ProxyConfig::load(&path).unwrap();
let patch = serde_json::json!({"web": {"conveyor": enabled}});
let mut response = apply_patch_to_path(&path, &patch, None).await.unwrap();
let desired = ProxyConfig::load(&path).unwrap();
let resolved = reconcile_runtime_effect(&mut response, &active, &desired).unwrap();
assert_eq!(resolved.effective.web.conveyor, enabled);
assert!(response.runtime_reload_required);
assert!(!response.process_restart_required);
let (managed, _) = read_managed_config(&path).await.unwrap();
assert_eq!(managed["web"]["conveyor"].as_bool(), Some(enabled));
let previous = std::fs::read(&path).unwrap();
let invalid = serde_json::json!({"web": {"conveyor": "false"}});
let error = apply_patch_to_path(&path, &invalid, None)
.await
.unwrap_err();
assert_eq!(error.status, hyper::StatusCode::BAD_REQUEST);
assert_eq!(std::fs::read(&path).unwrap(), previous);
}
}
+2 -1
View File
@@ -176,7 +176,8 @@ async fn patch_web_debug_is_hot_and_limits_are_process_deferred() {
assert!(desired.web.debug.sideband);
let limits_patch: Json = serde_json::json!({
"web": {"limits": {"max_http_connections": 2049}}
// Extra HTTP heads must fit alongside the default-on conveyor metadata reservation.
"web": {"limits": {"max_http_connections": 2049, "memory_envelope_bytes": 1610612736u64}}
});
let limits = apply_patch_to_path(&path, &limits_patch, None)
.await