Skip to content

feat: add health check enumeration in settings - #29266

Open
KHARSHAVARDHAN-eng wants to merge 4 commits into
argoproj:masterfrom
KHARSHAVARDHAN-eng:feat/29248-health-check-enumeration
Open

feat: add health check enumeration in settings#29266
KHARSHAVARDHAN-eng wants to merge 4 commits into
argoproj:masterfrom
KHARSHAVARDHAN-eng:feat/29248-health-check-enumeration

Conversation

@KHARSHAVARDHAN-eng

Copy link
Copy Markdown
Contributor

Summary

Adds a Settings → Health Checks view for inspecting configured Argo CD health checks.

What's included

  • Enumerates built-in Go health checks
  • Enumerates embedded Lua health checks
  • Enumerates custom and overridden Lua health checks
  • Adds a SettingsService API endpoint
  • Adds search, filtering, and sorting in the UI
  • Adds a detail panel with health check metadata
  • Adds read-only Lua source viewing
  • Adds documentation for the new UI

Testing

  • go test ./gitops-engine/pkg/health/...
  • go test ./util/lua/...
  • go test ./server/settings/...
  • pnpm lint
  • pnpm test -- health-checks-list

Fixes #29248

@KHARSHAVARDHAN-eng
KHARSHAVARDHAN-eng requested review from a team as code owners August 19, 2026 13:54
@bunnyshell

bunnyshell Bot commented Aug 19, 2026

Copy link
Copy Markdown

✅ Preview Environment deployed on Bunnyshell

Component Endpoints
argocd https://argocd-ie77n3.bunnyenv.com/
argocd-ttyd https://argocd-web-cli-ie77n3.bunnyenv.com/

See: Environment Details | Pipeline Logs

Available commands (reply to this comment):

  • 🔴 /bns:stop to stop the environment
  • 🚀 /bns:deploy to redeploy the environment
  • /bns:delete to remove the environment

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Add health check enumeration to Settings

✨ Enhancement 🧪 Tests 📝 Documentation 🕐 40+ Minutes

Grey Divider

AI Description

• Enumerates built-in, embedded, custom, and overridden health checks through SettingsService.
• Adds searchable, filterable Settings UI with metadata and read-only Lua source viewing.
• Documents the workflow and tests enumeration, API mapping, and UI behavior.
Diagram

graph TD
  A["Go Registry"] --> D["Health Enumerator"] --> E["Settings API"] --> F["API Client"] --> G["Health Checks UI"] --> H["Details Panel"]
  B["Embedded Lua"] --> D
  C["Argo CD Config"] --> D
Loading
High-Level Assessment

The selected approach is appropriate: it centralizes native checks in an enumerable registry, aggregates all sources in the existing Lua/settings layer, and exposes them through the established SettingsService and UI patterns. Maintaining a separate catalog was considered but would duplicate runtime definitions and risk drift; runtime reflection is not practical for Go function dispatch or embedded script metadata.

Files changed (21) +2074 / -139

Enhancement (14) +1592 / -137
health.goMake native health checks enumerable +26/-47

Make native health checks enumerable

• Replaces the group-and-kind switch with a shared registry map. Adds an accessor returning all native health-check GVKs while preserving runtime lookup behavior.

gitops-engine/pkg/health/health.go

settings.pb.goGenerate health-check protobuf types and RPC bindings +795/-89

Generate health-check protobuf types and RPC bindings

• Adds generated Go messages, serialization logic, client and server interfaces, and gRPC registration for 'GetHealthChecks'.

pkg/apiclient/settings/settings.pb.go

settings.pb.gw.goGenerate the health-check REST gateway +65/-0

Generate the health-check REST gateway

• Adds generated grpc-gateway handlers and routing for the new SettingsService health-check endpoint.

pkg/apiclient/settings/settings.pb.gw.go

settings.goServe aggregated health-check definitions +29/-0

Serve aggregated health-check definitions

• Loads configured resource overrides, enumerates all health-check sources, maps their metadata to API objects, and returns contextual errors.

server/settings/settings.go

settings.protoDefine the health-check SettingsService contract +19/-0

Define the health-check SettingsService contract

• Introduces health-check item and list response messages plus the 'GetHealthChecks' RPC and REST mapping.

server/settings/settings.proto

health-check-details-panel.tsxAdd health-check details and source panel +104/-0

Add health-check details and source panel

• Displays selected check metadata in a sliding panel. Lua definitions use a read-only Monaco viewer, while native checks show a Go implementation notice.

ui/src/app/settings/components/health-checks-list/health-check-details-panel.tsx

health-checks-filter.tsxAdd origin-based health-check filtering +82/-0

Add origin-based health-check filtering

• Implements origin filter preferences, result calculation, option counts, and filter clearing for all supported health-check origins.

ui/src/app/settings/components/health-checks-list/health-checks-filter.tsx

health-checks-list.scssStyle health-check origins and details +51/-0

Style health-check origins and details

• Adds distinct origin badges, wildcard indicators, and layout styling for the details panel header.

ui/src/app/settings/components/health-checks-list/health-checks-list.scss

health-checks-list.tsxAdd the Health Checks settings page +235/-0

Add the Health Checks settings page

• Fetches and presents health checks with URL-backed search and selection, origin filtering, sorting, pagination, and an empty state. Selecting a row opens its details panel.

ui/src/app/settings/components/health-checks-list/health-checks-list.tsx

settings-container.tsxRegister the Health Checks settings route +2/-0

Register the Health Checks settings route

• Adds the '/settings/health-checks' route and renders the new listing component.

ui/src/app/settings/components/settings-container.tsx

settings-overview.tsxLink Health Checks from Settings overview +6/-0

Link Health Checks from Settings overview

• Adds a Settings overview entry describing and linking to the health-check definitions page.

ui/src/app/settings/components/settings-overview/settings-overview.tsx

models.tsModel health-check API responses +14/-0

Model health-check API responses

• Defines frontend types for individual health-check metadata and the list response.

ui/src/app/shared/models.ts

auth-service.tsFetch health checks through the shared service +5/-1

Fetch health checks through the shared service

• Adds a typed client method that retrieves health-check definitions from the Settings endpoint.

ui/src/app/shared/services/auth-service.ts

health_checks.goAggregate and classify health-check definitions +159/-0

Aggregate and classify health-check definitions

• Enumerates native Go, embedded Lua, custom Lua, and overridden Lua checks. It detects wildcard overrides, deduplicates definitions by key, preserves source metadata, and returns deterministic ordering.

util/lua/health_checks.go

Tests (4) +405 / -0
health_test.goVerify native health-check enumeration +10/-0

Verify native health-check enumeration

• Confirms all 13 registered GVKs are returned and still resolve to executable health-check functions.

gitops-engine/pkg/health/health_test.go

settings_test.goTest SettingsService health-check responses +43/-0

Test SettingsService health-check responses

• Verifies the endpoint returns native Go checks, custom Lua checks, and Lua overrides with the expected origins and metadata.

server/settings/settings_test.go

health-checks-list.test.tsTest health-check list interactions +168/-0

Test health-check list interactions

• Covers origin filtering, search, deterministic sorting, details rendering, read-only Lua source display, and panel closure.

ui/src/app/settings/components/health-checks-list/health-checks-list.test.ts

health_checks_test.goTest health-check aggregation semantics +184/-0

Test health-check aggregation semantics

• Covers native and embedded definitions, custom and wildcard overrides, deterministic deduplication, and unchanged runtime Lua evaluation.

util/lua/health_checks_test.go

Documentation (2) +73 / -0
swagger.jsonDocument the health-check listing REST endpoint +60/-0

Document the health-check listing REST endpoint

• Adds the generated OpenAPI operation for GET '/api/v1/settings/health-checks' and schemas for health-check metadata and list responses.

assets/swagger.json

health.mdDocument health-check inspection in Settings +13/-0

Document health-check inspection in Settings

• Explains where operators can inspect health checks, the supported origins, displayed metadata, and Lua source behavior.

docs/operator-manual/health.md

Other (1) +4 / -2
generate-proto.shHarden local protobuf generation +4/-2

Harden local protobuf generation

• Creates the local include directory before generation and reads proto paths safely line-by-line instead of splitting shell words.

hack/generate-proto.sh

@qodo-code-review

qodo-code-review Bot commented Aug 19, 2026

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Action required

1. Lua source lacks authorization ✓ Resolved 🐞 Bug ⛨ Security
Description
GetHealthChecks performs no RBAC check and returns complete custom Lua source to every authenticated
account, as well as anonymous callers when anonymous access is enabled. This exposes arbitrary
health-check code stored in argocd-cm beyond the operators described as the feature's intended
users.
Code

server/settings/settings.go[R218-220]

