CFE-4681: timer_policy support for classes: promises#6167
Open
nickanderson wants to merge 1 commit into
Open
Conversation
|
Thank you for submitting a PR! Maybe @craigcomstock can review this? |
af21356 to
1ff08f3
Compare
- Flip default timer_policy to "absolute" (PRESERVE) for backward compatibility: classes: promises historically skip re-evaluation when the class is already defined, so the timer was never reset. - Bypass the ExpandDeRefPromise skip when timer_policy is explicitly set to "reset" with persistence > 0, allowing the promise to reach VerifyClassPromise so the DB timer can be updated. - Add second-layer bypass in VerifyClassPromise for the case where EvalClassExpression returns false (class already in context) but timer_policy is "reset" — write the DB entry to reset the timer. - Clean up acceptance tests: use imported bodies (in_shell, always), regline() instead of returnszero+grep, $(G.testdir), files promises with delete => tidy, and add test metadata. - Add timer_policy_reset acceptance test verifying the timer resets across agent runs. Ticket: CFE-4681 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1ff08f3 to
41cb477
Compare
Member
Author
|
@cf-bottom jenkins please |
|
Sure, I triggered a build: Jenkins: https://ci.cfengine.com/job/pr-pipeline/13940/ Packages: http://buildcache.cfengine.com/packages/testing-pr/jenkins-pr-pipeline-13940/ |
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.
Summary
timer_policyattribute toclasses:promise type, allowing users to control whether a persistent class timer resets on re-evaluation (reset) or preserves the original expiry (absolute)timer_policyforclasses:promises isabsolute(PRESERVE) for backward compatibility — historically these promises skip re-evaluation when the class is already defined, so the timer was never resetExpandDeRefPromiseskip whentimer_policy => "reset"is explicitly set withpersistence > 0, allowing the promise to reachVerifyClassPromiseso the DB timer can be updatedVerifyClassPromisefor the case whereEvalClassExpressionreturns false (class already in context from persistent DB) buttimer_policyisresetValueSizeDBkey length to include null terminator (strlen+1), matchingReadDB/WriteDBconventionsTest plan
timer_policy => "absolute"creates class with "policy preserve", second run skips the promisetimer_policy => "reset"creates class with "policy reset", second run resets the timerpersistent_timer_policy.cf: verifies absolute/preserve log outputpersistent_timer_policy_reset.cf: verifies timer reset across two agent runsTicket: CFE-4681
🤖 Generated with Claude Code