fix(constructs): emit numeric gRPC health-check status from healthCheckStatus() (SIM-307)#1406
Open
danielpaulus wants to merge 1 commit into
Open
fix(constructs): emit numeric gRPC health-check status from healthCheckStatus() (SIM-307)#1406danielpaulus wants to merge 1 commit into
danielpaulus wants to merge 1 commit into
Conversation
…ckStatus() (SIM-307)
GrpcAssertionBuilder.healthCheckStatus() returned a GeneralAssertionBuilder,
so the CLI's own documented example .equals('SERVING') shipped target
"SERVING" to the API. The go-runner evaluates gRPC health status numerically
(strconv.Atoi), so the label could never pass ("Invalid. Target health status
is not a number") — the advertised example built a permanently-failing check.
Only the webapp normalized the label to a number.
- healthCheckStatus() now returns a dedicated HealthCheckStatusAssertionBuilder
exposing only .equals()/.notEquals() (the only comparisons the runner
supports), accepting a GrpcHealthStatus label or the raw 0|1|2|3 enum and
emitting the numeric wire target. Mirrors the webapp's
grpcHealthStatusTargetByLabel mapping (single source of truth).
- Codegen reverse-maps the number back to the label so an imported check
round-trips to .equals('SERVING'); unmappable/legacy targets fall back to a
raw assertion object literal so the generated code always type-checks.
- Validation flags a GRPC_HEALTHCHECK_STATUS target that isn't 0-3, catching
object-literal callers who bypass the builder.
Reviewed via tri-model daniel-review (Codex + Gemini + Claude); all findings
fixed. Build clean, 21 gRPC unit/codegen tests green.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013AYwkvoaANQTH5dGStbBj2
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What & why
Fixes SIM-307.
GrpcAssertionBuilder.healthCheckStatus()returned aGeneralAssertionBuilder(free string target), so the CLI's own documented examplehealthCheckStatus().equals('SERVING')shippedtarget: "SERVING"to the API. The go-runner evaluates gRPC health status numerically (strconv.Atoi(target)), so"SERVING"returns "Invalid. Target health status is not a number" — the advertised example built a permanently-failing check. Only the webapp normalized the label→number; the CLI/raw-API path shipped a broken check.Root cause:
healthCheckStatus()used a string builder while the siblingstatusCode()correctly usesNumericAssertionBuilder.Changes
healthCheckStatus()now returns a dedicatedHealthCheckStatusAssertionBuilderexposing only.equals()/.notEquals()(the only comparisons the runner supports for health status), accepting aGrpcHealthStatuslabel or the raw0|1|2|3enum and emitting the numeric wire target. The label→number map (UNKNOWN:0, SERVING:1, NOT_SERVING:2, SERVICE_UNKNOWN:3) mirrors the webapp'sgrpcHealthStatusTargetByLabel— single source of truth, reused by codegen + validation. The documented.equals('SERVING')example now works and matches what's stored (no IaC drift).target:'1'round-trips tohealthCheckStatus().equals('SERVING'); unmappable/legacy targets fall back to a raw assertion object literal so generated code always type-checks.GRPC_HEALTHCHECK_STATUStarget that isn't0–3, catching object-literal callers who bypass the builder.Testing
21 gRPC unit + codegen tests green (all four labels →
0–3,.notEquals, raw-number incl. the falsy0, codegen round-trip for EQUALS/NOT_EQUALS + object-literal fallback, validation positive/negative).tsc --buildclean, lint clean.Review
Reviewed via a tri-model daniel-review (Codex + Gemini + Claude) — no blockers; the confirmed should-fixes (codegen fallback must emit compilable TS; preserve invalid JS-caller value in the diagnostic) were fixed and re-verified before this PR.
Note
The backend counterpart (rejecting a non-numeric health-status target at the API edge) is monorepo #3044 (SIM-306). This PR fixes the CLI/construct side so the friendly label API works end-to-end.
🤖 Generated with Claude Code