+			Origin:      string(def.Origin),
+			LuaScript:   def.LuaScript,
+			UseOpenLibs: def.UseOpenLibs,
Evidence
The endpoint loads resource overrides and copies each definition's full LuaScript into its response.
Settings authentication contains no RBAC enforcement, and the server authentication path permits an
anonymous principal when anonymous access is enabled.

server/settings/settings.go[200-225]
server/settings/settings.go[228-236]
util/lua/health_checks.go[94-132]
server/server.go[1581-1596]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The new health-check endpoint returns complete custom and override Lua scripts without resource-level authorization. Any authenticated account, and anonymous callers when anonymous access is enabled, can retrieve code configured in `argocd-cm`.

## Issue Context
`AuthFuncOverride` only authenticates requests; it does not authorize access to this newly exposed configuration. Restrict the endpoint to an appropriate operator permission, or ensure callers without that permission cannot receive configured Lua source.

## Fix Focus Areas
- server/settings/settings.go[200-225]
- server/settings/settings.go[228-236]
- server/server.go[1581-1596]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. JSX test uses .ts extension ⊘ Outdated 📘 Rule violation ≡ Correctness
Description
health-checks-list.test.ts contains JSX, but TypeScript parses JSX only in .tsx files.
Jest/ts-jest and UI linting will fail to parse the new test, violating the required passing test and
lint targets.
Code

ui/src/app/settings/components/health-checks-list/health-checks-list.test.ts[106]

+        const {container} = render(<HealthCheckDetailsPanel item={null} onClose={onClose} />);
Evidence
PR Compliance ID 4 requires lint and test targets to pass. The added test renders
<HealthCheckDetailsPanel ... /> as JSX in a .ts file, while the repository's Jest configuration
sends TypeScript tests through ts-jest.

AGENTS.md: Repository make targets must pass (build, codegen when applicable, lint, tests, cli build)
ui/src/app/settings/components/health-checks-list/health-checks-list.test.ts[104-107]
ui/jest.config.js[9-11]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The new test uses JSX while its filename has a `.ts` extension, causing TypeScript parsing failures in Jest and UI lint tooling.

## Issue Context
The repository uses `ts-jest` for `.ts` and `.tsx` tests. Files containing JSX must use the `.tsx` extension.

## Fix Focus Areas
- ui/src/app/settings/components/health-checks-list/health-checks-list.test.ts[106-106]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

3. Filter URL remains stale ✓ Resolved 🐞 Bug ≡ Correctness
Description
updateFilterPref changes only component state, leaving the origin query parameter unchanged when a
filter is selected or cleared. Reloading or sharing the page therefore restores the stale URL filter
rather than the visible selection.
Code

ui/src/app/settings/components/health-checks-list/health-checks-list.tsx[R84-87]

+    const updateFilterPref = (newPref: HealthChecksListPreferences) => {
+        setFilterPref(newPref);
+        setPage(0);
+    };
Evidence
The filter state is initialized from the URL, but its change handler only calls setFilterPref and
setPage. Search and row navigation separately write origin to the URL, demonstrating that
filter-only changes omit the required synchronization.

ui/src/app/settings/components/health-checks-list/health-checks-list.tsx[71-87]
ui/src/app/settings/components/health-checks-list/health-checks-list.tsx[97-106]
ui/src/app/settings/components/health-checks-list/health-checks-filter.tsx[63-75]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Origin filter changes update only local React state and do not update the URL query parameters. Reloads, copied links, and remounts consequently restore stale filter values.

## Issue Context
Initial filter state is derived from `query.getAll('origin')`, while search and row navigation already preserve the filter in the URL. Update the URL whenever the filter changes or is cleared.

## Fix Focus Areas
- ui/src/app/settings/components/health-checks-list/health-checks-list.tsx[71-87]
- ui/src/app/settings/components/health-checks-list/health-checks-filter.tsx[63-75]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


4. Wildcard customs mislabeled overrides ✓ Resolved 🐞 Bug ≡ Correctness
Description
EnumerateHealthChecks classifies every wildcard ConfigMap health check as OverrideLua even when it
matches no built-in check. For example, a new custom.io/* check is displayed as an override despite
being a custom wildcard definition.
Code

util/lua/health_checks.go[R105-107]

+		if !isOverride {
+			if isWildcard {
+				isOverride = true
Evidence
The unconditional wildcard branch bypasses the matching logic used for non-wildcard keys. Runtime
accepts any matching custom wildcard before looking for embedded scripts, so wildcard configuration
is not inherently an override of an existing built-in.

util/lua/health_checks.go[100-121]
util/lua/lua.go[251-286]
resource_customizations/.cnrm.cloud.google.com//health.lua[1-1]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Wildcard custom health checks are unconditionally marked as `OverrideLua`, even if their pattern does not overlap any built-in health check. This produces incorrect origin metadata and filtering results in the UI.

## Issue Context
Runtime precedence supports arbitrary custom wildcard checks. Classify a wildcard as an override only when it overlaps a built-in exact or wildcard definition; otherwise retain `CustomLua`.

## Fix Focus Areas
- util/lua/health_checks.go[100-121]
- util/lua/health_checks_test.go[63-121]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Tip of the day
💡 Did you know, you can copy the agent prompt from any finding and feed it to your IDE agent

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

Comment thread server/settings/settings.go
Comment thread util/lua/health_checks.go Outdated
@KHARSHAVARDHAN-eng

Copy link
Copy Markdown
Contributor Author

Thanks for the review! I've addressed all four comments:

Added RBAC enforcement using settings, get for Lua source visibility.
Renamed the JSX test file to .test.tsx.
Fixed wildcard custom/override classification.
Synchronized the origin filter with the URL state.

All relevant Go/UI tests, lint, vet, and git diff --check are passing. The fixes have been pushed to the PR.

@ppapapetrou76

Copy link
Copy Markdown
Contributor

@KHARSHAVARDHAN-eng can you please make sure that all CI steps are passing? Then let me know and I will have a look

Add a Settings UI for inspecting all configured health check
definitions, including built-in Go checks, embedded Lua checks,
custom Lua checks, and overrides.

The implementation adds health check enumeration through the
SettingsService API and exposes the definitions in the Settings UI
with search, filtering, metadata inspection, and read-only Lua source
viewing.

Fixes argoproj#29248

Signed-off-by: Harsha Vardhan <harshahvk2005@gmail.com>
Signed-off-by: Harsha Vardhan <harshahvk2005@gmail.com>
@KHARSHAVARDHAN-eng
KHARSHAVARDHAN-eng force-pushed the feat/29248-health-check-enumeration branch from 4ba216f to 7a01bf7 Compare August 20, 2026 13:45
…tion

Signed-off-by: Harsha Vardhan <harshahvk2005@gmail.com>
@KHARSHAVARDHAN-eng
KHARSHAVARDHAN-eng force-pushed the feat/29248-health-check-enumeration branch from 7a01bf7 to 38fbd5b Compare August 20, 2026 13:49
@codecov

codecov Bot commented Aug 20, 2026

Copy link
Copy Markdown

Bundle Report

Changes will increase total bundle size by 13.47kB (0.12%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
argo-cd-ui-array-push 11.26MB 13.47kB (0.12%) ⬆️

Affected Assets, Files, and Routes:

view changes for bundle: argo-cd-ui-array-push

Assets Changed:

Asset Name Size Change Total Size Change (%)
main.*.js 13.47kB 3.73MB 0.36%

@KHARSHAVARDHAN-eng
KHARSHAVARDHAN-eng force-pushed the feat/29248-health-check-enumeration branch from 1f30dbc to b3166d4 Compare August 20, 2026 15:37
Signed-off-by: Harsha Vardhan <harshahvk2005@gmail.com>
@KHARSHAVARDHAN-eng
KHARSHAVARDHAN-eng force-pushed the feat/29248-health-check-enumeration branch from b3166d4 to c6ff384 Compare August 20, 2026 15:48
@codecov

codecov Bot commented Aug 20, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.23529% with 14 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (master@c78cce0). Learn more about missing BASE report.
⚠️ Report is 15 commits behind head on master.

Files with missing lines Patch % Lines
util/lua/health_checks.go 87.80% 6 Missing and 4 partials ⚠️
server/settings/settings.go 86.66% 2 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##             master   #29266   +/-   ##
=========================================
  Coverage          ?   65.58%           
=========================================
  Files             ?      428           
  Lines             ?    60737           
  Branches          ?        0           
=========================================
  Hits              ?    39834           
  Misses            ?    17264           
  Partials          ?     3639           
Flag Coverage Δ
e2e 26.74% <0.00%> (?)
unit-tests 61.18% <88.23%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

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.

Health check types should be enumerable

3 participants