Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
546474e
feat(axum): add production startup and bounded shutdown
ChristianPavilonis Oct 6, 2026
798ef2b
ci: run ordinary checks on every pull request base
ChristianPavilonis Nov 10, 2026
49ba021
fix(axum): retain invalid native limits and platform key identity
ChristianPavilonis Nov 10, 2026
afe9bd7
fix(ci): sync the hosting fixture validator dependency lock
ChristianPavilonis Nov 10, 2026
1d8e42e
fix(ci): align test-only listener and stacked workflow contracts
ChristianPavilonis Nov 10, 2026
4f45fe8
test(cli): retain logging proof at the managed startup boundary
ChristianPavilonis Nov 10, 2026
9f090e5
fix(cli): generate image helpers only with Fastly example
ChristianPavilonis Nov 10, 2026
c49433e
Carry received-head preparation through native hosting
ChristianPavilonis Nov 12, 2026
1b5e361
Install prepared routes without rebuilding application policies
ChristianPavilonis Nov 12, 2026
0fdcb72
Merge current PR 275 review repairs and complete evidence readback
ChristianPavilonis Nov 12, 2026
6d1dda1
Retain deterministic callback-scope fixture from PR 275
ChristianPavilonis Nov 12, 2026
a13f68a
Merge owned cutover follow-up through PR 406
ChristianPavilonis Nov 13, 2026
9d3e7c0
Merge PR #460 into PR #406 for outbound compatibility stack
ChristianPavilonis Nov 13, 2026
b3187e1
Merge PR #460 into PR #406 for outbound compatibility stack
aram356 Nov 14, 2026
603bb0c
Merge PR #460 into PR #406 for outbound compatibility stack
aram356 Nov 16, 2026
e37e0df
Merge PR #460 into PR #406 for outbound compatibility stack
aram356 Nov 17, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 8 additions & 1 deletion crates/edgezero-adapter-axum/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ cli = [
"dep:toml",
"dep:walkdir",
]
test-utils = ["axum", "edgezero-core/test-utils"]
test-utils = ["axum", "edgezero-core/test-utils", "dep:validator"]

[dependencies]
edgezero-adapter = { path = "../edgezero-adapter", optional = true, features = [
Expand All @@ -55,6 +55,7 @@ redb = { workspace = true, optional = true }
reqwest = { workspace = true, optional = true }
serde = { workspace = true }
serde_json = { workspace = true }
validator = { workspace = true, optional = true }
simple_logger = { workspace = true }
thiserror = { workspace = true }
tokio = { workspace = true, optional = true }
Expand All @@ -66,6 +67,12 @@ walkdir = { workspace = true, optional = true }
[target.'cfg(unix)'.dependencies]
libc = { workspace = true }

[[bin]]
name = "edgezero-hosting-fixture"
path = "tests/fixtures/production_host.rs"
required-features = ["axum", "test-utils"]
test = false

[dev-dependencies]
async-trait = { workspace = true }
axum = { workspace = true, features = ["macros"] }
Expand Down
24 changes: 23 additions & 1 deletion crates/edgezero-adapter-axum/src/config_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,23 @@ impl AxumConfigStore {
path: &Path,
limits: ConfigStoreLimits,
existing: usize,
) -> Result<Self, ConfigStoreError> {
Self::load_snapshot(path, limits, existing, false)
}

pub(crate) fn load_required_at_startup(
path: &Path,
limits: ConfigStoreLimits,
existing: usize,
) -> Result<Self, ConfigStoreError> {
Self::load_snapshot(path, limits, existing, true)
}

fn load_snapshot(
path: &Path,
limits: ConfigStoreLimits,
existing: usize,
required: bool,
) -> Result<Self, ConfigStoreError> {
let mut options = fs::OpenOptions::new();
options.read(true);
Expand All @@ -137,7 +154,12 @@ impl AxumConfigStore {
}
Snapshot::load(&mut file, limits, existing)?
}
Err(err) if err.kind() == ErrorKind::NotFound => Snapshot::empty(limits, existing)?,
Err(err) if err.kind() == ErrorKind::NotFound && !required => {
Snapshot::empty(limits, existing)?
}
Err(err) if err.kind() == ErrorKind::NotFound => {
return Err(ConfigStoreError::unavailable("config file missing"));
}
Err(_io) => {
return Err(ConfigStoreError::unavailable("config snapshot open failed"));
}
Expand Down
41 changes: 39 additions & 2 deletions crates/edgezero-adapter-axum/src/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ use std::error::Error as StdError;
use std::future::{self, Future};
use std::io;

use edgezero_core::probe::LifecyclePhase;
use http_body::Body as HttpBody;
use hyper::Request;
use hyper::body::Incoming;
use hyper::server::conn::http1::Builder as Http1Builder;
use hyper::service::Service;
use hyper_util::rt::TokioIo;
use tokio::net::TcpStream;
use tokio::sync::watch;
use tokio::time::{Instant as TokioInstant, sleep_until};

use crate::header_deadline::{HeaderDeadline, HeaderDeadlineExceeded, HeaderIo, HeaderService};
Expand All @@ -24,15 +26,33 @@ pub(crate) enum ConnectionExit {
DeadlineExceeded,
}

/// Owns HTTP/1 parsing, idle/header expiry and the existing response deadline race.
#[cfg(test)]
pub(crate) fn serve_http1<ServiceType, ResponseBody>(
stream: TcpStream,
service: ServiceType,
responses: EgressConnection,
limits: AxumIngressConfig,
) -> impl Future<Output = Result<ConnectionExit, hyper::Error>>
where
ServiceType: Service<Request<Incoming>, Response = hyper::Response<ResponseBody>>,
ServiceType::Error: Into<Box<dyn StdError + Send + Sync>>,
ServiceType::Future: 'static,
ResponseBody: HttpBody + 'static,
ResponseBody::Error: Into<Box<dyn StdError + Send + Sync>>,
{
serve_http1_with_shutdown(stream, service, responses, None, limits)
}

/// Owns bounded HTTP/1 parsing, response deadlines and graceful lifecycle drain.
#[expect(
clippy::integer_division_remainder_used,
reason = "tokio::select! expands to internal randomized branch selection arithmetic"
)]
pub(crate) fn serve_http1<ServiceType, ResponseBody>(
pub(crate) fn serve_http1_with_shutdown<ServiceType, ResponseBody>(
stream: TcpStream,
service: ServiceType,
responses: EgressConnection,
mut phase: Option<watch::Receiver<LifecyclePhase>>,
limits: AxumIngressConfig,
) -> impl Future<Output = Result<ConnectionExit, hyper::Error>>
where
Expand All @@ -59,6 +79,22 @@ where
let mut connection = Box::pin(connection_future);

loop {
if phase.as_ref().is_some_and(|reader| {
matches!(
*reader.borrow(),
LifecyclePhase::Draining | LifecyclePhase::Stopped
)
}) {
connection.as_mut().graceful_shutdown();
phase = None;
}
let draining = async {
if let Some(reader) = phase.as_mut() {
let _changed = reader.changed().await;
} else {
future::pending::<()>().await;
}
};
if head
.deadline()
.is_some_and(|deadline| TokioInstant::now() >= deadline)
Expand Down Expand Up @@ -95,6 +131,7 @@ where
}
() = head.changed() => {}
() = responses.changed() => {}
() = draining => {}
}
}
}
Expand Down
Loading
Loading