-
Notifications
You must be signed in to change notification settings - Fork 0
Integrate Wildside with Nile Valley previews #358
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
leynos
wants to merge
17
commits into
main
Choose a base branch
from
backend-nile-valley-integration
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
7d9c77c
Add Nile Valley integration ExecPlan
leynos 4e3083f
Move health observation into domain
leynos d01fe30
Record health milestone review
leynos 4b41354
Harden backend container image
leynos 97c1f70
Record container milestone review
leynos 66cf831
Align Helm chart with Nile Valley
leynos 713b2be
Record Helm milestone review
leynos 5aaf44f
Add local k3d preview workflow
leynos ebbf228
Record local preview milestone review
leynos fea1a1d
Document Nile Valley preview integration
leynos e717eb5
Close Nile Valley integration execplan
leynos e0fb902
Extract image tag validation predicate
leynos 99fa83e
Extract health probe request helper
leynos 0ec7225
Snapshot health probe response envelopes
leynos bc93169
Bump qs audit override
leynos 2127f0c
Fix local k8s service status lookup
leynos 58b8165
Skip Docker preflight for prebuilt previews
leynos File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| .git | ||
| .gitignore | ||
| .node_modules | ||
| .tmp | ||
| .uv-cache | ||
| **/.terraform | ||
| **/.uv-cache | ||
| **/node_modules | ||
| **/target | ||
| coverage | ||
| frontend-pwa/dist | ||
| target | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,214 @@ | ||
| //! Domain health observations for process liveness and readiness. | ||
| //! | ||
| //! The health model is intentionally small: it records whether the process | ||
| //! should be considered alive and whether it is ready to receive traffic. HTTP, | ||
| //! Kubernetes, Docker, and Helm adapters map these domain observations to their | ||
| //! own protocols. | ||
|
|
||
| use std::sync::atomic::{AtomicBool, Ordering}; | ||
|
|
||
| use crate::domain::ports::HealthObserver; | ||
|
|
||
| /// Health status reported by a domain health observation. | ||
| #[derive(Clone, Copy, Debug, Eq, PartialEq)] | ||
| pub enum HealthStatus { | ||
| /// The observed capability is available. | ||
| Healthy, | ||
| /// The observed capability is unavailable. | ||
| Unhealthy, | ||
| } | ||
|
|
||
| impl HealthStatus { | ||
| /// Return whether this status represents a healthy observation. | ||
| /// | ||
| /// # Examples | ||
| /// | ||
| /// ``` | ||
| /// use backend::domain::HealthStatus; | ||
| /// | ||
| /// assert!(HealthStatus::Healthy.is_healthy()); | ||
| /// assert!(!HealthStatus::Unhealthy.is_healthy()); | ||
| /// ``` | ||
| pub fn is_healthy(self) -> bool { | ||
| matches!(self, Self::Healthy) | ||
| } | ||
| } | ||
|
|
||
| /// A liveness or readiness observation owned by the domain layer. | ||
| #[derive(Clone, Copy, Debug, Eq, PartialEq)] | ||
| pub struct HealthObservation { | ||
| status: HealthStatus, | ||
| } | ||
|
|
||
| impl HealthObservation { | ||
| /// Build a healthy observation. | ||
| /// | ||
| /// # Examples | ||
| /// | ||
| /// ``` | ||
| /// use backend::domain::HealthObservation; | ||
| /// | ||
| /// assert!(HealthObservation::healthy().is_healthy()); | ||
| /// ``` | ||
| pub fn healthy() -> Self { | ||
| Self { | ||
| status: HealthStatus::Healthy, | ||
| } | ||
| } | ||
|
|
||
| /// Build an unhealthy observation. | ||
| /// | ||
| /// # Examples | ||
| /// | ||
| /// ``` | ||
| /// use backend::domain::HealthObservation; | ||
| /// | ||
| /// assert!(!HealthObservation::unhealthy().is_healthy()); | ||
| /// ``` | ||
| pub fn unhealthy() -> Self { | ||
| Self { | ||
| status: HealthStatus::Unhealthy, | ||
| } | ||
| } | ||
|
|
||
| /// Return this observation's status. | ||
| pub fn status(self) -> HealthStatus { | ||
| self.status | ||
| } | ||
|
|
||
| /// Return whether this observation is healthy. | ||
| pub fn is_healthy(self) -> bool { | ||
| self.status.is_healthy() | ||
| } | ||
| } | ||
|
|
||
| /// Shared process health state used by runtime adapters. | ||
| /// | ||
| /// New instances start live but not ready. The server composition root marks | ||
| /// readiness once the HTTP listener has been constructed. | ||
| pub struct ProcessHealth { | ||
| ready: AtomicBool, | ||
| live: AtomicBool, | ||
| } | ||
|
|
||
| impl Default for ProcessHealth { | ||
| fn default() -> Self { | ||
| Self { | ||
| ready: AtomicBool::new(false), | ||
| live: AtomicBool::new(true), | ||
| } | ||
| } | ||
| } | ||
|
|
||
| impl ProcessHealth { | ||
| /// Create health state starting live but not ready. | ||
| /// | ||
| /// # Examples | ||
| /// | ||
| /// ``` | ||
| /// use backend::domain::ProcessHealth; | ||
| /// use backend::domain::ports::HealthObserver; | ||
| /// | ||
| /// let health = ProcessHealth::new(); | ||
| /// assert!(health.observe_liveness().is_healthy()); | ||
| /// assert!(!health.observe_readiness().is_healthy()); | ||
| /// ``` | ||
| pub fn new() -> Self { | ||
| Self::default() | ||
| } | ||
|
|
||
| /// Mark the process as ready to serve traffic. | ||
| pub fn mark_ready(&self) { | ||
| self.ready.store(true, Ordering::Release); | ||
| } | ||
|
|
||
| /// Mark the process as not ready to serve traffic. | ||
| pub fn mark_not_ready(&self) { | ||
| self.ready.store(false, Ordering::Release); | ||
| } | ||
|
|
||
| /// Mark the process unhealthy so liveness checks fail. | ||
| pub fn mark_unhealthy(&self) { | ||
| self.live.store(false, Ordering::Release); | ||
| } | ||
|
|
||
| fn observation_from(is_healthy: bool) -> HealthObservation { | ||
| if is_healthy { | ||
| HealthObservation::healthy() | ||
| } else { | ||
| HealthObservation::unhealthy() | ||
| } | ||
| } | ||
| } | ||
|
|
||
| impl HealthObserver for ProcessHealth { | ||
| fn observe_liveness(&self) -> HealthObservation { | ||
| Self::observation_from(self.live.load(Ordering::Acquire)) | ||
| } | ||
|
|
||
| fn observe_readiness(&self) -> HealthObservation { | ||
| Self::observation_from(self.ready.load(Ordering::Acquire)) | ||
| } | ||
| } | ||
|
|
||
| #[cfg(test)] | ||
| mod tests { | ||
| //! Tests for domain health observations and state transitions. | ||
|
|
||
| use super::{HealthObservation, HealthStatus, ProcessHealth}; | ||
| use crate::domain::ports::HealthObserver; | ||
| use rstest::{fixture, rstest}; | ||
|
|
||
| #[fixture] | ||
| fn health() -> ProcessHealth { | ||
| ProcessHealth::new() | ||
| } | ||
|
|
||
| #[rstest] | ||
| fn default_health_starts_live_but_not_ready(health: ProcessHealth) { | ||
| assert_eq!( | ||
| health.observe_liveness().status(), | ||
| HealthStatus::Healthy, | ||
| "process should start live" | ||
| ); | ||
| assert_eq!( | ||
| health.observe_readiness().status(), | ||
| HealthStatus::Unhealthy, | ||
| "process should not start ready before runtime initialisation" | ||
| ); | ||
| } | ||
|
|
||
| #[rstest] | ||
| fn marking_ready_makes_readiness_healthy(health: ProcessHealth) { | ||
| health.mark_ready(); | ||
|
|
||
| assert!(health.observe_readiness().is_healthy()); | ||
| } | ||
|
|
||
| #[rstest] | ||
| fn marking_not_ready_makes_readiness_unhealthy(health: ProcessHealth) { | ||
| health.mark_ready(); | ||
| health.mark_not_ready(); | ||
|
|
||
| assert!(!health.observe_readiness().is_healthy()); | ||
| } | ||
|
|
||
| #[rstest] | ||
| fn marking_unhealthy_makes_liveness_unhealthy(health: ProcessHealth) { | ||
| health.mark_unhealthy(); | ||
|
|
||
| assert!(!health.observe_liveness().is_healthy()); | ||
| } | ||
|
|
||
| #[rstest] | ||
| #[case(HealthObservation::healthy(), HealthStatus::Healthy, true)] | ||
| #[case(HealthObservation::unhealthy(), HealthStatus::Unhealthy, false)] | ||
| fn observations_report_status_and_predicate( | ||
| #[case] observation: HealthObservation, | ||
| #[case] expected_status: HealthStatus, | ||
| #[case] expected_healthy: bool, | ||
| ) { | ||
| assert_eq!(observation.status(), expected_status); | ||
| assert_eq!(observation.is_healthy(), expected_healthy); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| //! Domain port for observing runtime health. | ||
|
|
||
| use crate::domain::HealthObservation; | ||
|
|
||
| /// Observes process health without leaking adapter protocols into the domain. | ||
| pub trait HealthObserver { | ||
| /// Report whether the process should be considered alive. | ||
| fn observe_liveness(&self) -> HealthObservation; | ||
|
|
||
| /// Report whether the process is ready to receive traffic. | ||
| fn observe_readiness(&self) -> HealthObservation; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: leynos/wildside
Length of output: 41
Fix the
.dockerignoredependency ignore pattern..node_modulesentry on.dockerignoreline 3: it only matches a literal root folder named.node_modules(none exists), while**/node_moduleson line 8 already ignores the standardnode_modulesdirectory everywhere in the build context.🤖 Prompt for AI Agents