Skip to content

Add opt-in reusable application lifecycles - #379

Draft
prk-Jr wants to merge 3 commits into
mainfrom
feat/reusable-app-lifecycle
Draft

prk-Jr wants to merge 3 commits into
mainfrom
feat/reusable-app-lifecycle

Conversation

@prk-Jr

@prk-Jr prk-Jr commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Let applications amortize construction across requests through opt-in Fastly serving and caller-owned retained apps on Cloudflare and Spin. Existing entry points and Axum's retained-router lifecycle remain unchanged.
  • Preserve fresh request configuration, registries, and extensions, with custom Fastly dispatch and streaming supported through the SDK callback APIs.
  • Add Rust fixtures and CI coverage for initialization, isolation, failures, streaming, and lifecycle measurements. Correct Cloudflare's existing loss of duplicate response headers, including Set-Cookie.

Changes

Crate / File Change
edgezero-adapter-fastly Export SDK serving types; add retained-app serving helpers, one-time initialization tests, and warnings for ignored serving summaries.
edgezero-adapter-cloudflare Add explicit-metadata dispatch_app; replace generated header defaults once and append remaining application values.
edgezero-adapter-spin Add explicit-metadata dispatch_app with fresh request setup.
edgezero-core tests Cover retained app bounds, overlapping request isolation, cancellation cleanup, and recursion-guard cleanup.
tests/fixtures/reusable-app, smoke script, CI Add an isolated Rust fixture workspace, local HTTP driver, A/B/C measurements, and required Fastly HTTP smoke coverage.
Adapter guides, spec, plan, demo comment Document ownership, limits, failure behavior, adoption, rollback, and evidence boundaries.

Test plan

The following checks passed during implementation. Local CI gates were not rerun for PR creation; GitHub Actions will validate the submitted branch.

  • cargo test --workspace --all-targets
  • cargo clippy --workspace --all-targets --all-features -- -D warnings
  • cargo fmt --all -- --check
  • cargo check --workspace --all-targets --features "fastly cloudflare spin"
  • Fastly, Cloudflare, and Spin WASM target checks and fixture builds
  • Fastly WASM library and contract tests
  • Locked fixture tests: 17 harness tests and 2 portable tests
  • Docs formatting, lint, and build
  • Local Fastly HTTP smoke and matched cheap/expensive construction benchmarks
  • Local Cloudflare/Axum checks and Spin retained-mode overlap and binding recovery

Validation limits

  • The latest all-provider smoke exited 2 because Spin's per-request control selected different guests after three overlap attempts; retained-mode overlap passed.
  • Viceroy 0.17.0 admitted at most six requests per guest, including with an SDK limit of 100. Stable rounded memory samples over that span do not establish long-lived memory behavior.
  • Deployed eviction, resource lifetimes, and workload performance remain unverified. Application refresh, key rotation, and cache policies remain caller-owned.
  • Some fault modes have no supported local injection mechanism. Details and reproducible commands are in the fixture README. No deployment was performed.

Checklist

  • Changes follow repository conventions, with issue linking and local gate reruns omitted as requested
  • No Tokio dependencies added to core or adapter crates
  • Route parameters use {id} syntax
  • Application HTTP types come from edgezero_core
  • Metadata-aware dispatch uses existing registry construction
  • New lifecycle behavior has tests
  • No secrets or credentials committed; runtime artifacts are ignored

Add retained Fastly serving helpers and explicit prebuilt-app dispatch for Cloudflare and Spin while preserving default lifecycles. Preserve repeated Cloudflare response headers.

Add Rust lifecycle fixtures, isolation and cancellation coverage, local measurement tooling, CI integration, and adapter documentation with explicit provider validation limits.
@prk-Jr prk-Jr self-assigned this Sep 15, 2026
@prk-Jr
prk-Jr marked this pull request as draft September 15, 2026 12:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant