dwara_core/lifecycle/mod.rs
1//! API lifecycle management (DW-110).
2//!
3//! Three concerns that span the lifetime of an API surface the gateway
4//! fronts, all hand-rolled over existing substrates (no new
5//! dependencies):
6//!
7//! - [`portal`] -- the developer portal: a read-only static HTML page
8//! auto-generated from the configured OpenAPI spec sources. It
9//! aggregates the existing OpenAPI specs (file paths or upstream
10//! `/openapi.json` endpoints) into a single listing of the APIs, their
11//! versions, and links to the specs. The portal is served at a
12//! configured reserved path (before route resolution, like
13//! `/healthz`).
14//! - [`profiles`] -- environment profiles: dev/staging/prod config
15//! overlays. A `ProfileOverlay` carries a base config plus per-profile
16//! config patches; [`profiles::apply_profile`] merges the selected
17//! profile's patch onto the base. The profile is selected via the
18//! `DWARA_PROFILE` env var.
19//! - [`journey`] -- the API journey recorder: records the request flow
20//! through the gateway (route match, authn, authz, transforms,
21//! upstream pick, response) as a JSON document, stored via the
22//! existing analytics raw table. A `Journey` is a vec of `JourneyStep`
23//! (phase, duration, result, detail) keyed by request id.
24//!
25//! ## Feature gate
26//!
27//! The `api_lifecycle` cargo feature must be enabled. Without it, the
28//! module is not compiled and the top-level `lifecycle` config block is
29//! accepted but inert (validation warns, mirroring the `a2a`/`graphql`
30//! pattern).
31//!
32//! ## Dependency direction
33//!
34//! `lifecycle` depends on `config` (the config schema), `observability`
35//! (metrics), and `analytics` (the raw table the journey recorder
36//! stores into). It never imports `dataplane` -- the dataplane calls
37//! into the journey recorder and the portal renderer, never the
38//! reverse (the same direction the `ai` domain holds).
39
40pub mod journey;
41pub mod portal;
42pub mod profiles;
43
44pub use journey::{
45 journey_dimension, Journey, JourneyConfig, JourneyRecorder, JourneyStep, JourneyStepResult,
46};
47pub use portal::{DevPortal, DevPortalConfig, DevPortalSpec, DevPortalSpecSource, LoadedSpec};
48pub use profiles::{apply_profile, AppliedProfile, EnvProfile, ProfileOverlay};