HYPERFLEET-1290 - fix: restore backward compat for precondition api_call#237
Conversation
Downgrade the hard validation error introduced in HYPERFLEET-1290 to a deprecation warning so existing adapter configs using api_call directly on preconditions continue to work without changes. The precondition executor already handles api_call at runtime — the breakage was purely in the semantic validator. Callers are now warned at startup to migrate to the params source.api_call style. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
📝 WalkthroughWalkthroughTaskConfigValidator now collects deprecation messages in a warnings field, exposed via a new Warnings() method. Deprecated api_call usage in preconditions no longer produces a validation error but instead appends a deprecation warning with migration guidance. The config loader logs these warnings after successful semantic validation. Tests are updated to assert successful validation with the expected warning content instead of an error. Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 10 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (10 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify code
Comment |
Risk Score: 0 —
|
| Signal | Detail | Points |
|---|---|---|
| PR size | 32 lines | +0 |
| Sensitive paths | none | +0 |
| Test coverage | Tests cover changed packages | +0 |
Computed by hyperfleet-risk-scorer
There was a problem hiding this comment.
🧹 Nitpick comments (1)
internal/configloader/loader.go (1)
179-187: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winNo test coverage for the new warning-logging path.
taskValidator.Warnings()is now iterated and logged, but no test in the provided files exercisesLoadConfigwith a deprecatedapi_callprecondition to confirm the warning is actually surfaced through the logger. The logic itself is correct.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@internal/configloader/loader.go` around lines 179 - 187, Add test coverage for the warning-logging path in LoadConfig by exercising taskValidator.Warnings() with a deprecated api_call precondition and asserting the logger receives the warning. Update or add a test around LoadConfig in configloader/loader.go that triggers ValidateSemantic() successfully, then verifies o.logger.Warn is called with the expected deprecation message.Source: Path instructions
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@internal/configloader/loader.go`:
- Around line 179-187: Add test coverage for the warning-logging path in
LoadConfig by exercising taskValidator.Warnings() with a deprecated api_call
precondition and asserting the logger receives the warning. Update or add a test
around LoadConfig in configloader/loader.go that triggers ValidateSemantic()
successfully, then verifies o.logger.Warn is called with the expected
deprecation message.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Central YAML (base), Organization UI (inherited)
Review profile: CHILL
Plan: Enterprise
Run ID: adfaed86-5be1-47c3-a6b4-d91bb395baa8
📒 Files selected for processing (3)
internal/configloader/loader.gointernal/configloader/validator.gointernal/configloader/validator_test.go
🔗 Linked repositories identified
CodeRabbit considers these linked repositories for cross-repo context during reviews:
openshift-hyperfleet/architecture(manual)openshift-hyperfleet/hyperfleet-api(manual)openshift-hyperfleet/hyperfleet-sentinel(manual)openshift-hyperfleet/hyperfleet-adapter(manual)openshift-hyperfleet/hyperfleet-broker(manual)
|
@rh-amarin: The following test failed, say
Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
Summary
api_callis used directly on a precondition, breaking existing adapter configs without a migration pathapi_callat runtime (code was not removed), so only the validator was rejecting itparams[].source.api_callpatternChanges
internal/configloader/validator.go: Addedwarnings []stringfield andWarnings()method toTaskConfigValidator; changedvalidatePreconditionAPICallForbiddento append towarningsinstead oferrorsinternal/configloader/loader.go: Log collected warnings via the instance logger after semantic validationinternal/configloader/validator_test.go: Updated test to assert a deprecation warning is emitted (not an error) when a precondition usesapi_callTest plan
make build— binary compiles cleanlymake test— all unit tests passapi_callloads and logs aDEPRECATEDwarning at startup instead of refusing to startparams[].source.api_callcontinues to work with no warnings🤖 Generated with Claude Code