HYPERFLEET-837 - feat: Add resource recreation design for adapters#150
HYPERFLEET-837 - feat: Add resource recreation design for adapters#150mliptak0 wants to merge 1 commit into
Conversation
|
[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 |
|
Warning Review limit reached
More reviews will be available in 52 minutes and 19 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Central YAML (base), Organization UI (inherited) Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdds a design document for adapter resource recreation workflow, specifying evaluation order between Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes 🚥 Pre-merge checks | ✅ 6✅ Passed checks (6 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify code
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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.
Inline comments:
In `@hyperfleet/components/adapter/framework/adapter-recreation-flow-design.md`:
- Around line 89-95: The design must explicitly require the adapter to keep
status.Finalized=false while it returns Operation=Recreate with Reason="deletion
pending" during the post-delete discovery path, and only set
status.Finalized=true after a successful ApplyResource and subsequent post-apply
discovery; update any logic in the post-delete discovery and status reporting
paths (the code that sets Operation=Recreate / Reason="deletion pending", the
status.Finalized setter, and ApplyResource/post-apply discovery handlers) to
ensure Finalized is false during pending deletion and flipped to true only after
ApplyResource succeeds and the resource is confirmed present.
- Around line 46-52: The adapter recreation-flow design currently assigns CEL
decision logic to the executor while HyperFleet’s architecture expects Sentinel
to own those evaluations, so update the design to place
`lifecycle.recreate.when` decision-making in Sentinel or explicitly revise the
separation of concerns to allow adapter-side CEL evaluation. Also align the
design with the existing adapter implementation by adding
`lifecycle.recreate.when` support to the adapter config/schema and executor
flow, since the current code only handles `lifecycle.delete.when` and
`recreate_on_change`; reference the recreation flow section and the executor
decision logic in the design doc when updating.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Central YAML (base), Organization UI (inherited)
Review profile: CHILL
Plan: Enterprise
Run ID: 4987018a-1fb7-4552-907d-dd61bb92be66
📒 Files selected for processing (1)
hyperfleet/components/adapter/framework/adapter-recreation-flow-design.md
8e62cc2 to
0d7f54d
Compare
ciaranRoche
left a comment
There was a problem hiding this comment.
Nice work on this, couple of things inline and also a few follow up questions
- Post Processing, since we evalute conditions against resources, how will that be handled during recreation. We have a gaurd for deletion but curious how we will handle it during recreation
- Multi resource recreation, since we can have multi resource, how do we handle ordering of recreation
| expression: | | ||
| # Recreate when the generation has changed (indicating spec changed) | ||
| resources.?job.hasValue() | ||
| && string(generation) != resources.?job.metadata.annotations["hyperfleet.io/generation"] |
There was a problem hiding this comment.
I am thinking of a potential gap we will need to solve here. What happens if delete is true and recreate is true?
For both to fire, they need deleted_time set and generation annotation mismatch, this will happen when deletion is set 🤔 so essentially both will be true. We should define this pattern :
- Explicit evaluation ordering
- Config author responsibility
- Framework-level gaurd
- Something else
There was a problem hiding this comment.
lifecycle.delete has priority in this case and if evaluates to true, then lifecycle.recreate should be ignored - not evaluated or set to false
There was a problem hiding this comment.
For multi-resource recreation, I updated the doc. From what I see, currently it's done sequentially, I think that can persist how it is
|
|
||
| ### Out of Scope | ||
|
|
||
| - Intermediate status conditions during recreation (future enhancement) |
There was a problem hiding this comment.
Curious as to why this was pushed out of scope? What is the reasoning behind it?
There was a problem hiding this comment.
Thanks for pointing out, this was a left-over comment. It should be now specified how status conditions will reflect the state
| ``` | ||
|
|
||
| **Requirements when `lifecycle.recreate` is configured:** | ||
| - `discovery` block must exist — pre-discovery populates resource state so CEL expressions can compare current vs. desired state |
There was a problem hiding this comment.
Do we reject configs if the block does not exist? We might want to be explicit here if we do to ensure we cover it and have a test case for it
There was a problem hiding this comment.
Edited the doc to be explicit that if there is lifecycle.recreate, the pre-discovery must be present, otherwise lifecycle.recreate should be omitted
e726c45 to
528baf1
Compare
Co-authored-by: Cursor <cursoragent@cursor.com>
Summary
Define a design doc for recreation flow design in adapters
Test Plan
make test-allpassesmake lintpassesmake test-helm(if applicable)