HYPERFLEET-755 - fix: correct Health CEL expression in adapter failure test#52
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughThe change updates a YAML adapter task configuration for post.payloads[].build.conditions[] entries of type Health. Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Comment |
22be8e5 to
7683182
Compare
xueli181114
left a comment
There was a problem hiding this comment.
The Health CEL fix looks correct — properly handles resourcesSkipped for status, reason, and message. The ternary chain is clear and readable.
One concern: 5 other adapter-task-config files still use the old Health CEL pattern (without resourcesSkipped). Should they be updated too for consistency?
cl-deployment/adapter-task-config.yaml— old patterncl-invalid-resource/adapter-task-config.yaml— old patterncl-job/adapter-task-config.yaml— old patterncl-namespace/adapter-task-config.yaml— old patternnp-configmap/adapter-task-config.yaml— old patterncl-maestro/adapter-task-config.yaml— already has new pattern
If only cl-precondition-error needs this because it's the only test that exercises the resourcesSkipped path, then this is fine as-is. But if these configs represent the standard Health condition template, they should all be aligned.
These 5 adapters are "happy path" configs where preconditions always pass, so resourcesSkipped is always false and the old expression produces the same result. No functional impact on existing tests. That said, I agree they should be aligned for consistency, while I am concerned that modifying other configurations within the HYPERFLEET-755 of my auto-case might lead to misunderstandings. |
xueli181114
left a comment
There was a problem hiding this comment.
The Health CEL status expression has a logic issue with max-age reconciliation events.
Scenario: Sentinel publishes an event because max age exceeded (generation unchanged). The adapter receives it, correctly determines there's nothing to do, and sets executionStatus=success with resourcesSkipped=true.
The new status expression:
adapter.?executionStatus.orValue("") == "success" && !adapter.?resourcesSkipped.orValue(false) ? "True" : "False"
Evaluates: true && !true → false → Health = "False"
This incorrectly marks the resource as unhealthy when the adapter legitimately skipped work because nothing changed. The resourcesSkipped flag doesn't distinguish between:
- Legitimate skip — no work needed (max age reconciliation, everything in sync)
- Problem skip — precondition failure prevented processing
The old expression (executionStatus == "success" ? "True" : "False") didn't have this issue.
Suggestion: Either:
- Only treat
resourcesSkippedas unhealthy when there's also anerrorReasonorerrorMessage - Use a separate flag like
preconditionFailedto distinguish error skips from no-op skips - Or consider:
executionStatus == "success" && !(resourcesSkipped && errorReason != "")— skip is only unhealthy when accompanied by an error
testdata/adapter-configs/cl-precondition-error/adapter-task-config.yaml
Outdated
Show resolved
Hide resolved
| ? adapter.?errorReason.orValue("") | ||
| : "Healthy" | ||
| message: | ||
| expression: | |
There was a problem hiding this comment.
Category: Bug
The message.expression doesn't account for the new ExecutionFailed reason path. When
executionStatus != "success" and errorMessage is empty, the message defaults to "All adapter operations completed successfully" — which contradicts the "False" status and
"ExecutionFailed" reason.
The cl-maestro adapter config already handles this with a 3-way ternary. Consider matching
that pattern:
message:
expression: |
adapter.?executionStatus.orValue("") != "success"
? adapter.?errorMessage.orValue("Adapter execution failed")
: adapter.?errorMessage.orValue("") != ""
? adapter.?errorMessage.orValue("")
: "All adapter operations completed successfully"This way, execution failures always get a meaningful message even if errorMessage is empty.
xueli181114
left a comment
There was a problem hiding this comment.
The updated CEL expressions correctly handle all three scenarios:
- Normal success (
executionStatus=success, no skip) → HealthTrue✓ - Legitimate skip (
executionStatus=success,resourcesSkipped=true, noerrorReason) → HealthTrue✓ - Precondition error (
executionStatus=success,resourcesSkipped=true,errorReasonset) → HealthFalse✓ - Execution failure (
executionStatus != success) → HealthFalse, reasonExecutionFailed, meaningful fallback message ✓
The logic is consistent across status, reason, and message expressions.
/lgtm
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: xueli181114 The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
d3022bd
into
openshift-hyperfleet:main
Summary by CodeRabbit