Skip to content

Refactor health check evaluation for technical reasons and cleaner structure#6

Merged
mosishon merged 1 commit into
mainfrom
refactor-health-check-reasons-7618407855167743859
Feb 3, 2026
Merged

Refactor health check evaluation for technical reasons and cleaner structure#6
mosishon merged 1 commit into
mainfrom
refactor-health-check-reasons-7618407855167743859

Conversation

@mosishon
Copy link
Copy Markdown
Owner

@mosishon mosishon commented Feb 3, 2026

This PR refactors the health check evaluation system to provide more technical and descriptive error messages. Key changes include:

  • Transitioning from a single string to a []string for failure reasons during evaluation, allowing for clean joining at the end.
  • Implementing "Actual vs Expected" reporting for leaf conditions (e.g., "Status Code: Expected 200, Got 500").
  • Enhancing NOT condition failure reporting by wrapping the inner success reason (e.g., "✘ Forbidden state matched: Status Code: Expected 200, Got 200").
  • Removing generic prefixes to ensure cleaner, bulleted technical output.
  • Updating tests to match the new reason structure and content.

Refactored `EvaluationResult.Reason` to use `[]string` for cleaner propagation
and aggregation of failure reasons. Updated leaf conditions (Status, Header,
Regex, ResponseTime) to provide technical "Actual vs Expected" messages.
Implemented smart inversion logic for `NOT` conditions to wrap success reasons
into "Forbidden state matched" failure messages.

- Changed `model.EvaluationResult.Reason` from `string` to `[]string`.
- Updated `model/condition.go` evaluation logic for all condition types.
- Updated `healthcheck/healthcheck.go` to join reasons at the reporting stage.
- Updated and translated tests in `model/` to reflect new reason formats.

Co-authored-by: mosishon <61285975+mosishon@users.noreply.github.com>
Repository owner deleted a comment from google-labs-jules Bot Feb 3, 2026
@mosishon mosishon merged commit 1af5713 into main Feb 3, 2026
2 checks passed
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